1

Neovim: Update neovim module

This commit is contained in:
2024-06-05 21:58:56 +02:00
parent 7b625f87fb
commit 9160166399
2 changed files with 263 additions and 94 deletions

View File

@ -468,17 +468,53 @@ in {
}; };
}; };
_persistence = { _persisted = {
name = "persistence"; name = "persisted";
pkg = pkgs.vimPlugins.persistence-nvim; pkg = pkgs.vimPlugins.persisted-nvim;
dependencies = [telescope];
lazy = true; lazy = true;
config = '' config = ''
function(_, opts) function(_, opts)
require("persistence").setup(opts); require("persisted").setup(opts)
require("telescope").load_extension("persisted")
end end
''; '';
opts = { opts = {
options.__raw = "vim.opt.sessionoptions:get()"; silent = false;
use_git_branch = false;
autosave = true;
autoload = false;
follow_cwd = true;
};
};
_project = {
name = "project";
pkg = pkgs.vimPlugins.project-nvim;
dependencies = [telescope];
lazy = true;
config = ''
function(_, opts)
require("project_nvim").setup(opts)
end
'';
opts = {
manual_mode = false;
detection_methods = [
"lsp"
"pattern"
];
# exclude_dirs = [];
patterns = [
".git"
"Makefile"
"CMakeLists.txt"
"flake.nix"
];
}; };
}; };
@ -487,7 +523,9 @@ in {
pkg = pkgs.vimPlugins.dashboard-nvim; pkg = pkgs.vimPlugins.dashboard-nvim;
dependencies = [ dependencies = [
_web-devicons _web-devicons
_persistence # _persistence
_persisted
_project
]; ];
lazy = false; lazy = false;
config = '' config = ''
@ -502,36 +540,42 @@ in {
config = { config = {
center = [ center = [
{
action = "Telescope projects";
desc = " Open Project";
icon = " ";
key = "p";
}
{
action = "Telescope persisted";
desc = " Restore Session";
icon = " ";
key = "s";
}
{ {
action = "Telescope find_files"; action = "Telescope find_files";
desc = " Find File"; desc = " Find File";
icon = " "; icon = " ";
key = "f"; key = "f";
} }
{
action = "ene | startinsert";
desc = " New File";
icon = " ";
key = "n";
}
{ {
action = "Telescope oldfiles"; action = "Telescope oldfiles";
desc = " Recent Files"; desc = " Recent Files";
icon = " "; icon = " ";
key = "r"; key = "r";
} }
{
action = "ene | startinsert";
desc = " New File";
icon = " ";
key = "n";
}
{ {
action = "Telescope live_grep"; action = "Telescope live_grep";
desc = " Find Text"; desc = " Find Text";
icon = " "; icon = " ";
key = "g"; key = "g";
} }
{
action = "lua require('persistence').load()";
desc = " Restore Session";
icon = " ";
key = "s";
}
{ {
action = "Lazy"; action = "Lazy";
desc = " Lazy"; desc = " Lazy";
@ -557,6 +601,13 @@ in {
}; };
}; };
diffview = {
name = "diffview";
pkg = pkgs.vimPlugins.diffview-nvim;
lazy = true;
cmd = ["DiffviewOpen"];
};
flash = { flash = {
name = "flash"; name = "flash";
pkg = pkgs.vimPlugins.flash-nvim; pkg = pkgs.vimPlugins.flash-nvim;
@ -1012,7 +1063,7 @@ in {
}; };
}; };
# TODO: Snippet configs # TODO: Snippet configs (e.g. LaTeX)
luasnip = { luasnip = {
name = "luasnip"; name = "luasnip";
pkg = pkgs.vimPlugins.luasnip; pkg = pkgs.vimPlugins.luasnip;
@ -1024,6 +1075,20 @@ in {
''; '';
}; };
narrow-region = {
name = "narrow-region";
pkg = pkgs.vimPlugins.NrrwRgn;
lazy = true;
cmd = ["NR"];
config = ''
function(_, opts)
vim.keymap.del("x", "<space>Nr")
vim.keymap.del("x", "<space>nr")
vim.keymap.del("n", "<space>nr")
end
'';
};
navbuddy = { navbuddy = {
name = "navbuddy"; name = "navbuddy";
pkg = pkgs.vimPlugins.nvim-navbuddy; pkg = pkgs.vimPlugins.nvim-navbuddy;
@ -1064,7 +1129,20 @@ in {
enable_diagnostics = false; enable_diagnostics = false;
open_files_do_not_replace_types = ["terminal" "trouble" "qf"]; open_files_do_not_replace_types = ["terminal" "trouble" "qf"];
default_component_configs = {
container = {
enable_character_fade = true;
};
};
filesystem = { filesystem = {
bind_to_cwd = true;
cwd_target.sidebar = "global";
filtered_items = {
visible = true;
};
follow_current_file = { follow_current_file = {
enabled = true; enabled = true;
leave_dirs_open = false; leave_dirs_open = false;
@ -1079,6 +1157,8 @@ in {
}; };
window = { window = {
position = "left";
mappings = { mappings = {
"<CR>" = "open"; "<CR>" = "open";
"c" = "close_node"; "c" = "close_node";
@ -1117,6 +1197,22 @@ in {
lazy = true; lazy = true;
}; };
# TODO: Doesn't work
# _inc-rename = {
# name = "inc-rename";
# pkg = pkgs.vimPlugins.inc-rename-nvim;
# lazy = false;
# cmd = ["IncRename"];
# config = ''
# function(_, opts)
# require("inc_rename").setup()
# end
# '';
# opts = {
# preview_empty_name = true;
# };
# };
noice = { noice = {
name = "noice"; name = "noice";
pkg = pkgs.vimPlugins.noice-nvim; pkg = pkgs.vimPlugins.noice-nvim;
@ -1225,6 +1321,7 @@ in {
lazy = true; lazy = true;
}; };
# TODO: Missing bat catppuccin theme
_telescope-undo = { _telescope-undo = {
name = "telescope-undo"; name = "telescope-undo";
pkg = pkgs.vimPlugins.telescope-undo-nvim; pkg = pkgs.vimPlugins.telescope-undo-nvim;
@ -1277,7 +1374,9 @@ in {
}; };
}; };
# TODO: Also recognize @todo etc. variants # TODO: Can't match @ for @todo etc.
# https://github.com/folke/todo-comments.nvim/issues/213
# https://github.com/folke/todo-comments.nvim/issues/56
todo-comments = { todo-comments = {
name = "todo-comments"; name = "todo-comments";
pkg = pkgs.vimPlugins.todo-comments-nvim; pkg = pkgs.vimPlugins.todo-comments-nvim;
@ -1291,6 +1390,74 @@ in {
require("todo-comments").setup(opts) require("todo-comments").setup(opts)
end end
''; '';
opts = {
signs = true;
keywords = {
FIX = {
icon = " ";
color = "error";
alt = [
"FIXME"
"BUG"
"FIXIT"
"ISSUE"
# "#@fix" "#@fixme" "#@bug" "#@fixit" "#@issue"
];
# signs = false; # Configure signs for some keywords individually
};
TODO = {
icon = " ";
color = "info";
alt = [
# "#@todo"
];
};
HACK = {
icon = " ";
color = "warning";
alt = [
# "#@hack"
];
};
WARN = {
icon = " ";
color = "warning";
alt = [
"WARNING"
"XXX"
# "#@warn" "#@warning" "#@xxx"
];
};
PERF = {
icon = " ";
alt = [
"OPTIM"
"PERFORMANCE"
"OPTIMIZE"
# "#@perf" "#@optim" "#@performance" "#@optimize"
];
};
NOTE = {
icon = " ";
color = "hint";
alt = [
"INFO"
# "#@note" "#@info"
];
};
TEST = {
icon = " ";
color = "test";
alt = [
"TESTING"
"PASSED"
"FAILED"
# "#@test" "#@testing" "#@passed" "#@failed"
];
};
};
};
}; };
toggleterm = { toggleterm = {
@ -1306,6 +1473,7 @@ in {
''; '';
opts = { opts = {
open_mapping.__raw = "[[<C-/>]]"; open_mapping.__raw = "[[<C-/>]]";
autochdir = true;
hide_numbers = true; hide_numbers = true;
shade_terminals = false; shade_terminals = false;
shading_factor = 30; # Default is -30 to darken the terminal shading_factor = 30; # Default is -30 to darken the terminal
@ -1483,6 +1651,16 @@ in {
''; '';
}; };
vimtex = {
name = "vimtex";
pkg = pkgs.vimPlugins.vimtex;
config = ''
function(_, opts)
vim.g.vimtex_view_method = "zathura"
end
'';
};
which-key = { which-key = {
name = "which-key"; name = "which-key";
pkg = pkgs.vimPlugins.which-key-nvim; pkg = pkgs.vimPlugins.which-key-nvim;
@ -1531,6 +1709,7 @@ in {
comment comment
conform conform
dashboard dashboard
diffview
flash flash
gitmessenger gitmessenger
gitsigns gitsigns
@ -1545,6 +1724,7 @@ in {
lspconfig lspconfig
lualine lualine
luasnip luasnip
narrow-region
navbuddy navbuddy
neo-tree neo-tree
noice noice
@ -1560,65 +1740,11 @@ in {
trouble trouble
# twilight # NOTE: Don't like it # twilight # NOTE: Don't like it
ufo ufo
vimtex
which-key which-key
yanky yanky
]; ];
}; };
# NixVim plugins
# TODO: Figure out how debugging from nvim works...
# Debug-Adapter-Protocol
# dap = {
# enable = true;
# };
# TODO: Figure out how diff-mode works...
# diffview = {
# enable = true;
# };
# TODO: Incremental LSP rename (noice only does search/replace incrementally)
# inc-rename = {
# enable = true;
# };
# TODO: Need enabled for conform fallback?
# lsp-format = {
# enable = true;
# };
# TODO:
# Show marks in the gutter
# marks = {
# enable = true;
# };
# TODO:
# Generate doc comments
# neogen = {
# enable = true;
# };
# TODO:
# Interact with test frameworks
# neotest = {
# enable = true;
# };
# TODO: Lua deps not found
# REST/HTTP client
# rest = {
# enable = true;
# };
# TODO:
# LaTeX
# vimtex = {
# enable = true;
#
# texlivePackage = null; # Don't auto-install
# };
}; };
}; };
} }

View File

@ -203,13 +203,13 @@
# Flash/Search # Flash/Search
{ {
mode = "n"; mode = "n";
key = "s"; # TODO: Key doesn't work key = "s";
action = "<cmd>lua require('flash').jump()<cr>"; action = "<cmd>lua require('flash').jump()<cr>";
options.desc = "Flash jump"; options.desc = "Flash jump";
} }
{ {
mode = "n"; mode = "n";
key = "S"; # TODO: Key doesn't work key = "S";
action = "<cmd>lua require('flash').treesitter()<cr>"; action = "<cmd>lua require('flash').treesitter()<cr>";
options.desc = "Flash treesitter"; options.desc = "Flash treesitter";
} }
@ -217,7 +217,7 @@
# Various # Various
{ {
mode = "n"; mode = "n";
key = "<C-h>"; key = "<C-S-h>";
action = "<cmd>nohlsearch<cr>"; action = "<cmd>nohlsearch<cr>";
options.desc = "Clear search highlights"; options.desc = "Clear search highlights";
} }
@ -252,18 +252,19 @@
options.desc = "Show Lazy"; options.desc = "Show Lazy";
} }
{ # Already have <C-s> and <C-S-s>
mode = "n"; # {
key = "<leader>s"; # mode = "n";
action = "<cmd>w<cr>"; # key = "<leader>s";
options.desc = "Save current buffer"; # action = "<cmd>w<cr>";
} # options.desc = "Save current buffer";
{ # }
mode = "n"; # {
key = "<leader>S"; # mode = "n";
action = "<cmd>wa<cr>"; # key = "<leader>S";
options.desc = "Save all buffers"; # action = "<cmd>wa<cr>";
} # options.desc = "Save all buffers";
# }
{ {
mode = "n"; mode = "n";
@ -284,6 +285,18 @@
action = "<cmd>Telescope find_files<cr>"; action = "<cmd>Telescope find_files<cr>";
options.desc = "Find file"; options.desc = "Find file";
} }
{
mode = "n";
key = "<leader>p";
action = "<cmd>Telescope projects<cr>";
options.desc = "Open project";
}
{
mode = "n";
key = "<leader>s";
action = "<cmd>Telescope persisted<cr>";
options.desc = "Restore session";
}
{ {
mode = "n"; mode = "n";
key = "<leader>o"; key = "<leader>o";
@ -303,8 +316,14 @@
options.desc = "Find in working directory"; options.desc = "Find in working directory";
} }
{ {
mode = "n"; mode = "v";
key = "<leader>n"; key = "<leader>n";
action = ":NR!<cr>";
options.desc = "Narrow region";
}
{
mode = "n";
key = "<leader>N";
action = "<cmd>Telescope notify<cr>"; action = "<cmd>Telescope notify<cr>";
options.desc = "Show notify history"; options.desc = "Show notify history";
} }
@ -350,6 +369,12 @@
action = "<cmd>Telescope help_tags<cr>"; action = "<cmd>Telescope help_tags<cr>";
options.desc = "Show help tags"; options.desc = "Show help tags";
} }
{
mode = "n";
key = "<leader>T";
action = "<cmd>TodoTelescope<cr>";
options.desc = "Show TODOs";
}
]; ];
leader-quit = [ leader-quit = [
@ -496,8 +521,14 @@
{ {
mode = "n"; mode = "n";
key = "<leader>td"; key = "<leader>td";
action = "<cmd>TroubleToggle focus=false<cr>"; action = "<cmd>TroubleToggle workspace_diagnostics focus=false<cr>";
options.desc = "Toggle Trouble"; options.desc = "Toggle Trouble diagnostics";
}
{
mode = "n";
key = "<leader>tT";
action = "<cmd>TroubleToggle todo focus=false<cr>";
options.desc = "Toggle Trouble TODOs";
} }
{ {
@ -572,6 +603,12 @@
action = "<cmd>Telescope git_bcommits<cr>"; action = "<cmd>Telescope git_bcommits<cr>";
options.desc = "Show Git log for current file"; options.desc = "Show Git log for current file";
} }
{
mode = "n";
key = "<leader>gd";
action = "<cmd>DiffviewOpen<cr>";
options.desc = "Show Git diff for current worktree";
}
]; ];
leader-lsp = [ leader-lsp = [
@ -644,10 +681,16 @@
options.desc = "Show diagnostics"; options.desc = "Show diagnostics";
} }
# {
# mode = "n";
# key = "<leader>cr";
# action = "<cmd>lua vim.lsp.buf.rename()<cr>";
# options.desc = "Rename LSP symbol";
# }
{ {
mode = "n"; mode = "n";
key = "<leader>cr"; key = "<leader>cr";
action = "<cmd>lua vim.lsp.buf.rename()<cr>"; action = ":IncRename ";
options.desc = "Rename LSP symbol"; options.desc = "Rename LSP symbol";
} }
{ {