blob: 0dd76e0bbe44c7479bcfa368983dd6a8074538b5 (
plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
#+TITLE: My Tmux Config
#+AUTHOR: Naz <ndpm13@ch-naseem.com>
#+PROPERTY: header-args :tangle .config/tmux/tmux.conf :mkdirp yes
#+STARTUP: showeverything
#+OPTIONS: toc:nil
#+auto_tangle: t
* Table Of Content :toc:
- [[#general-configurations][General Configurations]]
- [[#enable-mouse][Enable Mouse]]
- [[#window--pane-indexing][Window & Pane Indexing]]
- [[#window-splitting][Window Splitting]]
- [[#ui-configurations][UI Configurations]]
- [[#colors-fix][Colors Fix]]
- [[#status-bar-position][Status Bar Position]]
- [[#key-bindings][Key Bindings]]
- [[#prefix-key][Prefix Key]]
- [[#clipboard][Clipboard]]
- [[#session-selection][Session Selection]]
- [[#vi-mode][Vi Mode]]
- [[#plugin-management-tpm][Plugin Management (TPM)]]
- [[#plugins][Plugins]]
* General Configurations
** Enable Mouse
#+begin_src conf
set -g mouse on
#+end_src
** Window & Pane Indexing
Start windows and panes at 1, not 0.
#+begin_src conf
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
#+end_src
** Window Splitting
Use ~PREFIX s~ and ~PREFIX v~ instead of ~PREFIX %~ and ~PREFIX "~, and keep the
current directory when splitting windows.
#+begin_src conf
unbind '%'
unbind '"'
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
#+end_src
* UI Configurations
** Colors Fix
I'm using this in Alacritty. If it doesn't work in your terminal emulator of
choice, try the other methods below.
#+begin_src conf
set-option -as terminal-overrides ",xterm*:RGB"
#+end_src
*** Other Methods
#+begin_example conf
set -g default-terminal "$TERM"
#+end_example
#+begin_example conf
set -ag terminal-overrides ",$TERM:Tc"
#+end_example
** Status Bar Position
#+begin_src conf
set -g status-position top
#+end_src
* Key Bindings
** Prefix Key
Use ~CTRL-Space~ as prefix instead of ~CTRL-B~.
#+begin_src conf
unbind C-b
set -g prefix C-Space
#+end_src
** Clipboard
This part requires ~xclip~ to be installed.
#+begin_src conf
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
#+end_src
** Session Selection
#+begin_src conf
bind S choose-session
#+end_src
** Vi Mode
#+begin_src conf
set-window-option -g mode-keys vi
#+end_src
*** Window Navigation
Remap ~PREFIX l~ to go to the next window, and ~PREFIX h~ to go to the previous
window.
#+begin_src conf
bind l next-window
bind h previous-window
#+end_src
*** Pane Resizing
#+begin_src conf
bind -n M-k resize-pane -U 1
bind -n M-j resize-pane -D 1
bind -n M-h resize-pane -L 2
bind -n M-l resize-pane -R 2
#+end_src
* Plugin Management (TPM)
I'm using [[https://github.com/tmux-plugins/tpm][TPM]] to manage my plugins. Please note that it's recommended to keep
the follow line *at the very bottom of* ~tmux.conf~.
#+NAME: run-tpm
#+begin_src conf :tangle no
run '~/.tmux/plugins/tpm/tpm'
#+end_src
** Plugins
#+begin_src conf :noweb yes
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'ndpm13/tmux-gruvbox-truecolor'
# Initialize TMUX plugin manager.
<<run-tpm>>
#+end_src
|