mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
feat: add codewindow keybindings
This commit is contained in:
parent
dce3d762d9
commit
25c9bb0962
2 changed files with 22 additions and 10 deletions
|
@ -1,11 +1,13 @@
|
||||||
{
|
{lib, ...}:
|
||||||
config,
|
with lib; {
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
with builtins; {
|
|
||||||
options.vim.minimap.codewindow = {
|
options.vim.minimap.codewindow = {
|
||||||
enable = mkEnableOption "Enable codewindow plugin for minimap view";
|
enable = mkEnableOption "Enable codewindow plugin for minimap view";
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
open = mkMappingOption "Open minimap [codewindow]" "<leader>mo";
|
||||||
|
close = mkMappingOption "Close minimap [codewindow]" "<leader>mc";
|
||||||
|
toggle = mkMappingOption "Toggle minimap [codewindow]" "<leader>mm";
|
||||||
|
toggleFocus = mkMappingOption "Toggle minimap focus [codewindow]" "<leader>mf";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,29 @@
|
||||||
with lib;
|
with lib;
|
||||||
with builtins; let
|
with builtins; let
|
||||||
cfg = config.vim.minimap.codewindow;
|
cfg = config.vim.minimap.codewindow;
|
||||||
|
|
||||||
|
self = import ./codewindow.nix {inherit lib;};
|
||||||
|
|
||||||
|
mappingDefinitions = self.options.vim.minimap.codewindow.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
"codewindow-nvim"
|
"codewindow-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
vim.maps.normal = mkMerge [
|
||||||
|
(mkSetLuaBinding mappings.open "require('codewindow').open_minimap")
|
||||||
|
(mkSetLuaBinding mappings.close "require('codewindow').close_minimap")
|
||||||
|
(mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap")
|
||||||
|
(mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus")
|
||||||
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere ''
|
||||||
local codewindow = require('codewindow')
|
local codewindow = require('codewindow')
|
||||||
codewindow.setup({
|
codewindow.setup({
|
||||||
exclude_filetypes = { 'NvimTree', 'orgagenda'},
|
exclude_filetypes = { 'NvimTree', 'orgagenda'},
|
||||||
}
|
})
|
||||||
)
|
|
||||||
codewindow.apply_default_keybinds()
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue