refactor!: use a new keymaps configuration format

This commit is contained in:
n3oney 2023-04-10 13:42:31 +02:00
parent 85c3c250f6
commit a54216006d
No known key found for this signature in database
GPG key ID: C786693DE727850E
11 changed files with 343 additions and 182 deletions

View file

@ -10,21 +10,51 @@ in {
config = { config = {
vim.startPlugins = ["plenary-nvim"]; vim.startPlugins = ["plenary-nvim"];
vim.nmap = mkIf cfg.disableArrows { vim.maps.normal =
"<up>" = "<nop>"; mkIf cfg.disableArrows {
"<down>" = "<nop>"; "<up>" = {
"<left>" = "<nop>"; action = "<nop>";
"<right>" = "<nop>";
};
vim.imap = mkIf cfg.disableArrows { noremap = false;
"<up>" = "<nop>"; };
"<down>" = "<nop>"; "<down>" = {
"<left>" = "<nop>"; action = "<nop>";
"<right>" = "<nop>";
};
vim.nnoremap = mkIf cfg.mapLeaderSpace {"<space>" = "<nop>";}; noremap = false;
};
"<left>" = {
action = "<nop>";
noremap = false;
};
"<right>" = {
action = "<nop>";
noremap = false;
};
}
// mkIf cfg.mapLeaderSpace {
"<space>" = {
action = "<nop>";
};
};
vim.maps.insert = mkIf cfg.disableArrows {
"<up>" = {
action = "<nop>";
noremap = false;
};
"<down>" = {
action = "<nop>";
noremap = false;
};
"<left>" = {
action = "<nop>";
noremap = false;
};
"<right>" = {
action = "<nop>";
noremap = false;
};
};
vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] '' vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] ''
" Debug mode settings " Debug mode settings

View file

