Feb 21, 2024
bind c new-window -ac "#{pane_current_path}"
This is a cool config for your tmux.conf where if you open a new pane/tab it will not only open it next to the current pane (-a
), but also open it to the same directory as the previous pane (-c "#{pane_current_path}"
). This is pretty similar to the functionality of opening a split pane in tmux, which is cool too but I can’t think of how much time I’ve wasted opening a new tab and trying to navigate to the same place as the current tab. Really sort of kills your flow, if you just want a quick side terminal for some stuff.
On that note, I noticed too how much time I’d spend trying to cd into a directory and then hitting ls and then cd .. and into another dir and so on. I finally came up with the idea of binding specific command + <key>
to these operations and it’s made navigation so much faster. This is my current zsh setup:
vi-ls() { zle vi-insert; l; zle kill-whole-line; zle accept-line }
zle -N vi-ls
bindkey -M vicmd "^A" vi-ls
bindkey -M viins "^A" vi-ls
vi-fg() { zle vi-insert; zle kill-whole-line; fg; zle accept-line }
zle -N vi-fg
bindkey -M vicmd "^[v" vi-fg
bindkey -M viins "^[v" vi-fg
vi-back() { zle vi-insert; zle kill-whole-line; cd .. ; zle accept-line }
zle -N vi-back
bindkey -M vicmd "^[w" vi-back
bindkey -M viins "^[w" vi-back
vi-pop() { zle vi-insert; zle kill-whole-line; popd; zle accept-line }
zle -N vi-pop
bindkey -M vicmd "^N" vi-pop
bindkey -M viins "^N" vi-pop
vi-nvim() { zle kill-whole-line; nvim; zle accept-line }
zle -N vi-nvim
bindkey -M vicmd "^[g" vi-nvim
bindkey -M viins "^[g" vi-nvim
The actual keys bound in the config are different from what I press on my keyboard, since I’ve been pretty vigorous with rebinding sequences with karabiner, and I should have a post going over that more in detail. But essentially I have ls, fg, suspend (ctrl-z), fg, pop, cd .. and vim all bound to different command + <key>
sequences, all accessible by my left hand alone. Makes things way faster! Hope this might help or inspire someone. God bless!