by sls · 9y ago · 0 comments
Another useful thing is to "bind-key C-\ last-window". That makes C-\ C-\ jump back to the last window you visited, which facilitates creating short-lived windows for specific tasks.
Final small tweak I like is "set -g base-index 1" so that C-\ 1 is the first window, 2 is the next, etc. instead of having the first window way over on 0.
My other tweaks are probably more idiosyncratic to my workflow.
# Window switching
bind -n S-up new-window
bind -n S-down confirm-before -p "kill-window #W? (y/n)" kill-window
bind -n S-left prev
bind -n S-right next
# Pane switching
bind -n C-left select-pane -L
bind -n C-right select-pane -R
bind -n C-down select-pane -D
bind -n C-up select-pane -U
# Special pane operations
bind -n C-M-up respawn-pane -k
bind -n C-M-down kill-pane
bind -n C-M-left swap-pane -U
bind -n C-M-right swap-pane -D
# Window splitting
bind -n C-M-\ split-window -h
bind -n C-M-] split-window -vI just realized though that I don't have a mapping for last-window. And there doesn't seem to be a default.
set-option -g prefix `
bind-key ` send-prefix
I don't find it's too much of a pain to press twice when in markdown.I use C-_, which can be "triggered" with C-7 and often with C-/.
If you run emacs as a daemon you can do pretty much everything tmux/screen do, without sacrificing precious keystrokes :P
But if for some reason I wanted to do that, I would use C-\ : send-prefix. That sends the prefix character to the process running in tmux, in this case the shell. It's also super useful if you ever find yourself running a nested tmux (i.e. in an ssh session) with the same prefix character. You can just send-prefix d to disconnect the remote shell from the remote tmux session, then open a new local shell outside of your local tmux session, log in and reconnect to the remote tmux.
You can open a new shell and reconnect to the remote tmux first, then use Ctrl-b, Shift-D to bring up a list of connected sessions and kick off / detach the nested original one you don't want.