-
Notifications
You must be signed in to change notification settings - Fork 1
/
learn-tmux
52 lines (36 loc) · 2.65 KB
/
learn-tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#vim tmux navigator (install this)
using -n with a key binding makes it available without the prefix key.
set -g status-right "<some pattern, google list of status patterns available>"
#p is pane number, there is a way to put in any shell command in here
a shell comand for battery with color coding can be created and that can be shown in the status
prefix + z zooms in a pane and makes it fullscreen temporarily. same key binding undones it.
window numbering can be done starting from one
there is one key binding to go to previous window, to switch between two windows
using window numbers can also be used to jump straight to nth window.
prefix b can be used to push the current pane into a new window and keep the cursor or context to present window with rest of the panes reorganized
panes are not starting from current path, is something to be explored
tmux choose-tree allows to choose from multiple tmux opened sessions. this can be used from inside the tmux session itself.
Press space on any of the session in choose tree to see list of windows that you can target directly (some key can be bound to this task also, Not yet done)
prefix L can be used to move between previous sessions. just like there is a command for windows.
tmux, system clipboard and vim clipboard need to be optimized.
also moving can be like vim in copy mode
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
Note - OS X users will need to install reattach-to-user-namespace in order to allow tmux to interact with the system clipboard.
With the above configuration set for your tmux session, you can interact with copy mode using the following steps:
<prefix> [ to start "copy-mode"
Move to the text you want to copy using Vim-like key-bindings, i.e., k to move up a line, / to search, etc.
v to start selection
Move to end of text with Vim key-bindings, e.g. e for end of word. The selection will be highlighted
y to copy the highlighted/selected text
The selected text will now be in your system clipboard.
Split window can take up an argument which is shell command to run. Good thing about this is that when this process ends, the pane is closed down automatically.
prefix h is bound to htop, q will quit the pane
Using this, make a shortcut to a todo file
Explore the plugin vim-tmux-runner