Update tmux.conf
This commit is contained in:
		
							parent
							
								
									d2a79c952e
								
							
						
					
					
						commit
						c9d39ea084
					
				
							
								
								
									
										140
									
								
								tmux.conf
									
									
									
									
									
								
							
							
						
						
									
										140
									
								
								tmux.conf
									
									
									
									
									
								
							| 
						 | 
					@ -1,35 +1,51 @@
 | 
				
			||||||
## Behavior ###############
 | 
					## Behavior ###############
 | 
				
			||||||
 | 
					# utf-8
 | 
				
			||||||
 | 
					set -g utf8 on
 | 
				
			||||||
 | 
					set -g status-utf8 on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Zero-based indexing is fine in programming languages, but not so much in
 | 
					# Zero-based indexing is fine in programming languages, but not so much in
 | 
				
			||||||
# a multiplexer when zero is on the other side of the keyboard.
 | 
					# a multiplexer when zero is on the other side of the keyboard.
 | 
				
			||||||
set -g base-index 1
 | 
					set -g base-index 1
 | 
				
			||||||
set -g renumber-windows on
 | 
					set -g renumber-windows on
 | 
				
			||||||
setw -g automatic-rename on
 | 
					setw -g automatic-rename on
 | 
				
			||||||
# status bar
 | 
					
 | 
				
			||||||
set-option -g status-utf8 on
 | 
					# address vim mode switching delay (http://superuser.com/a/252717/65504)
 | 
				
			||||||
# Remove the <C-a> delay
 | 
					set -g escape-time 0
 | 
				
			||||||
set -s escape-time 0
 | 
					
 | 
				
			||||||
 | 
					# tmux messages are displayed for 4 seconds
 | 
				
			||||||
 | 
					set -g display-time 2000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Rather than constraining window size to the maximum size of any client
 | 
					# Rather than constraining window size to the maximum size of any client
 | 
				
			||||||
# connected to the *session*, constrain window size to the maximum size of any
 | 
					# connected to the *session*, constrain window size to the maximum size of any
 | 
				
			||||||
# client connected to *that window*. Much more reasonable.
 | 
					# client connected to *that window*. Much more reasonable.
 | 
				
			||||||
setw -g aggressive-resize off
 | 
					setw -g aggressive-resize off
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# go zsh, go
 | 
					# go zsh, go
 | 
				
			||||||
set-option -g default-shell $SHELL
 | 
					set -g default-shell $SHELL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# a mouse
 | 
					# a mouse
 | 
				
			||||||
setw -g mouse-utf8 on
 | 
					# setw -g mouse-utf8 on
 | 
				
			||||||
setw -g mouse on
 | 
					setw -g mouse on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# fix mouse scrolling: enter copy mode on scroll-up, exits it when scrolled to bottom
 | 
					# fix mouse scrolling: enter copy mode on scroll-up, exits it when scrolled to bottom
 | 
				
			||||||
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
 | 
					bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# set -g visual-activity off
 | 
				
			||||||
 | 
					setw -g monitor-activity on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# focus events enabled for terminals that support them
 | 
				
			||||||
 | 
					set -g focus-events on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# increase scrollback buffer size
 | 
				
			||||||
 | 
					set -g history-limit 10000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Key bindings ###########
 | 
					## Key bindings ###########
 | 
				
			||||||
# Remap the key prefix
 | 
					# Remap the key prefix
 | 
				
			||||||
set -g prefix C-c
 | 
					set -g prefix ^c
 | 
				
			||||||
 | 
					set -g prefix2 ^f
 | 
				
			||||||
unbind C-b
 | 
					unbind C-b
 | 
				
			||||||
# Restore sigterm C-c
 | 
					# Restore sigterm C-c
 | 
				
			||||||
bind C-c send-prefix
 | 
					bind C-c send-prefix
 | 
				
			||||||
# Go to last active window
 | 
					 | 
				
			||||||
bind-key a last-window
 | 
					 | 
				
			||||||
# reload config without killing server
 | 
					 | 
				
			||||||
bind r source-file ~/.tmux.conf \; display-message "  Config reloaded..".
 | 
					 | 
				
			||||||
