From fd92907a05d321b9324199216dbd10533ed543d7 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Mon, 25 Mar 2024 01:10:28 +0300 Subject: [PATCH] Nvim : Share config with Android. --- module/NixOnDroid.nix | 2 +- module/common/Nvim.nix | 86 +------------------ module/common/nvim/Init.nix | 83 ++++++++++++++++++ .../common/nvim/{ => src}/config/Autoread.lua | 0 module/common/nvim/{ => src}/config/Etc.lua | 0 .../common/nvim/{ => src}/config/Search.lua | 0 module/common/nvim/{ => src}/config/Tab.lua | 0 .../nvim/{ => src}/key/Autocomplete.lua | 0 module/common/nvim/{ => src}/key/Buffer.lua | 0 .../common/nvim/{ => src}/key/Colorscheme.lua | 0 module/common/nvim/{ => src}/key/Comment.lua | 0 module/common/nvim/{ => src}/key/Common.lua | 0 module/common/nvim/{ => src}/key/Filetree.lua | 0 module/common/nvim/{ => src}/key/Fold.lua | 0 module/common/nvim/{ => src}/key/Gitsigns.lua | 0 module/common/nvim/{ => src}/key/Leader.lua | 0 module/common/nvim/{ => src}/key/Lsp.lua | 0 .../common/nvim/{ => src}/key/Navigation.lua | 0 module/common/nvim/{ => src}/key/Ollama.lua | 0 module/common/nvim/{ => src}/key/Rekey.lua | 0 module/common/nvim/{ => src}/key/Sort.lua | 0 .../common/nvim/{ => src}/key/Telescope.lua | 0 module/common/nvim/{ => src}/key/Terminal.lua | 0 module/common/nvim/{ => src}/key/Todo.lua | 0 module/common/nvim/{ => src}/key/Trouble.lua | 0 module/common/nvim/{ => src}/key/Update.lua | 0 module/common/nvim/{ => src}/key/Whichkey.lua | 0 module/common/nvim/{ => src}/plugin/Align.lua | 0 .../nvim/{ => src}/plugin/Autoclose.lua | 0 .../nvim/{ => src}/plugin/Bufferline.lua | 0 .../nvim/{ => src}/plugin/Closebuffers.lua | 0 .../common/nvim/{ => src}/plugin/Filetree.lua | 0 module/common/nvim/{ => src}/plugin/Fold.lua | 0 .../common/nvim/{ => src}/plugin/Gitsigns.lua | 0 .../common/nvim/{ => src}/plugin/Gruvbox.lua | 0 .../common/nvim/{ => src}/plugin/Indent.lua | 0 module/common/nvim/{ => src}/plugin/Init.lua | 0 .../common/nvim/{ => src}/plugin/Lualine.lua | 0 .../common/nvim/{ => src}/plugin/Ollama.lua | 0 .../nvim/{ => src}/plugin/Telescope.lua | 0 module/common/nvim/{ => src}/plugin/Todo.lua | 0 .../nvim/{ => src}/plugin/Tokyonight.lua | 0 .../nvim/{ => src}/plugin/Treesitter.lua | 0 .../common/nvim/{ => src}/plugin/Trouble.lua | 0 .../nvim/{ => src}/plugin/lsp/Haskell.lua | 0 .../nvim/{ => src}/plugin/lsp/Kotlin.lua | 0 .../nvim/{ => src}/plugin/lsp/Python.lua | 0 .../common/nvim/{ => src}/plugin/lsp/Rust.lua | 0 .../common/nvim/{ => src}/plugin/lsp/Tex.lua | 0 49 files changed, 87 insertions(+), 84 deletions(-) create mode 100644 module/common/nvim/Init.nix rename module/common/nvim/{ => src}/config/Autoread.lua (100%) rename module/common/nvim/{ => src}/config/Etc.lua (100%) rename module/common/nvim/{ => src}/config/Search.lua (100%) rename module/common/nvim/{ => src}/config/Tab.lua (100%) rename module/common/nvim/{ => src}/key/Autocomplete.lua (100%) rename module/common/nvim/{ => src}/key/Buffer.lua (100%) rename module/common/nvim/{ => src}/key/Colorscheme.lua (100%) rename module/common/nvim/{ => src}/key/Comment.lua (100%) rename module/common/nvim/{ => src}/key/Common.lua (100%) rename module/common/nvim/{ => src}/key/Filetree.lua (100%) rename module/common/nvim/{ => src}/key/Fold.lua (100%) rename module/common/nvim/{ => src}/key/Gitsigns.lua (100%) rename module/common/nvim/{ => src}/key/Leader.lua (100%) rename module/common/nvim/{ => src}/key/Lsp.lua (100%) rename module/common/nvim/{ => src}/key/Navigation.lua (100%) rename module/common/nvim/{ => src}/key/Ollama.lua (100%) rename module/common/nvim/{ => src}/key/Rekey.lua (100%) rename module/common/nvim/{ => src}/key/Sort.lua (100%) rename module/common/nvim/{ => src}/key/Telescope.lua (100%) rename module/common/nvim/{ => src}/key/Terminal.lua (100%) rename module/common/nvim/{ => src}/key/Todo.lua (100%) rename module/common/nvim/{ => src}/key/Trouble.lua (100%) rename module/common/nvim/{ => src}/key/Update.lua (100%) rename module/common/nvim/{ => src}/key/Whichkey.lua (100%) rename module/common/nvim/{ => src}/plugin/Align.lua (100%) rename module/common/nvim/{ => src}/plugin/Autoclose.lua (100%) rename module/common/nvim/{ => src}/plugin/Bufferline.lua (100%) rename module/common/nvim/{ => src}/plugin/Closebuffers.lua (100%) rename module/common/nvim/{ => src}/plugin/Filetree.lua (100%) rename module/common/nvim/{ => src}/plugin/Fold.lua (100%) rename module/common/nvim/{ => src}/plugin/Gitsigns.lua (100%) rename module/common/nvim/{ => src}/plugin/Gruvbox.lua (100%) rename module/common/nvim/{ => src}/plugin/Indent.lua (100%) rename module/common/nvim/{ => src}/plugin/Init.lua (100%) rename module/common/nvim/{ => src}/plugin/Lualine.lua (100%) rename module/common/nvim/{ => src}/plugin/Ollama.lua (100%) rename module/common/nvim/{ => src}/plugin/Telescope.lua (100%) rename module/common/nvim/{ => src}/plugin/Todo.lua (100%) rename module/common/nvim/{ => src}/plugin/Tokyonight.lua (100%) rename module/common/nvim/{ => src}/plugin/Treesitter.lua (100%) rename module/common/nvim/{ => src}/plugin/Trouble.lua (100%) rename module/common/nvim/{ => src}/plugin/lsp/Haskell.lua (100%) rename module/common/nvim/{ => src}/plugin/lsp/Kotlin.lua (100%) rename module/common/nvim/{ => src}/plugin/lsp/Python.lua (100%) rename module/common/nvim/{ => src}/plugin/lsp/Rust.lua (100%) rename module/common/nvim/{ => src}/plugin/lsp/Tex.lua (100%) diff --git a/module/NixOnDroid.nix b/module/NixOnDroid.nix index ea98dc42..24b6e1b9 100644 --- a/module/NixOnDroid.nix +++ b/module/NixOnDroid.nix @@ -36,7 +36,7 @@ in { enable = true; viAlias = true; vimAlias = true; - # extraConfig = (import ./common/Nvim.nix { inputs = inputs; }).customRc; + extraConfig = (import ./common/nvim/Init.nix { inputs = inputs; }).customRc; }; }; diff --git a/module/common/Nvim.nix b/module/common/Nvim.nix index 58a8aa60..3361b41a 100644 --- a/module/common/Nvim.nix +++ b/module/common/Nvim.nix @@ -1,85 +1,5 @@ -{ inputs, lib, ... }: let - nvimRc = { cfgPath, runtimes, cfgs }: let - runtimeRc = builtins.foldl' (acc: r: - acc + "set runtimepath+=${r}\n" - ) "" runtimes; - cfgRc = builtins.foldl' (acc: c: - acc + "lua dofile(\"${cfgPath}/${c}\")\n" - ) "" cfgs; - in runtimeRc + cfgRc; - - customRc = nvimRc { - cfgPath = ./nvim; - runtimes = [ - "~/.cache/nvim" - "~/.cache/nvim/treesitter" - "${inputs.nvimAlign}" - "${inputs.nvimAutoclose}" - "${inputs.nvimBufferline}" - "${inputs.nvimCloseBuffers}" - "${inputs.nvimDevicons}" - "${inputs.nvimGitsigns}" - "${inputs.nvimGruvboxMaterial}" - "${inputs.nvimIndentoMatic}" - "${inputs.nvimLspconfig}" - "${inputs.nvimLualine}" - "${inputs.nvimOllama}" - "${inputs.nvimPlenary}" - "${inputs.nvimSingleComment}" - "${inputs.nvimTelescope}" - "${inputs.nvimTodo}" - "${inputs.nvimTokyonight}" - "${inputs.nvimTreesitter}" - "${inputs.nvimTree}" - "${inputs.nvimTrouble}" - "${inputs.nvimWhichKey}" - ]; - cfgs = [ - "key/Rekey.lua" - "key/Leader.lua" - "config/Autoread.lua" - "config/Etc.lua" - "config/Search.lua" - "config/Tab.lua" - "plugin/Filetree.lua" - "plugin/Gruvbox.lua" - "plugin/Bufferline.lua" - "plugin/Lualine.lua" - "plugin/Autoclose.lua" - "plugin/Gitsigns.lua" - "plugin/Trouble.lua" - "plugin/Tokyonight.lua" - "plugin/Closebuffers.lua" - "plugin/Telescope.lua" - "plugin/Todo.lua" - "plugin/Indent.lua" - "plugin/Align.lua" - "plugin/Treesitter.lua" - "plugin/Fold.lua" - "plugin/Ollama.lua" - "plugin/lsp/Haskell.lua" - "plugin/lsp/Rust.lua" - "plugin/lsp/Tex.lua" - "key/Autocomplete.lua" - "key/Buffer.lua" - "key/Colorscheme.lua" - "key/Comment.lua" - "key/Common.lua" - "key/Filetree.lua" - "key/Fold.lua" - "key/Gitsigns.lua" - "key/Lsp.lua" - "key/Navigation.lua" - "key/Ollama.lua" - "key/Sort.lua" - "key/Telescope.lua" - "key/Terminal.lua" - "key/Todo.lua" - "key/Trouble.lua" - "key/Update.lua" - "key/Whichkey.lua" - ]; - }; +{ inputs, ... }: let + nvimCfg = import ./nvim/Init.nix { inputs = inputs; }; in { environment = { variables = { @@ -92,7 +12,7 @@ in { viAlias = true; vimAlias = true; configure = { - customRC = customRc; + customRC = nvimCfg.customRc; }; }; } diff --git a/module/common/nvim/Init.nix b/module/common/nvim/Init.nix new file mode 100644 index 00000000..5192137b --- /dev/null +++ b/module/common/nvim/Init.nix @@ -0,0 +1,83 @@ +{ inputs, ... }: let + nvimRc = { cfgPath, runtimes, cfgs }: let + runtimeRc = builtins.foldl' (acc: r: + acc + "set runtimepath+=${r}\n" + ) "" runtimes; + cfgRc = builtins.foldl' (acc: c: + acc + "lua dofile(\"${cfgPath}/${c}\")\n" + ) "" cfgs; + in runtimeRc + cfgRc; +in { + customRc = nvimRc { + cfgPath = ./src; + runtimes = [ + "~/.cache/nvim" + "~/.cache/nvim/treesitter" + "${inputs.nvimAlign}" + "${inputs.nvimAutoclose}" + "${inputs.nvimBufferline}" + "${inputs.nvimCloseBuffers}" + "${inputs.nvimDevicons}" + "${inputs.nvimGitsigns}" + "${inputs.nvimGruvboxMaterial}" + "${inputs.nvimIndentoMatic}" + "${inputs.nvimLspconfig}" + "${inputs.nvimLualine}" + "${inputs.nvimOllama}" + "${inputs.nvimPlenary}" + "${inputs.nvimSingleComment}" + "${inputs.nvimTelescope}" + "${inputs.nvimTodo}" + "${inputs.nvimTokyonight}" + "${inputs.nvimTreesitter}" + "${inputs.nvimTree}" + "${inputs.nvimTrouble}" + "${inputs.nvimWhichKey}" + ]; + cfgs = [ + "key/Rekey.lua" + "key/Leader.lua" + "config/Autoread.lua" + "config/Etc.lua" + "config/Search.lua" + "config/Tab.lua" + "plugin/Filetree.lua" + "plugin/Gruvbox.lua" + "plugin/Bufferline.lua" + "plugin/Lualine.lua" + "plugin/Autoclose.lua" + "plugin/Gitsigns.lua" + "plugin/Trouble.lua" + "plugin/Tokyonight.lua" + "plugin/Closebuffers.lua" + "plugin/Telescope.lua" + "plugin/Todo.lua" + "plugin/Indent.lua" + "plugin/Align.lua" + "plugin/Treesitter.lua" + "plugin/Fold.lua" + "plugin/Ollama.lua" + "plugin/lsp/Haskell.lua" + "plugin/lsp/Rust.lua" + "plugin/lsp/Tex.lua" + "key/Autocomplete.lua" + "key/Buffer.lua" + "key/Colorscheme.lua" + "key/Comment.lua" + "key/Common.lua" + "key/Filetree.lua" + "key/Fold.lua" + "key/Gitsigns.lua" + "key/Lsp.lua" + "key/Navigation.lua" + "key/Ollama.lua" + "key/Sort.lua" + "key/Telescope.lua" + "key/Terminal.lua" + "key/Todo.lua" + "key/Trouble.lua" + "key/Update.lua" + "key/Whichkey.lua" + ]; + }; +} diff --git a/module/common/nvim/config/Autoread.lua b/module/common/nvim/src/config/Autoread.lua similarity index 100% rename from module/common/nvim/config/Autoread.lua rename to module/common/nvim/src/config/Autoread.lua diff --git a/module/common/nvim/config/Etc.lua b/module/common/nvim/src/config/Etc.lua similarity index 100% rename from module/common/nvim/config/Etc.lua rename to module/common/nvim/src/config/Etc.lua diff --git a/module/common/nvim/config/Search.lua b/module/common/nvim/src/config/Search.lua similarity index 100% rename from module/common/nvim/config/Search.lua rename to module/common/nvim/src/config/Search.lua diff --git a/module/common/nvim/config/Tab.lua b/module/common/nvim/src/config/Tab.lua similarity index 100% rename from module/common/nvim/config/Tab.lua rename to module/common/nvim/src/config/Tab.lua diff --git a/module/common/nvim/key/Autocomplete.lua b/module/common/nvim/src/key/Autocomplete.lua similarity index 100% rename from module/common/nvim/key/Autocomplete.lua rename to module/common/nvim/src/key/Autocomplete.lua diff --git a/module/common/nvim/key/Buffer.lua b/module/common/nvim/src/key/Buffer.lua similarity index 100% rename from module/common/nvim/key/Buffer.lua rename to module/common/nvim/src/key/Buffer.lua diff --git a/module/common/nvim/key/Colorscheme.lua b/module/common/nvim/src/key/Colorscheme.lua similarity index 100% rename from module/common/nvim/key/Colorscheme.lua rename to module/common/nvim/src/key/Colorscheme.lua diff --git a/module/common/nvim/key/Comment.lua b/module/common/nvim/src/key/Comment.lua similarity index 100% rename from module/common/nvim/key/Comment.lua rename to module/common/nvim/src/key/Comment.lua diff --git a/module/common/nvim/key/Common.lua b/module/common/nvim/src/key/Common.lua similarity index 100% rename from module/common/nvim/key/Common.lua rename to module/common/nvim/src/key/Common.lua diff --git a/module/common/nvim/key/Filetree.lua b/module/common/nvim/src/key/Filetree.lua similarity index 100% rename from module/common/nvim/key/Filetree.lua rename to module/common/nvim/src/key/Filetree.lua diff --git a/module/common/nvim/key/Fold.lua b/module/common/nvim/src/key/Fold.lua similarity index 100% rename from module/common/nvim/key/Fold.lua rename to module/common/nvim/src/key/Fold.lua diff --git a/module/common/nvim/key/Gitsigns.lua b/module/common/nvim/src/key/Gitsigns.lua similarity index 100% rename from module/common/nvim/key/Gitsigns.lua rename to module/common/nvim/src/key/Gitsigns.lua diff --git a/module/common/nvim/key/Leader.lua b/module/common/nvim/src/key/Leader.lua similarity index 100% rename from module/common/nvim/key/Leader.lua rename to module/common/nvim/src/key/Leader.lua diff --git a/module/common/nvim/key/Lsp.lua b/module/common/nvim/src/key/Lsp.lua similarity index 100% rename from module/common/nvim/key/Lsp.lua rename to module/common/nvim/src/key/Lsp.lua diff --git a/module/common/nvim/key/Navigation.lua b/module/common/nvim/src/key/Navigation.lua similarity index 100% rename from module/common/nvim/key/Navigation.lua rename to module/common/nvim/src/key/Navigation.lua diff --git a/module/common/nvim/key/Ollama.lua b/module/common/nvim/src/key/Ollama.lua similarity index 100% rename from module/common/nvim/key/Ollama.lua rename to module/common/nvim/src/key/Ollama.lua diff --git a/module/common/nvim/key/Rekey.lua b/module/common/nvim/src/key/Rekey.lua similarity index 100% rename from module/common/nvim/key/Rekey.lua rename to module/common/nvim/src/key/Rekey.lua diff --git a/module/common/nvim/key/Sort.lua b/module/common/nvim/src/key/Sort.lua similarity index 100% rename from module/common/nvim/key/Sort.lua rename to module/common/nvim/src/key/Sort.lua diff --git a/module/common/nvim/key/Telescope.lua b/module/common/nvim/src/key/Telescope.lua similarity index 100% rename from module/common/nvim/key/Telescope.lua rename to module/common/nvim/src/key/Telescope.lua diff --git a/module/common/nvim/key/Terminal.lua b/module/common/nvim/src/key/Terminal.lua similarity index 100% rename from module/common/nvim/key/Terminal.lua rename to module/common/nvim/src/key/Terminal.lua diff --git a/module/common/nvim/key/Todo.lua b/module/common/nvim/src/key/Todo.lua similarity index 100% rename from module/common/nvim/key/Todo.lua rename to module/common/nvim/src/key/Todo.lua diff --git a/module/common/nvim/key/Trouble.lua b/module/common/nvim/src/key/Trouble.lua similarity index 100% rename from module/common/nvim/key/Trouble.lua rename to module/common/nvim/src/key/Trouble.lua diff --git a/module/common/nvim/key/Update.lua b/module/common/nvim/src/key/Update.lua similarity index 100% rename from module/common/nvim/key/Update.lua rename to module/common/nvim/src/key/Update.lua diff --git a/module/common/nvim/key/Whichkey.lua b/module/common/nvim/src/key/Whichkey.lua similarity index 100% rename from module/common/nvim/key/Whichkey.lua rename to module/common/nvim/src/key/Whichkey.lua diff --git a/module/common/nvim/plugin/Align.lua b/module/common/nvim/src/plugin/Align.lua similarity index 100% rename from module/common/nvim/plugin/Align.lua rename to module/common/nvim/src/plugin/Align.lua diff --git a/module/common/nvim/plugin/Autoclose.lua b/module/common/nvim/src/plugin/Autoclose.lua similarity index 100% rename from module/common/nvim/plugin/Autoclose.lua rename to module/common/nvim/src/plugin/Autoclose.lua diff --git a/module/common/nvim/plugin/Bufferline.lua b/module/common/nvim/src/plugin/Bufferline.lua similarity index 100% rename from module/common/nvim/plugin/Bufferline.lua rename to module/common/nvim/src/plugin/Bufferline.lua diff --git a/module/common/nvim/plugin/Closebuffers.lua b/module/common/nvim/src/plugin/Closebuffers.lua similarity index 100% rename from module/common/nvim/plugin/Closebuffers.lua rename to module/common/nvim/src/plugin/Closebuffers.lua diff --git a/module/common/nvim/plugin/Filetree.lua b/module/common/nvim/src/plugin/Filetree.lua similarity index 100% rename from module/common/nvim/plugin/Filetree.lua rename to module/common/nvim/src/plugin/Filetree.lua diff --git a/module/common/nvim/plugin/Fold.lua b/module/common/nvim/src/plugin/Fold.lua similarity index 100% rename from module/common/nvim/plugin/Fold.lua rename to module/common/nvim/src/plugin/Fold.lua diff --git a/module/common/nvim/plugin/Gitsigns.lua b/module/common/nvim/src/plugin/Gitsigns.lua similarity index 100% rename from module/common/nvim/plugin/Gitsigns.lua rename to module/common/nvim/src/plugin/Gitsigns.lua diff --git a/module/common/nvim/plugin/Gruvbox.lua b/module/common/nvim/src/plugin/Gruvbox.lua similarity index 100% rename from module/common/nvim/plugin/Gruvbox.lua rename to module/common/nvim/src/plugin/Gruvbox.lua diff --git a/module/common/nvim/plugin/Indent.lua b/module/common/nvim/src/plugin/Indent.lua similarity index 100% rename from module/common/nvim/plugin/Indent.lua rename to module/common/nvim/src/plugin/Indent.lua diff --git a/module/common/nvim/plugin/Init.lua b/module/common/nvim/src/plugin/Init.lua similarity index 100% rename from module/common/nvim/plugin/Init.lua rename to module/common/nvim/src/plugin/Init.lua diff --git a/module/common/nvim/plugin/Lualine.lua b/module/common/nvim/src/plugin/Lualine.lua similarity index 100% rename from module/common/nvim/plugin/Lualine.lua rename to module/common/nvim/src/plugin/Lualine.lua diff --git a/module/common/nvim/plugin/Ollama.lua b/module/common/nvim/src/plugin/Ollama.lua similarity index 100% rename from module/common/nvim/plugin/Ollama.lua rename to module/common/nvim/src/plugin/Ollama.lua diff --git a/module/common/nvim/plugin/Telescope.lua b/module/common/nvim/src/plugin/Telescope.lua similarity index 100% rename from module/common/nvim/plugin/Telescope.lua rename to module/common/nvim/src/plugin/Telescope.lua diff --git a/module/common/nvim/plugin/Todo.lua b/module/common/nvim/src/plugin/Todo.lua similarity index 100% rename from module/common/nvim/plugin/Todo.lua rename to module/common/nvim/src/plugin/Todo.lua diff --git a/module/common/nvim/plugin/Tokyonight.lua b/module/common/nvim/src/plugin/Tokyonight.lua similarity index 100% rename from module/common/nvim/plugin/Tokyonight.lua rename to module/common/nvim/src/plugin/Tokyonight.lua diff --git a/module/common/nvim/plugin/Treesitter.lua b/module/common/nvim/src/plugin/Treesitter.lua similarity index 100% rename from module/common/nvim/plugin/Treesitter.lua rename to module/common/nvim/src/plugin/Treesitter.lua diff --git a/module/common/nvim/plugin/Trouble.lua b/module/common/nvim/src/plugin/Trouble.lua similarity index 100% rename from module/common/nvim/plugin/Trouble.lua rename to module/common/nvim/src/plugin/Trouble.lua diff --git a/module/common/nvim/plugin/lsp/Haskell.lua b/module/common/nvim/src/plugin/lsp/Haskell.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Haskell.lua rename to module/common/nvim/src/plugin/lsp/Haskell.lua diff --git a/module/common/nvim/plugin/lsp/Kotlin.lua b/module/common/nvim/src/plugin/lsp/Kotlin.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Kotlin.lua rename to module/common/nvim/src/plugin/lsp/Kotlin.lua diff --git a/module/common/nvim/plugin/lsp/Python.lua b/module/common/nvim/src/plugin/lsp/Python.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Python.lua rename to module/common/nvim/src/plugin/lsp/Python.lua diff --git a/module/common/nvim/plugin/lsp/Rust.lua b/module/common/nvim/src/plugin/lsp/Rust.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Rust.lua rename to module/common/nvim/src/plugin/lsp/Rust.lua diff --git a/module/common/nvim/plugin/lsp/Tex.lua b/module/common/nvim/src/plugin/lsp/Tex.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Tex.lua rename to module/common/nvim/src/plugin/lsp/Tex.lua