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 = {
name = "persistence";
pkg = pkgs.vimPlugins.persistence-nvim;
_persisted = {
name = "persisted";
pkg = pkgs.vimPlugins.persisted-nvim;
dependencies = [telescope];
lazy = true;
config = ''
function(_, opts)
require("persistence").setup(opts);
require("persisted").setup(opts)
require("telescope").load_extension("persisted")
end
'';
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;
dependencies = [
_web-devicons
_persistence
# _persistence
_persisted
_project
];
lazy = false;
config = ''
@ -502,36 +540,42 @@ in {
config = {
center = [
{
action = "Telescope projects";
desc = " Open Project";
icon = " ";
key = "p";
}
{
action = "Telescope persisted";
desc = " Restore Session";
icon = " ";
key = "s";
}
{
action = "Telescope find_files";
desc = " Find File";
icon = " ";
key = "f";
}
{
action = "ene | startinsert";
desc = " New File";
icon = " ";
key = "n";
}
{
action = "Telescope oldfiles";
desc = " Recent Files";
icon = " ";
key = "r";
}
{
action = "ene | startinsert";
desc = " New File";
icon = " ";
key = "n";
}
{
action = "Telescope live_grep";
desc = " Find Text";
icon = " ";
key = "g";
}
{
action = "lua require('persistence').load()";
desc = " Restore Session";
icon = " ";
key = "s";
}
{
action = "Lazy";
desc = " Lazy";
@ -557,6 +601,13 @@ in {
};
};
diffview = {
name = "diffview";
pkg = pkgs.vimPlugins.diffview-nvim;
lazy = true;
cmd = ["DiffviewOpen"];
};
flash = {
name = "flash";
pkg = pkgs.vimPlugins.flash-nvim;
@ -1012,7 +1063,7 @@ in {
};
};
# TODO: Snippet configs
# TODO: Snippet configs (e.g. LaTeX)
luasnip = {
name = "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 = {
name = "navbuddy";
pkg = pkgs.vimPlugins.nvim-navbuddy;
@ -1064,7 +1129,20 @@ in {
enable_diagnostics = false;
open_files_do_not_replace_types = ["terminal" "trouble" "qf"];
default_component_configs = {
container = {
enable_character_fade = true;
};
};
filesystem = {
bind_to_cwd = true;
cwd_target.sidebar = "global";
filtered_items = {
visible = true;
};
follow_current_file = {
enabled = true;
leave_dirs_open = false;
@ -1079,6 +1157,8 @@ in {
};
window = {
position = "left";
mappings = {
"<CR>" = "open";
"c" = "close_node";
@ -1117,6 +1197,22 @@ in {
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 = {
name = "noice";
pkg = pkgs.vimPlugins.noice-nvim;
@ -1225,6 +1321,7 @@ in {
lazy = true;
};
# TODO: Missing bat catppuccin theme
_telescope-undo = {
name = "telescope-undo";
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 = {
name = "todo-comments";
pkg = pkgs.vimPlugins.todo-comments-nvim;
@ -1291,6 +1390,74 @@ in {
require("todo-comments").setup(opts)
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 = {
@ -1306,6 +1473,7 @@ in {
'';
opts = {
open_mapping.__raw = "[[<C-/>]]";
autochdir = true;
hide_numbers = true;
shade_terminals = false;
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 = {
name = "which-key";
pkg = pkgs.vimPlugins.which-key-nvim;
@ -1531,6 +1709,7 @@ in {
comment
conform
dashboard
diffview
flash
gitmessenger
gitsigns
@ -1545,6 +1724,7 @@ in {
lspconfig
lualine
luasnip
narrow-region
navbuddy
neo-tree
noice
@ -1560,65 +1740,11 @@ in {
trouble
# twilight # NOTE: Don't like it
ufo
vimtex
which-key
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
{
mode = "n";
key = "s"; # TODO: Key doesn't work
key = "s";
action = "<cmd>lua require('flash').jump()<cr>";
options.desc = "Flash jump";
}
{
mode = "n";
key = "S"; # TODO: Key doesn't work
key = "S";
action = "<cmd>lua require('flash').treesitter()<cr>";
options.desc = "Flash treesitter";
}
@ -217,7 +217,7 @@
# Various
{
mode = "n";
key = "<C-h>";
key = "<C-S-h>";
action = "<cmd>nohlsearch<cr>";
options.desc = "Clear search highlights";
}
@ -252,18 +252,19 @@
options.desc = "Show Lazy";
}
{
mode = "n";
key = "<leader>s";
action = "<cmd>w<cr>";
options.desc = "Save current buffer";
}
{
mode = "n";
key = "<leader>S";
action = "<cmd>wa<cr>";
options.desc = "Save all buffers";
}
# Already have <C-s> and <C-S-s>
# {
# mode = "n";
# key = "<leader>s";
# action = "<cmd>w<cr>";
# options.desc = "Save current buffer";
# }
# {
# mode = "n";
# key = "<leader>S";
# action = "<cmd>wa<cr>";
# options.desc = "Save all buffers";
# }
{
mode = "n";
@ -284,6 +285,18 @@
action = "<cmd>Telescope find_files<cr>";
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";
key = "<leader>o";
@ -303,8 +316,14 @@
options.desc = "Find in working directory";
}
{
mode = "n";
mode = "v";
key = "<leader>n";
action = ":NR!<cr>";
options.desc = "Narrow region";
}
{
mode = "n";
key = "<leader>N";
action = "<cmd>Telescope notify<cr>";
options.desc = "Show notify history";
}
@ -350,6 +369,12 @@
action = "<cmd>Telescope help_tags<cr>";
options.desc = "Show help tags";
}
{
mode = "n";
key = "<leader>T";
action = "<cmd>TodoTelescope<cr>";
options.desc = "Show TODOs";
}
];
leader-quit = [
@ -496,8 +521,14 @@
{
mode = "n";
key = "<leader>td";
action = "<cmd>TroubleToggle focus=false<cr>";
options.desc = "Toggle Trouble";
action = "<cmd>TroubleToggle workspace_diagnostics focus=false<cr>";
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>";
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 = [
@ -644,10 +681,16 @@
options.desc = "Show diagnostics";
}
# {
# mode = "n";
# key = "<leader>cr";
# action = "<cmd>lua vim.lsp.buf.rename()<cr>";
# options.desc = "Rename LSP symbol";
# }
{
mode = "n";
key = "<leader>cr";
action = "<cmd>lua vim.lsp.buf.rename()<cr>";
action = ":IncRename ";
options.desc = "Rename LSP symbol";
}
{