Skip to content

Commit

Permalink
feat(tmux): simplify config again
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Apr 26, 2021
1 parent f7b2382 commit 1cc575b
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions config/tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# General
# -- General

# override outside terminal
set -sa terminal-overrides ',xterm-256color:RGB'

# Display
# -- Display

# start windows numbering at 1
set -g base-index 1
Expand All @@ -14,7 +14,7 @@ set -g set-titles on
# redraw status line every 10 seconds
set -g status-interval 10

# Navigation
# -- Navigation

# split current window horizontally
bind - split-window -v
Expand All @@ -34,32 +34,43 @@ bind < swap-pane -U
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# select previous window
bind -r C-h previous-window
# select next window
bind -r C-l next-window
# move to last active window
bind Tab last-window
bind t select-layout tiled

# enable mouse navigation
set -g mouse on

# clipboard
# -- Copy mode

bind Enter copy-mode

# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# set only on OS X where it's required
set -g default-command "reattach-to-user-namespace -l $SHELL"
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'

# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-urlview'

# Other bindings

bind t select-layout tiled
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'dracula/tmux'

# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'

0 comments on commit 1cc575b

Please sign in to comment.