dotfiles/tmux.conf.mine

164 lines
6.4 KiB
Text

# vim: set ft=conf
# Behave like screen
unbind-key C-b
set-option -g prefix C-a
bind-key a send-prefix
# Handle Window splitting a little more human-like.
unbind %
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
# Helpers
bind-key C-a last-window
bind-key r source-file ~/.tmux.conf \; display-message 'source-file done' # Reload tmux configuration
# Basic Options
set-option -g base-index 1
set-option -g bell-action any
set-option -g visual-bell off
set-window-option -g xterm-keys on
#setw -g xterm-keys on
# Enable mouse
setw -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
#set-window-option -g mode-mouse on
#set-window-option -g mouse-select-pane on
#set-window-option -g mouse-resize-pane on
#set-window-option -g mouse-select-window on
# Use zsh
set-option -g default-shell /usr/bin/zsh
#set-option -g default-command /usr/bin/zsh
# Use 256 color
set-option -g default-terminal 'screen-256color'
#set-option -g default-terminal 'screen-256color-bce'
# Monitor and highlight window with activity
set-window-option -g monitor-activity on
# Act like vim
set -gs escape-time 0
set-option -g set-titles on
set-window-option -g automatic-rename on
#set-option -g allow-rename off
set-window-option -g mode-keys vi
#bind-key -r h select-pane -L
#bind-key -r j select-pane -D
#bind-key -r k select-pane -U
#bind-key -r l select-pane -R
#bind-key s split-window -v
#bind-key v split-window -h
#bind-key -r C-h select-window -t :-
#bind-key -r C-l select-window -t :+
#bind-key -r > resize-pane -R 10
#bind-key -r < resize-pane -L 10
#bind-key -r + resize-pane -D 10
#bind-key -r - resize-pane -U 10
# displays *
bind * list-clients
# Helpful commands
bind / command-prompt -p "man" "split-window -h 'exec man %%'"
bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'" # Open a ssh session in a new window with input host
# Join pane into a new split in current window
bind-key C-j command-prompt -p "join pane from:" "join-pane -h -s '%%'"
bind-key C-s command-prompt -p "send pane to:" "join-pane -h -t '%%'"
# Powerline
#source ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
#
# Override Powerline config
#set -g status-interval 5
# move x clipboard into tmux paste buffer
#bind C-p run "xclip -o | tmux load-buffer -"
# move tmux copy buffer into x clipboard
#bind C-y run "tmux save-buffer - | xclip -i -selection clipboard"
#bind-key C-y run "tmux show-buffer | xsel -i -b" \; display-message "Copied tmux buffer to system clipboard"
#bind-key C-p run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer" \; display-message "Copied system clipboard to tmux"
#disabled for tmux-yank plugin
#bind -t vi-copy 'y' copy-selection
#bind -t vi-copy 'y' copy-pipe "xclip"
#bind -t vi-copy 'y' copy-pipe "xclip --clipboard"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard; tmux paste-buffer'
bind-key -T copy-mode-vi ! send-keys -X copy-pipe-and-cancel "tr -d '\n' | xclip -in -selection clipboard"
bind-key -T copy-mode-vi Home send-keys -X start-of-line
bind-key -T copy-mode-vi End send-keys -X end-of-line
#bind-key y run "tmux send-keys 'C-a'; tmux copy-mode; tmux send-keys 'v150j$be'; tr -d '\n' | xclip -in -selection clipboard; tmux send-keys 'C-e'; display_message 'Line copied to clipboard!'"
bind Space next-window
#bind -n M-NPage copy-mode ; send-keys NPage
#bind -n M-PPage copy-mode ; send-keys PPage
bind -n M-Right next-window
bind -n M-Left previous-window
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
bind -n C-PPage run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-PPage') || tmux select-pane -L"
bind -n C-NPage run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-NPage') || tmux select-pane -D"
#source /usr/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
#source /usr/share/tmux/powerline.conf
# Powerline
#source ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
# Override Powerline config
#set -g status-interval 5
# Alternative to Powerline:
set -g status on
# No longer necessary
##set -g status-utf8 on
#set -g status-interval 2
#set -g status-fg colour247
#set -g status-bg colour232
#set -g status-right '#[bg=colour233] #[fg=white,bg=colour234] %T #[fg=yellow,bg=colour233] #[bg=colour232]'
#set -g status-left '#[fg=colour16,bg=colour237,bold] #S #[fg=colour254,bg=colour234,nobold]'
#set -g window-status-format "#[fg=colour43,bg=colour234] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
#set -g window-status-current-format "#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
#set -g window-status-separator ">"
source $HOME/.tmux/tmuxline.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-copycat'
#set -g @plugin 'tmux-plugins/tmux-yank'
#set -g @yank_selection 'primary'
# 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'
# ZSH Integrations
bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'