From b766ab8dbae39fb8c02580a19344f1baafb7dfba Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 30 Nov 2023 15:38:08 +0100 Subject: [PATCH] fix(neovim): make formatting sane again --- modules/tui/neovim/default.nix | 390 ++++++++++++++++----------------- 1 file changed, 195 insertions(+), 195 deletions(-) diff --git a/modules/tui/neovim/default.nix b/modules/tui/neovim/default.nix index abd0eae..6b9b959 100644 --- a/modules/tui/neovim/default.nix +++ b/modules/tui/neovim/default.nix @@ -1,204 +1,204 @@ { - config, - config', - inputs, - lib, - pkgs, - ... + config, + config', + inputs, + lib, + pkgs, + ... }: with lib; let - cfg = config.myOptions.programs.neovim; + cfg = config.myOptions.programs.neovim; in { - options.myOptions.programs.neovim.enable = mkEnableOption "enable neovim"; + options.myOptions.programs.neovim.enable = mkEnableOption "enable neovim"; - config = mkIf cfg.enable { - home-manager.users.${config'.username} = { - imports = [inputs.nixvim.homeManagerModules.nixvim]; + config = mkIf cfg.enable { + home-manager.users.${config'.username} = { + imports = [inputs.nixvim.homeManagerModules.nixvim]; - programs.nixvim = { - enable = true; - defaultEditor = true; - package = pkgs.neovim-nightly; - enableMan = true; - colorscheme = "catppuccin"; - colorschemes.catppuccin = { - enable = true; - flavour = "mocha"; - transparentBackground = true; + programs.nixvim = { + enable = true; + defaultEditor = true; + package = pkgs.neovim-nightly; + enableMan = true; + colorscheme = "catppuccin"; + colorschemes.catppuccin = { + enable = true; + flavour = "mocha"; + transparentBackground = true; + }; + + options = { + number = true; + relativenumber = true; + autoread = true; + so = 7; + cmdheight = 1; + ignorecase = true; + smartcase = true; + showmatch = true; + timeoutlen = 500; + encoding = "utf8"; + smarttab = true; + shiftwidth = 4; + tabstop = 4; + expandtab = true; + linebreak = true; + smartindent = true; + updatetime = 300; + hidden = true; + background = "dark"; + mousemoveevent = true; + smoothscroll = true; + }; + + globals = { + mapleader = " "; + }; + + keymaps = [ + { + action = "vim.cmd.CHADopen"; + lua = true; + key = "v"; + } + ]; + + plugins = { + airline = { + enable = true; + powerline = true; + theme = "catppuccin"; + }; + fugitive.enable = true; + treesitter = { + enable = true; + ensureInstalled = [ + "lua" + "rust" + "markdown" + "markdown-inline" + "python" + "cmake" + "cpp" + "c" + ]; + folding = false; + indent = true; + nixvimInjections = true; + incrementalSelection.enable = true; + }; + coq-nvim = { + enable = true; + autoStart = "shut-up"; + installArtifacts = true; + recommendedKeymaps = true; + }; + chadtree = { + enable = true; + keymap.openFileFolder.tertiary = ["t" ""]; + }; + toggleterm = { + enable = true; + direction = "float"; + openMapping = ""; + shadeTerminals = true; + shadingFactor = 2; + size = 10; + }; + # TODO laytan/cloak.nvim + gitsigns = { + enable = true; + currentLineBlame = true; + numhl = true; + signcolumn = true; + wordDiff = true; + }; + lsp = { + enable = true; + servers = { + rust-analyzer = { + enable = true; + installCargo = false; + installRustc = false; + }; + lua-ls.enable = true; + clangd.enable = true; + nil_ls.enable = true; + bashls.enable = true; + }; + #onAttach = '' + # vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + # local bufopts = { noremap = true, silent = true, buffer = bufnr } + # vim.keymap.set('n', 'wl', function() + # print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + # end, bufopts) + # vim.keymap.set('n', '', function() vim.lsp.buf.format { async = true } end, bufopts) + #''; + keymaps = { + lspBuf = { + gD = "declaration"; + gd = "definition"; + K = "hover"; + gi = "implementation"; + "" = "signature_help"; + "wa" = "add_workspace_folder"; + "wr" = "remove_workspace_folder"; + "wl" = "list_workspace_folders"; + "D" = "type_definition"; + "r" = "rename"; + "a" = "code_action"; + gr = "references"; + "" = "format"; + }; + diagnostic = { + "e" = "open_float"; + "j" = "goto_prev"; + "k" = "goto_next"; + "q" = "setloclist"; + }; + # TODO maybe change + silent = false; + }; + }; + rust-tools = { + enable = true; + crateGraph = { + enabledGraphvizBackends = ["png" "svg"]; + backend = "x11"; + }; + inlayHints = { + auto = true; + onlyCurrentLine = true; + showParameterHints = true; + }; + }; + leap.enable = true; + fidget.enable = true; + telescope = { + enable = true; + keymaps = { + "ff" = "find_files"; + "fg" = "live_grep"; + "fb" = "buffers"; + "fh" = "help_tags"; + }; + # TODO maybe change + keymapsSilent = false; + }; + comment-nvim.enable = true; + crates-nvim.enable = true; + harpoon = { + enable = true; + enableTelescope = true; + keymapsSilent = false; + }; + }; + + extraPlugins = with pkgs.vimPlugins; [ + zen-mode-nvim + ]; + }; }; - - options = { - number = true; - relativenumber = true; - autoread = true; - so = 7; - cmdheight = 1; - ignorecase = true; - smartcase = true; - showmatch = true; - timeoutlen = 500; - encoding = "utf8"; - smarttab = true; - shiftwidth = 4; - tabstop = 4; - expandtab = true; - linebreak = true; - smartindent = true; - updatetime = 300; - hidden = true; - background = "dark"; - mousemoveevent = true; - smoothscroll = true; - }; - - globals = { - mapleader = " "; - }; - - keymaps = [ - { - action = "vim.cmd.CHADopen"; - lua = true; - key = "v"; - } - ]; - - plugins = { - airline = { - enable = true; - powerline = true; - theme = "catppuccin"; - }; - fugitive.enable = true; - treesitter = { - enable = true; - ensureInstalled = [ - "lua" - "rust" - "markdown" - "markdown-inline" - "python" - "cmake" - "cpp" - "c" - ]; - folding = false; - indent = true; - nixvimInjections = true; - incrementalSelection.enable = true; - }; - coq-nvim = { - enable = true; - autoStart = "shut-up"; - installArtifacts = true; - recommendedKeymaps = true; - }; - chadtree = { - enable = true; - keymap.openFileFolder.tertiary = ["t" ""]; - }; - toggleterm = { - enable = true; - direction = "float"; - openMapping = ""; - shadeTerminals = true; - shadingFactor = 2; - size = 10; - }; - # TODO laytan/cloak.nvim - gitsigns = { - enable = true; - currentLineBlame = true; - numhl = true; - signcolumn = true; - wordDiff = true; - }; - lsp = { - enable = true; - servers = { - rust-analyzer = { - enable = true; - installCargo = false; - installRustc = false; - }; - lua-ls.enable = true; - clangd.enable = true; - nil_ls.enable = true; - bashls.enable = true; - }; - #onAttach = '' - # vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - # local bufopts = { noremap = true, silent = true, buffer = bufnr } - # vim.keymap.set('n', 'wl', function() - # print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - # end, bufopts) - # vim.keymap.set('n', '', function() vim.lsp.buf.format { async = true } end, bufopts) - #''; - keymaps = { - lspBuf = { - gD = "declaration"; - gd = "definition"; - K = "hover"; - gi = "implementation"; - "" = "signature_help"; - "wa" = "add_workspace_folder"; - "wr" = "remove_workspace_folder"; - "wl" = "list_workspace_folders"; - "D" = "type_definition"; - "r" = "rename"; - "a" = "code_action"; - gr = "references"; - "" = "format"; - }; - diagnostic = { - "e" = "open_float"; - "j" = "goto_prev"; - "k" = "goto_next"; - "q" = "setloclist"; - }; - # TODO maybe change - silent = false; - }; - }; - rust-tools = { - enable = true; - crateGraph = { - enabledGraphvizBackends = ["png" "svg"]; - backend = "x11"; - }; - inlayHints = { - auto = true; - onlyCurrentLine = true; - showParameterHints = true; - }; - }; - leap.enable = true; - fidget.enable = true; - telescope = { - enable = true; - keymaps = { - "ff" = "find_files"; - "fg" = "live_grep"; - "fb" = "buffers"; - "fh" = "help_tags"; - }; - # TODO maybe change - keymapsSilent = false; - }; - comment-nvim.enable = true; - crates-nvim.enable = true; - harpoon = { - enable = true; - enableTelescope = true; - keymapsSilent = false; - }; - }; - - extraPlugins = with pkgs.vimPlugins; [ - zen-mode-nvim - ]; - }; }; - }; }