Skip to content

Instantly share code, notes, and snippets.

@hkboujrida
Created April 8, 2022 16:22
Show Gist options
  • Save hkboujrida/7e3d48af38dafead48f65e118f9771fd to your computer and use it in GitHub Desktop.
Save hkboujrida/7e3d48af38dafead48f65e118f9771fd to your computer and use it in GitHub Desktop.
# Set vi key bindings mode
set -g mode-keys vi
set -g status-keys vi
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind -T copy-mode DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xclip -i"
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xclip -i"
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send -X select-word \; send -X copy-pipe-no-clear "xclip -i"
bind -T copy-mode TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xclip -i"
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xclip -i"
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send -X select-line \; send -X copy-pipe-no-clear "xclip -i"
bind -n MouseDown2Pane run "tmux set-buffer -b primary_selection \"$(xclip -o)\"; tmux paste-buffer -b primary_selection; tmux delete-buffer -b primary_selection"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
# Config Dracula Theme
set -g @dracula-show-fahrenheit false
set -g @dracula-show-powerline true
set -g @dracula-show-network false
set -g @dracula-show-left-icon session
set -g @dracula-cpu-usage true
set -g @dracula-ram-usage true
set -g @dracula-day-month true
set -g @dracula-military-time true
set -g @dracula-show-flags true
# Set 256 colors
set -s default-terminal 'tmux-256color'
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# swap windows with shift+arrow with prefix
bind-key S-Left swap-window -t -1
bind-key S-Right swap-window -t +1
set -g @yank_selection 'primary'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
# turn mouse on
set -g mouse on
# restore vim sessions
set -g @resurrect-strategy-vim 'session'
# restore neovim sessions
set -g @resurrect-strategy-nvim 'session'
# restore panes
set -g @resurrect-capture-pane-contents 'on'
# restore last saved environment (automatically)
set -g @continuum-restore 'on'
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
# 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