@ -19,6 +19,107 @@ with builtins; let
type = with types; attrsOf (nullOr str); type = with types; attrsOf (nullOr str);
} }
// it); // it);
mkBool = value: description:
mkOption {
type = types.bool;
default = value;
description = description;
};
# Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you!
mapConfigOptions = {
silent =
mkBool false
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
nowait =
mkBool false
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
script =
mkBool false
"Equivalent to adding <script> to a map.";
expr =
mkBool false
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
unique =
mkBool false
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
noremap =
mkBool true
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
desc = mkOption {
type = types.nullOr types.str;
default = null;
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
};
};
genMaps = mode: maps: let
/*
Take a user-defined action (string or attrs) and return the following attribute set:
{
action = (string) the actual action to map to this key
config = (attrs) the configuration options for this mapping (noremap, silent...)
}
*/
normalizeAction = action: let
# Extract the values of the config options that have been explicitly set by the user
config =
filterAttrs (n: v: v != null)
(getAttrs (attrNames mapConfigOptions) action);
in {
config =
if config == {}
then {"__empty" = null;}
else config;
action =
if action.lua
then {"__raw" = action.action;}
else action.action;
};
in
builtins.attrValues (builtins.mapAttrs
(key: action: let
normalizedAction = normalizeAction action;
in {
inherit (normalizedAction) action config;
key = key;
mode = mode;
})
maps);
mapOption = types.submodule {
options =
mapConfigOptions
// {
action = mkOption {
type = types.str;
description = "The action to execute.";
};
lua = mkOption {
type = types.bool;
description = ''
If true, `action` is considered to be lua code.
Thus, it will not be wrapped in `""`.
'';
default = false;
};
};
};
mapOptions = mode:
mkOption {
description = "Mappings for ${mode} mode";
type = types.attrsOf mapOption;
default = {};
};
in { in {
options.vim = { options.vim = {
viAlias = mkOption { viAlias = mkOption {
@ -67,64 +168,39 @@ in {
type = types.attrs; type = types.attrs;
}; };
nnoremap = maps = mkOption {
mkMappingOption {description = "Defines 'Normal mode' mappings";}; type = types.submodule {
options = {
normal = mapOptions "normal";
insert = mapOptions "insert";
select = mapOptions "select";
visual = mapOptions "visual and select";
terminal = mapOptions "terminal";
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
inoremap = mkMappingOption { visualOnly = mapOptions "visual only";
description = "Defines 'Insert and Replace mode' mappings"; operator = mapOptions "operator-pending";
}; insertCommand = mapOptions "insert and command-line";
lang = mapOptions "insert, command-line and lang-arg";
command = mapOptions "command-line";
};
};
default = {};
description = ''
Custom keybindings for any mode.
vnoremap = mkMappingOption { For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp.
description = "Defines 'Visual and Select mode' mappings"; '';
};
xnoremap = example = ''
mkMappingOption {description = "Defines 'Visual mode' mappings";}; maps = {
normalVisualOp.";" = ":"; # Same as noremap ; :
snoremap = normal."<leader>m" = {
mkMappingOption {description = "Defines 'Select mode' mappings";}; silent = true;
action = "<cmd>make<CR>";
cnoremap = }; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
mkMappingOption {description = "Defines 'Command-line mode' mappings";}; };
'';
onoremap = mkMappingOption {
description = "Defines 'Operator pending mode' mappings";
};
tnoremap = mkMappingOption {
description = "Defines 'Terminal mode' mappings";
};
nmap = mkMappingOption {
description = "Defines 'Normal mode' mappings";
};
imap = mkMappingOption {
description = "Defines 'Insert and Replace mode' mappings";
};
vmap = mkMappingOption {
description = "Defines 'Visual and Select mode' mappings";
};
xmap = mkMappingOption {
description = "Defines 'Visual mode' mappings";
};
smap = mkMappingOption {
description = "Defines 'Select mode' mappings";
};
cmap = mkMappingOption {
description = "Defines 'Command-line mode' mappings";
};
omap = mkMappingOption {
description = "Defines 'Operator pending mode' mappings";
};
tmap = mkMappingOption {
description = "Defines 'Terminal mode' mappings";
}; };
}; };
@ -148,34 +224,66 @@ in {
mapAttrsFlatten (name: value: "let g:${name}=${valToVim value}") mapAttrsFlatten (name: value: "let g:${name}=${valToVim value}")
(filterNonNull cfg.globals); (filterNonNull cfg.globals);
matchCtrl = it: match "Ctrl-(.)(.*)" it; toLuaObject = args:
mapKeyBinding = it: let if builtins.isAttrs args
groups = matchCtrl it; then
in if hasAttr "__raw" args
if groups == null then args.__raw
then it else if hasAttr "__empty" args
else "<C-${toUpper (head groups)}>${head (tail groups)}"; then "{ }"
mapVimBinding = prefix: mappings: else
mapAttrsFlatten (name: value: "${prefix} ${mapKeyBinding name} ${value}") "{"
(filterNonNull mappings); + (concatStringsSep ","
(mapAttrsToList
(n: v:
if head (stringToCharacters n) == "@"
then toLuaObject v
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(
n: v:
!isNull v && (toLuaObject v != "{}")
)
args)))
+ "}"
else if builtins.isList args
then "{" + concatMapStringsSep "," toLuaObject args + "}"
else if builtins.isString args
then
# This should be enough!
builtins.toJSON args
else if builtins.isPath args
then builtins.toJSON (toString args)
else if builtins.isBool args
then "${boolToString args}"
else if builtins.isFloat args
then "${toString args}"
else if builtins.isInt args
then "${toString args}"
else if isNull args
then "nil"
else "";
nmap = mapVimBinding "nmap" config.vim.nmap; toLuaBindings = mode: maps:
imap = mapVimBinding "imap" config.vim.imap; builtins.map (value: ''
vmap = mapVimBinding "vmap" config.vim.vmap; map("${mode}", "${value.key}", ${
xmap = mapVimBinding "xmap" config.vim.xmap; if value.action ? "__raw"
smap = mapVimBinding "smap" config.vim.smap; then value.action."__raw"
cmap = mapVimBinding "cmap" config.vim.cmap; else "\"${value.action}\""
omap = mapVimBinding "omap" config.vim.omap; }, ${toLuaObject value.config})'') (genMaps mode maps);
tmap = mapVimBinding "tmap" config.vim.tmap;
nnoremap = mapVimBinding "nnoremap" config.vim.nnoremap; # I'm not sure if every one of these will work.
inoremap = mapVimBinding "inoremap" config.vim.inoremap; allmap = toLuaBindings "" config.vim.maps.normalVisualOp;
vnoremap = mapVimBinding "vnoremap" config.vim.vnoremap; nmap = toLuaBindings "n" config.vim.maps.normal;
xnoremap = mapVimBinding "xnoremap" config.vim.xnoremap; vmap = toLuaBindings "v" config.vim.maps.visual;
snoremap = mapVimBinding "snoremap" config.vim.snoremap; xmap = toLuaBindings "x" config.vim.maps.visualOnly;
cnoremap = mapVimBinding "cnoremap" config.vim.cnoremap; smap = toLuaBindings "s" config.vim.maps.select;
onoremap = mapVimBinding "onoremap" config.vim.onoremap; imap = toLuaBindings "u" config.vim.maps.insert;
tnoremap = mapVimBinding "tnoremap" config.vim.tnoremap; cmap = toLuaBindings "c" config.vim.maps.command;
tmap = toLuaBindings "t" config.vim.maps.terminal;
lmap = toLuaBindings "l" config.vim.maps.lang;
omap = toLuaBindings "o" config.vim.maps.operator;
icmap = toLuaBindings "ic" config.vim.maps.insertCommand;
resolveDag = { resolveDag = {
name, name,
@ -209,8 +317,31 @@ in {
nvim.dag.entryAfter ["globalsScript"] luaConfig; nvim.dag.entryAfter ["globalsScript"] luaConfig;
mappings = let mappings = let
maps = [nmap imap vmap xmap smap cmap omap tmap nnoremap inoremap vnoremap xnoremap snoremap cnoremap onoremap tnoremap]; maps = [
mapConfig = concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps); (splitString
"\n"
''
local function map(mode, lhs, rhs, opts)
local options = { noremap=true, silent=true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
'')
nmap
imap
vmap
xmap
smap
cmap
omap
tmap
lmap
icmap
allmap
];
mapConfig = wrapLuaConfig (concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps));
in in
nvim.dag.entryAfter ["globalsScript"] mapConfig; nvim.dag.entryAfter ["globalsScript"] mapConfig;
}; };

View file

@ -10,34 +10,34 @@ in {
config = mkIf (cfg.enable && cfg.lspsaga.enable) { config = mkIf (cfg.enable && cfg.lspsaga.enable) {
vim.startPlugins = ["lspsaga"]; vim.startPlugins = ["lspsaga"];
vim.vnoremap = { vim.maps.visual = {
"<silent><leader>ca" = ":<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>"; "<silent><leader>ca" = {action = ":<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>";};
}; };
vim.nnoremap = vim.maps.normal =
{ {
"<silent><leader>lf" = "<cmd>lua require'lspsaga.provider'.lsp_finder()<CR>"; "<silent><leader>lf" = {action = "<cmd>lua require'lspsaga.provider'.lsp_finder()<CR>";};
"<silent><leader>lh" = "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>"; "<silent><leader>lh" = {action = "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>";};
"<silent><C-f>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>"; "<silent><C-f>" = {action = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>";};
"<silent><C-b>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>"; "<silent><C-b>" = {action = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>";};
"<silent><leader>lr" = "<cmd>lua require'lspsaga.rename'.rename()<CR>"; "<silent><leader>lr" = {action = "<cmd>lua require'lspsaga.rename'.rename()<CR>";};
"<silent><leader>ld" = "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>"; "<silent><leader>ld" = {action = "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>";};
"<silent><leader>ll" = "<cmd>lua require'lspsaga.diagnostic'.show_line_diagnostics()<CR>"; "<silent><leader>ll" = {action = "<cmd>lua require'lspsaga.diagnostic'.show_line_diagnostics()<CR>";};
"<silent><leader>lc" = "<cmd>lua require'lspsaga.diagnostic'.show_cursor_diagnostics()<CR>"; "<silent><leader>lc" = {action = "<cmd>lua require'lspsaga.diagnostic'.show_cursor_diagnostics()<CR>";};
"<silent><leader>lp" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_prev()<CR>"; "<silent><leader>lp" = {action = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_prev()<CR>";};
"<silent><leader>ln" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_next()<CR>"; "<silent><leader>ln" = {action = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_next()<CR>";};
} }
// ( // (
if (!cfg.nvimCodeActionMenu.enable) if (!cfg.nvimCodeActionMenu.enable)
then { then {
"<silent><leader>ca" = "<cmd>lua require('lspsaga.codeaction').code_action()<CR>"; "<silent><leader>ca" = {action = "<cmd>lua require('lspsaga.codeaction').code_action()<CR>";};
} }
else {} else {}
) )
// ( // (
if (!cfg.lspSignature.enable) if (!cfg.lspSignature.enable)
then { then {
"<silent><leader>ls" = "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>"; "<silent><leader>ls" = {action = "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>";};
} }
else {} else {}
); );

View file

@ -12,34 +12,34 @@ in {
config = mkIf (cfg.enable && cfg.lspsaga.enable) { config = mkIf (cfg.enable && cfg.lspsaga.enable) {
vim.startPlugins = ["lspsaga"]; vim.startPlugins = ["lspsaga"];
vim.vnoremap = { vim.maps.visual = {
"<silent><leader>ca" = ":<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>"; "<silent><leader>ca" = {action = ":<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>";};
}; };
vim.nnoremap = vim.maps.normal =
{ {
"<silent><leader>lf" = "<cmd>lua require'lspsaga.provider'.lsp_finder()<CR>"; "<silent><leader>lf" = {action = "<cmd>lua require'lspsaga.provider'.lsp_finder()<CR>";};
"<silent><leader>lh" = "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>"; "<silent><leader>lh" = {action = "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>";};
"<silent><C-f>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>"; "<silent><C-f>" = {action = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>";};
"<silent><C-b>" = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>"; "<silent><C-b>" = {action = "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>";};
"<silent><leader>lr" = "<cmd>lua require'lspsaga.rename'.rename()<CR>"; "<silent><leader>lr" = {action = "<cmd>lua require'lspsaga.rename'.rename()<CR>";};
"<silent><leader>ld" = "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>"; "<silent><leader>ld" = {action = "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>";};
"<silent><leader>ll" = "<cmd>lua require'lspsaga.diagnostic'.show_line_diagnostics()<CR>"; "<silent><leader>ll" = {action = "<cmd>lua require'lspsaga.diagnostic'.show_line_diagnostics()<CR>";};
"<silent><leader>lc" = "<cmd>lua require'lspsaga.diagnostic'.show_cursor_diagnostics()<CR>"; "<silent><leader>lc" = {action = "<cmd>lua require'lspsaga.diagnostic'.show_cursor_diagnostics()<CR>";};
"<silent><leader>lp" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_prev()<CR>"; "<silent><leader>lp" = {action = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_prev()<CR>";};
"<silent><leader>ln" = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_next()<CR>"; "<silent><leader>ln" = {action = "<cmd>lua require'lspsaga.diagnostic'.lsp_jump_diagnostic_next()<CR>";};
} }
// ( // (
if (!cfg.nvimCodeActionMenu.enable) if (!cfg.nvimCodeActionMenu.enable)
then { then {
"<silent><leader>ca" = "<cmd>lua require('lspsaga.codeaction').code_action()<CR>"; "<silent><leader>ca" = {action = "<cmd>lua require('lspsaga.codeaction').code_action()<CR>";};
} }
else {} else {}
) )
// ( // (
if (!cfg.lspSignature.enable) if (!cfg.lspSignature.enable)
then { then {
"<silent><leader>ls" = "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>"; "<silent><leader>ls" = {action = "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>";};
} }
else {} else {}
); );

View file

@ -10,8 +10,8 @@ in {
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
vim.startPlugins = ["nvim-code-action-menu"]; vim.startPlugins = ["nvim-code-action-menu"];
vim.nnoremap = { vim.maps.normal = {
"<silent><leader>ca" = ":CodeActionMenu<CR>"; "<silent><leader>ca" = {action = ":CodeActionMenu<CR>";};
}; };
}; };
} }

