mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
utility/smart-splits: init
This commit is contained in:
parent
77a32f0961
commit
d6d569c53e
6 changed files with 101 additions and 0 deletions
|
@ -191,6 +191,7 @@ isMaximal: {
|
||||||
surround.enable = isMaximal;
|
surround.enable = isMaximal;
|
||||||
leetcode-nvim.enable = isMaximal;
|
leetcode-nvim.enable = isMaximal;
|
||||||
multicursors.enable = isMaximal;
|
multicursors.enable = isMaximal;
|
||||||
|
smart-splits.enable = isMaximal;
|
||||||
|
|
||||||
motion = {
|
motion = {
|
||||||
hop.enable = true;
|
hop.enable = true;
|
||||||
|
|
|
@ -431,5 +431,10 @@
|
||||||
[lackac](https://github.com/lackac):
|
[lackac](https://github.com/lackac):
|
||||||
|
|
||||||
[solarized.nvim]: https://github.com/maxmx03/solarized.nvim
|
[solarized.nvim]: https://github.com/maxmx03/solarized.nvim
|
||||||
|
[smart-splits.nvim]: https://github.com/mrjones2014/smart-splits.nvim
|
||||||
|
|
||||||
- Add [solarized.nvim] theme with support for multiple variants
|
- Add [solarized.nvim] theme with support for multiple variants
|
||||||
|
|
||||||
|
- Add [smart-splits.nvim] for navigating between Neovim windows and terminal multiplexer panes.
|
||||||
|
Available at `vim.utility.smart-splits`.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
./outline
|
./outline
|
||||||
./preview
|
./preview
|
||||||
./sleuth
|
./sleuth
|
||||||
|
./smart-splits
|
||||||
./snacks-nvim
|
./snacks-nvim
|
||||||
./surround
|
./surround
|
||||||
./telescope
|
./telescope
|
||||||
|
|
51
modules/plugins/utility/smart-splits/config.nix
Normal file
51
modules/plugins/utility/smart-splits/config.nix
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.smart-splits;
|
||||||
|
inherit (options.vim.utility.smart-splits) keymaps;
|
||||||
|
mkSmartSplitKey = act: let
|
||||||
|
key = cfg.keymaps.${act};
|
||||||
|
in
|
||||||
|
lib.optional (key != null) {
|
||||||
|
inherit key;
|
||||||
|
desc = keymaps.${act}.description;
|
||||||
|
action = ''function() require('smart-splits').${act}() end'';
|
||||||
|
mode = "n";
|
||||||
|
lua = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.lazy.plugins = {
|
||||||
|
${pkgs.vimPlugins.smart-splits-nvim.pname} = {
|
||||||
|
package = pkgs.vimPlugins.smart-splits-nvim;
|
||||||
|
setupModule = "smart-splits";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
# plugin needs to be loaded right after startup so that the multiplexer detects vim running in the pane
|
||||||
|
event = ["DeferredUIEnter"];
|
||||||
|
|
||||||
|
keys = lib.flatten [
|
||||||
|
(mkSmartSplitKey "resize_left")
|
||||||
|
(mkSmartSplitKey "resize_down")
|
||||||
|
(mkSmartSplitKey "resize_up")
|
||||||
|
(mkSmartSplitKey "resize_right")
|
||||||
|
(mkSmartSplitKey "move_cursor_left")
|
||||||
|
(mkSmartSplitKey "move_cursor_down")
|
||||||
|
(mkSmartSplitKey "move_cursor_up")
|
||||||
|
(mkSmartSplitKey "move_cursor_right")
|
||||||
|
(mkSmartSplitKey "move_cursor_previous")
|
||||||
|
(mkSmartSplitKey "swap_buf_left")
|
||||||
|
(mkSmartSplitKey "swap_buf_down")
|
||||||
|
(mkSmartSplitKey "swap_buf_up")
|
||||||
|
(mkSmartSplitKey "swap_buf_right")
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/utility/smart-splits/default.nix
Normal file
6
modules/plugins/utility/smart-splits/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./smart-splits.nix
|
||||||
|
];
|
||||||
|
}
|
37
modules/plugins/utility/smart-splits/smart-splits.nix
Normal file
37
modules/plugins/utility/smart-splits/smart-splits.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.smart-splits = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable smart-splits.nvim, a Neovim plugin for smart,
|
||||||
|
seamless, directional navigation and resizing of splits.
|
||||||
|
|
||||||
|
Supports tmux, Wezterm, Kitty, and Zellij multiplexer integrations.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "smart-splits" {};
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
resize_left = mkMappingOption "Resize Window/Pane Left" "<A-h>";
|
||||||
|
resize_down = mkMappingOption "Resize Window/Pane Down" "<A-j>";
|
||||||
|
resize_up = mkMappingOption "Resize Window/Pane Up" "<A-k>";
|
||||||
|
resize_right = mkMappingOption "Resize Window/Pane Right" "<A-l>";
|
||||||
|
move_cursor_left = mkMappingOption "Focus Window/Pane on the Left" "<C-h>";
|
||||||
|
move_cursor_down = mkMappingOption "Focus Window/Pane Below" "<C-j>";
|
||||||
|
move_cursor_up = mkMappingOption "Focus Window/Pane Above" "<C-k>";
|
||||||
|
move_cursor_right = mkMappingOption "Focus Window/Pane on the Right" "<C-l>";
|
||||||
|
move_cursor_previous = mkMappingOption "Focus Previous Window/Pane" "<C-\\>";
|
||||||
|
swap_buf_left = mkMappingOption "Swap Buffer Left" "<leader><leader>h";
|
||||||
|
swap_buf_down = mkMappingOption "Swap Buffer Down" "<leader><leader>j";
|
||||||
|
swap_buf_up = mkMappingOption "Swap Buffer Up" "<leader><leader>k";
|
||||||
|
swap_buf_right = mkMappingOption "Swap Buffer Right" "<leader><leader>l";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue