Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. # Settings for tmux
  2.  
  3. # Setting the prefix from C-b to C-a
  4. set -g prefix C-a
  5. #
  6. # Free the original Ctrl-b prefix keybinding
  7. unbind C-b
  8. #
  9. # Setting duration of time to show message
  10. set-option -g display-time 4000
  11. #setting the delay between prefix and command
  12. set -s escape-time 1
  13. #
  14. # Ensure that we can send Ctrl-A to other apps
  15. bind C-a send-prefix
  16.  
  17. # Set the base index for windows to 1 instead of 0
  18. set -g base-index 1
  19.  
  20.  
  21. set -g focus-events on
  22.  
  23. # Set the base index for panes to 1 instead of 0
  24. setw -g pane-base-index 1
  25.  
  26. # Reload the file with Prefix r
  27. bind r source-file ~/.tmux.conf \; display "Reloaded!"
  28.  
  29. # splitting panes with | and -
  30. bind | split-window -h
  31. bind - split-window -v
  32.  
  33. # moving between panes with Prefix h,j,k,l
  34. bind -r h select-pane -L
  35. bind -r j select-pane -D
  36. bind -r k select-pane -U
  37. bind -r l select-pane -R
  38.  
  39. # Quick window selection
  40. bind -r C-h select-window -t :-
  41. bind -r C-l select-window -t :+
  42.  
  43. # Pane resizing panes with Prefix H,J,K,L
  44. bind -r H resize-pane -L 5
  45. bind -r J resize-pane -D 5
  46. bind -r K resize-pane -U 5
  47. bind -r L resize-pane -R 5
  48.  
  49. # mouse support - set to on if you want to use the mouse
  50. set -g mouse on
  51.  
  52. # Set the default terminal mode to 256color mode
  53. set -g default-terminal "screen-256color"
  54.  
  55. # set the status line's colors
  56. set -g status-style fg=white,bg=black
  57.  
  58. # set the color of the window list
  59. setw -g window-status-style fg=cyan,bg=black
  60.  
  61. # set colors for the active window
  62. setw -g window-status-current-style fg=white,bold,bg=red
  63.  
  64. # colors for pane borders
  65. setw -g pane-border-style fg=green,bg=black
  66. setw -g pane-active-border-style fg=white,bg=yellow
  67.  
  68. # active pane normal, other shaded out
  69. setw -g window-style fg=colour240,bg=colour235
  70. setw -g window-active-style fg=white,bg=black
  71.  
  72. # Command / message line
  73. setw -g message-style fg=white,bold,bg=black
  74.  
  75. # Status line left side to show Session:window:pane
  76. set -g status-left-length 40
  77. set -g status-left "#[fg=green]S:#S #[fg=yellow]W:#I #[fg=cyan]P:#P"
  78.  
  79. # Status line right side - 31 Oct 13:37
  80. set -g status-right "#[fg=cyan]%b/%d %R"
  81.  
  82. # Update the status line every sixty seconds
  83. set -g status-interval 60
  84.  
  85. # Center the window list in the status line
  86. set -g status-justify centre
  87.  
  88. # enable activity alerts
  89. setw -g monitor-activity on
  90. set -g visual-activity on
  91.  
  92. # enable vi keys.
  93. setw -g mode-keys vi
  94.  
  95. # split pane and retain the current directory of existing pane
  96. bind _ split-window -v -c "#{pane_current_path}"
  97. bind \ split-window -h -c "#{pane_current_path}"
  98.  
  99. # Load mac-specific settings
  100. # Setting the namespace
  101. set -g default-command "reattach-to-user-namespace -l /bin/zsh"
  102.  
  103. # Prefix C-c copy buffer to system clipboard
  104. bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
  105.  
  106. # Prefix C-v paste system clipboard into tmux
  107. bind C-v run \
  108. "tmux set-buffer \"$(reattach-to-user-namespace pbpaste)\"; tmux paste-buffer"
  109.  
  110. # Setup 'v' to begin selection as in Vim
  111. bind-key -t vi-copy v begin-selection
  112. bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
  113.  
  114. # Update default binding of `Enter` to also use copy-pipe
  115. unbind -t vi-copy Enter
  116. bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
  117.  
  118.  
  119.  
  120. ################## END Of Mac specific setting####################
  121. # load private settings if they exist
  122. if-shell "[ -f ~/.tmux.private]" "source ~/.tmux.private"
  123.  
  124. is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
  125. | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  126. bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  127. bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  128. bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  129. bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
  130. bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
  131.  
  132. # bind C-l send-keys 'C-l'
  133. set -g default-shell /bin/zsh
  134.  
  135. set -g @plugin 'tmux-plugins/tpm'
  136. set -g @plugin 'tmux-plugins/tmux-resurrect'
  137. set -g @plugin 'tmux-plugins/vim-tmux-focus-events'
  138. set -g @plugin 'tmux-plugins/tmux-continuum'
  139. set -g @plugin 'tmux-plugins/tmux-copycat'
  140. set -g @plugin 'tmux-plugins/tmux-open'
  141. run '~/.tmux/plugins/tpm/tpm'
  142.  
  143. is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
  144. | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  145. bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  146. bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  147. bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  148. bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
  149. bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
  150.  
  151. # automatically save sessions
  152. set -g @continuum-restore 'on'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement