diff options
| author | stefan <stefan@s00.xyz> | 2025-05-21 23:56:59 -0400 |
|---|---|---|
| committer | stefan <stefan@s00.xyz> | 2025-05-21 23:56:59 -0400 |
| commit | 5e9c5436692dd4e28a9cfef901ceec2897a33fbb (patch) | |
| tree | 33054cab14f51506de1db2adfef92a3cc62eab7f | |
| parent | 805616a27ee83f9fe8452e17c9df0330463fbb8e (diff) | |
| download | home-5e9c5436692dd4e28a9cfef901ceec2897a33fbb.tar.gz | |
`modules/{tmux,neovim}`: integrate navigation
| -rw-r--r-- | modules/neovim/nvim/init.lua | 1 | ||||
| -rw-r--r-- | modules/neovim/nvim/lua/config/keybinds.lua | 4 | ||||
| -rw-r--r-- | modules/neovim/nvim/lua/config/tmux.lua | 3 | ||||
| -rw-r--r-- | modules/tmux/default.nix | 32 |
4 files changed, 40 insertions, 0 deletions
diff --git a/modules/neovim/nvim/init.lua b/modules/neovim/nvim/init.lua index d562542..3a0bf92 100644 --- a/modules/neovim/nvim/init.lua +++ b/modules/neovim/nvim/init.lua @@ -7,3 +7,4 @@ require("config.icons") require("config.fzf") require("config.oil") require("config.statusline") +require("config.tmux") diff --git a/modules/neovim/nvim/lua/config/keybinds.lua b/modules/neovim/nvim/lua/config/keybinds.lua index 551fc14..e2ec96e 100644 --- a/modules/neovim/nvim/lua/config/keybinds.lua +++ b/modules/neovim/nvim/lua/config/keybinds.lua @@ -45,6 +45,10 @@ nmap('<M-m>', function() require("tmux").move_left() end, { desc = "Focus window nmap('<M-n>', function() require("tmux").move_bottom() end, { desc = "Focus window below the current one" }) nmap('<M-e>', function() require("tmux").move_top() end, { desc = "Focus window above the current one" }) nmap('<M-i>', function() require("tmux").move_right() end, { desc = "Focus window right of the current one" }) +nmap('<M-M>', function() require("tmux").resize_left() end, { desc = "Resize left side of split" }) +nmap('<M-N>', function() require("tmux").resize_bottom() end, { desc = "Resize bottom side of split" }) +nmap('<M-E>', function() require("tmux").resize_top() end, { desc = "Resize top side of split" }) +nmap('<M-I>', function() require("tmux").resize_right() end, { desc = "Resize right side of split" }) -- nmap('<leader>fo', '<cmd>Telescope find_files<CR>', { silent = true }) nmap('<leader>fo', '<cmd>FzfLua files<CR>', { silent = true }) diff --git a/modules/neovim/nvim/lua/config/tmux.lua b/modules/neovim/nvim/lua/config/tmux.lua index 8dbcff4..d1940c6 100644 --- a/modules/neovim/nvim/lua/config/tmux.lua +++ b/modules/neovim/nvim/lua/config/tmux.lua @@ -2,4 +2,7 @@ require("tmux").setup({ navigation = { enable_default_keybindings = false, }, + resize = { + enable_default_keybindings = false, + }, }) diff --git a/modules/tmux/default.nix b/modules/tmux/default.nix index 318e1db..360fab2 100644 --- a/modules/tmux/default.nix +++ b/modules/tmux/default.nix @@ -88,10 +88,42 @@ in is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?$'" + bind-key -n M-C if-shell "$is_vim" "send-keys C-w; send-keys q" kill-pane + + # bind-key -n M-Enter "split-window -h; select-layout -E" + bind-key -n M-Enter if-shell "tmux list-panes | wc -l | 'grep -q ^1$'" "split-window -h" "select-pane -t bottom-right; split-window -v; select-layout -E" + bind-key -n M-f resize-pane -Z + + bind-key -n M-1 if-shell 'tmux select-window -t :1' ''' 'new-window -t :1' + bind-key -n M-2 if-shell 'tmux select-window -t :2' ''' 'new-window -t :2' + bind-key -n M-3 if-shell 'tmux select-window -t :3' ''' 'new-window -t :3' + bind-key -n M-4 if-shell 'tmux select-window -t :4' ''' 'new-window -t :4' + bind-key -n M-5 if-shell 'tmux select-window -t :5' ''' 'new-window -t :5' + bind-key -n M-6 if-shell 'tmux select-window -t :6' ''' 'new-window -t :6' + bind-key -n M-7 if-shell 'tmux select-window -t :7' ''' 'new-window -t :7' + bind-key -n M-8 if-shell 'tmux select-window -t :8' ''' 'new-window -t :8' + bind-key -n M-9 if-shell 'tmux select-window -t :9' ''' 'new-window -t :9' + bind-key -n M-0 if-shell 'tmux select-window -t :0' ''' 'new-window -t :0' + + bind-key -n M-! if-shell "tmux join-pane -t :1" "" "new-window -dt :1; join-pane -t :1; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-@ if-shell "tmux join-pane -t :2" "" "new-window -dt :2; join-pane -t :2; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-# if-shell "tmux join-pane -t :3" "" "new-window -dt :3; join-pane -t :3; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-$ if-shell "tmux join-pane -t :4" "" "new-window -dt :4; join-pane -t :4; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-% if-shell "tmux join-pane -t :5" "" "new-window -dt :5; join-pane -t :5; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-^ if-shell "tmux join-pane -t :6" "" "new-window -dt :6; join-pane -t :6; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-& if-shell "tmux join-pane -t :7" "" "new-window -dt :7; join-pane -t :7; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-* if-shell "tmux join-pane -t :8" "" "new-window -dt :8; join-pane -t :8; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-( if-shell "tmux join-pane -t :9" "" "new-window -dt :9; join-pane -t :9; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n M-) if-shell "tmux join-pane -t :0" "" "new-window -dt :0; join-pane -t :0; select-pane -t top-left; kill-pane; select-layout -E" + bind-key -n 'M-m' if-shell "$is_vim" 'send-keys M-m' 'select-pane -L' bind-key -n 'M-n' if-shell "$is_vim" 'send-keys M-n' 'select-pane -D' bind-key -n 'M-e' if-shell "$is_vim" 'send-keys M-e' 'select-pane -U' bind-key -n 'M-i' if-shell "$is_vim" 'send-keys M-i' 'select-pane -R' + bind-key -n 'M-M' if-shell "$is_vim" 'send-keys M-M' 'resize-pane -L 1' + bind-key -n 'M-N' if-shell "$is_vim" 'send-keys M-N' 'resize-pane -D 1' + bind-key -n 'M-E' if-shell "$is_vim" 'send-keys M-E' 'resize-pane -U 1' + bind-key -n 'M-I' if-shell "$is_vim" 'send-keys M-I' 'resize-pane -R 1' bind-key -T root m if -F "#{==:#{pane_mode},tree-mode}" "send h" "send m" bind-key -T root n if -F "#{==:#{pane_mode},tree-mode}" "send j" "send n" |