mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +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 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
{lib, ...}:
|
||||
with lib; {
|
||||
options.vim.minimap.codewindow = {
|
||||
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 builtins; let
|
||||
cfg = config.vim.minimap.codewindow;
|
||||
|
||||
self = import ./codewindow.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.minimap.codewindow.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"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 ''
|
||||
local codewindow = require('codewindow')
|
||||
codewindow.setup({
|
||||
exclude_filetypes = { 'NvimTree', 'orgagenda'},
|
||||
}
|
||||
)
|
||||
codewindow.apply_default_keybinds()
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue