1

Neovim: Substantial update to neovim config

- Overhaul keybindings
- Remove unused plugins (e.g., sandwich)
- Add markview and obsidian integration among others
This commit is contained in:
2024-10-10 14:15:23 +02:00
parent 0f8c191988
commit dbd40e61c2
2 changed files with 230 additions and 294 deletions

View File

@ -70,15 +70,33 @@ in {
file.".config/vale/.vale.ini".source = ./vale_config.ini; file.".config/vale/.vale.ini".source = ./vale_config.ini;
}; };
# TODO: Read the LazyVim config for further ideas
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
enableMan = false; enableMan = false; # Nixvim man pages
luaLoader.enable = true; # NOTE: Experimental luaLoader.enable = true; # NOTE: Experimental
viAlias = cfg.alias; viAlias = cfg.alias;
vimAlias = cfg.alias; vimAlias = cfg.alias;
colorschemes.catppuccin = {
enable = true;
settings = {
flavour = "mocha"; # latte, frappe, macchiato, mocha
background = {
light = "latte";
dark = "mocha";
};
};
};
performance.byteCompileLua = {
enable = true;
configs = true;
initLua = true;
nvimRuntime = true;
plugins = true;
};
globals = { globals = {
mapleader = " "; mapleader = " ";
mallocalleader = " "; mallocalleader = " ";
@ -89,13 +107,7 @@ in {
extraConfigLua = builtins.readFile ./extraConfigLua.lua; extraConfigLua = builtins.readFile ./extraConfigLua.lua;
# extraLuaPackages = with pkgs.lua51Packages; []; # extraLuaPackages = with pkgs.lua51Packages; [];
# extraPython3Packages = p: [];
# extraPython3Packages = p: [
# # For CHADtree
# p.pyyaml
# p.pynvim-pp
# p.std2
# ];
autoCmd = [ autoCmd = [
{ {
@ -150,7 +162,6 @@ in {
} }
]; ];
# TODO: Incremental selection
keymaps = import ./mappings.nix {inherit lib mylib;}; keymaps = import ./mappings.nix {inherit lib mylib;};
plugins.lazy = let plugins.lazy = let
@ -194,30 +205,6 @@ in {
}; };
}; };
catppuccin = rec {
name = "catppuccin";
pkg = pkgs.vimPlugins.catppuccin-nvim;
lazy = false;
priority = 1000;
config = ''
function(_, opts)
require("${name}").setup(opts)
vim.cmd([[
let $BAT_THEME = "catppuccin"
colorscheme catppuccin
]])
end
'';
opts = {
flavour = "mocha"; # latte, frappe, macchiato, mocha
background = {
light = "latte";
dark = "mocha";
};
};
};
# NOTE: In LazyVim require("clang_extensions").setup(opts) is called where opts is the server definition from lspconfig... # NOTE: In LazyVim require("clang_extensions").setup(opts) is called where opts is the server definition from lspconfig...
clangd-extensions = rec { clangd-extensions = rec {
name = "clangd_extensions"; name = "clangd_extensions";
@ -263,11 +250,11 @@ in {
lazy = true; lazy = true;
}; };
_cmp-nvim-lsp-signature-help = { # _cmp-nvim-lsp-signature-help = {
name = "cmp-nvim-lsp-signature-help"; # name = "cmp-nvim-lsp-signature-help";
pkg = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; # pkg = pkgs.vimPlugins.cmp-nvim-lsp-signature-help;
lazy = true; # lazy = true;
}; # };
_cmp-luasnip = { _cmp-luasnip = {
name = "cmp_luasnip"; name = "cmp_luasnip";
@ -275,7 +262,6 @@ in {
lazy = true; lazy = true;
}; };
# TODO: Check additional completion backends
cmp = rec { cmp = rec {
name = "cmp"; name = "cmp";
pkg = pkgs.vimPlugins.nvim-cmp; pkg = pkgs.vimPlugins.nvim-cmp;
@ -298,7 +284,7 @@ in {
{name = "nvim_lsp";} {name = "nvim_lsp";}
{name = "luasnip";} {name = "luasnip";}
# {name = "nvim_lsp_signature_help";} # {name = "nvim_lsp_signature_help";} # Already provided by something else (noice?)
# {name = "buffer";} # Too much noise # {name = "buffer";} # Too much noise
# {name = "cmdline";} # Using nui as cmdline completion backend # {name = "cmdline";} # Using nui as cmdline completion backend
]; ];
@ -311,15 +297,25 @@ in {
"<C-Up>".__raw = "cmp.mapping.scroll_docs(-4)"; "<C-Up>".__raw = "cmp.mapping.scroll_docs(-4)";
"<C-Down>".__raw = "cmp.mapping.scroll_docs(4)"; "<C-Down>".__raw = "cmp.mapping.scroll_docs(4)";
"<C-Space>".__raw = "cmp.mapping.complete({})"; "<C-Space>".__raw = "cmp.mapping.complete({})";
"<CR>".__raw = "cmp.mapping.confirm({ select = true })"; "<CR>".__raw = ''
cmp.mapping(function(fallback)
if cmp.visible() then
if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({select = true})
end
else
fallback()
end
end)
'';
"<Tab>".__raw = '' "<Tab>".__raw = ''
cmp.mapping(function(fallback) cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then elseif luasnip.locally_jumpable(1) then
require("luasnip").expand_or_jump() luasnip.jump(1)
elseif has_words_before() then
cmp.complete()
else else
fallback() -- This will call the intellitab <Tab> binding fallback() -- This will call the intellitab <Tab> binding
end end
@ -329,7 +325,7 @@ in {
cmp.mapping(function(fallback) cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
@ -370,7 +366,6 @@ in {
''; '';
}; };
# TODO: Only colorize html/css/scss/sass/etc.
# colorizer = rec { # colorizer = rec {
# name = "colorizer"; # name = "colorizer";
# pkg = pkgs.vimPlugins.nvim-colorizer-lua; # pkg = pkgs.vimPlugins.nvim-colorizer-lua;
@ -494,7 +489,7 @@ in {
name = "dashboard"; name = "dashboard";
pkg = pkgs.vimPlugins.dashboard-nvim; pkg = pkgs.vimPlugins.dashboard-nvim;
dependencies = [ dependencies = [
_web-devicons web-devicons
_persisted _persisted
]; ];
lazy = false; lazy = false;
@ -524,6 +519,12 @@ in {
icon = " "; icon = " ";
key = "r"; key = "r";
} }
{
action = "ObsidianSearch";
desc = " Obsidian Note";
icon = " ";
key = "o";
}
{ {
action = "ene | startinsert"; action = "ene | startinsert";
desc = " New File"; desc = " New File";
@ -572,7 +573,7 @@ in {
name = "flash"; name = "flash";
pkg = pkgs.vimPlugins.flash-nvim; pkg = pkgs.vimPlugins.flash-nvim;
lazy = true; lazy = true;
keys = ["s" "S" "f" "F" "t" "T"]; keys = ["f" "F"];
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
@ -615,50 +616,6 @@ in {
# Don't call setup! # Don't call setup!
}; };
# indent-blankline = {
# name = "indent-blankline";
# pkg = pkgs.vimPlugins.indent-blankline-nvim;
# lazy = false;
# config = ''
# function(_, opts)
# -- Regular setup
# require("ibl").setup(opts)
#
# -- Setup IBL with rainbow-delimiters
# -- local highlight = {
# -- "RainbowRed",
# -- "RainbowYellow",
# -- "RainbowBlue",
# -- "RainbowOrange",
# -- "RainbowGreen",
# -- "RainbowViolet",
# -- "RainbowCyan",
# -- }
# -- local hooks = require("ibl.hooks")
#
# -- -- create the highlight groups in the highlight setup hook, so they are reset
# -- -- every time the colorscheme changes
# -- hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
# -- vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
# -- vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
# -- vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
# -- vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
# -- vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
# -- vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
# -- vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
# -- end)
#
# -- vim.g.rainbow_delimiters = { highlight = highlight }
# -- opts.scope = {highlight = highlight}
#
# -- Call setup function
# -- require("ibl").setup(opts)
#
# -- hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
# end
# '';
# };
illuminate = rec { illuminate = rec {
name = "illuminate"; name = "illuminate";
pkg = pkgs.vimPlugins.vim-illuminate; pkg = pkgs.vimPlugins.vim-illuminate;
@ -758,7 +715,16 @@ in {
intellitab = { intellitab = {
name = "intellitab"; name = "intellitab";
pkg = pkgs.vimPlugins.intellitab-nvim; # pkg = pkgs.vimPlugins.intellitab-nvim; # Prints at each indent :(
pkg = pkgs.vimUtils.buildVimPlugin {
name = "intellitab-nvim";
src = pkgs.fetchFromGitHub {
owner = "ChUrl";
repo = "intellitab.nvim";
rev = "6d644b7d92198477f2920d0c3b3b22dad470ef10"; # Disable print
sha256 = "sha256-MwBcsYpyrjoXa7nxcwaci3h0NIWyMoF1NyYfEbFzo0E=";
};
};
lazy = true; lazy = true;
event = ["InsertEnter"]; event = ["InsertEnter"];
}; };
@ -838,18 +804,8 @@ in {
# Newer alternative to neodev # Newer alternative to neodev
_lazydev = rec { _lazydev = rec {
name = "lazydev"; name = "lazydev";
pkg = let pkg = pkgs.vimPlugins.lazydev-nvim;
nvim-lazydev = pkgs.vimUtils.buildVimPlugin { lazy = true;
name = "nvim-lazydev";
src = pkgs.fetchFromGitHub {
owner = "folke";
repo = "lazydev.nvim";
rev = "8146b3ad692ae7026fea1784fd5b13190d4f883c"; # v1.4
sha256 = "sha256-JGRjwRDx2Gdp/EBwO2XmWRGOWmHDu0XAzLps+/RSpYk=";
};
};
in
nvim-lazydev;
ft = ["lua"]; ft = ["lua"];
config = mkDefaultConfig name; config = mkDefaultConfig name;
# opts = { # opts = {
@ -989,12 +945,12 @@ in {
end end
''; '';
opts = { opts = {
extensions = ["fzf" "chadtree" "neo-tree" "toggleterm" "trouble"]; extensions = ["fzf" "neo-tree" "toggleterm" "trouble"];
options = { options = {
always_divide_middle = true; always_divide_middle = true;
globalstatus = true; globalstatus = true;
ignore_focus = ["neo-tree" "chadtree"]; ignore_focus = ["neo-tree"];
section_separators = { section_separators = {
left = ""; left = "";
right = ""; right = "";
@ -1035,21 +991,31 @@ in {
''; '';
}; };
# TODO: Closing a narrow buffer leaves a permanent highlight markview = {
narrow-region = { name = "markview";
name = "narrow-region"; pkg = pkgs.vimPlugins.markview-nvim;
pkg = pkgs.vimPlugins.NrrwRgn;
lazy = true; lazy = true;
cmd = ["NR"]; ft = ["markdown"];
config = '' dependencies = [
function(_, opts) treesitter
vim.keymap.del("x", "<space>Nr") web-devicons
vim.keymap.del("x", "<space>nr") ];
vim.keymap.del("n", "<space>nr")
end
'';
}; };
# 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;
@ -1073,7 +1039,7 @@ in {
pkg = pkgs.vimPlugins.neo-tree-nvim; pkg = pkgs.vimPlugins.neo-tree-nvim;
dependencies = [ dependencies = [
_plenary _plenary
_web-devicons web-devicons
_nui _nui
]; ];
lazy = true; lazy = true;
@ -1186,7 +1152,7 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
opts = { opts = {
presets = { presets = {
bottom_search = true; bottom_search = false;
command_palette = true; command_palette = true;
long_message_to_split = true; long_message_to_split = true;
inc_rename = true; inc_rename = true;
@ -1241,6 +1207,26 @@ in {
}; };
}; };
obsidian = rec {
name = "obsidian";
pkg = pkgs.vimPlugins.obsidian-nvim;
lazy = true;
cmd = ["ObsidianSearch" "ObsidianNew"];
ft = ["markdown"];
dependencies = [
_plenary
];
config = mkDefaultConfig name;
opts = {
workspaces = [
{
name = "Chriphost";
path = "~/Notes/Obsidian/Chriphost";
}
];
};
};
oil = rec { oil = rec {
name = "oil"; name = "oil";
pkg = pkgs.vimPlugins.oil-nvim; pkg = pkgs.vimPlugins.oil-nvim;
@ -1309,28 +1295,18 @@ in {
''; '';
}; };
# TODO: Disable default keymaps
sandwich = {
name = "sandwich";
pkg = pkgs.vimPlugins.vim-sandwich;
lazy = false;
init = ''
function()
-- Disable default keymaps
vim.g.sandwich_no_default_key_mappings = 1
vim.g.operator_sandwich_no_default_key_mappings = 1
vim.g.textobj_sandwich_no_default_key_mappings = 1
end
'';
};
# TODO: Indent doesn't follow prev line correctly, don't know if sleuth issue
sleuth = { sleuth = {
name = "sleuth"; name = "sleuth";
pkg = pkgs.vimPlugins.vim-sleuth; pkg = pkgs.vimPlugins.vim-sleuth;
lazy = false; lazy = false;
}; };
sneak = {
name = "sneak";
pkg = pkgs.vimPlugins.vim-sneak;
lazy = false;
};
_plenary = { _plenary = {
name = "plenary"; # For telescope name = "plenary"; # For telescope
pkg = pkgs.vimPlugins.plenary-nvim; pkg = pkgs.vimPlugins.plenary-nvim;
@ -1343,7 +1319,6 @@ 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;
@ -1356,7 +1331,6 @@ in {
lazy = true; lazy = true;
}; };
# TODO: Check additional telescope backends
telescope = { telescope = {
name = "telescope"; name = "telescope";
pkg = pkgs.vimPlugins.telescope-nvim; pkg = pkgs.vimPlugins.telescope-nvim;
@ -1396,9 +1370,6 @@ in {
}; };
}; };
# 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 = rec { todo-comments = rec {
name = "todo-comments"; name = "todo-comments";
pkg = pkgs.vimPlugins.todo-comments-nvim; pkg = pkgs.vimPlugins.todo-comments-nvim;
@ -1420,7 +1391,6 @@ in {
"BUG" "BUG"
"FIXIT" "FIXIT"
"ISSUE" "ISSUE"
# "#@fix" "#@fixme" "#@bug" "#@fixit" "#@issue"
]; ];
# signs = false; # Configure signs for some keywords individually # signs = false; # Configure signs for some keywords individually
}; };
@ -1428,14 +1398,12 @@ in {
icon = " "; icon = " ";
color = "info"; color = "info";
alt = [ alt = [
# "#@todo"
]; ];
}; };
HACK = { HACK = {
icon = " "; icon = " ";
color = "warning"; color = "warning";
alt = [ alt = [
# "#@hack"
]; ];
}; };
WARN = { WARN = {
@ -1444,7 +1412,6 @@ in {
alt = [ alt = [
"WARNING" "WARNING"
"XXX" "XXX"
# "#@warn" "#@warning" "#@xxx"
]; ];
}; };
PERF = { PERF = {
@ -1453,7 +1420,6 @@ in {
"OPTIM" "OPTIM"
"PERFORMANCE" "PERFORMANCE"
"OPTIMIZE" "OPTIMIZE"
# "#@perf" "#@optim" "#@performance" "#@optimize"
]; ];
}; };
NOTE = { NOTE = {
@ -1461,7 +1427,6 @@ in {
color = "hint"; color = "hint";
alt = [ alt = [
"INFO" "INFO"
# "#@note" "#@info"
]; ];
}; };
TEST = { TEST = {
@ -1471,14 +1436,12 @@ in {
"TESTING" "TESTING"
"PASSED" "PASSED"
"FAILED" "FAILED"
# "#@test" "#@testing" "#@passed" "#@failed"
]; ];
}; };
}; };
}; };
}; };
# TODO: The shell colorscheme is unreadable
toggleterm = rec { toggleterm = rec {
name = "toggleterm"; name = "toggleterm";
pkg = pkgs.vimPlugins.toggleterm-nvim; pkg = pkgs.vimPlugins.toggleterm-nvim;
@ -1579,9 +1542,8 @@ in {
# highlight_current_scope.enable = false; # Ugly # highlight_current_scope.enable = false; # Ugly
# }; # };
# TODO: Doesn't work
incremental_selection = { incremental_selection = {
enable = true; enable = false;
keymaps = { keymaps = {
"init_selection" = "gnn"; "init_selection" = "gnn";
"node_decremental" = "grm"; "node_decremental" = "grm";
@ -1599,7 +1561,6 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
# TODO: Show in left pane (either neo-tree or trouble)
trouble = rec { trouble = rec {
name = "trouble"; name = "trouble";
pkg = pkgs.vimPlugins.trouble-nvim; pkg = pkgs.vimPlugins.trouble-nvim;
@ -1608,24 +1569,6 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
# twilight = rec {
# name = "twilight";
# pkg = pkgs.vimPlugins.twilight-nvim;
# config = (mkDefaultConfig name);
# opts = {
# dimming.alpha = 0.75;
# context = 15;
# treesitter = true;
# expand = [
# "function"
# "method"
# "table"
# "if_statement"
# ];
# # exclude = []; # Excluded filetypes
# };
# };
_promise = { _promise = {
name = "promise"; name = "promise";
pkg = pkgs.vimPlugins.promise-async; pkg = pkgs.vimPlugins.promise-async;
@ -1642,13 +1585,6 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
_web-devicons = rec {
name = "nvim-web-devicons";
pkg = pkgs.vimPlugins.nvim-web-devicons;
lazy = true;
config = mkDefaultConfig name;
};
vimtex = { vimtex = {
name = "vimtex"; name = "vimtex";
pkg = pkgs.vimPlugins.vimtex; pkg = pkgs.vimPlugins.vimtex;
@ -1662,6 +1598,8 @@ in {
"-synctex=1", "-synctex=1",
"-interaction=nonstopmode", "-interaction=nonstopmode",
}, },
aux_dir = ".aux",
out_dir = ".out",
} }
end end
''; '';
@ -1672,6 +1610,13 @@ in {
pkg = pkgs.vimPlugins.vim-wakatime; pkg = pkgs.vimPlugins.vim-wakatime;
}; };
web-devicons = rec {
name = "nvim-web-devicons";
pkg = pkgs.vimPlugins.nvim-web-devicons;
lazy = true;
config = mkDefaultConfig name;
};
_mini = { _mini = {
name = "mini"; name = "mini";
pkg = pkgs.vimPlugins.mini-nvim; pkg = pkgs.vimPlugins.mini-nvim;
@ -1705,17 +1650,17 @@ in {
disable_defaults = true; disable_defaults = true;
win_move_mode = { win_move_mode = {
"h" = "left"; h = "left";
"j" = "down"; j = "down";
"k" = "up"; k = "up";
"l" = "right"; l = "right";
}; };
}; };
}; };
}; };
yanky = rec { yanky = rec {
name = "yanky"; # TODO: Bindings name = "yanky";
pkg = pkgs.vimPlugins.yanky-nvim; pkg = pkgs.vimPlugins.yanky-nvim;
lazy = true; lazy = true;
cmd = [ cmd = [
@ -1725,66 +1670,66 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
in [ in [
# autopairs # Automatic closing brackets/parens
# Theme bbye # Delete buffer without closing the window or split
# better-escape # Escape to normal mode using "jk"
catppuccin
_web-devicons
#
# Plugins
#
autopairs
bbye
better-escape
# chadtree # NOTE: Using neo-tree
clangd-extensions clangd-extensions
cmp
# colorizer # blink-cmp # Auto completion popups # TODO: Try this instead of cmp
comment
conform cmp # Auto completion popups
dashboard
diffview # colorizer # Colorize color strings # TODO: Only colorize html/css/scss/sass/js
direnv
flash comment # Toggle line- or block-comments
gitmessenger conform # Auto formatting on save
gitsigns dashboard # Dashboard when starting nvim
haskell-tools
# indent-blankline # NOTE: Too much noise diffview # Git diff # TODO: Check the keybindings
illuminate
# incline # TODO: Bad styling direnv # Automatically load local environments
intellitab flash # Highlight f/F search results
jdtls gitmessenger # Show last git commit for the current line
lastplace gitsigns # Show git line additions/deletions/changes in the gutter
lazygit haskell-tools # Haskell integration
lint illuminate # Highlight usages of word under cursor
lspconfig
lualine # incline # Statuslines for each window # TODO: Bad styling
luasnip
narrow-region intellitab # Indent to the correct level on blanklines
navbuddy jdtls # Eclipse JDT language server integration for Java
neo-tree lastplace # Reopen a file at the last editing position
noice lazygit # Git frontend
oil lint # Lint documents on save
rainbow-delimiters lspconfig # Language server configurations for different languages
rustaceanvim lualine # Status line
sandwich # Manipulate pairs
luasnip # Snippets # TODO: No snippets yet, figure out how to add them. Maybe use luasnip from nixvim
markview # Markdown support
# narrow-region # Open a buffer restricted to the selection
navbuddy # Structural file view
neo-tree # File tree sidebar
noice # Modern UI overhaul, e.g. floating cmdline
obsidian # Integration with Obsidian.md
oil # File manager
rainbow-delimiters # Bracket/Paren colorization
rustaceanvim # Rust integration
sleuth # Heuristically set indent depth sleuth # Heuristically set indent depth
telescope sneak # Like f/F but for two characters
telescope # Option picker frontend
todo-comments # Highlight TODOs todo-comments # Highlight TODOs
toggleterm toggleterm # Integrated terminal
treesitter treesitter # AST based syntax highlighting + indentation
trim # Trim whitespace trim # Trim whitespace
trouble # Diagnostics window trouble # Diagnostics window
# twilight # NOTE: Don't like it
ufo # Code folding ufo # Code folding
vimtex vimtex # LaTeX support
wakatime wakatime # Time tracking
which-key web-devicons
which-key # Live keybinding help
winshift # Move windows around winshift # Move windows around
yanky yanky # Clipboard history
]; ];
}; };
}; };

View File

@ -1,4 +1,18 @@
{...}: let {...}: let
disabled-mappings = let
mkDisabledMapping = mapping: {
key = mapping;
action = "<Nop>";
};
disableMappings = [
# I only use f and F together with flash.nvim and s and S with sneak
"t"
"T"
];
in
builtins.map mkDisabledMapping disableMappings;
no-leader = [ no-leader = [
# Cursor movement # Cursor movement
{ {
@ -199,20 +213,18 @@
action = "\"+y"; action = "\"+y";
options.desc = "Copy"; options.desc = "Copy";
} }
{
# Flash/Search mode = "n";
# { key = "<C-p>";
# mode = "n"; action = "<cmd>YankyRingHistory<cr>";
# key = "s"; options.desc = "Paste (Yanky)";
# action = "<cmd>lua require('flash').jump()<cr>"; }
# options.desc = "Flash jump"; {
# } mode = "n";
# { key = "<C-S-p>";
# mode = "n"; action = "<cmd>YankyClearHistory<cr>";
# key = "S"; options.desc = "Clear Yanky History";
# action = "<cmd>lua require('flash').treesitter()<cr>"; }
# options.desc = "Flash Treesitter";
# }
# Various # Various
{ {
@ -221,27 +233,18 @@
action = "<cmd>nohlsearch<cr>"; action = "<cmd>nohlsearch<cr>";
options.desc = "Clear Search Highlights"; options.desc = "Clear Search Highlights";
} }
{ {
mode = "n"; mode = "n";
key = "K"; key = "K";
action = "<cmd>lua vim.lsp.buf.hover()<cr>"; action = "<cmd>lua vim.lsp.buf.hover()<cr>";
options.desc = "LSP Hover"; options.desc = "LSP Hover";
} }
{ {
mode = "n"; mode = "n";
key = "/"; key = "/";
action = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; action = "<cmd>Telescope current_buffer_fuzzy_find<cr>";
options.desc = "Grep Buffer"; options.desc = "Grep Buffer";
} }
# {
# mode = "v";
# key = ";";
# action = "<Esc>";
# options.desc = "Exit visual mode";
# }
]; ];
leader = [ leader = [
@ -251,32 +254,6 @@
action = "<cmd>Lazy<cr>"; action = "<cmd>Lazy<cr>";
options.desc = "Lazy"; options.desc = "Lazy";
} }
# 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";
key = "<leader>R";
action = "<cmd>edit!<cr>";
options.desc = "Reload Buffer";
}
{
mode = "n";
key = "<leader><Space>";
action = "<cmd>Telescope buffers<cr>";
options.desc = "List Buffers";
}
{ {
mode = "n"; mode = "n";
key = "<leader>f"; key = "<leader>f";
@ -337,6 +314,12 @@
action = "<cmd>Telescope live_grep<cr>"; action = "<cmd>Telescope live_grep<cr>";
options.desc = "Grep Directory"; options.desc = "Grep Directory";
} }
{
mode = "n";
key = "<leader>o";
action = "<cmd>ObsidianSearch<cr>";
options.desc = "Obsidian Note";
}
]; ];
leader-help = [ leader-help = [
@ -426,9 +409,21 @@
{ {
mode = "n"; mode = "n";
key = "<leader>bb"; key = "<leader>bb";
action = "<cmd>Telescope buffers sort_mru=true<cr>"; # There is also sort_lastused=true action = "<cmd>Telescope buffers sort_lastused=true<cr>"; # There is also sort_mru=true
options.desc = "List Buffers"; options.desc = "List Buffers";
} }
{
mode = "n";
key = "<leader><Space>";
action = "<cmd>Telescope buffers sort_lastused=true<cr>";
options.desc = "List Buffers";
}
{
mode = "n";
key = "<leader>R";
action = "<cmd>edit!<cr>";
options.desc = "Reload Buffer";
}
{ {
mode = "n"; mode = "n";
key = "<leader>bn"; key = "<leader>bn";
@ -539,12 +534,6 @@
action = "<cmd>Oil<cr>"; action = "<cmd>Oil<cr>";
options.desc = "Oil"; options.desc = "Oil";
} }
# {
# mode = "n";
# key = "<leader>tt";
# action = "<cmd>CHADopen --nofocus<cr>";
# options.desc = "Toggle CHADtree";
# }
{ {
mode = "n"; mode = "n";
key = "<leader>tn"; key = "<leader>tn";
@ -751,6 +740,8 @@
]; ];
in in
builtins.concatLists [ builtins.concatLists [
disabled-mappings
no-leader no-leader
leader leader
leader-help leader-help