diff options
| author | Simen A. W. Olsen <hello@simenandre.no> | 2024-12-27 14:37:58 +0100 |
|---|---|---|
| committer | Simen A. W. Olsen <hello@simenandre.no> | 2024-12-27 14:38:11 +0100 |
| commit | f311c01a1b2672ab2c724674de8022e83988545e (patch) | |
| tree | 6ba37deb89746ea70ea022c15b124e975e33b953 /tmux | |
| parent | 54abce564fa2ce215df74066102f68ed8ba0164a (diff) | |
| download | dotfiles-f311c01a1b2672ab2c724674de8022e83988545e.tar.gz dotfiles-f311c01a1b2672ab2c724674de8022e83988545e.zip | |
reorganize
Diffstat (limited to 'tmux')
| -rw-r--r-- | tmux/tmux.conf | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..ca1ab51 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,64 @@ + +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix +set -g status-style 'bg=#333333 fg=#5eacd3' +set -g mouse on +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 +set-option -g mouse on + +set -ga terminal-overrides ",screen-256color*:Tc" +set-option -g default-terminal "screen-256color" +set -s escape-time 0 + +set-window-option -g mode-keys vi +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' + +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" + +bind-key -r g run-shell "tmux neww lazygit" +bind-key -r i run-shell "tmux neww ~/scripts/tmux-cht.sh" + +bind-key -r f run-shell "tmux neww twm" +bind-key -r F run-shell "tmux neww twm -l" +bind-key -r e run-shell "tmux switch -t $TWM_DEFAULT" +bind X confirm-before kill-session + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator + +# decide whether we're in a Vim process +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 -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+' + +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 +bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+ + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + + +run '~/.tmux/plugins/tpm/tpm' |
