mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 09:48:42 +02:00
plugins/tmux-navigator: init + tests (#314)
This commit is contained in:
parent
35c56b62a1
commit
ca187c2262
3 changed files with 62 additions and 0 deletions
|
@ -86,6 +86,7 @@
|
|||
./utils/specs.nix
|
||||
./utils/startify.nix
|
||||
./utils/surround.nix
|
||||
./utils/tmux-navigator.nix
|
||||
./utils/todo-comments.nix
|
||||
./utils/undotree.nix
|
||||
./utils/vim-bbye.nix
|
||||
|
|
42
plugins/utils/tmux-navigator.nix
Normal file
42
plugins/utils/tmux-navigator.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs:
|
||||
with lib; let
|
||||
cfg = config.plugins.tmux-navigator;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.tmux-navigator = {
|
||||
enable = mkEnableOption "Enable Tmux-Navigator (see https://github.com/christoomey/vim-tmux-navigator for tmux installation instruction)";
|
||||
|
||||
package = helpers.mkPackageOption "tmux-navigator" pkgs.vimPlugins.tmux-navigator;
|
||||
|
||||
tmuxNavigatorSaveOnSwitch = helpers.mkNullOrOption (lib.types.enum [1 2]) ''
|
||||
null: don't save on switch (default value)
|
||||
1: update (write the current buffer, but only if changed)
|
||||
2: wall (write all buffers)
|
||||
'';
|
||||
|
||||
tmuxNavigatorDisableWhenZoomed = helpers.mkNullOrOption (lib.types.enum [1]) ''
|
||||
null: unzoom when moving from Vim to another pane (default value)
|
||||
1: If the tmux window is zoomed, keep it zoomed when moving from Vim to another pane
|
||||
'';
|
||||
|
||||
tmuxNavigatorNoWrap = helpers.mkNullOrOption (lib.types.enum [1]) ''
|
||||
null: move past the edge of the screen, tmux/vim will wrap around to the opposite side (default value)
|
||||
1: disable wrap
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
tmux_navigator_save_on_switch = cfg.tmuxNavigatorSaveOnSwitch;
|
||||
tmux_navigator_disable_when_zoomed = cfg.tmuxNavigatorDisableWhenZoomed;
|
||||
tmux_navigator_no_wrap = cfg.tmuxNavigatorNoWrap;
|
||||
};
|
||||
};
|
||||
}
|
19
tests/test-sources/plugins/utils/tmux-navigator.nix
Normal file
19
tests/test-sources/plugins/utils/tmux-navigator.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
# Empty configuration
|
||||
empty = {
|
||||
plugins.tmux-navigator.enable = true;
|
||||
};
|
||||
|
||||
# Actiavte all settings
|
||||
defaults = {
|
||||
plugins.tmux-navigator = {
|
||||
enable = true;
|
||||
|
||||
tmuxNavigatorSaveOnSwitch = 2;
|
||||
|
||||
tmuxNavigatorDisableWhenZoomed = 1;
|
||||
|
||||
tmuxNavigatorNoWrap = 1;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue