-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
143 lines (120 loc) · 5.26 KB
/
.tmux.conf
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
set -g mouse off
set -g history-limit 100000
set -g default-terminal "screen-256color"
set -g status-style bg='#1a1a1a',fg='#d3d3d3'
set -g pane-border-style bg=default,fg='#1a1a1a'
set -g pane-active-border-style bg=default,fg='#1a1a1a'
set-option -g pane-border-status off
set -g pane-border-format ""
#set -g pane-border-width 0
# setw synchronize-panes off
# set-option -g mode-keys emacs
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# set -g alternate-screen off
# Set prefix to C-b (default)
set-option -g prefix C-b
unbind C-b
bind C-b send-prefix
# Remote tmux configuration (.tmux.conf)
# Allow passthrough to remote tmux using C-a
# bind-key C-a send-prefix
# Set prefix to C-a
# set-option -g prefix C-a
# unbind C-a
# bind C-a send-prefix
# sample running shell
# bind-key C-v run-shell 'echo "hellow world" > /tmp/output.txt'
# quikly switch between sessions
bind-key f command-prompt -p "Session name:" "run-shell 'tmux switch-client -t %1 || tmux display-message \"Session %1 not found.\"'"
# bind-key C-f command-prompt -p "Session name:" "run-shell '~/find-and-switch-session.sh %1'"
bind-key m 'switch-client -l' # switch to latest session
# reloading
# bind-key C-r source-file ~/.tmux.conf
bind-key r run-shell "cp ~/emacs-setup/.tmux.conf ~/.tmux.conf && cp ~/emacs-setup/.zshrc ~/.zshrc && tmux source-file ~/.tmux.conf && source ~/.zshrc"
# bind C-n command-prompt -p "New Session:" "new-session -A -s '%%'"
# bind k confirm kill-session
# start sshfs
unbind t
#bind-key t run-shell "sshfs -o cache=yes,compression=no,kernel_cache,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sandbox:/home/aziz/workspaces ~/workspaces"
# copy paste management
bind-key C-v command-prompt -p "Server:" "run-shell 'ssh %% \"cat ~/clipboard/clipboard.txt\" | pbcopy > /dev/null 2>&1 &'"
bind-key C-c command-prompt -p "Server:" "run-shell 'pbpaste | ssh %% \"cat > ~/clipboard/clipboard.txt\" > /dev/null 2>&1 &'"
# bind-key C-y run-shell "pbpaste | ssh sandbox 'cat > ~/clipboard/clipboard.text'"
# bind-key C-y command-prompt -p "Server:" "run-shell 'pbpaste | ssh %% \"cat ~/clipboard/clipboard.txt\":'"
# unbind ]
# bind C-c copy-mode
# bind C-v paste-buffer
# Unbind all scrolling-related keys
# unbind -T copy-mode-vi PageUp
# unbind -T copy-mode-vi PageDown
# unbind -T copy-mode C-b
# unbind -T copy-mode C-u
# unbind -T copy-mode C-d
# unbind -T copy-mode-vi k
# unbind -T copy-mode-vi j
# C-b [: Enter copy mode
# C-f: Move forward (right) one character
# C-b: Move backward (left) one character
# C-n: Move down one line
# C-p: Move up one line
# M-f: Move forward one word
# M-b: Move backward one word
# C-a: Move to the beginning of the line
# C-e: Move to the end of the line
# C-v: Move down one page (like PageDown)
# M-v: Move up one page (like PageUp)
# C-Space: Start selection
# C-w: Copy the selected text to buffer
# bind C-p previous-window
# bind C-n next-window
# bind C-a send-prefix
# bind a last-window
# window movement
# Ctrl-b c: Create a new window.
# Ctrl-b w: List and switch between windows.
# Ctrl-b n/p: Move to the next/previous window.
# Ctrl-b ,: Rename the current window.
# pane management
bind | split-window -h -p 20
bind - split-window -v -p 20
# Ctrl-b %: Split pane vertically.
# Ctrl-b ": Split pane horizontally.
# Ctrl-b o: Switch to the next pane.
# Ctrl-b q: Show pane numbers and switch with numbers.
# Ctrl-b x: Close the current pane.
# spliting into 20% bellow
# split windows and move window occupy 3 into this
# tmux join-pane -s local:3
# tmux join-pane -s local:3 -t current-session:0.1
# tmux split-window -v -p 20
# tmux split-window -v -p 20 "tail -f /var/log/syslog"
# bind-key S split-window -v -p 25
# bind-key m command-prompt "split-window -v -p 20; join-pane -s '%%'"
# tmux move-pane -s source-session:source-window.pane -t target-session:target-window
# tmux swap-pane -s my-session:2.0
# Swap current pane with a specific window (interactive prompt)
bind-key S command-prompt -p "Swap with (session:window.pane):" "swap-pane -s '%%'"
# second prompt examples
#bind-key S command-prompt -p "Swap with (session:window.pane):" "command-prompt -p 'Second prompt:' 'run-shell \"tmux swap-pane -s %% && tmux send-keys %% \"'"
# sent to all panes
# Ctrl-b : and then setw synchronize-panes on
# sending commands to specific windows and pane
# tmux send-keys -t session-name:window-number "command" C-m
# tmux send-keys -t session-name:window-number.pane-number "command" C-m
# eg: tmux send-keys -t node-research:1 "console.log('Hello from Window 1');" C-m
# eg: tmux send-keys -t node-research:1.0 "console.log('Hello from Pane 0');" C-m
# list all pane and windows
# tmux list-windows
# tmux list-panes -t session-name:window-number
# move window to another sessions
# tmux move-window -s session-name:window-number -t target-session
# eg: tmux move-window -s node-research:1 -t other-session
# Moving Panes Between Windows
# tmux break-pane -t session-name:window-number.pane-number
# eg: tmux break-pane -t node-research:1.0
# Joining panes
# tmux join-pane -s session-name:window-number.pane-number -t target-session:target-window
# tmux join-pane -s node-research:1.0 -t node-research:2
# moving sessions windows
# tmux new-session -d -s new-session-name
# tmux send-keys -t existing-session:window-number "tmux attach -t new-session-name" C-m