View file

@ -10,13 +10,13 @@ in {
config = mkIf (cfg.enable && cfg.trouble.enable) { config = mkIf (cfg.enable && cfg.trouble.enable) {
vim.startPlugins = ["trouble"]; vim.startPlugins = ["trouble"];
vim.nnoremap = { vim.maps.normal = {
"<leader>xx" = "<cmd>TroubleToggle<CR>"; "<leader>xx" = {action = "<cmd>TroubleToggle<CR>";};
"<leader>lwd" = "<cmd>TroubleToggle workspace_diagnostics<CR>"; "<leader>lwd" = {action = "<cmd>TroubleToggle workspace_diagnostics<CR>";};
"<leader>ld" = "<cmd>TroubleToggle document_diagnostics<CR>"; "<leader>ld" = {action = "<cmd>TroubleToggle document_diagnostics<CR>";};
"<leader>lr" = "<cmd>TroubleToggle lsp_references<CR>"; "<leader>lr" = {action = "<cmd>TroubleToggle lsp_references<CR>";};
"<leader>xq" = "<cmd>TroubleToggle quickfix<CR>"; "<leader>xq" = {action = "<cmd>TroubleToggle quickfix<CR>";};
"<leader>xl" = "<cmd>TroubleToggle loclist<CR>"; "<leader>xl" = {action = "<cmd>TroubleToggle loclist<CR>";};
}; };
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere '' vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''

View file

@ -12,10 +12,10 @@ in {
"mind-nvim" "mind-nvim"
]; ];
vim.nnoremap = { vim.maps.normal = {
"<leader>om" = ":MindOpenMain<CR>"; "<leader>om" = {action = ":MindOpenMain<CR>";};
"<leader>op" = ":MindOpenProject<CR>"; "<leader>op" = {action = ":MindOpenProject<CR>";};
"<leader>oc" = ":MindClose<CR>"; "<leader>oc" = {action = ":MindClose<CR>";};
}; };
vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere '' vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere ''

View file

@ -13,10 +13,10 @@ in {
"todo-comments" "todo-comments"
]; ];
vim.nnoremap = { vim.maps.normal = {
"<leader>tdq" = ":TodoQuickFix<CR>"; "<leader>tdq" = {action = ":TodoQuickFix<CR>";};
"<leader>tds" = ":TodoTelescope<CR>"; "<leader>tds" = {action = ":TodoTelescope<CR>";};
"<leader>tdt" = ":TodoTrouble<CR>"; "<leader>tdt" = {action = ":TodoTrouble<CR>";};
}; };
vim.luaConfigRC.todo-comments = '' vim.luaConfigRC.todo-comments = ''

View file

@ -23,24 +23,24 @@ in {
"bufdelete-nvim" "bufdelete-nvim"
]; ];
vim.nnoremap = { vim.maps.normal = {
"<silent><leader>bn" = ":BufferLineCycleNext<CR>"; "<silent><leader>bn" = {action = ":BufferLineCycleNext<CR>";};
"<silent><leader>bp" = ":BufferLineCyclePrev<CR>"; "<silent><leader>bp" = {action = ":BufferLineCyclePrev<CR>";};
"<silent><leader>bc" = ":BufferLinePick<CR>"; "<silent><leader>bc" = {action = ":BufferLinePick<CR>";};
"<silent><leader>bse" = ":BufferLineSortByExtension<CR>"; "<silent><leader>bse" = {action = ":BufferLineSortByExtension<CR>";};
"<silent><leader>bsd" = ":BufferLineSortByDirectory<CR>"; "<silent><leader>bsd" = {action = ":BufferLineSortByDirectory<CR>";};
"<silent><leader>bsi" = ":lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)<CR>"; "<silent><leader>bsi" = {action = ":lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)<CR>";};
"<silent><leader>bmn" = ":BufferLineMoveNext<CR>"; "<silent><leader>bmn" = {action = ":BufferLineMoveNext<CR>";};
"<silent><leader>bmp" = ":BufferLineMovePrev<CR>"; "<silent><leader>bmp" = {action = ":BufferLineMovePrev<CR>";};
"<silent><leader>b1" = "<Cmd>BufferLineGoToBuffer 1<CR>"; "<silent><leader>b1" = {action = "<Cmd>BufferLineGoToBuffer 1<CR>";};
"<silent><leader>b2" = "<Cmd>BufferLineGoToBuffer 2<CR>"; "<silent><leader>b2" = {action = "<Cmd>BufferLineGoToBuffer 2<CR>";};
"<silent><leader>b3" = "<Cmd>BufferLineGoToBuffer 3<CR>"; "<silent><leader>b3" = {action = "<Cmd>BufferLineGoToBuffer 3<CR>";};
"<silent><leader>b4" = "<Cmd>BufferLineGoToBuffer 4<CR>"; "<silent><leader>b4" = {action = "<Cmd>BufferLineGoToBuffer 4<CR>";};
"<silent><leader>b5" = "<Cmd>BufferLineGoToBuffer 5<CR>"; "<silent><leader>b5" = {action = "<Cmd>BufferLineGoToBuffer 5<CR>";};
"<silent><leader>b6" = "<Cmd>BufferLineGoToBuffer 6<CR>"; "<silent><leader>b6" = {action = "<Cmd>BufferLineGoToBuffer 6<CR>";};
"<silent><leader>b7" = "<Cmd>BufferLineGoToBuffer 7<CR>"; "<silent><leader>b7" = {action = "<Cmd>BufferLineGoToBuffer 7<CR>";};
"<silent><leader>b8" = "<Cmd>BufferLineGoToBuffer 8<CR>"; "<silent><leader>b8" = {action = "<Cmd>BufferLineGoToBuffer 8<CR>";};
"<silent><leader>b9" = "<Cmd>BufferLineGoToBuffer 9<CR>"; "<silent><leader>b9" = {action = "<Cmd>BufferLineGoToBuffer 9<CR>";};
}; };
vim.luaConfigRC.nvimBufferline = nvim.dag.entryAnywhere '' vim.luaConfigRC.nvimBufferline = nvim.dag.entryAnywhere ''

