Skip to content

Instantly share code, notes, and snippets.

@josecoelho
Created January 21, 2025 02:07
Show Gist options
  • Save josecoelho/ffb81205577f57d084fa362c748b1c32 to your computer and use it in GitHub Desktop.
Save josecoelho/ffb81205577f57d084fa362c748b1c32 to your computer and use it in GitHub Desktop.
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin "janoamaral/tokyo-night-tmux"
set -g @plugin 'tmux-plugins/tmux-open'
# quickly open urls in the browser
# c^b - u - listing all urls on bottom pane
# requires brew install urlview extract_url
set -g @plugin 'tmux-plugins/tmux-urlview'
# Theme
set -g @tokyo-night-tmux_window_id_style none
set -g @tokyo-night-tmux_pane_id_style hsquare
set -g @tokyo-night-tmux_zoom_id_style dsquare
# Fix slow esc on VIM
set -sg escape-time 10
# Mouse on
set-option -g mouse on
# Fix colors
set -g default-terminal "screen-256color"
# Auto restore sessions
set -g @continuum-restore 'on'
# Opening panes and windows in the same directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Clear terminal using C^b k
bind k clear-history
# VI mode
set-window-option -g mode-keys vi
# Pane navigation like vim
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"
bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Mac clipboard
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment