From 68e17cd66a350049c6c558b8c0cd444ed443828f Mon Sep 17 00:00:00 2001 From: Jabir Ali Ouassou Date: Mon, 27 Jan 2025 17:30:13 +0100 Subject: [PATCH] clean: minor revisions --- README.md | 20 +++++++++----------- tilish.tmux | 15 ++++++--------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d8f0184..83c765a 100644 --- a/README.md +++ b/README.md @@ -306,16 +306,15 @@ Alternatively, `tilish` also supports a [Prefix mode](#prefix-mode). This is in less ergonomic than the default `tilish` keybindings. However, it does not require the use of Alt, and is therefore compatible with the default `i3wm` keybindings. -## Integration with vim +## Integration with vim/neovim -There are multiple great plugins, [tmux-navigate][10], [vim-tmux-navigator][3], -[smart-splits.nvim][11], which both allow seamless navigation between `vim` -splits and `tmux` splits. -[tmux-navigate][10] has an advantage that it also works over `ssh` connections, -and that it plays better with zooming (Alt+z). If you -use either plugin, you can tell `tilish` to make it setup the keybindings for -you. (If you don't, `tilish` will use fallback keybindings that don't integrate -with `vim`.) +There are multiple great plugins [tmux-navigate][10], [vim-tmux-navigator][3], +[smart-splits.nvim][11], which all allow seamless navigation between `vim` +splits and `tmux` splits. [tmux-navigate][10] has an advantage that it also +works over `ssh` connections, and that it plays better with zooming +(Alt+z). If you use these plugins, you can tell `tilish` +to make it setup the keybindings for you as described below. (If you don't, +`tilish` will use fallback keybindings that don't integrate with `vim`.) ### Navigate @@ -381,8 +380,7 @@ A minimal working example of a `~/.tmux.conf` with `tpm` would then be: Integration with [smart-splits][11] is achieved through setting the `@tilish-smartsplits` option to `on`. This automatically configures the -keybindings so that M-hjkl permit navigating around -panes. +keybindings so that M-hjkl permit navigating around panes. Prior to that, it requires installing the `smart-splits.nvim` plugin and configuring the following keybindings in e.g. `~/.config/nvim/init.vim`: diff --git a/tilish.tmux b/tilish.tmux index 6ef4dba..4ce6822 100755 --- a/tilish.tmux +++ b/tilish.tmux @@ -177,12 +177,10 @@ tmux $bind "${mod}${O}" swap-pane -D # Switch to pane via Alt + hjkl. - if [ "${smartsplits:-}" != "on" ]; then - tmux $bind "${mod}${h}" select-pane -L - tmux $bind "${mod}${j}" select-pane -D - tmux $bind "${mod}${k}" select-pane -U - tmux $bind "${mod}${l}" select-pane -R - fi + tmux $bind "${mod}${h}" select-pane -L + tmux $bind "${mod}${j}" select-pane -D + tmux $bind "${mod}${k}" select-pane -U + tmux $bind "${mod}${l}" select-pane -R # Move a pane via Alt + Shift + hjkl. if [ -z "$legacy" ]; then @@ -282,14 +280,13 @@ fi elif [ "${smartsplits:-}" = "on" ]; then # If `@tilish-smartsplits` is nonzero, integrate Alt + hjkl with `smart-splits.nvim`. - # This assumes that your Vim/Neovim is setup to use Alt + hjkl bindings as well. - + # This assumes that your Vim/Neovim is setup to use Alt + hjkl bindings as well. tmux $bind "${mod}${h}" if -F "#{@pane-is-vim}" 'send M-h' 'select-pane -L' tmux $bind "${mod}${j}" if -F "#{@pane-is-vim}" 'send M-j' 'select-pane -D' tmux $bind "${mod}${k}" if -F "#{@pane-is-vim}" 'send M-k' 'select-pane -U' tmux $bind "${mod}${l}" if -F "#{@pane-is-vim}" 'send M-l' 'select-pane -R' - # Smart pane resizing with awareness of Neovim splits. tmux escape then C-hjkl to resize + # Smart pane resizing with awareness of Neovim splits. tmux escape then C-hjkl to resize. tmux bind -r C-h if -F "#{@pane-is-vim}" 'send-keys C-h' 'resize-pane -L 7' tmux bind -r C-j if -F "#{@pane-is-vim}" 'send-keys C-j' 'resize-pane -D 7' tmux bind -r C-k if -F "#{@pane-is-vim}" 'send-keys C-k' 'resize-pane -U 7'