View file

@ -9,8 +9,8 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = ["hop-nvim"]; vim.startPlugins = ["hop-nvim"];
vim.nnoremap = { vim.maps.normal."<leader>h" = {
"<leader>h" = "<cmd> HopPattern<CR>"; action = "<cmd> HopPattern<CR>";
}; };
vim.luaConfigRC.hop-nvim = nvim.dag.entryAnywhere '' vim.luaConfigRC.hop-nvim = nvim.dag.entryAnywhere ''

View file

@ -13,38 +13,38 @@ in {
"telescope" "telescope"
]; ];
vim.nnoremap = vim.maps.normal =
{ {
"<leader>ff" = "<cmd> Telescope find_files<CR>"; "<leader>ff" = {action = "<cmd> Telescope find_files<CR>";};
"<leader>fg" = "<cmd> Telescope live_grep<CR>"; "<leader>fg" = {action = "<cmd> Telescope live_grep<CR>";};
"<leader>fb" = "<cmd> Telescope buffers<CR>"; "<leader>fb" = {action = "<cmd> Telescope buffers<CR>";};
"<leader>fh" = "<cmd> Telescope help_tags<CR>"; "<leader>fh" = {action = "<cmd> Telescope help_tags<CR>";};
"<leader>ft" = "<cmd> Telescope<CR>"; "<leader>ft" = {action = "<cmd> Telescope<CR>";};
"<leader>fvcw" = "<cmd> Telescope git_commits<CR>"; "<leader>fvcw" = {action = "<cmd> Telescope git_commits<CR>";};
"<leader>fvcb" = "<cmd> Telescope git_bcommits<CR>"; "<leader>fvcb" = {action = "<cmd> Telescope git_bcommits<CR>";};
"<leader>fvb" = "<cmd> Telescope git_branches<CR>"; "<leader>fvb" = {action = "<cmd> Telescope git_branches<CR>";};
"<leader>fvs" = "<cmd> Telescope git_status<CR>"; "<leader>fvs" = {action = "<cmd> Telescope git_status<CR>";};
"<leader>fvx" = "<cmd> Telescope git_stash<CR>"; "<leader>fvx" = {action = "<cmd> Telescope git_stash<CR>";};
} }
// ( // (
if config.vim.lsp.enable if config.vim.lsp.enable
then { then {
"<leader>flsb" = "<cmd> Telescope lsp_document_symbols<CR>"; "<leader>flsb" = {action = "<cmd> Telescope lsp_document_symbols<CR>";};
"<leader>flsw" = "<cmd> Telescope lsp_workspace_symbols<CR>"; "<leader>flsw" = {action = "<cmd> Telescope lsp_workspace_symbols<CR>";};
"<leader>flr" = "<cmd> Telescope lsp_references<CR>"; "<leader>flr" = {action = "<cmd> Telescope lsp_references<CR>";};
"<leader>fli" = "<cmd> Telescope lsp_implementations<CR>"; "<leader>fli" = {action = "<cmd> Telescope lsp_implementations<CR>";};
"<leader>flD" = "<cmd> Telescope lsp_definitions<CR>"; "<leader>flD" = {action = "<cmd> Telescope lsp_definitions<CR>";};
"<leader>flt" = "<cmd> Telescope lsp_type_definitions<CR>"; "<leader>flt" = {action = "<cmd> Telescope lsp_type_definitions<CR>";};
"<leader>fld" = "<cmd> Telescope diagnostics<CR>"; "<leader>fld" = {action = "<cmd> Telescope diagnostics<CR>";};
} }
else {} else {}
) )
// ( // (
if config.vim.treesitter.enable if config.vim.treesitter.enable
then { then {
"<leader>fs" = "<cmd> Telescope treesitter<CR>"; "<leader>fs" = {action = "<cmd> Telescope treesitter<CR>";};
} }
else {} else {}
); );