diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/tmux.conf | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/linux/tmux.conf b/linux/tmux.conf index 4977e70..131fc47 100644 --- a/linux/tmux.conf +++ b/linux/tmux.conf @@ -43,11 +43,17 @@ bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -D +# Set copying settings +setw -g mode-keys vi +set-option -s set-clipboard off bind P paste-buffer -bind-key -Tcopy-mode-vi 'v' send -X begin-selection -bind-key -Tcopy-mode-vi 'y' send -X copy-selection -bind-key -Tcopy-mode-vi 'r' send -X rectangle-toggle -bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'` +bind-key -T copy-mode-vi 'v' send -X begin-selection +bind-key -T copy-mode-vi 'r' send -X rectangle-toggle +bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'` +unbind -T copy-mode-vi Enter +bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i' +#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -ind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i' +#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i'' bind-key S-Left swap-window -t -1 bind-key S-Right swap-window -t +1 @@ -62,6 +68,29 @@ set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g mouse on #set-option -s set-clipboard off +# -- macros -------------------------------------------------------------------- +bind-key a send-keys \"jakob.stendahl\ <jakob.stendahl@infomedia.dk>\" + +# -- vim-tmux-navigator -------------------------------------------------------- +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l |