clean: minor revisions

This commit is contained in:
Jabir Ali Ouassou 2025-01-27 17:30:13 +01:00
parent 8ee11d6913
commit 68e17cd66a
2 changed files with 15 additions and 20 deletions

View file

@ -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 <kbd>Alt</kbd>, 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 (<kbd>Alt</kbd>+<kbd>z</kbd>). 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
(<kbd>Alt</kbd>+<kbd>z</kbd>). 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 <kbd>M</kbd>-<kbd>hjkl</kbd> permit navigating around
panes.
keybindings so that <kbd>M</kbd>-<kbd>hjkl</kbd> 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`:

View file

@ -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
@ -283,13 +281,12 @@
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.
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'