1

Neovim: Update neovim module

This commit is contained in:
2024-06-04 01:51:53 +02:00
parent 15a0e1447e
commit bda07de277
5 changed files with 480 additions and 148 deletions

View File

@ -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
# 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 <Tab> 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 = ["<C-c>" "<C-b>"]; # 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,15 +840,44 @@ in {
'';
opts = {
use_default_mappings = false;
filesystem.follow_current_file = {
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 = {
};
buffers = {
follow_current_file = {
enabled = true;
leave_dirs_open = false;
};
};
window = {
mappings = {
"<CR>" = "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";
"<Esc>" = "cancel";
"/" = "fuzzy_finder";
"?" = "show_help";
};
};
};
};
_notify = {
@ -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;

View File

@ -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", "<Down>", 'v:lua.get_wildmenu_key("<right>", "<down>")', { expr = true })
vim.api.nvim_set_keymap("c", "<Up>", 'v:lua.get_wildmenu_key("<left>", "<up>")', { 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",
})

View File

@ -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 = "<Down>";
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 = "<Up>";
action = "v:count == 0 ? 'gk' : 'k'";
options.desc = "Move cursor up";
options.expr = true;
}
{
mode = "n";
key = "<C-h>";
action = "<cmd>vertical resize -2<cr>";
options.desc = "Decrease window width";
}
{
mode = "n";
key = "<C-l>";
action = "<cmd>vertical resize +2<cr>";
options.desc = "Increase window width";
}
{
mode = "n";
key = "<C-j>";
action = "<cmd>resize -2<cr>";
options.desc = "Decrease window height";
}
{
mode = "n";
key = "<C-k>";
action = "<cmd>resize +2<cr>";
options.desc = "Increase window height";
}
{
mode = "n";
key = "<M-j>";
action = "<cmd>m .+1<cr>==";
options.desc = "Move line down";
}
{
mode = "i";
key = "<M-j>";
action = "<Esc><cmd>m .+1<cr>==gi";
options.desc = "Move line down";
}
{
mode = "v";
key = "<M-j>";
action = ":m '>+1<cr>gv=gv";
options.desc = "Move line down";
}
{
mode = "n";
key = "<M-k>";
action = "<cmd>m .-2<cr>==";
options.desc = "Move line up";
}
{
mode = "i";
key = "<M-k>";
action = "<Esc><cmd>m .-2<cr>==gi";
options.desc = "Move line up";
}
{
mode = "v";
key = "<M-k>";
action = ":m '<-2<cr>gv=gv";
options.desc = "Move line up";
}
{
mode = "n";
key = "<C-s>";
action = "<cmd>w<CR>";
action = "<cmd>w<cr>";
options.desc = "Save current buffer";
}
{
mode = "n";
key = "<C-S-s>";
action = "<cmd>wa<CR>";
action = "<cmd>wa<cr>";
options.desc = "Save all buffers";
}
{
mode = "v";
key = ";";
action = "<Esc>";
options.desc = "Exit visual mode";
}
{
mode = "v";
key = "<";
action = "<gv";
options.desc = "Outdent";
}
{
mode = "n";
key = "<";
action = "v<<Esc>";
options.desc = "Outdent";
}
{
mode = "v";
key = ">";
action = ">gv";
options.desc = "Indent";
}
{
mode = "n";
key = "<";
action = "v<<Esc>";
options.desc = "Outdent";
}
{
mode = "n";
key = ">";
action = "v><Esc>";
options.desc = "Indent";
}
{
mode = "i";
key = "<Tab>";
action = "<cmd>lua require('intellitab').indent()<cr>";
options.desc = "Indent (IntelliTab)";
}
{
mode = "n";
key = "<C-d>";
@ -64,12 +166,7 @@
action = "Nzzzv";
options.desc = "Previous match (centered)";
}
{
mode = "i";
key = "<Tab>";
action = "<cmd>lua require('intellitab').indent()<CR>";
options.desc = "Indent (IntelliTab)";
}
{
mode = "i";
key = "<C-BS>";
@ -82,6 +179,7 @@
action = "<C-w>";
options.desc = "Delete previous word"; # TODO: Breaks backspace <C-v><S-i> multiline cursor?
}
{
mode = "i";
key = "<C-S-v>";
@ -100,115 +198,133 @@
action = "\"+y";
options.desc = "Copy to clipboard";
}
{
mode = "n";
key = "<C-h>";
action = "<cmd>nohlsearch<CR>";
action = "<cmd>nohlsearch<cr>";
options.desc = "Clear search highlights";
}
{
mode = "n";
key = "K";
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
action = "<cmd>lua vim.lsp.buf.hover()<cr>";
options.desc = "Show LSP hover";
}
{
mode = "n";
key = "/";
action = "<cmd>Telescope current_buffer_fuzzy_find<cr>";
options.desc = "Find in current buffer";
}
];
leader = [
{
mode = "n";
key = "<leader>L";
action = "<cmd>Lazy<CR>";
action = "<cmd>Lazy<cr>";
options.desc = "Show Lazy";
}
{
mode = "n";
key = "<leader><Space>";
action = "<cmd>Telescope buffers<CR>";
options.desc = "Show open buffers";
key = "<leader>s";
action = "<cmd>w<cr>";
options.desc = "Save current buffer";
}
{
mode = "n";
key = "<leader>S";
action = "<cmd>wa<CR>";
action = "<cmd>wa<cr>";
options.desc = "Save all buffers";
}
{
mode = "n";
key = "<leader>R";
action = "<cmd>edit!<cr>";
options.desc = "Reload current buffer";
}
{
mode = "n";
key = "<leader><Space>";
action = "<cmd>Telescope buffers<cr>";
options.desc = "Show open buffers";
}
{
mode = "n";
key = "<leader>f";
action = "<cmd>Telescope find_files<CR>";
action = "<cmd>Telescope find_files<cr>";
options.desc = "Find file";
}
{
mode = "n";
key = "<leader>o";
action = "<cmd>Telescope vim_options<CR>";
action = "<cmd>Telescope vim_options<cr>";
options.desc = "Show Vim options";
}
{
mode = "n";
key = "<leader>u";
action = "<cmd>Telescope undo<CR>";
action = "<cmd>Telescope undo<cr>";
options.desc = "Show undo history";
}
{
mode = "n";
key = "<leader>/";
action = "<cmd>Telescope current_buffer_fuzzy_find<CR>";
options.desc = "Find in current buffer";
}
{
mode = "n";
key = "<leader>n";
action = "<cmd>Telescope notify<CR>";
options.desc = "Show notify history";
}
{
mode = "n";
key = "<leader>s";
action = "<cmd>Telescope live_grep<CR>";
action = "<cmd>Telescope live_grep<cr>";
options.desc = "Find in working directory";
}
{
mode = "n";
key = "<leader>n";
action = "<cmd>Telescope notify<cr>";
options.desc = "Show notify history";
}
{
mode = "n";
key = "<leader>r";
action = "<cmd>Telescope resume<CR>";
action = "<cmd>Telescope resume<cr>";
options.desc = "Show last telescope picker";
}
{
mode = "n";
key = "<leader>?";
action = "<cmd>Telescope keymaps<CR>";
action = "<cmd>Telescope keymaps<cr>";
options.desc = "Show keymaps";
}
{
mode = "n";
key = "<leader>:";
action = "<cmd>Telescope commands<CR>";
action = "<cmd>Telescope commands<cr>";
options.desc = "Execute command";
}
{
mode = "n";
key = "<leader>M";
action = "<cmd>Telescope marks<CR>";
action = "<cmd>Telescope marks<cr>";
options.desc = "Show marks";
}
{
mode = "n";
key = "<leader>J";
action = "<cmd>Telescope jumplist<CR>";
action = "<cmd>Telescope jumplist<cr>";
options.desc = "Show jumplist";
}
{
mode = "n";
key = "<leader>m";
action = "<cmd>Telescope man_pages<CR>";
action = "<cmd>Telescope man_pages<cr>";
options.desc = "Show manpages";
}
{
mode = "n";
key = "<leader>h";
action = "<cmd>Telescope help_tags<CR>";
action = "<cmd>Telescope help_tags<cr>";
options.desc = "Show help tags";
}
];
@ -222,13 +338,13 @@
{
mode = "n";
key = "<leader>qq";
action = "<cmd>quitall<CR>";
action = "<cmd>quitall<cr>";
options.desc = "Quit";
}
{
mode = "n";
key = "<leader>q!";
action = "<cmd>quitall!<CR>";
action = "<cmd>quitall!<cr>";
options.desc = "Quit forcefully";
}
];
@ -242,25 +358,25 @@
{
mode = "n";
key = "<leader>bb";
action = "<cmd>Telescope buffers<CR>";
action = "<cmd>Telescope buffers<cr>";
options.desc = "Show open buffers";
}
{
mode = "n";
key = "<leader>bn";
action = "<cmd>bnext<CR>";
action = "<cmd>bnext<cr>";
options.desc = "Goto next buffer";
}
{
mode = "n";
key = "<leader>bp";
action = "<cmd>bprevious<CR>";
action = "<cmd>bprevious<cr>";
options.desc = "Goto previous buffer";
}
{
mode = "n";
key = "<leader>bd";
action = "<cmd>Bdelete<CR>";
action = "<cmd>Bdelete<cr>";
options.desc = "Close current buffer";
}
];
@ -271,6 +387,14 @@
key = "<leader>w";
action = "+windows";
}
{
mode = "n";
key = "<leader>wd";
action = "<C-w>c";
options.desc = "Close current window";
}
{
mode = "n";
key = "<leader>ws";
@ -289,12 +413,7 @@
action = "<C-w>=";
options.desc = "Balance windows";
}
{
mode = "n";
key = "<leader>wd";
action = "<C-w>c";
options.desc = "Close current window";
}
{
mode = "n";
key = "<leader>wh";
@ -336,27 +455,48 @@
{
mode = "n";
key = "<leader>tt";
action = "<cmd>Neotree action=show toggle=true<CR>";
action = "<cmd>Neotree action=show toggle=true<cr><C-w>=";
options.desc = "Toggle NeoTree";
}
# {
# mode = "n";
# key = "<leader>tt";
# action = "<cmd>CHADopen --nofocus<CR>";
# action = "<cmd>CHADopen --nofocus<cr>";
# options.desc = "Toggle CHADtree";
# }
{
mode = "n";
key = "<leader>tn";
action = "<cmd>Navbuddy<CR>";
action = "<cmd>Navbuddy<cr>";
options.desc = "Toggle NavBuddy";
}
{
mode = "n";
key = "<leader>td";
action = "<cmd>TroubleToggle focus=false<CR>";
action = "<cmd>TroubleToggle focus=false<cr>";
options.desc = "Toggle Trouble";
}
{
mode = "n";
key = "<leader>tf";
action = "<cmd>ToggleAutoformat<cr>";
options.desc = "Toggle autoformat-on-save";
}
{
mode = "n";
key = "<leader>tD";
action = "<cmd>ToggleInlineDiagnostics<cr>";
options.desc = "Toggle inline diagnostics";
}
{
mode = "n";
key = "<leader>tw";
action = "<cmd>:set wrap!<cr>";
options.desc = "Toggle word-wrap";
}
];
leader-git = [
@ -368,37 +508,38 @@
{
mode = "n";
key = "<leader>gg";
action = "<cmd>LazyGit<CR>";
action = "<cmd>LazyGit<cr>";
options.desc = "Show LazyGit";
}
{
mode = "n";
key = "<leader>gm";
action = "<cmd>GitMessenger<CR>";
action = "<cmd>GitMessenger<cr>";
options.desc = "Show GitMessenger";
}
{
mode = "n";
key = "<leader>gs";
action = "<cmd>Telescope git_status<CR>";
action = "<cmd>Telescope git_status<cr>";
options.desc = "Show Git status";
}
{
mode = "n";
key = "<leader>gc";
action = "<cmd>Telescope git_commits<CR>";
action = "<cmd>Telescope git_commits<cr>";
options.desc = "Show Git log";
}
{
mode = "n";
key = "<leader>gb";
action = "<cmd>Telescope git_branches<CR>";
action = "<cmd>Telescope git_branches<cr>";
options.desc = "Show Git branches";
}
{
mode = "n";
key = "<leader>gf";
action = "<cmd>Telescope git_bcommits<CR>";
action = "<cmd>Telescope git_bcommits<cr>";
options.desc = "Show Git log for current file";
}
];
@ -412,37 +553,37 @@
{
mode = "n";
key = "<leader>lr";
action = "<cmd>Telescope lsp_references<CR>";
action = "<cmd>Telescope lsp_references<cr>";
options.desc = "Goto references";
}
{
mode = "n";
key = "<leader>ld";
action = "<cmd>Telescope lsp_definitions<CR>";
action = "<cmd>Telescope lsp_definitions<cr>";
options.desc = "Goto definition";
}
{
mode = "n";
key = "<leader>li";
action = "<cmd>Telescope lsp_implementations<CR>";
action = "<cmd>Telescope lsp_implementations<cr>";
options.desc = "Goto implementation";
}
{
mode = "n";
key = "<leader>lt";
action = "<cmd>Telescope lsp_type_definitions<CR>";
action = "<cmd>Telescope lsp_type_definitions<cr>";
options.desc = "Goto type definition";
}
{
mode = "n";
key = "<leader>lI";
action = "<cmd>Telescope lsp_incoming_calls<CR>";
action = "<cmd>Telescope lsp_incoming_calls<cr>";
options.desc = "Show incoming calls";
}
{
mode = "n";
key = "<leader>lO";
action = "<cmd>Telescope lsp_outgoing_calls<CR>";
action = "<cmd>Telescope lsp_outgoing_calls<cr>";
options.desc = "Show outgoing calls";
}
];
@ -456,32 +597,40 @@
{
mode = "n";
key = "<leader>cf";
action = "<cmd>lua require('conform').format()<CR>";
action = "<cmd>lua require('conform').format()<cr>";
options.desc = "Format current buffer";
}
{
mode = "n";
key = "<leader>cd";
action = "<cmd>Telescope diagnostics<CR>";
options.desc = "Show diagnostics";
action = "<cmd>lua vim.diagnostic.open_float()<cr>";
options.desc = "Show LSP line diagnostics";
}
{
mode = "n";
key = "<leader>cD";
action = "<cmd>Telescope diagnostics<cr>";
options.desc = "Show diagnostics";
}
{
mode = "n";
key = "<leader>cr";
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
action = "<cmd>lua vim.lsp.buf.rename()<cr>";
options.desc = "Rename LSP symbol";
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
action = "<cmd>lua vim.lsp.buf.code_action()<cr>";
options.desc = "Show LSP code actions";
}
{
mode = "n";
key = "<leader>cD";
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
options.desc = "Show LSP line diagnostics";
key = "<leader>ch";
action = "<cmd>ClangdSwitchSourceHeader<cr>";
options.desc = "Switch C/C++ source/header";
}
];
in

View File

@ -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

View File

@ -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