Skip to content

Commit

Permalink
Update .tmux.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
apemost committed Apr 26, 2024
1 parent 910fe77 commit ec9183b
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions .tmux.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Remap <prefix> from <Ctrl-b> to <Ctrl-a>
set -g prefix C-a
unbind C-b
unbind-key C-b
bind-key C-a send-prefix

# Make `<prefix> r` reload the config file
unbind r
bind r source-file ~/.tmux.conf
unbind-key r
bind-key r source-file ~/.tmux.conf

# Start windows numbering at 1
set -g base-index 1
Expand Down Expand Up @@ -33,29 +33,29 @@ set -g default-terminal 'xterm-256color'
set -ga terminal-overrides ',*256col*:Tc'

# Split current window horizontally
bind - split-window -v
bind-key - split-window -v

# Split current window vertically
bind | split-window -h
bind-key | split-window -h

# Pane navigation
bind h select-pane -L # Move left
bind j select-pane -D # Move down
bind k select-pane -U # Move up
bind l select-pane -R # Move right
bind-key h select-pane -L # Move left
bind-key j select-pane -D # Move down
bind-key k select-pane -U # Move up
bind-key l select-pane -R # Move right

# Pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
bind-key -r H resize-pane -L 2
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2

# Copy mode
run -b 'tmux bind -T copy-mode-vi v send -X begin-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-shell -b 'tmux bind-key -T copy-mode-vi v send-keys -X begin-selection 2> /dev/null || true'
run-shell -b 'tmux bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel 2> /dev/null || true'

# Connect tmux to the macOS clipboard service
if -b 'command -v reattach-to-user-namespace &> /dev/null' {
if-shell -b 'command -v reattach-to-user-namespace &> /dev/null' {
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
bind-key -T copy-mode DoubleClick1Pane {
select-pane
Expand All @@ -82,7 +82,9 @@ if -b 'command -v reattach-to-user-namespace &> /dev/null' {
}

# Connect tmux to the Linux clipboard service
if -b 'command -v xclip &> /dev/null' {
if-shell -b 'command -v xclip &> /dev/null' {
run-shell -b "tmux bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'"

bind-key -T copy-mode C-w send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode M-w send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
Expand Down Expand Up @@ -123,7 +125,7 @@ bind-key > {
select-window -n
}

if -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
if-shell -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
Expand All @@ -132,11 +134,11 @@ if -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
}

# User defined overrides
if -b '[ -f ~/.tmux.conf.local ]' {
if-shell -b '[ -f ~/.tmux.conf.local ]' {
source ~/.tmux.conf.local
}

# Initialize TMUX plugin manager
if -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
run -b '~/.tmux/plugins/tpm/tpm'
if-shell -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
run-shell -b '~/.tmux/plugins/tpm/tpm'
}

0 comments on commit ec9183b

Please sign in to comment.