Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vim-tmux-navigator #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
result
.config
.direnv
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.direnv

17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
flake = false;
};

# tmux-navigator
tmux-navigator = {
url = "github:christoomey/vim-tmux-navigator";
flake = false;
};

# Rust crates
crates-nvim = {
url = "github:Saecki/crates.nvim";
Expand Down
1 change: 1 addition & 0 deletions modules/lib/types-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ with lib; let
"open-browser"
"plantuml-syntax"
"plantuml-previewer"
"tmux-navigator"
];

pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
Expand Down
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
./telescope
./git
./plantuml
./tmux
];

pkgsModule = {config, ...}: {
Expand Down
51 changes: 51 additions & 0 deletions modules/tmux/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
pkgs,
lib,
config,
...
}:
with lib;
with builtins; let
cfg = config.vim.tmux-navigator;
in {
options.vim = {
tmux-navigator = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tmux-navigator = {
tmuxNavigator = {

enable = mkOption {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use mkEnableOption

type = types.bool;
default = false;
description = "enable tmux-navigator, this plugin will only work together with tmuxPlugins.vim-tmux-navigator";
};

autosave-on-leave = mkOption {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
autosave-on-leave = mkOption {
autosaveOnLeave = mkOption {

type = types.enum ["disabled" "update" "wall"];
default = "disabled";
description = "enable autosave when navigating to tmux";
};

disable-when-zoomed = mkOption {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
disable-when-zoomed = mkOption {
disableWhenZoomed = mkOption {

type = types.bool;
default = false;
description = "disable navigator when the tmux pane is zoomed";
};

preserve-zoom = mkOption {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
preserve-zoom = mkOption {
preserveZoom = mkOption {

type = types.bool;
default = false;
description = "preserve zoom when moving from ";
};
};
};

config = mkIf cfg.enable {
vim.startPlugins = [
"tmux-navigator"
];
Comment on lines +40 to +42
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vim.startPlugins = [
"tmux-navigator"
];
vim.startPlugins = ["tmux-navigator"];


vim.configRC.tmux-navigator = nvim.dag.entryAnywhere ''
${optionalString (cfg.autosave-on-leave == "update") "let g:tmux_navigator_save_on_switch = 1"}
${optionalString (cfg.autosave-on-leave == "wall") "let g:tmux_navigator_save_on_switch = 2"}
${optionalString (cfg.disable-when-zoomed) "let g:tmux_navigator_disable_when_zoomed = 1"}
${optionalString (cfg.preserve-zoom) "let g:tmux_navigator_preserve_zoom = 1"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${optionalString (cfg.preserve-zoom) "let g:tmux_navigator_preserve_zoom = 1"}
${optionalString (cfg.preserve-zoom) "let g:tmux_navigator_preserve_zoom = 1"}

'';
};
}