Skip to content

Commit

Permalink
modify tmux configs more
Browse files Browse the repository at this point in the history
  • Loading branch information
baileywickham committed Dec 13, 2023
1 parent e72efc2 commit 597af13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
6 changes: 2 additions & 4 deletions config/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ bind C-f command-prompt -p find-session 'switch-client -t %%'
# session navigation
bind BTab switch-client -l # move to last session

# split current window horizontally
bind - split-window -v
# split current window vertically
bind _ split-window -h
bind _ split-window -v
bind - split-window -h

# pane navigation
bind -r h select-pane -L # move left
Expand Down
25 changes: 23 additions & 2 deletions config/.tmux.conf.local
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tmux_conf_new_session_prompt=false
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_retain_current_path=false
tmux_conf_new_window_retain_current_path=true

# new window tries to reconnect ssh sessions, possible values are:
# - true
Expand Down Expand Up @@ -163,7 +163,7 @@ tmux_conf_theme_status_attr="none"
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W"
tmux_conf_theme_terminal_title='#{hostname} | #{circled_session_name} | #W'

# window status style
# - built-in variables are:
Expand Down Expand Up @@ -445,3 +445,24 @@ tmux_conf_uninstall_plugins_on_reload=true
#
# "$@"
# # /!\ do not remove the previous line


# 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|l?n?vim?x?|fzf)(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

0 comments on commit 597af13

Please sign in to comment.