# set vi keys
 | 
					# set vi keys
 | 
				
			||||||
setw -g mode-keys vi
 | 
					setw -g mode-keys vi
 | 
				
			||||||
unbind [
 | 
					unbind [
 | 
				
			||||||
| 
						 | 
					@ -50,7 +66,12 @@ bind s split-window -v
 | 
				
			||||||
bind v split-window -h
 | 
					bind v split-window -h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# break pane into a window
 | 
					# break pane into a window
 | 
				
			||||||
bind w break-pane
 | 
					bind = break-pane
 | 
				
			||||||
 | 
					bind - join-pane
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# reload config without killing server
 | 
				
			||||||
 | 
					bind r source-file ~/.tmux.conf \; display-message "  Config reloaded..".
 | 
				
			||||||
 | 
					bind R refresh-client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Smart pane switching with awareness of vim splits
 | 
					# Smart pane switching with awareness of vim splits
 | 
				
			||||||
# See: https://github.com/christoomey/vim-tmux-navigator
 | 
					# See: https://github.com/christoomey/vim-tmux-navigator
 | 
				
			||||||
| 
						 | 
					@ -60,44 +81,89 @@ bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
 | 
				
			||||||
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
 | 
					bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
 | 
				
			||||||
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
 | 
					bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
 | 
				
			||||||
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
 | 
					bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
 | 
				
			||||||
 | 
					bind C-w last-pane
 | 
				
			||||||
 | 
					bind C-n next-window
 | 
				
			||||||
 | 
					bind C-p previous-window
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bind h resize-pane -L 5
 | 
					bind -n C-1 select-window -t :1
 | 
				
			||||||
bind j resize-pane -D 5
 | 
					bind -n C-2 select-window -t :2
 | 
				
			||||||
bind k resize-pane -U 5
 | 
					bind -n C-3 select-window -t :3
 | 
				
			||||||
bind l resize-pane -R 5
 | 
					bind -n C-4 select-window -t :4
 | 
				
			||||||
 | 
					bind -n C-5 select-window -t :5
 | 
				
			||||||
 | 
					bind -n C-6 select-window -t :6
 | 
				
			||||||
 | 
					bind -n C-7 select-window -t :7
 | 
				
			||||||
 | 
					bind -n C-8 select-window -t :8
 | 
				
			||||||
 | 
					bind -n C-9 select-window -t :9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bind n next-window
 | 
					# Pane resizing
 | 
				
			||||||
bind p previous-window
 | 
					bind C-h resize-pane -L 6
 | 
				
			||||||
 | 
					bind C-j resize-pane -D 6
 | 
				
			||||||
 | 
					bind C-k resize-pane -U 6
 | 
				
			||||||
 | 
					bind C-l resize-pane -R 6
 | 
				
			||||||
 | 
					bind -n M-h resize-pane -L 6
 | 
				
			||||||
 | 
					bind -n M-j resize-pane -D 6
 | 
				
			||||||
 | 
					bind -n M-k resize-pane -U 6
 | 
				
			||||||
 | 
					bind -n M-l resize-pane -R 6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Swap panes directionally
 | 
				
			||||||
 | 
					bind H run '~/.dotfiles/tmux/swap-pane.rb left'
 | 
				
			||||||
 | 
					bind J run '~/.dotfiles/tmux/swap-pane.rb down'
 | 
				
			||||||
 | 
					bind K run '~/.dotfiles/tmux/swap-pane.rb up'
 | 
				
			||||||
 | 
					bind L run '~/.dotfiles/tmux/swap-pane.rb right'
 | 
				
			||||||
 | 
					bind M run '~/.dotfiles/tmux/swap-pane.rb master'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bind o resize-pane -Z
 | 
				
			||||||
 | 
					bind P run-shell '~/.dotfiles/tmux/select-pane.sh'
 | 
				
			||||||
 | 
					bind S run-shell '~/.dotfiles/tmux/select-session.sh'
 | 
				
			||||||
 | 
					bind W run-shell '~/.dotfiles/tmux/select-window.sh'
 | 
				
			||||||
 | 
					bind / choose-session
 | 
				
			||||||
 | 
					bind . choose-window
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bind n run-shell 'TMUX= tmux new-session -t "$(basename \"$PWD\")" -d \; switch-client -t "$(basename \"$PWD\")"'
 | 
				
			||||||
 | 
					bind N run-shell 'TMUX= tmux new-session -t "$(tmux display-message -p #S)" -s "$(tmux display-message -p #S-clone)" -d \; switch-client -n \; display-message "session #S cloned"'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bind = select-layout tiled
 | 
				
			||||||
 | 
					bind | select-layout even-horizontal
 | 
				
			||||||
 | 
					bind _ select-layout even-vertical
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# switch between sessions
 | 
				
			||||||
 | 
					bind -r [ switch-client -p
 | 
				
			||||||
 | 
					bind -r ] switch-client -n
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Disable confirmation
 | 
					# Disable confirmation
 | 
				
			||||||
bind & kill-window
 | 
					 | 
				
			||||||
bind x kill-pane
 | 
					bind x kill-pane
 | 
				
			||||||
 | 
					bind X kill-window
 | 
				
			||||||
 | 
					bind q kill-session
 | 
				
			||||||
 | 
					bind Q kill-server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# after copying to a tmux buffer, hit y again to copy to clipboard
 | 
					 | 
				
			||||||
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
 | 
					 | 
				
			||||||
# quick view of processes
 | 
					# quick view of processes
 | 
				
			||||||
bind '~' split-window "exec top"
 | 
					bind '~' split-window "exec top"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Looks ########################
 | 
					## Looks ########################
 | 
				
			||||||
set -g default-terminal "screen-256color"
 | 
					set -g set-titles on
 | 
				
			||||||
 | 
					set -g set-titles-string "tmux [#H] #S/#W/#T"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -g status-bg colour236
 | 
					set -s default-terminal "xterm-256color"
 | 
				
			||||||
set -g status-fg white
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
set-window-option -g window-status-current-fg black
 | 
					setw -g window-status-fg colour245
 | 
				
			||||||
set-window-option -g window-status-current-bg yellow
 | 
					setw -g window-status-bg colour237
 | 
				
			||||||
 | 
					setw -g window-status-current-fg yellow
 | 
				
			||||||
 | 
					setw -g window-status-current-bg black
 | 
				
			||||||
 | 
					setw -g window-status-activity-attr bold,blink
 | 
				
			||||||
 | 
					setw -g window-status-activity-bg colour236
 | 
				
			||||||
 | 
					setw -g window-status-activity-fg white
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -g pane-border-fg colour235
 | 
					 | 
				
			||||||
set -g pane-border-bg black
 | 
					 | 
				
			||||||
set -g pane-active-border-fg yellow
 | 
					set -g pane-active-border-fg yellow
 | 
				
			||||||
set -g pane-active-border-bg black
 | 
					set -g pane-border-fg colour238
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Status bar ###################
 | 
					set -g status-bg colour237
 | 
				
			||||||
set-option -g status-justify left
 | 
					set -g status-fg white
 | 
				
			||||||
set-option -g status-right-length 60
 | 
					set -g status-interval 60
 | 
				
			||||||
set-option -g status-left-length 60
 | 
					set -g status-justify left
 | 
				
			||||||
set-option -g status-left '#[bg=yellow] #[fg=black]#[bold]#S #[default] '
 | 
					set -g status-right-length 100
 | 
				
			||||||
set-option -g status-right '#(hostname) '
 | 
					set -g status-left-length 80
 | 
				
			||||||
 | 
					set -g status-left '#[fg=white] #S #[fg=yellow]'
 | 
				
			||||||
 | 
					set -g status-right "#[fg=colour242]<#[fg=colour248]< #(sysctl -n vm.loadavg | awk '{ print $2,$3,$4 }') < #[fg=yellow]#(dig +short myip.opendns.com @208.67.222.222) #[bg=yellow]#[fg=black] #(hostname) "
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -g window-status-format "#I. #W"
 | 
					set -g window-status-format " #I #W:#T "
 | 
				
			||||||
set -g window-status-current-format " #I. #W "
 | 
					set -g window-status-current-format " ⮀ #W:#T "
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue