commit db2a8261ef30132661c40f65450d716d4c1b8602
parent 1157093adc052a78b4f0ded738f4eb976b9d3667
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date: Tue, 4 Jan 2022 21:28:56 +0100
More tweaking of the tmux config
Diffstat:
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
@@ -1,34 +1,45 @@
-# not sure if the following 2 lines are needed
-set -g default-terminal "tmux-256color"
-set -ga terminal-overrides ',*:Tc' # this is for 256 color
-set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # this is for the cursor shape in neovim
-set -s escape-time 0 # stop delay before passing escape keypress to vim
+# if you look at the man page to understand commands, search for:
+# - set-option instead of set
+# - bind-key instead of bind
+# - send-keys instead of send
-set-option -g prefix C-a
+# fix issues
+set -g default-terminal "tmux-256color" # not sure if this is needed
+set -ga terminal-overrides ',*:Tc' # fix to enble 256 color
+set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # fix cursor shape in neovim
+set -s escape-time 0 # stop delay before passing escape keypress to vim
-bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded"
+# sane defaults
+set -g prefix C-a
+set -g history-limit 100000 # number of lines stored for scroll
+set -g base-index 1 # windows indexed at 1
+set -g pane-base-index 1 # panes indexed at 1
bind , command-prompt "rename-window '%%'" # when renaming windows, don't suggest previous name
-bind-key a last-window
-# index panes and windows starting at 1
-set -g base-index 1
-set-window-option -g pane-base-index 1
+# status bar
+set -g status-style "fg=green,bg=default" # more discreet status bar
+set -g message-style "fg=black,bg=green"
+set -g window-status-current-style "fg=black,bg=green"
+set -g window-status-last-style "underscore,italics"
+set -g status-right "" # get rid of right part of status bar
+
+# shortcuts
+bind C-a copy-mode
+bind a last-window
+bind r source-file "~/.config/tmux/tmux.conf" \; display "Configuration reloaded"
+
+# vim keybindings for copy mode
+set -g mode-keys vi # vi keybindings
+bind -T copy-mode-vi v send -X begin-selection
+bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -i -selection clipboard"
+bind -T copy-mode-vi r send -X rectangle-toggle
+
+# switch / and ? bindings for search, also use incremental search
+bind -T copy-mode-vi / command-prompt -i -p "(search up)" "send -X search-backward-incremental '%%%'"
+bind -T copy-mode-vi ? command-prompt -i -p "(search down)" "send -X search-forward-incremental '%%%'"
# vim keybindings for moving panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
-
-# vim keybindings for copy mode
-bind P paste-buffer
-bind-key C-a copy-mode
-bind-key -T copy-mode-vi v send-keys -X begin-selection
-bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard"
-bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
-
-set -g status-right "" # get rid of right part of status bar
-set -g status-style "fg=green,bg=default" # more discreet status bar
-set -g message-style "fg=black,bg=green"
-set -g window-status-current-style "fg=black,bg=green"
-set -g window-status-last-style "underscore,italics"