diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix index f34f8278..4ab1e7cd 100644 --- a/home/modules/neovim/default.nix +++ b/home/modules/neovim/default.nix @@ -68,6 +68,7 @@ in { file.".config/vale/.vale.ini".source = ./vale_config.ini; }; + # TODO: Read the LazyVim config for further ideas programs.nixvim = { enable = true; defaultEditor = true; @@ -87,30 +88,51 @@ in { # extraLuaPackages = with pkgs.lua51Packages; []; - extraPython3Packages = p: [ - # For CHADtree - # p.pyyaml - # p.pynvim-pp - # p.std2 - ]; + # extraPython3Packages = p: [ + # # For CHADtree + # p.pyyaml + # p.pynvim-pp + # p.std2 + # ]; + # TODO: Resize splits on window-resize autoCmd = [ { event = ["BufWritePost"]; - # pattern = "*"; - callback = {__raw = "function() require('lint').try_lint() end";}; + callback.__raw = "function() require('lint').try_lint() end"; + } + # Now setup directly in conform + # { + # event = ["BufWritePre"]; + # callback.__raw = "function() require('conform').format() end"; + # } + { + event = ["TextYankPost"]; + callback.__raw = "function() vim.highlight.on_yank() end"; } { - event = ["BufWritePre"]; - callback = {__raw = "function() require('conform').format() end";}; + event = ["VimResized"]; + callback.__raw = '' + function() + local current_tab = vim.fn.tabpagenr() + vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) + end + ''; + } + { + event = "FileType"; + pattern = ["json" "jsonc" "json5"]; # Disable conceal for these filetypes + callback.__raw = "function() vim.opt_local.conceallevel = 0 end"; } ]; - # TODO: Toggle wrapping - # TODO: Toggle format on save - # TODO: Toggle format on paste + # TODO: Incremental selection keymaps = import ./keybinds.nix {inherit lib mylib;}; + # TODO: Incremental LSP rename + # TODO: Dashboard + # TODO: Configure lazy-loading correctly with handlers plugins.lazy = { enable = true; @@ -118,24 +140,30 @@ in { autopairs = { name = "autopairs"; pkg = pkgs.vimPlugins.nvim-autopairs; - lazy = false; + lazy = true; + event = ["InsertEnter"]; config = '' function(_, opts) require("nvim-autopairs").setup(opts) end ''; + opts = { + check_ts = true; + }; }; bbye = { name = "bbye"; pkg = pkgs.vimPlugins.vim-bbye; - lazy = false; + lazy = true; + cmd = ["Bdelete" "Bwipeout"]; }; better-escape = { name = "better-escape"; pkg = pkgs.vimPlugins.better-escape-nvim; - lazy = false; + lazy = true; + event = ["InsertEnter"]; config = '' function(_, opts) require("better_escape").setup(opts) @@ -187,15 +215,21 @@ in { # }; # }; + # TODO: In LazyVim require("clang_extensions").setup(opts) is called where opts is the server definition from lspconfig... clangd-extensions = { name = "clangd-extensions"; pkg = pkgs.vimPlugins.clangd_extensions-nvim; - lazy = false; + lazy = true; config = '' function(_, opts) require("clangd_extensions").setup(opts) end ''; + opts = { + inlay_hints = { + inline = false; + }; + }; }; _cmp-async-path = { @@ -242,10 +276,12 @@ in { lazy = true; }; + # TODO: Check additional completion backends cmp = { name = "cmp"; pkg = pkgs.vimPlugins.nvim-cmp; - lazy = false; + lazy = true; + event = ["InsertEnter"]; dependencies = [ _cmp-async-path _cmp-buffer @@ -289,7 +325,7 @@ in { elseif has_words_before() then cmp.complete() else - fallback() + fallback() -- This will call the intellitab binding end end, { "i", "s" }) ''; @@ -342,7 +378,9 @@ in { colorizer = { name = "colorizer"; pkg = pkgs.vimPlugins.nvim-colorizer-lua; - lazy = false; + enabled = false; + lazy = true; + event = ["BufReadPost" "BufNewFile"]; config = '' function(_, opts) require("colorizer").setup(opts) @@ -373,6 +411,7 @@ in { name = "comment"; pkg = pkgs.vimPlugins.comment-nvim; lazy = false; + # keys = ["" ""]; # TODO: This list only works in normal mode dependencies = [ _ts-context-commentstring ]; @@ -396,7 +435,8 @@ in { conform = { name = "conform"; pkg = pkgs.vimPlugins.conform-nvim; - lazy = false; + lazy = true; + event = ["BufReadPost" "BufNewFile"]; config = '' function(_, opts) require("conform").setup(opts) @@ -418,6 +458,16 @@ in { python = ["black"]; rust = ["rustfmt"]; }; + + format_on_save.__raw = '' + function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat then + return + end + return { timeout_ms = 500, lsp_fallback = true } + end + ''; }; }; @@ -425,7 +475,7 @@ in { flash = { name = "flash"; pkg = pkgs.vimPlugins.flash-nvim; - lazy = true; + lazy = false; config = '' function(_, opts) require("flash").setup(opts) @@ -436,7 +486,8 @@ in { gitmessenger = { name = "gitmessenger"; pkg = pkgs.vimPlugins.git-messenger-vim; - lazy = false; + lazy = true; + cmd = ["GitMessenger"]; config = '' function(_, opts) for k, v in pairs(opts) do @@ -455,7 +506,8 @@ in { gitsigns = { name = "gitsigns"; pkg = pkgs.vimPlugins.gitsigns-nvim; - lazy = false; + lazy = true; + event = ["BufReadPost" "BufNewFile"]; config = '' function(_, opts) require("gitsigns").setup(opts) @@ -469,14 +521,15 @@ in { haskell-tools = { name = "haskell-tools"; pkg = pkgs.vimPlugins.haskell-tools-nvim; - lazy = false; + lazy = false; # Recommended by author # Don't call setup! }; illuminate = { name = "illuminate"; pkg = pkgs.vimPlugins.vim-illuminate; - lazy = false; + lazy = true; + event = ["BufreadPost" "BufNewFile"]; config = '' function(_, opts) require("illuminate").configure(opts) @@ -500,7 +553,8 @@ in { intellitab = { name = "intellitab"; pkg = pkgs.vimPlugins.intellitab-nvim; - lazy = false; + lazy = true; + event = ["InsertEnter"]; }; lastplace = { @@ -517,13 +571,16 @@ in { lazygit = { name = "lazygit"; pkg = pkgs.vimPlugins.lazygit-nvim; - lazy = false; + dependencies = [_plenary]; + lazy = true; + cmd = ["LazyGit" "LazyGitConfig" "LazyGitCurrentFile" "LazyGitFilter" "LazyGitFilterCurrentFile"]; }; lint = { name = "lint"; pkg = pkgs.vimPlugins.nvim-lint; - lazy = false; + lazy = true; + event = ["BufReadPost" "BufNewFile"]; config = '' function(_, opts) local lint = require("lint") @@ -535,10 +592,10 @@ in { ''; opts = { linters_by_ft = { - c = ["clang-tidy"]; - h = ["clang-tidy"]; - cpp = ["clang-tidy"]; - hpp = ["clang-tidy"]; + c = ["clangtidy"]; + h = ["clangtidy"]; + cpp = ["clangtidy"]; + hpp = ["clangtidy"]; clojure = ["clj-kondo"]; java = ["checkstyle"]; javascript = ["eslint_d"]; @@ -546,7 +603,7 @@ in { markdown = ["vale"]; nix = ["statix"]; python = ["flake8"]; - rust = ["clippy"]; + # rust = ["clippy"]; text = ["vale"]; }; }; @@ -561,18 +618,69 @@ in { require("neodev").setup(opts) end ''; + opts = { + library = { + enabled = true; + runtime = true; + types = true; + plugins = true; + }; + + setup_jsonls = false; + lspconfig = true; + pathStrict = true; + }; }; + # TODO: This entire thing is rough, maybe I should look for another way... lspconfig = { name = "lspconfig"; pkg = pkgs.vimPlugins.nvim-lspconfig; - lazy = false; + lazy = true; + cmd = ["LspInfo"]; + event = ["BufReadPost" "BufNewFile"]; dependencies = [ - _neodev + _neodev # Has to be setup before lspconfig ]; config = let servers = mylib.generators.toLuaObject [ - {name = "clangd";} + { + name = "clangd"; + extraOptions = { + root_dir.__raw = '' + function(fname) + return require("lspconfig.util").root_pattern( + "Makefile", + "CMakeLists.txt", + ".clang-format", + ".clang-tidy" + )(fname) or require("lspconfig.util").root_pattern( + "compile_commands.json" + )(fname) or require("lspconfig.util").find_git_ancestor(fname) + end + ''; + + cmd = [ + "clangd" + "--background-index" + "--clang-tidy" + "--header-insertion=iwyu" + "--completion-style=detailed" + "--function-arg-placeholders" + "--fallback-style=llvm" + ]; + + capabilities = { + offsetEncoding = ["utf-16"]; + }; + + init_options = { + usePlaceholders = true; + completeUnimported = true; + clangdFileStatus = true; + }; + }; + } {name = "clojure_lsp";} {name = "cmake";} {name = "lua_ls";} @@ -683,7 +791,8 @@ in { navbuddy = { name = "navbuddy"; pkg = pkgs.vimPlugins.nvim-navbuddy; - lazy = false; + lazy = true; + cmd = ["Navbuddy"]; config = '' function(_, opts) local actions = require("nvim-navbuddy.actions") -- ? @@ -713,6 +822,7 @@ in { }; }; + # TODO: Notification spam on filter (when searching for ignored/non-existing file) neo-tree = { name = "neo-tree"; pkg = pkgs.vimPlugins.neo-tree-nvim; @@ -722,7 +832,7 @@ in { _nui ]; lazy = true; - cmd = "Neotree"; + cmd = ["Neotree"]; config = '' function(_, opts) require("neo-tree").setup(opts) @@ -730,13 +840,42 @@ in { ''; opts = { use_default_mappings = false; - filesystem.follow_current_file = { - enabled = true; - leave_dirs_open = false; + popup_border_style = "rounded"; + enable_git_status = true; + enable_diagnostics = false; + open_files_do_not_replace_types = ["terminal" "trouble" "qf"]; + + filesystem = { + follow_current_file = { + enabled = true; + leave_dirs_open = false; + }; }; - buffers.follow_current_file = { - enabled = true; - leave_dirs_open = false; + + buffers = { + follow_current_file = { + enabled = true; + leave_dirs_open = false; + }; + }; + + window = { + mappings = { + "" = "open"; + "c" = "close_node"; + "R" = "refresh"; + "q" = "close_window"; + "i" = "show_file_details"; + "r" = "rename"; + "d" = "delete"; + "x" = "cut_to_clipboard"; + "y" = "copy_to_clipboard"; + "p" = "paste_from_clipboard"; + "a" = "add"; + "" = "cancel"; + "/" = "fuzzy_finder"; + "?" = "show_help"; + }; }; }; }; @@ -838,7 +977,7 @@ in { rustaceanvim = { name = "rustaceanvim"; pkg = pkgs.vimPlugins.rustaceanvim; - lazy = false; + lazy = false; # Recommended by author # Don't call setup! }; @@ -848,6 +987,7 @@ in { lazy = false; }; + # TODO: Indent doesn't follow prev line correctly, don't know if sleuth issue sleuth = { name = "sleuth"; pkg = pkgs.vimPlugins.vim-sleuth; @@ -878,11 +1018,12 @@ in { lazy = true; }; + # TODO: Check additional telescope backends telescope = { name = "telescope"; pkg = pkgs.vimPlugins.telescope-nvim; lazy = true; - cmd = "Telescope"; + cmd = ["Telescope"]; dependencies = [ _plenary _telescope-fzf-native @@ -894,6 +1035,7 @@ in { "undo" "ui-select" "fzf" + # "lazygit" ]; in '' function(_, opts) @@ -916,10 +1058,12 @@ in { }; }; + # TODO: Also recognize @todo etc. variants todo-comments = { name = "todo-comments"; pkg = pkgs.vimPlugins.todo-comments-nvim; - lazy = false; + lazy = true; + event = ["BufReadPost" "BufNewFile"]; dependencies = [ _plenary ]; @@ -933,7 +1077,8 @@ in { toggleterm = { name = "toggleterm"; pkg = pkgs.vimPlugins.toggleterm-nvim; - lazy = false; + lazy = true; + cmd = ["ToggleTerm"]; config = '' function(_, opts) require("toggleterm").setup(opts) @@ -969,7 +1114,9 @@ in { in { name = "treesitter"; pkg = pkgs.vimPlugins.nvim-treesitter; - lazy = false; + lazy = true; + cmd = ["TSModuleInfo"]; + event = ["BufReadPost" "BufNewFile"]; config = '' function(_, opts) -- Fix treesitter grammars/parsers on nix @@ -1018,10 +1165,12 @@ in { ''; }; + # TODO: Show in left pane (either neo-tree or trouble) trouble = { name = "trouble"; pkg = pkgs.vimPlugins.trouble-nvim; - lazy = false; + lazy = true; + cmd = ["Trouble" "TroubleToggle"]; config = '' function(_, opts) require("trouble").setup(opts) @@ -1147,6 +1296,12 @@ in { # enable = true; # }; + # TODO: + # Dashboard + # dashboard = { + # enable = true; + # }; + # TODO: Figure out how diff-mode works... # diffview = { # enable = true; @@ -1162,19 +1317,19 @@ in { # enable = true; # }; - # TODO + # TODO: # Show marks in the gutter # marks = { # enable = true; # }; - # TODO + # TODO: # Generate doc comments # neogen = { # enable = true; # }; - # TODO + # TODO: # Interact with test frameworks # neotest = { # enable = true; @@ -1186,7 +1341,7 @@ in { # enable = true; # }; - # TODO: Setup + # TODO: # LaTeX # vimtex = { # enable = true; diff --git a/home/modules/neovim/extraConfigLua.lua b/home/modules/neovim/extraConfigLua.lua index a61cc098..683d3710 100644 --- a/home/modules/neovim/extraConfigLua.lua +++ b/home/modules/neovim/extraConfigLua.lua @@ -1,13 +1,36 @@ --- Hide inline diagnostics and show border +-- Toggle inline diagnostics and show border +vim.g.enable_inline_diagnostics = false vim.diagnostic.config({ - virtual_text = false, + virtual_text = vim.g.enable_inline_diagnostics, float = { border = "rounded" }, }) +vim.api.nvim_create_user_command("ToggleInlineDiagnostics", function() + vim.g.enable_inline_diagnostics = not vim.g.enable_inline_diagnostics + vim.diagnostic.config({ virtual_text = vim.g.enable_inline_diagnostics }) + require("notify")((vim.g.enable_inline_diagnostics and "Enabled" or "Disabled") .. " inline diagnostics") +end, { + desc = "Toggle inline diagnostics", +}) + +-- Toggle conform format_on_save +vim.g.disable_autoformat = false +vim.api.nvim_create_user_command("ToggleAutoformat", function() + vim.g.disable_autoformat = not vim.g.disable_autoformat + require("notify")((vim.g.disable_autoformat and "Disabled" or "Enabled") .. " autoformat-on-save") +end, { + desc = "Toggle autoformat-on-save", +}) -- Allow navigating popupmenu completion with Up/Down vim.api.nvim_set_keymap("c", "", 'v:lua.get_wildmenu_key("", "")', { expr = true }) vim.api.nvim_set_keymap("c", "", 'v:lua.get_wildmenu_key("", "")', { expr = true }) - function _G.get_wildmenu_key(key_wildmenu, key_regular) return vim.fn.wildmenumode() ~= 0 and key_wildmenu or key_regular end + +-- Check LSP server config +vim.api.nvim_create_user_command("LspInspect", function() + require("notify")(vim.inspect(vim.lsp.get_active_clients())) +end, { + desc = "Print LSP server configuration", +}) diff --git a/home/modules/neovim/keybinds.nix b/home/modules/neovim/keybinds.nix index a1c55291..a5d992d7 100644 --- a/home/modules/neovim/keybinds.nix +++ b/home/modules/neovim/keybinds.nix @@ -1,45 +1,147 @@ -{ - lib, - mylib, - ... -}: let +{...}: let no-leader = [ + { + mode = "n"; + key = "j"; + action = "v:count == 0 ? 'gj' : 'j'"; + options.desc = "Move cursor down"; + options.expr = true; + } + { + mode = "n"; + key = ""; + action = "v:count == 0 ? 'gj' : 'j'"; + options.desc = "Move cursor down"; + options.expr = true; + } + { + mode = "n"; + key = "k"; + action = "v:count == 0 ? 'gk' : 'k'"; + options.desc = "Move cursor up"; + options.expr = true; + } + { + mode = "n"; + key = ""; + action = "v:count == 0 ? 'gk' : 'k'"; + options.desc = "Move cursor up"; + options.expr = true; + } + + { + mode = "n"; + key = ""; + action = "vertical resize -2"; + options.desc = "Decrease window width"; + } + { + mode = "n"; + key = ""; + action = "vertical resize +2"; + options.desc = "Increase window width"; + } + { + mode = "n"; + key = ""; + action = "resize -2"; + options.desc = "Decrease window height"; + } + { + mode = "n"; + key = ""; + action = "resize +2"; + options.desc = "Increase window height"; + } + + { + mode = "n"; + key = ""; + action = "m .+1=="; + options.desc = "Move line down"; + } + { + mode = "i"; + key = ""; + action = "m .+1==gi"; + options.desc = "Move line down"; + } + { + mode = "v"; + key = ""; + action = ":m '>+1gv=gv"; + options.desc = "Move line down"; + } + { + mode = "n"; + key = ""; + action = "m .-2=="; + options.desc = "Move line up"; + } + { + mode = "i"; + key = ""; + action = "m .-2==gi"; + options.desc = "Move line up"; + } + { + mode = "v"; + key = ""; + action = ":m '<-2gv=gv"; + options.desc = "Move line up"; + } + { mode = "n"; key = ""; - action = "w"; + action = "w"; options.desc = "Save current buffer"; } { mode = "n"; key = ""; - action = "wa"; + action = "wa"; options.desc = "Save all buffers"; } + + { + mode = "v"; + key = ";"; + action = ""; + options.desc = "Exit visual mode"; + } + { mode = "v"; key = "<"; action = " multiline cursor? } + { mode = "i"; key = ""; @@ -100,115 +198,133 @@ action = "\"+y"; options.desc = "Copy to clipboard"; } + { mode = "n"; key = ""; - action = "nohlsearch"; + action = "nohlsearch"; options.desc = "Clear search highlights"; } + { mode = "n"; key = "K"; - action = "lua vim.lsp.buf.hover()"; + action = "lua vim.lsp.buf.hover()"; options.desc = "Show LSP hover"; } + + { + mode = "n"; + key = "/"; + action = "Telescope current_buffer_fuzzy_find"; + options.desc = "Find in current buffer"; + } ]; leader = [ { mode = "n"; key = "L"; - action = "Lazy"; + action = "Lazy"; options.desc = "Show Lazy"; } + { mode = "n"; - key = ""; - action = "Telescope buffers"; - options.desc = "Show open buffers"; + key = "s"; + action = "w"; + options.desc = "Save current buffer"; } { mode = "n"; key = "S"; - action = "wa"; + action = "wa"; options.desc = "Save all buffers"; } + + { + mode = "n"; + key = "R"; + action = "edit!"; + options.desc = "Reload current buffer"; + } + + { + mode = "n"; + key = ""; + action = "Telescope buffers"; + options.desc = "Show open buffers"; + } { mode = "n"; key = "f"; - action = "Telescope find_files"; + action = "Telescope find_files"; options.desc = "Find file"; } { mode = "n"; key = "o"; - action = "Telescope vim_options"; + action = "Telescope vim_options"; options.desc = "Show Vim options"; } { mode = "n"; key = "u"; - action = "Telescope undo"; + action = "Telescope undo"; options.desc = "Show undo history"; } { mode = "n"; key = "/"; - action = "Telescope current_buffer_fuzzy_find"; - options.desc = "Find in current buffer"; - } - { - mode = "n"; - key = "n"; - action = "Telescope notify"; - options.desc = "Show notify history"; - } - { - mode = "n"; - key = "s"; - action = "Telescope live_grep"; + action = "Telescope live_grep"; options.desc = "Find in working directory"; } + { + mode = "n"; + key = "n"; + action = "Telescope notify"; + options.desc = "Show notify history"; + } { mode = "n"; key = "r"; - action = "Telescope resume"; + action = "Telescope resume"; options.desc = "Show last telescope picker"; } { mode = "n"; key = "?"; - action = "Telescope keymaps"; + action = "Telescope keymaps"; options.desc = "Show keymaps"; } { mode = "n"; key = ":"; - action = "Telescope commands"; + action = "Telescope commands"; options.desc = "Execute command"; } { mode = "n"; key = "M"; - action = "Telescope marks"; + action = "Telescope marks"; options.desc = "Show marks"; } { mode = "n"; key = "J"; - action = "Telescope jumplist"; + action = "Telescope jumplist"; options.desc = "Show jumplist"; } { mode = "n"; key = "m"; - action = "Telescope man_pages"; + action = "Telescope man_pages"; options.desc = "Show manpages"; } { mode = "n"; key = "h"; - action = "Telescope help_tags"; + action = "Telescope help_tags"; options.desc = "Show help tags"; } ]; @@ -222,13 +338,13 @@ { mode = "n"; key = "qq"; - action = "quitall"; + action = "quitall"; options.desc = "Quit"; } { mode = "n"; key = "q!"; - action = "quitall!"; + action = "quitall!"; options.desc = "Quit forcefully"; } ]; @@ -242,25 +358,25 @@ { mode = "n"; key = "bb"; - action = "Telescope buffers"; + action = "Telescope buffers"; options.desc = "Show open buffers"; } { mode = "n"; key = "bn"; - action = "bnext"; + action = "bnext"; options.desc = "Goto next buffer"; } { mode = "n"; key = "bp"; - action = "bprevious"; + action = "bprevious"; options.desc = "Goto previous buffer"; } { mode = "n"; key = "bd"; - action = "Bdelete"; + action = "Bdelete"; options.desc = "Close current buffer"; } ]; @@ -271,6 +387,14 @@ key = "w"; action = "+windows"; } + + { + mode = "n"; + key = "wd"; + action = "c"; + options.desc = "Close current window"; + } + { mode = "n"; key = "ws"; @@ -289,12 +413,7 @@ action = "="; options.desc = "Balance windows"; } - { - mode = "n"; - key = "wd"; - action = "c"; - options.desc = "Close current window"; - } + { mode = "n"; key = "wh"; @@ -336,27 +455,48 @@ { mode = "n"; key = "tt"; - action = "Neotree action=show toggle=true"; + action = "Neotree action=show toggle=true="; options.desc = "Toggle NeoTree"; } # { # mode = "n"; # key = "tt"; - # action = "CHADopen --nofocus"; + # action = "CHADopen --nofocus"; # options.desc = "Toggle CHADtree"; # } { mode = "n"; key = "tn"; - action = "Navbuddy"; + action = "Navbuddy"; options.desc = "Toggle NavBuddy"; } { mode = "n"; key = "td"; - action = "TroubleToggle focus=false"; + action = "TroubleToggle focus=false"; options.desc = "Toggle Trouble"; } + + { + mode = "n"; + key = "tf"; + action = "ToggleAutoformat"; + options.desc = "Toggle autoformat-on-save"; + } + + { + mode = "n"; + key = "tD"; + action = "ToggleInlineDiagnostics"; + options.desc = "Toggle inline diagnostics"; + } + + { + mode = "n"; + key = "tw"; + action = ":set wrap!"; + options.desc = "Toggle word-wrap"; + } ]; leader-git = [ @@ -368,37 +508,38 @@ { mode = "n"; key = "gg"; - action = "LazyGit"; + action = "LazyGit"; options.desc = "Show LazyGit"; } { mode = "n"; key = "gm"; - action = "GitMessenger"; + action = "GitMessenger"; options.desc = "Show GitMessenger"; } + { mode = "n"; key = "gs"; - action = "Telescope git_status"; + action = "Telescope git_status"; options.desc = "Show Git status"; } { mode = "n"; key = "gc"; - action = "Telescope git_commits"; + action = "Telescope git_commits"; options.desc = "Show Git log"; } { mode = "n"; key = "gb"; - action = "Telescope git_branches"; + action = "Telescope git_branches"; options.desc = "Show Git branches"; } { mode = "n"; key = "gf"; - action = "Telescope git_bcommits"; + action = "Telescope git_bcommits"; options.desc = "Show Git log for current file"; } ]; @@ -412,37 +553,37 @@ { mode = "n"; key = "lr"; - action = "Telescope lsp_references"; + action = "Telescope lsp_references"; options.desc = "Goto references"; } { mode = "n"; key = "ld"; - action = "Telescope lsp_definitions"; + action = "Telescope lsp_definitions"; options.desc = "Goto definition"; } { mode = "n"; key = "li"; - action = "Telescope lsp_implementations"; + action = "Telescope lsp_implementations"; options.desc = "Goto implementation"; } { mode = "n"; key = "lt"; - action = "Telescope lsp_type_definitions"; + action = "Telescope lsp_type_definitions"; options.desc = "Goto type definition"; } { mode = "n"; key = "lI"; - action = "Telescope lsp_incoming_calls"; + action = "Telescope lsp_incoming_calls"; options.desc = "Show incoming calls"; } { mode = "n"; key = "lO"; - action = "Telescope lsp_outgoing_calls"; + action = "Telescope lsp_outgoing_calls"; options.desc = "Show outgoing calls"; } ]; @@ -456,32 +597,40 @@ { mode = "n"; key = "cf"; - action = "lua require('conform').format()"; + action = "lua require('conform').format()"; options.desc = "Format current buffer"; } + { mode = "n"; key = "cd"; - action = "Telescope diagnostics"; - options.desc = "Show diagnostics"; + action = "lua vim.diagnostic.open_float()"; + options.desc = "Show LSP line diagnostics"; } + { + mode = "n"; + key = "cD"; + action = "Telescope diagnostics"; + options.desc = "Show diagnostics"; + } + { mode = "n"; key = "cr"; - action = "lua vim.lsp.buf.rename()"; + action = "lua vim.lsp.buf.rename()"; options.desc = "Rename LSP symbol"; } { mode = "n"; key = "ca"; - action = "lua vim.lsp.buf.code_action()"; + action = "lua vim.lsp.buf.code_action()"; options.desc = "Show LSP code actions"; } { mode = "n"; - key = "cD"; - action = "lua vim.diagnostic.open_float()"; - options.desc = "Show LSP line diagnostics"; + key = "ch"; + action = "ClangdSwitchSourceHeader"; + options.desc = "Switch C/C++ source/header"; } ]; in diff --git a/home/modules/neovim/neovide_config.ini b/home/modules/neovim/neovide_config.ini index 94064527..c688c93a 100644 --- a/home/modules/neovim/neovide_config.ini +++ b/home/modules/neovim/neovide_config.ini @@ -2,5 +2,6 @@ fork = true # Start neovide detached frame = "none" # full, buttonless, none idle = true # Don't render frames without changes title-hidden = true +tabs = false # maximized = true # vsync = true diff --git a/home/modules/neovim/vim_opts.nix b/home/modules/neovim/vim_opts.nix index 78456cac..9aa7bacf 100644 --- a/home/modules/neovim/vim_opts.nix +++ b/home/modules/neovim/vim_opts.nix @@ -6,20 +6,22 @@ showmode = false; # Status line already shows this backspace = ["indent" "eol" "start"]; termguicolors = true; # Required by multiple plugins - hidden = true; # Don't unload buffers immediately + hidden = true; # Don't unload buffers immediately (required for terminal persistence) mouse = "a"; completeopt = ["menuone" "noselect" "noinsert"]; - timeoutlen = 50; + timeoutlen = 50; # Controls which-key delay pumheight = 0; formatexpr = "v:lua.require('conform').formatexpr()"; - laststatus = 3; - # winblend = 30; + laststatus = 3; # Global statusline + winblend = 30; # Floating popup transparency + sessionoptions = ["buffers" "curdir" "tabpages" "winsize" "help" "globals" "skiprtp" "folds"]; + showtabline = 0; # Disable tabline # Cursor ruler = true; # Show cursor position in status line number = true; relativenumber = true; - signcolumn = "yes"; + signcolumn = "yes"; # Always show to reduce window jumping cursorline = true; scrolloff = 10; @@ -38,7 +40,9 @@ # backup = false; undofile = true; undodir = "/home/christoph/.vim/undo"; + undolevels = 10000; # autochdir = true; + confirm = true; # Search incsearch = true; # Already highlight results while typing