From 4583b9b65bbfe05a45245bbd38761f91a126c06d Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 18 Dec 2024 13:45:27 +0300 Subject: [PATCH] Nvim: Rewrate with replaceVars. --- .treefmt.toml | 4 + flake.nix | 1 + home/file/nvim/default.nix | 108 ++++++++++-------- home/file/nvim/module/config/Autoread.lua | 5 + home/file/nvim/module/config/Autoread.nix | 10 -- home/file/nvim/module/config/Etc.lua | 32 ++++++ home/file/nvim/module/config/Etc.nix | 37 ------ home/file/nvim/module/config/Highlight.lua | 23 ++++ home/file/nvim/module/config/Highlight.nix | 54 --------- home/file/nvim/module/config/Search.lua | 5 + home/file/nvim/module/config/Search.nix | 10 -- home/file/nvim/module/config/Tab.lua | 9 ++ home/file/nvim/module/config/Tab.nix | 17 --- home/file/nvim/module/key/Autocomplete.lua | 5 + home/file/nvim/module/key/Autocomplete.nix | 10 -- home/file/nvim/module/key/Buffer.lua | 12 ++ home/file/nvim/module/key/Buffer.nix | 17 --- home/file/nvim/module/key/Cmd.lua | 7 ++ home/file/nvim/module/key/Cmd.nix | 12 -- home/file/nvim/module/key/Colorscheme.lua | 22 ++++ home/file/nvim/module/key/Colorscheme.nix | 27 ----- home/file/nvim/module/key/Filetree.lua | 2 + home/file/nvim/module/key/Filetree.nix | 7 -- home/file/nvim/module/key/Gitsigns.lua | 5 + home/file/nvim/module/key/Gitsigns.nix | 7 -- home/file/nvim/module/key/Leader.lua | 7 ++ home/file/nvim/module/key/Leader.nix | 12 -- home/file/nvim/module/key/Navigation.lua | 29 +++++ home/file/nvim/module/key/Navigation.nix | 38 ------ home/file/nvim/module/key/Prompt.lua | 2 + home/file/nvim/module/key/Prompt.nix | 7 -- home/file/nvim/module/key/Rekey.lua | 49 ++++++++ home/file/nvim/module/key/Rekey.nix | 54 --------- home/file/nvim/module/key/Save.lua | 15 +++ home/file/nvim/module/key/Save.nix | 20 ---- home/file/nvim/module/key/Sort.lua | 2 + home/file/nvim/module/key/Sort.nix | 7 -- home/file/nvim/module/key/TabWidth.lua | 17 +++ home/file/nvim/module/key/TabWidth.nix | 22 ---- home/file/nvim/module/key/Telescope.lua | 6 + home/file/nvim/module/key/Telescope.nix | 14 --- home/file/nvim/module/key/Terminal.lua | 5 + home/file/nvim/module/key/Terminal.nix | 10 -- home/file/nvim/module/key/Trouble.lua | 5 + home/file/nvim/module/key/Trouble.nix | 13 --- home/file/nvim/module/plugin/Align.lua | 6 + home/file/nvim/module/plugin/Align.nix | 11 -- home/file/nvim/module/plugin/Autoclose.lua | 13 +++ home/file/nvim/module/plugin/Autoclose.nix | 18 --- home/file/nvim/module/plugin/Bufferline.lua | 1 + home/file/nvim/module/plugin/Bufferline.nix | 6 - home/file/nvim/module/plugin/Closebuffers.lua | 7 ++ home/file/nvim/module/plugin/Closebuffers.nix | 12 -- home/file/nvim/module/plugin/Colorizer.lua | 4 + home/file/nvim/module/plugin/Colorizer.nix | 9 -- home/file/nvim/module/plugin/Dressing.lua | 1 + home/file/nvim/module/plugin/Dressing.nix | 6 - home/file/nvim/module/plugin/Filetree.lua | 36 ++++++ home/file/nvim/module/plugin/Filetree.nix | 41 ------- home/file/nvim/module/plugin/Fold.lua | 3 + home/file/nvim/module/plugin/Fold.nix | 8 -- home/file/nvim/module/plugin/Gen.lua | 3 + home/file/nvim/module/plugin/Gen.nix | 8 -- home/file/nvim/module/plugin/Gitsigns.lua | 40 +++++++ home/file/nvim/module/plugin/Gitsigns.nix | 45 -------- home/file/nvim/module/plugin/Gruvbox.lua | 15 +++ home/file/nvim/module/plugin/Gruvbox.nix | 20 ---- home/file/nvim/module/plugin/Indent.lua | 6 + home/file/nvim/module/plugin/Indent.nix | 11 -- home/file/nvim/module/plugin/Init.lua | 49 ++++++++ home/file/nvim/module/plugin/Init.nix | 54 --------- home/file/nvim/module/plugin/Telescope.lua | 12 ++ home/file/nvim/module/plugin/Telescope.nix | 17 --- home/file/nvim/module/plugin/Todo.lua | 51 +++++++++ home/file/nvim/module/plugin/Todo.nix | 56 --------- home/file/nvim/module/plugin/Treesitter.lua | 21 ++++ home/file/nvim/module/plugin/Treesitter.nix | 26 ----- home/file/nvim/module/plugin/Trouble.lua | 1 + home/file/nvim/module/plugin/Trouble.nix | 6 - home/file/nvim/module/plugin/lsp/Go.lua | 3 + home/file/nvim/module/plugin/lsp/Go.nix | 8 -- home/file/nvim/module/plugin/lsp/Haskell.lua | 5 + home/file/nvim/module/plugin/lsp/Haskell.nix | 10 -- home/file/nvim/module/plugin/lsp/Kotlin.lua | 3 + home/file/nvim/module/plugin/lsp/Kotlin.nix | 8 -- home/file/nvim/module/plugin/lsp/Lua.lua | 3 + home/file/nvim/module/plugin/lsp/Lua.nix | 8 -- home/file/nvim/module/plugin/lsp/Nix.lua | 13 +++ home/file/nvim/module/plugin/lsp/Nix.nix | 18 --- home/file/nvim/module/plugin/lsp/Python.lua | 3 + home/file/nvim/module/plugin/lsp/Python.nix | 8 -- home/file/nvim/module/plugin/lsp/Rust.lua | 16 +++ home/file/nvim/module/plugin/lsp/Rust.nix | 21 ---- home/file/nvim/module/plugin/lsp/Tex.lua | 60 ++++++++++ home/file/nvim/module/plugin/lsp/Tex.nix | 65 ----------- home/file/sway/default.nix | 40 ++++--- 96 files changed, 727 insertions(+), 970 deletions(-) create mode 100644 home/file/nvim/module/config/Autoread.lua delete mode 100644 home/file/nvim/module/config/Autoread.nix create mode 100644 home/file/nvim/module/config/Etc.lua delete mode 100644 home/file/nvim/module/config/Etc.nix create mode 100644 home/file/nvim/module/config/Highlight.lua delete mode 100644 home/file/nvim/module/config/Highlight.nix create mode 100644 home/file/nvim/module/config/Search.lua delete mode 100644 home/file/nvim/module/config/Search.nix create mode 100644 home/file/nvim/module/config/Tab.lua delete mode 100644 home/file/nvim/module/config/Tab.nix create mode 100644 home/file/nvim/module/key/Autocomplete.lua delete mode 100644 home/file/nvim/module/key/Autocomplete.nix create mode 100644 home/file/nvim/module/key/Buffer.lua delete mode 100644 home/file/nvim/module/key/Buffer.nix create mode 100644 home/file/nvim/module/key/Cmd.lua delete mode 100644 home/file/nvim/module/key/Cmd.nix create mode 100644 home/file/nvim/module/key/Colorscheme.lua delete mode 100644 home/file/nvim/module/key/Colorscheme.nix create mode 100644 home/file/nvim/module/key/Filetree.lua delete mode 100644 home/file/nvim/module/key/Filetree.nix create mode 100644 home/file/nvim/module/key/Gitsigns.lua delete mode 100644 home/file/nvim/module/key/Gitsigns.nix create mode 100644 home/file/nvim/module/key/Leader.lua delete mode 100644 home/file/nvim/module/key/Leader.nix create mode 100644 home/file/nvim/module/key/Navigation.lua delete mode 100644 home/file/nvim/module/key/Navigation.nix create mode 100644 home/file/nvim/module/key/Prompt.lua delete mode 100644 home/file/nvim/module/key/Prompt.nix create mode 100644 home/file/nvim/module/key/Rekey.lua delete mode 100644 home/file/nvim/module/key/Rekey.nix create mode 100644 home/file/nvim/module/key/Save.lua delete mode 100644 home/file/nvim/module/key/Save.nix create mode 100644 home/file/nvim/module/key/Sort.lua delete mode 100644 home/file/nvim/module/key/Sort.nix create mode 100644 home/file/nvim/module/key/TabWidth.lua delete mode 100644 home/file/nvim/module/key/TabWidth.nix create mode 100644 home/file/nvim/module/key/Telescope.lua delete mode 100644 home/file/nvim/module/key/Telescope.nix create mode 100644 home/file/nvim/module/key/Terminal.lua delete mode 100644 home/file/nvim/module/key/Terminal.nix create mode 100644 home/file/nvim/module/key/Trouble.lua delete mode 100644 home/file/nvim/module/key/Trouble.nix create mode 100644 home/file/nvim/module/plugin/Align.lua delete mode 100644 home/file/nvim/module/plugin/Align.nix create mode 100644 home/file/nvim/module/plugin/Autoclose.lua delete mode 100644 home/file/nvim/module/plugin/Autoclose.nix create mode 100644 home/file/nvim/module/plugin/Bufferline.lua delete mode 100644 home/file/nvim/module/plugin/Bufferline.nix create mode 100644 home/file/nvim/module/plugin/Closebuffers.lua delete mode 100644 home/file/nvim/module/plugin/Closebuffers.nix create mode 100644 home/file/nvim/module/plugin/Colorizer.lua delete mode 100644 home/file/nvim/module/plugin/Colorizer.nix create mode 100644 home/file/nvim/module/plugin/Dressing.lua delete mode 100644 home/file/nvim/module/plugin/Dressing.nix create mode 100644 home/file/nvim/module/plugin/Filetree.lua delete mode 100644 home/file/nvim/module/plugin/Filetree.nix create mode 100644 home/file/nvim/module/plugin/Fold.lua delete mode 100644 home/file/nvim/module/plugin/Fold.nix create mode 100644 home/file/nvim/module/plugin/Gen.lua delete mode 100644 home/file/nvim/module/plugin/Gen.nix create mode 100644 home/file/nvim/module/plugin/Gitsigns.lua delete mode 100644 home/file/nvim/module/plugin/Gitsigns.nix create mode 100644 home/file/nvim/module/plugin/Gruvbox.lua delete mode 100644 home/file/nvim/module/plugin/Gruvbox.nix create mode 100644 home/file/nvim/module/plugin/Indent.lua delete mode 100644 home/file/nvim/module/plugin/Indent.nix create mode 100644 home/file/nvim/module/plugin/Init.lua delete mode 100644 home/file/nvim/module/plugin/Init.nix create mode 100644 home/file/nvim/module/plugin/Telescope.lua delete mode 100644 home/file/nvim/module/plugin/Telescope.nix create mode 100644 home/file/nvim/module/plugin/Todo.lua delete mode 100644 home/file/nvim/module/plugin/Todo.nix create mode 100644 home/file/nvim/module/plugin/Treesitter.lua delete mode 100644 home/file/nvim/module/plugin/Treesitter.nix create mode 100644 home/file/nvim/module/plugin/Trouble.lua delete mode 100644 home/file/nvim/module/plugin/Trouble.nix create mode 100644 home/file/nvim/module/plugin/lsp/Go.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Go.nix create mode 100644 home/file/nvim/module/plugin/lsp/Haskell.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Haskell.nix create mode 100644 home/file/nvim/module/plugin/lsp/Kotlin.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Kotlin.nix create mode 100644 home/file/nvim/module/plugin/lsp/Lua.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Lua.nix create mode 100644 home/file/nvim/module/plugin/lsp/Nix.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Nix.nix create mode 100644 home/file/nvim/module/plugin/lsp/Python.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Python.nix create mode 100644 home/file/nvim/module/plugin/lsp/Rust.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Rust.nix create mode 100644 home/file/nvim/module/plugin/lsp/Tex.lua delete mode 100644 home/file/nvim/module/plugin/lsp/Tex.nix diff --git a/.treefmt.toml b/.treefmt.toml index 13f06f83..793db782 100644 --- a/.treefmt.toml +++ b/.treefmt.toml @@ -25,3 +25,7 @@ includes = [ "*.sh" ] command = "prettier" options = [ "-w" ] includes = [ "*.css" ] + +[formatter.stylua] +command = "stylua" +includes = [ "*.lua" ] diff --git a/flake.nix b/flake.nix index 7ddb8ea7..355903b4 100644 --- a/flake.nix +++ b/flake.nix @@ -159,6 +159,7 @@ nodePackages.prettier nodePackages.prettier-plugin-toml shfmt + stylua treefmt ]; # buildInputs = with pkgs; [ ]; diff --git a/home/file/nvim/default.nix b/home/file/nvim/default.nix index 133ce98a..cb1c1143 100644 --- a/home/file/nvim/default.nix +++ b/home/file/nvim/default.nix @@ -1,21 +1,37 @@ { + config, inputs, pkgs, util, ... -}@args: +}: let nvimRc = { runtimes, configs }: let + accent = config.module.style.color.accent; + bg = config.module.style.color.bg.regular; + fg = config.module.style.color.fg.dark; + ollamaModel = config.module.ollama.primaryModel; + selection = config.module.style.color.selection; + # Plugin paths to install. runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes; # My configuration files combined into one big file. - config = pkgs.writeText "nvimRc" (util.catText configs args); + cfgRaw = pkgs.writeText "nvim-rc-raw" (util.readFiles configs); + cfg = pkgs.replaceVars cfgRaw { + inherit + accent + bg + fg + ollamaModel + selection + ; + }; # Tell Neovim to load this file. - configRc = "lua dofile(\"${config}\")"; + configRc = "lua dofile(\"${cfg}\")"; in runtimeRc + configRc; in @@ -45,49 +61,49 @@ in ]; configs = [ - ./module/key/Rekey.nix - ./module/key/Leader.nix - ./module/config/Autoread.nix - ./module/config/Etc.nix - ./module/config/Search.nix - ./module/config/Tab.nix - ./module/config/Highlight.nix - ./module/plugin/Filetree.nix - ./module/plugin/Gruvbox.nix - ./module/plugin/Bufferline.nix - ./module/plugin/Autoclose.nix - ./module/plugin/Gitsigns.nix - ./module/plugin/Trouble.nix - ./module/plugin/Closebuffers.nix - ./module/plugin/Telescope.nix - ./module/plugin/Todo.nix - ./module/plugin/Indent.nix - ./module/plugin/Align.nix - ./module/plugin/Treesitter.nix - ./module/plugin/Fold.nix - ./module/plugin/Gen.nix - ./module/plugin/Colorizer.nix - ./module/plugin/Dressing.nix - ./module/plugin/lsp/Go.nix - ./module/plugin/lsp/Haskell.nix - ./module/plugin/lsp/Lua.nix - ./module/plugin/lsp/Nix.nix - ./module/plugin/lsp/Rust.nix - ./module/plugin/lsp/Tex.nix - ./module/key/Autocomplete.nix - ./module/key/Buffer.nix - ./module/key/Cmd.nix - ./module/key/Colorscheme.nix - ./module/key/Filetree.nix - ./module/key/Gitsigns.nix - ./module/key/Navigation.nix - ./module/key/Prompt.nix - ./module/key/Save.nix - ./module/key/Sort.nix - ./module/key/TabWidth.nix - ./module/key/Telescope.nix - ./module/key/Terminal.nix - ./module/key/Trouble.nix + ./module/key/Rekey.lua + ./module/key/Leader.lua + ./module/config/Autoread.lua + ./module/config/Etc.lua + ./module/config/Search.lua + ./module/config/Tab.lua + ./module/config/Highlight.lua + ./module/plugin/Filetree.lua + ./module/plugin/Gruvbox.lua + ./module/plugin/Bufferline.lua + ./module/plugin/Autoclose.lua + ./module/plugin/Gitsigns.lua + ./module/plugin/Trouble.lua + ./module/plugin/Closebuffers.lua + ./module/plugin/Telescope.lua + ./module/plugin/Todo.lua + ./module/plugin/Indent.lua + ./module/plugin/Align.lua + ./module/plugin/Treesitter.lua + ./module/plugin/Fold.lua + ./module/plugin/Gen.lua + ./module/plugin/Colorizer.lua + ./module/plugin/Dressing.lua + ./module/plugin/lsp/Go.lua + ./module/plugin/lsp/Haskell.lua + ./module/plugin/lsp/Lua.lua + ./module/plugin/lsp/Nix.lua + ./module/plugin/lsp/Rust.lua + ./module/plugin/lsp/Tex.lua + ./module/key/Autocomplete.lua + ./module/key/Buffer.lua + ./module/key/Cmd.lua + ./module/key/Colorscheme.lua + ./module/key/Filetree.lua + ./module/key/Gitsigns.lua + ./module/key/Navigation.lua + ./module/key/Prompt.lua + ./module/key/Save.lua + ./module/key/Sort.lua + ./module/key/TabWidth.lua + ./module/key/Telescope.lua + ./module/key/Terminal.lua + ./module/key/Trouble.lua ]; }; } diff --git a/home/file/nvim/module/config/Autoread.lua b/home/file/nvim/module/config/Autoread.lua new file mode 100644 index 00000000..bc9a40c7 --- /dev/null +++ b/home/file/nvim/module/config/Autoread.lua @@ -0,0 +1,5 @@ +vim.o.autoread = true +vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { + command = "if mode() != 'c' | checktime | endif", + pattern = { "*" }, +}) diff --git a/home/file/nvim/module/config/Autoread.nix b/home/file/nvim/module/config/Autoread.nix deleted file mode 100644 index 54c04f8a..00000000 --- a/home/file/nvim/module/config/Autoread.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - text = '' - vim.o.autoread = true - vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { - command = "if mode() != 'c' | checktime | endif", - pattern = { "*" }, - }) - ''; -} diff --git a/home/file/nvim/module/config/Etc.lua b/home/file/nvim/module/config/Etc.lua new file mode 100644 index 00000000..b904d915 --- /dev/null +++ b/home/file/nvim/module/config/Etc.lua @@ -0,0 +1,32 @@ +-- TODO: Add comments and separate files. +vim.opt.clipboard = "unnamedplus" +vim.opt.cursorline = false +vim.opt.fixeol = false +vim.opt.incsearch = true +vim.opt.number = true +vim.opt.scrolloff = 4 +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.termguicolors = true +vim.opt.ttyfast = true +vim.opt.wildmode = "longest,list" +-- vim.opt.completeopt = "menuone,noselect" + +-- Disable continuing comments on newline. +vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o") + +-- Disable mouse. +vim.cmd("set mouse=") + +-- Disable signs for diagnostics. +vim.diagnostic.config({ signs = false }) + +-- Display invisible characters. +-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.") +vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·") + +-- Relative line numbers. +vim.wo.relativenumber = true + +-- Disable swap files. +vim.opt.swapfile = false diff --git a/home/file/nvim/module/config/Etc.nix b/home/file/nvim/module/config/Etc.nix deleted file mode 100644 index 34ff0caf..00000000 --- a/home/file/nvim/module/config/Etc.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ ... }: -{ - text = '' - -- TODO: Add comments and separate files. - vim.opt.clipboard = "unnamedplus" - vim.opt.cursorline = false - vim.opt.fixeol = false - vim.opt.incsearch = true - vim.opt.number = true - vim.opt.scrolloff = 4 - vim.opt.splitbelow = true - vim.opt.splitright = true - vim.opt.termguicolors = true - vim.opt.ttyfast = true - vim.opt.wildmode = "longest,list" - -- vim.opt.completeopt = "menuone,noselect" - - -- Disable continuing comments on newline. - vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o") - - -- Disable mouse. - vim.cmd("set mouse=") - - -- Disable signs for diagnostics. - vim.diagnostic.config({ signs = false }) - - -- Display invisible characters. - -- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.") - vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·") - - -- Relative line numbers. - vim.wo.relativenumber = true - - -- Disable swap files. - vim.opt.swapfile = false - ''; -} diff --git a/home/file/nvim/module/config/Highlight.lua b/home/file/nvim/module/config/Highlight.lua new file mode 100644 index 00000000..8bfc235c --- /dev/null +++ b/home/file/nvim/module/config/Highlight.lua @@ -0,0 +1,23 @@ +vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, { + group = vim.api.nvim_create_augroup("Color", {}), + pattern = "*", + callback = function() + -- Background. + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#@bg@" }) + vim.api.nvim_set_hl(0, "Pmenu", { bg = "#@bg@" }) + vim.api.nvim_set_hl(0, "PmenuExtra", { bg = "#@bg@" }) + vim.api.nvim_set_hl(0, "TelescopeSelection", { bg = "#@bg@" }) + + -- Selection. + vim.api.nvim_set_hl(0, "Visual", { bg = "#@selection@", bold = true, fg = "#@fg@" }) + vim.api.nvim_set_hl(0, "PmenuSel", { bg = "#@selection@", bold = true, fg = "#@fg@" }) + + -- Transparent. + vim.api.nvim_set_hl(0, "NormalFloat", { bg = clear }) + + -- Border. + vim.api.nvim_set_hl(0, "FloatBorder", { bg = clear, fg = "#@accent@" }) + vim.api.nvim_set_hl(0, "FloatTitle", { bg = clear, fg = "#@accent@" }) + vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = clear, fg = "#@accent@" }) + end, +}) diff --git a/home/file/nvim/module/config/Highlight.nix b/home/file/nvim/module/config/Highlight.nix deleted file mode 100644 index d6c78ca2..00000000 --- a/home/file/nvim/module/config/Highlight.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ config, lib, ... }: -let - color = config.module.style.color; - mkHighlight = - name: value: - ''vim.api.nvim_set_hl(0, "${name}", ${ - lib.generators.toLua { - multiline = false; - asBindings = false; - } value - })''; - bg = { - bg = "#${color.bg.regular}"; - }; - selection = { - bg = "#${color.selection}"; - bold = true; - fg = "#${color.fg.dark}"; - }; - transparent = { - bg = lib.generators.mkLuaInline "clear"; - }; - border = { - bg = lib.generators.mkLuaInline "clear"; - fg = "#${color.accent}"; - }; -in -{ - text = '' - vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, { - group = vim.api.nvim_create_augroup('Color', {}), - pattern = "*", - callback = function () - -- Background. - ${mkHighlight "CursorLine" bg} - ${mkHighlight "Pmenu" bg} - ${mkHighlight "PmenuExtra" bg} - ${mkHighlight "TelescopeSelection" bg} - - -- Selection. - ${mkHighlight "Visual" selection} - ${mkHighlight "PmenuSel" selection} - - -- Transparent. - ${mkHighlight "NormalFloat" transparent} - - -- Border. - ${mkHighlight "FloatBorder" border} - ${mkHighlight "FloatTitle" border} - ${mkHighlight "TelescopeBorder" border} - end - }) - ''; -} diff --git a/home/file/nvim/module/config/Search.lua b/home/file/nvim/module/config/Search.lua new file mode 100644 index 00000000..f982afc2 --- /dev/null +++ b/home/file/nvim/module/config/Search.lua @@ -0,0 +1,5 @@ +vim.opt.hlsearch = true +vim.opt.ignorecase = true +vim.opt.incsearch = true +vim.opt.showmatch = true +vim.opt.smartcase = true diff --git a/home/file/nvim/module/config/Search.nix b/home/file/nvim/module/config/Search.nix deleted file mode 100644 index 21842a32..00000000 --- a/home/file/nvim/module/config/Search.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - text = '' - vim.opt.hlsearch = true - vim.opt.ignorecase = true - vim.opt.incsearch = true - vim.opt.showmatch = true - vim.opt.smartcase = true - ''; -} diff --git a/home/file/nvim/module/config/Tab.lua b/home/file/nvim/module/config/Tab.lua new file mode 100644 index 00000000..8bd650a1 --- /dev/null +++ b/home/file/nvim/module/config/Tab.lua @@ -0,0 +1,9 @@ +vim.opt.autoindent = true +vim.opt.expandtab = false +-- vim.opt.smartindent = true +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 +vim.opt.tabstop = 2 + +-- Disable Markdown forced formatting. +vim.g.markdown_recommended_style = 0 diff --git a/home/file/nvim/module/config/Tab.nix b/home/file/nvim/module/config/Tab.nix deleted file mode 100644 index 4db277cd..00000000 --- a/home/file/nvim/module/config/Tab.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: -let - indentDefault = 2; -in -{ - text = '' - vim.opt.autoindent = true - vim.opt.expandtab = false - -- vim.opt.smartindent = true - vim.opt.shiftwidth = ${toString indentDefault} - vim.opt.softtabstop = ${toString indentDefault} - vim.opt.tabstop = ${toString indentDefault} - - -- Disable Markdown forced formatting. - vim.g.markdown_recommended_style = 0 - ''; -} diff --git a/home/file/nvim/module/key/Autocomplete.lua b/home/file/nvim/module/key/Autocomplete.lua new file mode 100644 index 00000000..2f397283 --- /dev/null +++ b/home/file/nvim/module/key/Autocomplete.lua @@ -0,0 +1,5 @@ +-- Autocomplete. +rekey_input("", "") + +-- LSP autocomplete. +rekey_normal("", "lua vim.lsp.buf.code_action()") diff --git a/home/file/nvim/module/key/Autocomplete.nix b/home/file/nvim/module/key/Autocomplete.nix deleted file mode 100644 index 9765db16..00000000 --- a/home/file/nvim/module/key/Autocomplete.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - text = '' - -- Autocomplete. - rekey_input("", "") - - -- LSP autocomplete. - rekey_normal("", "lua vim.lsp.buf.code_action()") - ''; -} diff --git a/home/file/nvim/module/key/Buffer.lua b/home/file/nvim/module/key/Buffer.lua new file mode 100644 index 00000000..3c059f95 --- /dev/null +++ b/home/file/nvim/module/key/Buffer.lua @@ -0,0 +1,12 @@ +-- New empty buffer. +remap_normal("n", "enew") + +-- Close buffer. +function _buf_close() + pcall(vim.cmd, "w") + vim.cmd([[bp|sp|bn|bd!]]) +end +rekey_normal("x", "lua _buf_close()") + +-- Close all hidden buffers. +rekey_normal("X", "BDelete hidden") diff --git a/home/file/nvim/module/key/Buffer.nix b/home/file/nvim/module/key/Buffer.nix deleted file mode 100644 index 4e468a83..00000000 --- a/home/file/nvim/module/key/Buffer.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: -{ - text = '' - -- New empty buffer. - remap_normal("n", "enew") - - -- Close buffer. - function _buf_close() - pcall(vim.cmd, "w") - vim.cmd[[bp|sp|bn|bd!]] - end - rekey_normal("x", "lua _buf_close()") - - -- Close all hidden buffers. - rekey_normal("X", "BDelete hidden") - ''; -} diff --git a/home/file/nvim/module/key/Cmd.lua b/home/file/nvim/module/key/Cmd.lua new file mode 100644 index 00000000..c9373ccd --- /dev/null +++ b/home/file/nvim/module/key/Cmd.lua @@ -0,0 +1,7 @@ +-- Remap ; to :. +rekey_normal(";", ":") +rekey_visual(";", ":") + +-- Repeat previous command. +rekey_normal(".", "@:") +rekey_visual(".", "@:") diff --git a/home/file/nvim/module/key/Cmd.nix b/home/file/nvim/module/key/Cmd.nix deleted file mode 100644 index acc11f00..00000000 --- a/home/file/nvim/module/key/Cmd.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: -{ - text = '' - -- Remap ; to :. - rekey_normal(";", ":") - rekey_visual(";", ":") - - -- Repeat previous command. - rekey_normal(".", "@:") - rekey_visual(".", "@:") - ''; -} diff --git a/home/file/nvim/module/key/Colorscheme.lua b/home/file/nvim/module/key/Colorscheme.lua new file mode 100644 index 00000000..374fe32d --- /dev/null +++ b/home/file/nvim/module/key/Colorscheme.lua @@ -0,0 +1,22 @@ +function toggle_contrast() + if vim.g.gruvbox_material_background == "light" then + vim.g.gruvbox_material_background = "medium" + elseif vim.g.gruvbox_material_background == "medium" then + vim.g.gruvbox_material_background = "hard" + elseif vim.g.gruvbox_material_background == "hard" then + vim.g.gruvbox_material_background = "light" + end + vim.cmd("colorscheme gruvbox-material") +end + +function toggle_light() + if vim.o.background == "light" then + vim.o.background = "dark" + elseif vim.o.background == "dark" then + vim.o.background = "light" + end + -- require("lualine").setup() +end + +rekey_normal("[", "lua toggle_contrast()") +rekey_normal("]", "lua toggle_light()") diff --git a/home/file/nvim/module/key/Colorscheme.nix b/home/file/nvim/module/key/Colorscheme.nix deleted file mode 100644 index 98e76bb7..00000000 --- a/home/file/nvim/module/key/Colorscheme.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ ... }: -{ - text = '' - function toggle_contrast() - if vim.g.gruvbox_material_background == "light" then - vim.g.gruvbox_material_background = "medium" - elseif vim.g.gruvbox_material_background == "medium" then - vim.g.gruvbox_material_background = "hard" - elseif vim.g.gruvbox_material_background == "hard" then - vim.g.gruvbox_material_background = "light" - end - vim.cmd("colorscheme gruvbox-material") - end - - function toggle_light() - if vim.o.background == "light" then - vim.o.background = "dark" - elseif vim.o.background == "dark" then - vim.o.background = "light" - end - -- require("lualine").setup() - end - - rekey_normal("[", "lua toggle_contrast()") - rekey_normal("]", "lua toggle_light()") - ''; -} diff --git a/home/file/nvim/module/key/Filetree.lua b/home/file/nvim/module/key/Filetree.lua new file mode 100644 index 00000000..fe19a3ed --- /dev/null +++ b/home/file/nvim/module/key/Filetree.lua @@ -0,0 +1,2 @@ +-- Toggle file tree. +rekey_normal("1", "NvimTreeToggle") diff --git a/home/file/nvim/module/key/Filetree.nix b/home/file/nvim/module/key/Filetree.nix deleted file mode 100644 index f0cb68a8..00000000 --- a/home/file/nvim/module/key/Filetree.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - text = '' - -- Toggle file tree. - rekey_normal("1", "NvimTreeToggle") - ''; -} diff --git a/home/file/nvim/module/key/Gitsigns.lua b/home/file/nvim/module/key/Gitsigns.lua new file mode 100644 index 00000000..7e5dadac --- /dev/null +++ b/home/file/nvim/module/key/Gitsigns.lua @@ -0,0 +1,5 @@ +-- Toggle Git inspection mode. +rekey_normal( + "g", + "Gitsigns toggle_current_line_blameGitsigns toggle_word_diffGitsigns toggle_linehl" +) diff --git a/home/file/nvim/module/key/Gitsigns.nix b/home/file/nvim/module/key/Gitsigns.nix deleted file mode 100644 index bbd41908..00000000 --- a/home/file/nvim/module/key/Gitsigns.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - text = '' - -- Toggle Git inspection mode. - rekey_normal("g", "Gitsigns toggle_current_line_blameGitsigns toggle_word_diffGitsigns toggle_linehl") - ''; -} diff --git a/home/file/nvim/module/key/Leader.lua b/home/file/nvim/module/key/Leader.lua new file mode 100644 index 00000000..df40fcc9 --- /dev/null +++ b/home/file/nvim/module/key/Leader.lua @@ -0,0 +1,7 @@ +leader = " " + +vim.g.mapleader = leader +vim.g.maplocalleader = leader + +-- Disable key press timeout. +vim.cmd("set notimeout nottimeout") diff --git a/home/file/nvim/module/key/Leader.nix b/home/file/nvim/module/key/Leader.nix deleted file mode 100644 index 50b832f9..00000000 --- a/home/file/nvim/module/key/Leader.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: -{ - text = '' - leader = " " - - vim.g.mapleader = leader - vim.g.maplocalleader = leader - - -- Disable key press timeout. - vim.cmd("set notimeout nottimeout") - ''; -} diff --git a/home/file/nvim/module/key/Navigation.lua b/home/file/nvim/module/key/Navigation.lua new file mode 100644 index 00000000..392e94bf --- /dev/null +++ b/home/file/nvim/module/key/Navigation.lua @@ -0,0 +1,29 @@ +-- Switch windows. +rekey_normal("a", "h") +rekey_normal("d", "l") +rekey_normal("s", "j") +rekey_normal("w", "k") + +-- Switch buffers. +rekey_normal("E", "BufferLineMoveNext") +rekey_normal("Q", "BufferLineMovePrev") +rekey_normal("e", "BufferLineCycleNext") +rekey_normal("q", "BufferLineCyclePrev") + +-- Splits. +rekey_normal("\\", "vsplit") +rekey_normal("-", "split") +rekey_normal("=", "=") -- Equalize split sizes. +rekey_normal("c", "q") -- Close split. + +-- Resize splits. +rekey_normal("h", "4<") +rekey_normal("l", "4>") +rekey_normal("j", "2+") +rekey_normal("k", "2-") + +-- Move splits. +rekey_normal("A", "A") +rekey_normal("D", "D") +rekey_normal("S", "S") +rekey_normal("W", "W") diff --git a/home/file/nvim/module/key/Navigation.nix b/home/file/nvim/module/key/Navigation.nix deleted file mode 100644 index 7ef08506..00000000 --- a/home/file/nvim/module/key/Navigation.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ ... }: -let - stepHorizontal = 4; - stepVertical = 2; -in -{ - text = '' - -- Switch windows. - rekey_normal("a", "h") - rekey_normal("d", "l") - rekey_normal("s", "j") - rekey_normal("w", "k") - - -- Switch buffers. - rekey_normal("E", "BufferLineMoveNext") - rekey_normal("Q", "BufferLineMovePrev") - rekey_normal("e", "BufferLineCycleNext") - rekey_normal("q", "BufferLineCyclePrev") - - -- Splits. - rekey_normal("\\", "vsplit") - rekey_normal("-", "split") - rekey_normal("=", "=") -- Equalize split sizes. - rekey_normal("c", "q") -- Close split. - - -- Resize splits. - rekey_normal("h", "${toString stepHorizontal}<") - rekey_normal("l", "${toString stepHorizontal}>") - rekey_normal("j", "${toString stepVertical}+") - rekey_normal("k", "${toString stepVertical}-") - - -- Move splits. - rekey_normal("A", "A") - rekey_normal("D", "D") - rekey_normal("S", "S") - rekey_normal("W", "W") - ''; -} diff --git a/home/file/nvim/module/key/Prompt.lua b/home/file/nvim/module/key/Prompt.lua new file mode 100644 index 00000000..cee5d9ef --- /dev/null +++ b/home/file/nvim/module/key/Prompt.lua @@ -0,0 +1,2 @@ +rekey_normal("p", ":Gen") +rekey_visual("p", ":Gen") diff --git a/home/file/nvim/module/key/Prompt.nix b/home/file/nvim/module/key/Prompt.nix deleted file mode 100644 index 86a567ca..00000000 --- a/home/file/nvim/module/key/Prompt.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - text = '' - rekey_normal("p", ":Gen") - rekey_visual("p", ":Gen") - ''; -} diff --git a/home/file/nvim/module/key/Rekey.lua b/home/file/nvim/module/key/Rekey.lua new file mode 100644 index 00000000..314e9750 --- /dev/null +++ b/home/file/nvim/module/key/Rekey.lua @@ -0,0 +1,49 @@ +-- Base rekey function. +local function rekey(t, key, command) + vim.api.nvim_set_keymap(t, key, command, { noremap = true }) +end + +-- Base remap function. +local function remap(t, key, command) + vim.api.nvim_set_keymap(t, key, command, { noremap = false }) +end + +-- Rekey in normal mode. +function rekey_normal(key, command) + rekey("n", key, command) +end + +-- Rekey in input mode. +function rekey_input(key, command) + rekey("i", key, command) +end + +-- Rekey in visual mode. +function rekey_visual(key, command) + rekey("v", key, command) +end + +-- Rekey in terminal mode. +function rekey_terminal(key, command) + rekey("t", key, command) +end + +-- Remap in normal mode. +function remap_normal(key, command) + remap("n", key, command) +end + +-- Remap in input mode. +function remap_input(key, command) + remap("i", key, command) +end + +-- Remap in visual mode. +function remap_visual(key, command) + remap("v", key, command) +end + +-- Remap in terminal mode. +function remap_terminal(key, command) + remap("t", key, command) +end diff --git a/home/file/nvim/module/key/Rekey.nix b/home/file/nvim/module/key/Rekey.nix deleted file mode 100644 index a12a2fe7..00000000 --- a/home/file/nvim/module/key/Rekey.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ ... }: -{ - text = '' - -- Base rekey function. - local function rekey(t, key, command) - vim.api.nvim_set_keymap(t, key, command, { noremap = true }) - end - - -- Base remap function. - local function remap(t, key, command) - vim.api.nvim_set_keymap(t, key, command, { noremap = false }) - end - - -- Rekey in normal mode. - function rekey_normal(key, command) - rekey("n", key, command) - end - - -- Rekey in input mode. - function rekey_input(key, command) - rekey("i", key, command) - end - - -- Rekey in visual mode. - function rekey_visual(key, command) - rekey("v", key, command) - end - - -- Rekey in terminal mode. - function rekey_terminal(key, command) - rekey("t", key, command) - end - - -- Remap in normal mode. - function remap_normal(key, command) - remap("n", key, command) - end - - -- Remap in input mode. - function remap_input(key, command) - remap("i", key, command) - end - - -- Remap in visual mode. - function remap_visual(key, command) - remap("v", key, command) - end - - -- Remap in terminal mode. - function remap_terminal(key, command) - remap("t", key, command) - end - ''; -} diff --git a/home/file/nvim/module/key/Save.lua b/home/file/nvim/module/key/Save.lua new file mode 100644 index 00000000..595d87c9 --- /dev/null +++ b/home/file/nvim/module/key/Save.lua @@ -0,0 +1,15 @@ +-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim. +function bye() + pcall(vim.cmd, "wa") + vim.cmd([[qa!]]) +end + +-- Save everything. +rekey_normal("", "wa!") +rekey_input("", "wa!") + +-- Save all we can and leave. +rekey_normal("z", "lua bye()") + +-- Just leave, no saves. +rekey_normal("Z", "qa!") diff --git a/home/file/nvim/module/key/Save.nix b/home/file/nvim/module/key/Save.nix deleted file mode 100644 index be1b72dc..00000000 --- a/home/file/nvim/module/key/Save.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: -{ - text = '' - -- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim. - function bye() - pcall(vim.cmd, "wa") - vim.cmd[[qa!]] - end - - -- Save everything. - rekey_normal("", "wa!") - rekey_input("", "wa!") - - -- Save all we can and leave. - rekey_normal("z", "lua bye()") - - -- Just leave, no saves. - rekey_normal("Z", "qa!") - ''; -} diff --git a/home/file/nvim/module/key/Sort.lua b/home/file/nvim/module/key/Sort.lua new file mode 100644 index 00000000..3b234ef8 --- /dev/null +++ b/home/file/nvim/module/key/Sort.lua @@ -0,0 +1,2 @@ +-- Sort visual selection alphabetically. +rekey_visual("A", ":'<,'>sort") diff --git a/home/file/nvim/module/key/Sort.nix b/home/file/nvim/module/key/Sort.nix deleted file mode 100644 index 59e496a2..00000000 --- a/home/file/nvim/module/key/Sort.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - text = '' - -- Sort visual selection alphabetically. - rekey_visual("A", ":'<,'>sort") - ''; -} diff --git a/home/file/nvim/module/key/TabWidth.lua b/home/file/nvim/module/key/TabWidth.lua new file mode 100644 index 00000000..b2dffa54 --- /dev/null +++ b/home/file/nvim/module/key/TabWidth.lua @@ -0,0 +1,17 @@ +function toggle_tab_width() + if vim.bo.shiftwidth == 2 then + vim.bo.shiftwidth = 4 + vim.bo.tabstop = 4 + vim.bo.softtabstop = 4 + elseif vim.bo.shiftwidth == 4 then + vim.bo.shiftwidth = 8 + vim.bo.tabstop = 8 + vim.bo.softtabstop = 8 + elseif vim.bo.shiftwidth == 8 then + vim.bo.shiftwidth = 2 + vim.bo.tabstop = 2 + vim.bo.softtabstop = 2 + end +end + +rekey_normal("", "lua toggle_tab_width()") diff --git a/home/file/nvim/module/key/TabWidth.nix b/home/file/nvim/module/key/TabWidth.nix deleted file mode 100644 index 6037dcb1..00000000 --- a/home/file/nvim/module/key/TabWidth.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: -{ - text = '' - function toggle_tab_width() - if vim.bo.shiftwidth == 2 then - vim.bo.shiftwidth = 4 - vim.bo.tabstop = 4 - vim.bo.softtabstop = 4 - elseif vim.bo.shiftwidth == 4 then - vim.bo.shiftwidth = 8 - vim.bo.tabstop = 8 - vim.bo.softtabstop = 8 - elseif vim.bo.shiftwidth == 8 then - vim.bo.shiftwidth = 2 - vim.bo.tabstop = 2 - vim.bo.softtabstop = 2 - end - end - - rekey_normal("", "lua toggle_tab_width()") - ''; -} diff --git a/home/file/nvim/module/key/Telescope.lua b/home/file/nvim/module/key/Telescope.lua new file mode 100644 index 00000000..b747f5eb --- /dev/null +++ b/home/file/nvim/module/key/Telescope.lua @@ -0,0 +1,6 @@ +rekey_normal("fa", "Telescope") +rekey_normal("fb", "lua require('telescope.builtin').buffers()") +rekey_normal("ff", "lua require('telescope.builtin').find_files()") +rekey_normal("fg", "lua require('telescope.builtin').live_grep()") +rekey_normal("fh", "lua require('telescope.builtin').help_tags()") +rekey_normal("ft", "Telescope treesitter") diff --git a/home/file/nvim/module/key/Telescope.nix b/home/file/nvim/module/key/Telescope.nix deleted file mode 100644 index 17f5c84c..00000000 --- a/home/file/nvim/module/key/Telescope.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: -let - mod = "f"; -in -{ - text = '' - rekey_normal("${mod}a", "Telescope") - rekey_normal("${mod}b", "lua require('telescope.builtin').buffers()") - rekey_normal("${mod}f", "lua require('telescope.builtin').find_files()") - rekey_normal("${mod}g", "lua require('telescope.builtin').live_grep()") - rekey_normal("${mod}h", "lua require('telescope.builtin').help_tags()") - rekey_normal("${mod}t", "Telescope treesitter") - ''; -} diff --git a/home/file/nvim/module/key/Terminal.lua b/home/file/nvim/module/key/Terminal.lua new file mode 100644 index 00000000..359cc74c --- /dev/null +++ b/home/file/nvim/module/key/Terminal.lua @@ -0,0 +1,5 @@ +-- Open terminal window. +rekey_normal("4", "terminal") + +-- Detach from terminal with Esc key. +rekey_terminal("", "") diff --git a/home/file/nvim/module/key/Terminal.nix b/home/file/nvim/module/key/Terminal.nix deleted file mode 100644 index f41ba735..00000000 --- a/home/file/nvim/module/key/Terminal.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - text = '' - -- Open terminal window. - rekey_normal("4", "terminal") - - -- Detach from terminal with Esc key. - rekey_terminal("", "") - ''; -} diff --git a/home/file/nvim/module/key/Trouble.lua b/home/file/nvim/module/key/Trouble.lua new file mode 100644 index 00000000..d66faec5 --- /dev/null +++ b/home/file/nvim/module/key/Trouble.lua @@ -0,0 +1,5 @@ +-- Toggle diagnostics window. +rekey_normal("2", "Trouble diagnostics toggle focus=true") + +-- Toggle To-do window. +rekey_normal("3", "Trouble todo toggle focus=true") diff --git a/home/file/nvim/module/key/Trouble.nix b/home/file/nvim/module/key/Trouble.nix deleted file mode 100644 index 06eb18cc..00000000 --- a/home/file/nvim/module/key/Trouble.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: -let - focus = true; -in -{ - text = '' - -- Toggle diagnostics window. - rekey_normal("2", "Trouble diagnostics toggle focus=${toString focus}") - - -- Toggle To-do window. - rekey_normal("3", "Trouble todo toggle focus=${toString focus}") - ''; -} diff --git a/home/file/nvim/module/plugin/Align.lua b/home/file/nvim/module/plugin/Align.lua new file mode 100644 index 00000000..9098259f --- /dev/null +++ b/home/file/nvim/module/plugin/Align.lua @@ -0,0 +1,6 @@ +require("mini.align").setup({ + mappings = { + start = "a", + -- start_with_preview = 'A', + }, +}) diff --git a/home/file/nvim/module/plugin/Align.nix b/home/file/nvim/module/plugin/Align.nix deleted file mode 100644 index c23fd6c3..00000000 --- a/home/file/nvim/module/plugin/Align.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - text = '' - require("mini.align").setup { - mappings = { - start = "a", - -- start_with_preview = 'A', - }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/Autoclose.lua b/home/file/nvim/module/plugin/Autoclose.lua new file mode 100644 index 00000000..02f10801 --- /dev/null +++ b/home/file/nvim/module/plugin/Autoclose.lua @@ -0,0 +1,13 @@ +require("autoclose").setup({ + keys = { + ["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} }, + ["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} }, + ["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} }, + ['"'] = { escape = true, close = true, pair = '""', disabled_filetypes = {} }, + ["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} }, + ["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} }, + }, + -- options = { + -- disabled_filetypes = { "text", "markdown" }, + -- } +}) diff --git a/home/file/nvim/module/plugin/Autoclose.nix b/home/file/nvim/module/plugin/Autoclose.nix deleted file mode 100644 index c2c64878..00000000 --- a/home/file/nvim/module/plugin/Autoclose.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: -{ - text = '' - require("autoclose").setup({ - keys = { - ["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} }, - ["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} }, - ["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} }, - ["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} }, - ["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} }, - ["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} }, - }, - -- options = { - -- disabled_filetypes = { "text", "markdown" }, - -- } - }) - ''; -} diff --git a/home/file/nvim/module/plugin/Bufferline.lua b/home/file/nvim/module/plugin/Bufferline.lua new file mode 100644 index 00000000..da65645a --- /dev/null +++ b/home/file/nvim/module/plugin/Bufferline.lua @@ -0,0 +1 @@ +require("bufferline").setup() diff --git a/home/file/nvim/module/plugin/Bufferline.nix b/home/file/nvim/module/plugin/Bufferline.nix deleted file mode 100644 index 0339f530..00000000 --- a/home/file/nvim/module/plugin/Bufferline.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - text = '' - require("bufferline").setup() - ''; -} diff --git a/home/file/nvim/module/plugin/Closebuffers.lua b/home/file/nvim/module/plugin/Closebuffers.lua new file mode 100644 index 00000000..94c8ae6a --- /dev/null +++ b/home/file/nvim/module/plugin/Closebuffers.lua @@ -0,0 +1,7 @@ +require("close_buffers").setup({ + file_glob_ignore = {}, + file_regex_ignore = {}, + filetype_ignore = {}, + next_buffer_cmd = nil, + preserve_window_layout = { "this", "nameless" }, +}) diff --git a/home/file/nvim/module/plugin/Closebuffers.nix b/home/file/nvim/module/plugin/Closebuffers.nix deleted file mode 100644 index 6736b05b..00000000 --- a/home/file/nvim/module/plugin/Closebuffers.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: -{ - text = '' - require("close_buffers").setup({ - file_glob_ignore = {}, - file_regex_ignore = {}, - filetype_ignore = {}, - next_buffer_cmd = nil, - preserve_window_layout = { "this", "nameless" }, - }) - ''; -} diff --git a/home/file/nvim/module/plugin/Colorizer.lua b/home/file/nvim/module/plugin/Colorizer.lua new file mode 100644 index 00000000..7721db27 --- /dev/null +++ b/home/file/nvim/module/plugin/Colorizer.lua @@ -0,0 +1,4 @@ +-- Ensure termguicolors is enabled if not already +vim.opt.termguicolors = true + +require("nvim-highlight-colors").setup({}) diff --git a/home/file/nvim/module/plugin/Colorizer.nix b/home/file/nvim/module/plugin/Colorizer.nix deleted file mode 100644 index 33c47e8a..00000000 --- a/home/file/nvim/module/plugin/Colorizer.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: -{ - text = '' - -- Ensure termguicolors is enabled if not already - vim.opt.termguicolors = true - - require('nvim-highlight-colors').setup({}) - ''; -} diff --git a/home/file/nvim/module/plugin/Dressing.lua b/home/file/nvim/module/plugin/Dressing.lua new file mode 100644 index 00000000..c587d596 --- /dev/null +++ b/home/file/nvim/module/plugin/Dressing.lua @@ -0,0 +1 @@ +require("dressing").setup({}) diff --git a/home/file/nvim/module/plugin/Dressing.nix b/home/file/nvim/module/plugin/Dressing.nix deleted file mode 100644 index 1f50c94f..00000000 --- a/home/file/nvim/module/plugin/Dressing.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - text = '' - require("dressing").setup({ }) - ''; -} diff --git a/home/file/nvim/module/plugin/Filetree.lua b/home/file/nvim/module/plugin/Filetree.lua new file mode 100644 index 00000000..43abc702 --- /dev/null +++ b/home/file/nvim/module/plugin/Filetree.lua @@ -0,0 +1,36 @@ +-- Disable netrw at the very start of your init.lua. +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +local function my_on_attach(bufnr) + local api = require("nvim-tree.api") + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- Default mappings. + api.config.mappings.default_on_attach(bufnr) + + -- Custom mappings. + -- vim.keymap.set('n', '', api.tree.change_root_to_node, opts('Cd into')) +end + +-- Set termguicolors to enable highlight groups. +vim.opt.termguicolors = true + +-- Setup nvim-tree. +require("nvim-tree").setup({ + on_attach = my_on_attach, + sort_by = "case_sensitive", + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = false, + git_ignored = false, + }, +}) diff --git a/home/file/nvim/module/plugin/Filetree.nix b/home/file/nvim/module/plugin/Filetree.nix deleted file mode 100644 index 20c99b97..00000000 --- a/home/file/nvim/module/plugin/Filetree.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ ... }: -{ - text = '' - -- Disable netrw at the very start of your init.lua. - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - - local function my_on_attach(bufnr) - local api = require "nvim-tree.api" - - local function opts(desc) - return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - - -- Default mappings. - api.config.mappings.default_on_attach(bufnr) - - -- Custom mappings. - -- vim.keymap.set('n', '', api.tree.change_root_to_node, opts('Cd into')) - end - - -- Set termguicolors to enable highlight groups. - vim.opt.termguicolors = true - - -- Setup nvim-tree. - require("nvim-tree").setup({ - on_attach = my_on_attach, - sort_by = "case_sensitive", - view = { - width = 30, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = false, - git_ignored = false - }, - }) - ''; -} diff --git a/home/file/nvim/module/plugin/Fold.lua b/home/file/nvim/module/plugin/Fold.lua new file mode 100644 index 00000000..5992a3c4 --- /dev/null +++ b/home/file/nvim/module/plugin/Fold.lua @@ -0,0 +1,3 @@ +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.foldlevel = 99 +vim.opt.foldmethod = "expr" diff --git a/home/file/nvim/module/plugin/Fold.nix b/home/file/nvim/module/plugin/Fold.nix deleted file mode 100644 index e10ae3cb..00000000 --- a/home/file/nvim/module/plugin/Fold.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - text = '' - vim.opt.foldexpr = "nvim_treesitter#foldexpr()" - vim.opt.foldlevel = 99 - vim.opt.foldmethod = "expr" - ''; -} diff --git a/home/file/nvim/module/plugin/Gen.lua b/home/file/nvim/module/plugin/Gen.lua new file mode 100644 index 00000000..8d1cbdef --- /dev/null +++ b/home/file/nvim/module/plugin/Gen.lua @@ -0,0 +1,3 @@ +require("gen").setup({ + model = "@ollamaModel@", +}) diff --git a/home/file/nvim/module/plugin/Gen.nix b/home/file/nvim/module/plugin/Gen.nix deleted file mode 100644 index 5926f911..00000000 --- a/home/file/nvim/module/plugin/Gen.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, ... }: -{ - text = '' - require("gen").setup { - model = "${config.module.ollama.primaryModel}" - } - ''; -} diff --git a/home/file/nvim/module/plugin/Gitsigns.lua b/home/file/nvim/module/plugin/Gitsigns.lua new file mode 100644 index 00000000..70fda981 --- /dev/null +++ b/home/file/nvim/module/plugin/Gitsigns.lua @@ -0,0 +1,40 @@ +require("gitsigns").setup({ + signs = { + add = { text = "│" }, + change = { text = "│" }, + changedelete = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + untracked = { text = "┆" }, + }, + linehl = false, + numhl = true, + signcolumn = false, + word_diff = false, + watch_gitdir = { + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, + current_line_blame_opts = { + delay = 1000, + ignore_whitespace = false, + virt_text = true, + virt_text_pos = "eol", + }, + current_line_blame_formatter = ", - ", + max_file_length = 40000, + sign_priority = 6, + status_formatter = nil, + update_debounce = 100, + preview_config = { + border = "single", + col = 1, + relative = "cursor", + row = 0, + style = "minimal", + }, +}) + +-- Set custom color. +vim.cmd("highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa") diff --git a/home/file/nvim/module/plugin/Gitsigns.nix b/home/file/nvim/module/plugin/Gitsigns.nix deleted file mode 100644 index ed357c77..00000000 --- a/home/file/nvim/module/plugin/Gitsigns.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ ... }: -{ - text = '' - require("gitsigns").setup { - signs = { - add = { text = "│" }, - change = { text = "│" }, - changedelete = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - untracked = { text = "┆" }, - }, - linehl = false, - numhl = true, - signcolumn = false, - word_diff = false, - watch_gitdir = { - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = false, - current_line_blame_opts = { - delay = 1000, - ignore_whitespace = false, - virt_text = true, - virt_text_pos = "eol", - }, - current_line_blame_formatter = ", - ", - max_file_length = 40000, - sign_priority = 6, - status_formatter = nil, - update_debounce = 100, - preview_config = { - border = "single", - col = 1, - relative = "cursor", - row = 0, - style = "minimal", - }, - } - - -- Set custom color. - vim.cmd("highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa") - ''; -} diff --git a/home/file/nvim/module/plugin/Gruvbox.lua b/home/file/nvim/module/plugin/Gruvbox.lua new file mode 100644 index 00000000..fb54fb70 --- /dev/null +++ b/home/file/nvim/module/plugin/Gruvbox.lua @@ -0,0 +1,15 @@ +vim.cmd([[ + if has('termguicolors') + set termguicolors + endif + ]]) + +vim.o.background = "dark" +vim.g.gruvbox_material_background = "medium" +vim.g.gruvbox_material_foreground = "original" +vim.g.gruvbox_material_transparent_background = 2 +-- vim.g.gruvbox_material_better_performance = 1 -- NOTE: Broken on NixOS. + +-- vim.cmd("autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE") +vim.cmd("colorscheme gruvbox-material") +vim.cmd("let g:lightline = {'colorscheme' : 'gruvbox_material'}") diff --git a/home/file/nvim/module/plugin/Gruvbox.nix b/home/file/nvim/module/plugin/Gruvbox.nix deleted file mode 100644 index 01edadf4..00000000 --- a/home/file/nvim/module/plugin/Gruvbox.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: -{ - text = '' - vim.cmd([[ - if has('termguicolors') - set termguicolors - endif - ]]) - - vim.o.background = "dark" - vim.g.gruvbox_material_background = "medium" - vim.g.gruvbox_material_foreground = "original" - vim.g.gruvbox_material_transparent_background = 2 - -- vim.g.gruvbox_material_better_performance = 1 -- NOTE: Broken on NixOS. - - -- vim.cmd("autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE") - vim.cmd("colorscheme gruvbox-material") - vim.cmd("let g:lightline = {'colorscheme' : 'gruvbox_material'}") - ''; -} diff --git a/home/file/nvim/module/plugin/Indent.lua b/home/file/nvim/module/plugin/Indent.lua new file mode 100644 index 00000000..2da01558 --- /dev/null +++ b/home/file/nvim/module/plugin/Indent.lua @@ -0,0 +1,6 @@ +-- Auto-detect indentation type. +require("indent-o-matic").setup({ + max_lines = 1024, + skip_multiline = true, + standard_widths = { 2, 4, 8 }, +}) diff --git a/home/file/nvim/module/plugin/Indent.nix b/home/file/nvim/module/plugin/Indent.nix deleted file mode 100644 index e9441397..00000000 --- a/home/file/nvim/module/plugin/Indent.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - text = '' - -- Auto-detect indentation type. - require("indent-o-matic").setup { - max_lines = 1024, - skip_multiline = true, - standard_widths = { 2, 4, 8 }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/Init.lua b/home/file/nvim/module/plugin/Init.lua new file mode 100644 index 00000000..4a5f47b1 --- /dev/null +++ b/home/file/nvim/module/plugin/Init.lua @@ -0,0 +1,49 @@ +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({ "git", "clone", "--depth", "1", "https://git.voronind.com/mirror/packer.nvim.git", install_path }) + vim.cmd([[packadd packer.nvim]]) + return true + end + return false +end + +local packer_bootstrap = ensure_packer() + +local available = function(commands) + for _, command in ipairs(commands) do + if vim.fn.executable(command) ~= 1 then + return false + end + end + return true +end + +return require("packer").startup(function(use) + use("https://git.voronind.com/mirror/SingleComment.nvim.git") + use("https://git.voronind.com/mirror/autoclose.nvim.git") + use("https://git.voronind.com/mirror/bufferline.nvim.git") + use("https://git.voronind.com/mirror/close-buffers.nvim.git") + use("https://git.voronind.com/mirror/gitsigns.nvim.git") + use("https://git.voronind.com/mirror/gruvbox-material.git") + use("https://git.voronind.com/mirror/indent-o-matic.git") + use("https://git.voronind.com/mirror/lualine.nvim.git") + use("https://git.voronind.com/mirror/mini.align.git") + use("https://git.voronind.com/mirror/nvim-lspconfig.git") + use("https://git.voronind.com/mirror/nvim-tree.lua.git") + use("https://git.voronind.com/mirror/nvim-treesitter.git") + use("https://git.voronind.com/mirror/nvim-web-devicons.git") + use("https://git.voronind.com/mirror/packer.nvim.git") + use("https://git.voronind.com/mirror/plenary.nvim.git") + use("https://git.voronind.com/mirror/telescope.nvim.git") + use("https://git.voronind.com/mirror/todo-comments.nvim.git") + use("https://git.voronind.com/mirror/tokyonight.nvim.git") + use("https://git.voronind.com/mirror/trouble.nvim.git") + use("https://git.voronind.com/mirror/which-key.nvim.git") + + -- Auto-install. + if packer_bootstrap then + require("packer").sync() + end +end) diff --git a/home/file/nvim/module/plugin/Init.nix b/home/file/nvim/module/plugin/Init.nix deleted file mode 100644 index 74d8e330..00000000 --- a/home/file/nvim/module/plugin/Init.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ ... }: -{ - text = '' - local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim" - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({"git", "clone", "--depth", "1", "https://git.voronind.com/mirror/packer.nvim.git", install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false - end - - local packer_bootstrap = ensure_packer() - - local available = function(commands) - for _, command in ipairs(commands) do - if vim.fn.executable(command) ~= 1 then - return false - end - end - return true - end - - return require("packer").startup(function(use) - use "https://git.voronind.com/mirror/SingleComment.nvim.git" - use "https://git.voronind.com/mirror/autoclose.nvim.git" - use "https://git.voronind.com/mirror/bufferline.nvim.git" - use "https://git.voronind.com/mirror/close-buffers.nvim.git" - use "https://git.voronind.com/mirror/gitsigns.nvim.git" - use "https://git.voronind.com/mirror/gruvbox-material.git" - use "https://git.voronind.com/mirror/indent-o-matic.git" - use "https://git.voronind.com/mirror/lualine.nvim.git" - use "https://git.voronind.com/mirror/mini.align.git" - use "https://git.voronind.com/mirror/nvim-lspconfig.git" - use "https://git.voronind.com/mirror/nvim-tree.lua.git" - use "https://git.voronind.com/mirror/nvim-treesitter.git" - use "https://git.voronind.com/mirror/nvim-web-devicons.git" - use "https://git.voronind.com/mirror/packer.nvim.git" - use "https://git.voronind.com/mirror/plenary.nvim.git" - use "https://git.voronind.com/mirror/telescope.nvim.git" - use "https://git.voronind.com/mirror/todo-comments.nvim.git" - use "https://git.voronind.com/mirror/tokyonight.nvim.git" - use "https://git.voronind.com/mirror/trouble.nvim.git" - use "https://git.voronind.com/mirror/which-key.nvim.git" - - -- Auto-install. - if packer_bootstrap then - require("packer").sync() - end - end) - ''; -} diff --git a/home/file/nvim/module/plugin/Telescope.lua b/home/file/nvim/module/plugin/Telescope.lua new file mode 100644 index 00000000..3b012671 --- /dev/null +++ b/home/file/nvim/module/plugin/Telescope.lua @@ -0,0 +1,12 @@ +require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = "move_selection_previous", + [""] = "move_selection_next", + }, + }, + }, + extensions = {}, + pickers = {}, +}) diff --git a/home/file/nvim/module/plugin/Telescope.nix b/home/file/nvim/module/plugin/Telescope.nix deleted file mode 100644 index 3524d954..00000000 --- a/home/file/nvim/module/plugin/Telescope.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: -{ - text = '' - require("telescope").setup{ - defaults = { - mappings = { - i = { - [""] = "move_selection_previous", - [""] = "move_selection_next", - }, - }, - }, - extensions = { }, - pickers = { }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/Todo.lua b/home/file/nvim/module/plugin/Todo.lua new file mode 100644 index 00000000..1e4ce859 --- /dev/null +++ b/home/file/nvim/module/plugin/Todo.lua @@ -0,0 +1,51 @@ +require("todo-comments").setup({ + sign_priority = 8, + signs = false, + keywords = { + FIX = { icon = " ", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } }, + HACK = { icon = " ", color = "warning", alt = { "WTF", "LOL", "KEKW" } }, + LINK = { icon = "󰌷 ", color = "info", alt = { "REF", "SEE", "MORE", "ALSO", "SOURCE", "SRC" } }, + NOTE = { icon = "󰎚 ", color = "hint", alt = { "INFO" } }, + PERF = { icon = " ", color = "default", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + TODO = { icon = " ", color = "info", alt = { "LATER", "FUTURE", "ROADMAP" } }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + WIP = { icon = " ", color = "warning", alt = { "PROGRESS" } }, + }, + gui_style = { + bg = "BOLD", + fg = "NONE", + }, + merge_keywords = true, + highlight = { + after = "fg", + before = "", + comments_only = true, + exclude = {}, + keyword = "wide", + max_line_len = 400, + multiline = true, + multiline_context = 10, + multiline_pattern = "^.", + pattern = [[.*<(KEYWORDS)\s*:]], + }, + colors = { + default = { "Identifier", "#7C3AED" }, + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + hint = { "DiagnosticHint", "#10B981" }, + info = { "DiagnosticInfo", "#2563EB" }, + test = { "Identifier", "#FF00FF" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + pattern = [[\b(KEYWORDS):]], + }, +}) diff --git a/home/file/nvim/module/plugin/Todo.nix b/home/file/nvim/module/plugin/Todo.nix deleted file mode 100644 index 970bbbbd..00000000 --- a/home/file/nvim/module/plugin/Todo.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ ... }: -{ - text = '' - require("todo-comments").setup { - sign_priority = 8, - signs = false, - keywords = { - FIX = { icon = " ", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, }, - HACK = { icon = " ", color = "warning", alt = { "WTF", "LOL", "KEKW" } }, - LINK = { icon = "󰌷 ", color = "info", alt = { "REF", "SEE", "MORE", "ALSO", "SOURCE", "SRC" } }, - NOTE = { icon = "󰎚 ", color = "hint", alt = { "INFO" } }, - PERF = { icon = " ", color = "default", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - TODO = { icon = " ", color = "info", alt = { "LATER", "FUTURE", "ROADMAP" }}, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - WIP = { icon = " ", color = "warning", alt = { "PROGRESS" } }, - }, - gui_style = { - bg = "BOLD", - fg = "NONE", - }, - merge_keywords = true, - highlight = { - after = "fg", - before = "", - comments_only = true, - exclude = {}, - keyword = "wide", - max_line_len = 400, - multiline = true, - multiline_context = 10, - multiline_pattern = "^.", - pattern = [[.*<(KEYWORDS)\s*:]], - }, - colors = { - default = { "Identifier", "#7C3AED" }, - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - hint = { "DiagnosticHint", "#10B981" }, - info = { "DiagnosticInfo", "#2563EB" }, - test = { "Identifier", "#FF00FF" }, - warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, - }, - search = { - command = "rg", - args = { - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - }, - pattern = [[\b(KEYWORDS):]], - }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/Treesitter.lua b/home/file/nvim/module/plugin/Treesitter.lua new file mode 100644 index 00000000..df26de44 --- /dev/null +++ b/home/file/nvim/module/plugin/Treesitter.lua @@ -0,0 +1,21 @@ +require("nvim-treesitter.configs").setup({ + parser_install_dir = "~/.cache/nvim/treesitter", + auto_install = true, + -- ensure_installed = "all", + sync_install = false, + highlight = { + additional_vim_regex_highlighting = false, + enable = true, + use_languagetree = true, + disable = { "lua" }, + }, + indent = { + enable = true, + }, + autotag = { + enable = true, + }, + rainbow = { + enable = true, + }, +}) diff --git a/home/file/nvim/module/plugin/Treesitter.nix b/home/file/nvim/module/plugin/Treesitter.nix deleted file mode 100644 index 4655911e..00000000 --- a/home/file/nvim/module/plugin/Treesitter.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ ... }: -{ - text = '' - require("nvim-treesitter.configs").setup { - parser_install_dir = "~/.cache/nvim/treesitter", - auto_install = true, - -- ensure_installed = "all", - sync_install = false, - highlight = { - additional_vim_regex_highlighting = false, - enable = true, - use_languagetree = true, - disable = { "lua" }, - }, - indent = { - enable = true, - }, - autotag = { - enable = true - }, - rainbow = { - enable = true - }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/Trouble.lua b/home/file/nvim/module/plugin/Trouble.lua new file mode 100644 index 00000000..38ef1e9f --- /dev/null +++ b/home/file/nvim/module/plugin/Trouble.lua @@ -0,0 +1 @@ +require("trouble").setup() diff --git a/home/file/nvim/module/plugin/Trouble.nix b/home/file/nvim/module/plugin/Trouble.nix deleted file mode 100644 index f2f04fca..00000000 --- a/home/file/nvim/module/plugin/Trouble.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - text = '' - require("trouble").setup() - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Go.lua b/home/file/nvim/module/plugin/lsp/Go.lua new file mode 100644 index 00000000..fb32be25 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Go.lua @@ -0,0 +1,3 @@ +local lspconfig = require("lspconfig") + +lspconfig.gopls.setup({}) diff --git a/home/file/nvim/module/plugin/lsp/Go.nix b/home/file/nvim/module/plugin/lsp/Go.nix deleted file mode 100644 index a78a6419..00000000 --- a/home/file/nvim/module/plugin/lsp/Go.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.gopls.setup {} - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Haskell.lua b/home/file/nvim/module/plugin/lsp/Haskell.lua new file mode 100644 index 00000000..cd419c27 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Haskell.lua @@ -0,0 +1,5 @@ +local lspconfig = require("lspconfig") + +lspconfig.hls.setup({ + filetypes = { "haskell", "lhaskell", "cabal" }, +}) diff --git a/home/file/nvim/module/plugin/lsp/Haskell.nix b/home/file/nvim/module/plugin/lsp/Haskell.nix deleted file mode 100644 index fb312fc6..00000000 --- a/home/file/nvim/module/plugin/lsp/Haskell.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.hls.setup { - filetypes = { 'haskell', 'lhaskell', 'cabal' }, - } - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Kotlin.lua b/home/file/nvim/module/plugin/lsp/Kotlin.lua new file mode 100644 index 00000000..5e19c4ca --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Kotlin.lua @@ -0,0 +1,3 @@ +local lspconfig = require("lspconfig") + +lspconfig.kotlin_language_server.setup({}) diff --git a/home/file/nvim/module/plugin/lsp/Kotlin.nix b/home/file/nvim/module/plugin/lsp/Kotlin.nix deleted file mode 100644 index 089145c8..00000000 --- a/home/file/nvim/module/plugin/lsp/Kotlin.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.kotlin_language_server.setup {} - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Lua.lua b/home/file/nvim/module/plugin/lsp/Lua.lua new file mode 100644 index 00000000..e8b1e7fc --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Lua.lua @@ -0,0 +1,3 @@ +local lspconfig = require("lspconfig") + +lspconfig.lua_ls.setup({}) diff --git a/home/file/nvim/module/plugin/lsp/Lua.nix b/home/file/nvim/module/plugin/lsp/Lua.nix deleted file mode 100644 index 325d1a68..00000000 --- a/home/file/nvim/module/plugin/lsp/Lua.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.lua_ls.setup {} - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Nix.lua b/home/file/nvim/module/plugin/lsp/Nix.lua new file mode 100644 index 00000000..506e6755 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Nix.lua @@ -0,0 +1,13 @@ +local lspconfig = require("lspconfig") + +lspconfig.nixd.setup({ + settings = { + nixd = { + diagnostic = { + suppress = { + "sema-escaping-with", + }, + }, + }, + }, +}) diff --git a/home/file/nvim/module/plugin/lsp/Nix.nix b/home/file/nvim/module/plugin/lsp/Nix.nix deleted file mode 100644 index 9a12516b..00000000 --- a/home/file/nvim/module/plugin/lsp/Nix.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.nixd.setup({ - settings = { - nixd = { - diagnostic = { - suppress = { - "sema-escaping-with" - }, - }, - }, - }, - }) - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Python.lua b/home/file/nvim/module/plugin/lsp/Python.lua new file mode 100644 index 00000000..69360ab2 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Python.lua @@ -0,0 +1,3 @@ +local lspconfig = require("lspconfig") + +lspconfig.pyright.setup({}) diff --git a/home/file/nvim/module/plugin/lsp/Python.nix b/home/file/nvim/module/plugin/lsp/Python.nix deleted file mode 100644 index 650f4447..00000000 --- a/home/file/nvim/module/plugin/lsp/Python.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.pyright.setup {} - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Rust.lua b/home/file/nvim/module/plugin/lsp/Rust.lua new file mode 100644 index 00000000..d0b24329 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Rust.lua @@ -0,0 +1,16 @@ +local lspconfig = require("lspconfig") + +lspconfig.rust_analyzer.setup({ + settings = { + ["rust-analyzer"] = { + rustfmt = { + extraArgs = { + "--config", + "hard_tabs=true", + }, + }, + }, + }, +}) + +vim.g.rust_recommended_style = false diff --git a/home/file/nvim/module/plugin/lsp/Rust.nix b/home/file/nvim/module/plugin/lsp/Rust.nix deleted file mode 100644 index 141cac17..00000000 --- a/home/file/nvim/module/plugin/lsp/Rust.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require("lspconfig") - - lspconfig.rust_analyzer.setup { - settings = { - ["rust-analyzer"] = { - rustfmt = { - extraArgs = { - "--config", - "hard_tabs=true", - } - } - }, - }, - } - - vim.g.rust_recommended_style = false - ''; -} diff --git a/home/file/nvim/module/plugin/lsp/Tex.lua b/home/file/nvim/module/plugin/lsp/Tex.lua new file mode 100644 index 00000000..69eb5085 --- /dev/null +++ b/home/file/nvim/module/plugin/lsp/Tex.lua @@ -0,0 +1,60 @@ +local lspconfig = require("lspconfig") +local config = { + filetypes = { + "bib", + "gitcommit", + "markdown", + "org", + "pandoc", + "plaintex", + "rnoweb", + "rst", + "tex", + "text", + }, + settings = { + ["ltex"] = { + language = "auto", + }, + }, +} + +lspconfig.ltex.setup(config) + +-- Use TeX LSP for spellcheck. +vim.api.nvim_create_user_command("SCOn", function(args) + lspconfig.ltex.setup(config) +end, { desc = "Enable spellcheck." }) + +vim.api.nvim_create_user_command("SCOff", function(args) + lspconfig.ltex.setup({ filetypes = {} }) +end, { desc = "Disable spellcheck." }) + +vim.api.nvim_create_user_command("SCLangRU", function(args) + config.settings["ltex"].language = "ru-RU" + lspconfig.ltex.setup(config) +end, { desc = "Set spellcheck to Russian." }) + +vim.api.nvim_create_user_command("SCLangEN", function(args) + config.settings["ltex"].language = "en-US" + lspconfig.ltex.setup(config) +end, { desc = "Set spellcheck to English." }) + +vim.api.nvim_create_user_command("SCLangAuto", function(args) + config.settings["ltex"].language = "auto" + lspconfig.ltex.setup(config) +end, { desc = "Set spellcheck to Auto." }) + +vim.api.nvim_create_user_command("SCForce", function(args) + vim.cmd("setfiletype text") + vim.cmd("SCOn") +end, { desc = "Set buffer type to text." }) + +vim.api.nvim_create_user_command("SCReset", function(args) + vim.cmd("filetype detect") + vim.cmd("SCLangAuto") +end, { desc = "Set buffer type to auto." }) + +vim.api.nvim_create_user_command("SCInfo", function(args) + vim.cmd("LspInfo") +end, { desc = "Show info about spellcheck." }) diff --git a/home/file/nvim/module/plugin/lsp/Tex.nix b/home/file/nvim/module/plugin/lsp/Tex.nix deleted file mode 100644 index 8cef79d5..00000000 --- a/home/file/nvim/module/plugin/lsp/Tex.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ ... }: -{ - text = '' - local lspconfig = require('lspconfig') - local config = { - filetypes = { - "bib", - "gitcommit", - "markdown", - "org", - "pandoc", - "plaintex", - "rnoweb", - "rst", - "tex", - "text", - }, - settings = { - ["ltex"] = { - language = "auto" - } - } - } - - lspconfig.ltex.setup(config) - - -- Use TeX LSP for spellcheck. - vim.api.nvim_create_user_command("SCOn", function (args) - lspconfig.ltex.setup(config) - end, { desc = "Enable spellcheck." }) - - vim.api.nvim_create_user_command("SCOff", function (args) - lspconfig.ltex.setup { filetypes = {} } - end, { desc = "Disable spellcheck." }) - - vim.api.nvim_create_user_command("SCLangRU", function (args) - config.settings['ltex'].language = "ru-RU" - lspconfig.ltex.setup(config) - end, { desc = "Set spellcheck to Russian." }) - - vim.api.nvim_create_user_command("SCLangEN", function (args) - config.settings['ltex'].language = "en-US" - lspconfig.ltex.setup(config) - end, { desc = "Set spellcheck to English." }) - - vim.api.nvim_create_user_command("SCLangAuto", function (args) - config.settings['ltex'].language = "auto" - lspconfig.ltex.setup(config) - end, { desc = "Set spellcheck to Auto." }) - - vim.api.nvim_create_user_command("SCForce", function (args) - vim.cmd("setfiletype text") - vim.cmd("SCOn") - end, { desc = "Set buffer type to text." }) - - vim.api.nvim_create_user_command("SCReset", function (args) - vim.cmd("filetype detect") - vim.cmd("SCLangAuto") - end, { desc = "Set buffer type to auto." }) - - vim.api.nvim_create_user_command("SCInfo", function (args) - vim.cmd("LspInfo") - end, { desc = "Show info about spellcheck." }) - ''; -} diff --git a/home/file/sway/default.nix b/home/file/sway/default.nix index ed816e2e..52a00f4f 100644 --- a/home/file/sway/default.nix +++ b/home/file/sway/default.nix @@ -190,25 +190,27 @@ let ] ); - swayRc = (pkgs.replaceVars swayRcRaw { - inherit - FullscreenRecording - FullscreenScreenshot - SelectRecording - SelectScreenshot - accent - border - borderSize - fg - fontName - keyboardLayouts - keyboardOptions - wallpaper - windowGap - ; - }).overrideAttrs (old: { - doCheck = false; - }); + swayRc = + (pkgs.replaceVars swayRcRaw { + inherit + FullscreenRecording + FullscreenScreenshot + SelectRecording + SelectScreenshot + accent + border + borderSize + fg + fontName + keyboardLayouts + keyboardOptions + wallpaper + windowGap + ; + }).overrideAttrs + (old: { + doCheck = false; + }); in { text =