mirror of https://github.com/nirenjan/dotfiles.git
				
				
				
			
		
			
				
	
	
		
			387 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			387 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
| # Switch prefix to use C-s instead of C-b
 | |
| unbind-key C-b
 | |
| set-option -g prefix C-s
 | |
| bind-key C-q send-prefix
 | |
| 
 | |
| # Use 256 color mode
 | |
| set-option -g default-terminal "screen-256color"
 | |
| 
 | |
| # Set the Esc/Alt disambiguation timeout to 50ms
 | |
| # The default is 500ms, which makes vim kind of painful
 | |
| set-option -sg escape-time 50
 | |
| 
 | |
| # Enable UTF-8
 | |
| set-window-option -g utf8 on
 | |
| 
 | |
| # Don't constrain the window size to smallest client size
 | |
| set-window-option -g aggressive-resize on
 | |
| 
 | |
| # Enable mouse mode
 | |
| set-option -g mode-mouse on
 | |
| set-option -g mouse-select-pane on
 | |
| set-option -g mouse-select-window on
 | |
| set-option -g mouse-utf8 on
 | |
| # I find your lack of mouse-resize-pane off disturbing
 | |
| set-option -g mouse-resize-pane off
 | |
| 
 | |
| # Scrollback buffer
 | |
| set-option -g history-limit 100000
 | |
| 
 | |
| # Default settings
 | |
| set-option -g default-command "/bin/bash"
 | |
| #set-option -g default-path "~"
 | |
| set-option -g default-shell "/bin/bash"
 | |
| 
 | |
| # Display timeout
 | |
| set-option -g display-time 1500
 | |
| 
 | |
| # Start numbering from 1
 | |
| # (because 0 is just too far away!)
 | |
| set-option -g base-index 1
 | |
| set-option -g pane-base-index 1
 | |
| 
 | |
| # Make tmux set the parent xterm title
 | |
| set-option -g set-titles on
 | |
| set-option -g set-titles-string "(#H) [#S:#I.#P] #W"
 | |
| 
 | |
| # Configure the tmux colours
 | |
| # Based on Solarized [altercation/solarized] on GitHub
 | |
| TMUX_STATUS_BG=white
 | |
| TMUX_STATUS_FG=brightyellow
 | |
| TMUX_MESSAGE_BG=white
 | |
| TMUX_MESSAGE_FG=brightyellow
 | |
| 
 | |
| # Status bar
 | |
| set-option -g status on
 | |
| set-option -g status-interval 2
 | |
| set-option -g status-bg $TMUX_STATUS_BG
 | |
| set-option -g status-fg $TMUX_STATUS_FG
 | |
| set-option -g status-utf8 on
 | |
| set-option -g status-position top
 | |
| 
 | |
| # Status bar - left
 | |
| # <username>@<host> <session name>
 | |
| set-option -g  status-left "#[fg=blue]#(whoami) "
 | |
| set-option -ga status-left "#[fg=green]#h "
 | |
| set-option -ga status-left "#[fg=brightmagenta][#S]"
 | |
| # Status bar - left length
 | |
| set-option -g status-left-length 40
 | |
| 
 | |
| # Status bar - right
 | |
| # <date/time> <stardate>
 | |
| set-option -g  status-right "#[fg=yellow]%a %F %R "
 | |
| set-option -ga status-right "#[fg=red]#(~/bin/stardate)"
 | |
| # Status bar - right length
 | |
| set-option -g status-right-length 30
 | |
| 
 | |
| # Status bar - window status
 | |
| set-window-option -g window-status-current-bg $TMUX_STATUS_BG
 | |
| set-window-option -g window-status-current-fg cyan
 | |
| set-window-option -g window-status-current-attr underscore
 | |
| set-window-option -g window-status-bg $TMUX_STATUS_BG
 | |
| set-window-option -g window-status-fg $TMUX_STATUS_FG
 | |
| set-window-option -g window-status-format "#I.#P:#W#F"
 | |
| set-window-option -g window-status-current-format "#I.#P:#W#F"
 | |
| 
 | |
| # Message bar formatting
 | |
| set-option -g message-bg $TMUX_MESSAGE_BG
 | |
| set-option -g message-fg $TMUX_MESSAGE_FG
 | |
| set-option -g message-command-bg $TMUX_MESSAGE_FG
 | |
| set-option -g message-command-fg $TMUX_MESSAGE_BG
 | |
| 
 | |
| # Pane highlighting
 | |
| set-option -g pane-active-border-fg green
 | |
| 
 | |
| # Window switching
 | |
| bind-key    C-s last-window
 | |
| unbind-key  l # existing default binding
 | |
| 
 | |
| # Window splitting
 | |
| # Just because I like the Vim key-bindings to split the window
 | |
| bind-key    s split-window
 | |
| bind-key    v split-window -h
 | |
| # Delete the existing default bindings
 | |
| unbind-key  %
 | |
| unbind-key  '"'
 | |
| 
 | |
| # Use vi style key bindings
 | |
| set-option -g mode-keys vi
 | |
| set-option -g status-keys vi
 | |
| 
 | |
| # Pane logging, a-la screen's C-a H
 | |
| bind-key H \
 | |
|     pipe-pane -o 'cat >> ~/tmux_logs/tmux_log.#I-#P' \;\
 | |
|     display-message 'Toggled logging to ~/tmux_logs/tmux_log.#I-#P'
 | |
| 
 | |
| # Synchronize panes - have a hotkey to switch sync on and off
 | |
| bind-key C-y set-window-option synchronize-panes
 | |
| 
 | |
| # Tweak the copy mode bindings
 | |
| unbind-key -t vi-copy C-e
 | |
| unbind-key -t vi-copy C-y
 | |
| unbind-key -t vi-copy Enter
 | |
| unbind-key -t vi-copy Space
 | |
| unbind-key -t vi-copy v
 | |
| bind-key -t vi-copy v begin-selection
 | |
| bind-key -t vi-copy C-v rectangle-toggle
 | |
| bind-key -t vi-copy y copy-selection
 | |
| 
 | |
| # Resize the panes using vi-style keys
 | |
| bind-key -r h resize-pane -L
 | |
| bind-key -r j resize-pane -D
 | |
| bind-key -r k resize-pane -U
 | |
| bind-key -r l resize-pane -R
 | |
| 
 | |
| # Allow the escape key to quit the command mode
 | |
| bind-key -ct vi-edit Escape cancel
 | |
| 
 | |
| # Pane zooming
 | |
| # Unbind the - key first
 | |
| unbind-key -
 | |
| bind-key + \
 | |
|     new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
 | |
|     swap-pane -s tmux-zoom.1 \;\
 | |
|     select-window -t tmux-zoom
 | |
| bind-key - \
 | |
|     last-window \;\
 | |
|     swap-pane -s tmux-zoom.1 \;\
 | |
|     kill-window -t tmux-zoom
 | |
| 
 | |
| # Clear history
 | |
| # Bash uses C-l to clear the screen, so you can use C-l, M-k to clear the
 | |
| # screen and the scrollback buffer too
 | |
| bind-key -n M-k clear-history
 | |
| 
 | |
| # Power detach (detach and hangup parent process)
 | |
| bind-key D detach-client -P
 | |
| 
 | |
| # Rather than go with the last session, let the user pick from the list
 | |
| # of available sessions
 | |
| bind-key L choose-session
 | |
| 
 | |
| # Allow the escape key to quit the choice window
 | |
| bind-key -t vi-choice Escape cancel
 | |
| 
 | |
| # Terminator style pane switching
 | |
| # OSX Terminal.app, enable Use option as meta key
 | |
| # and delete the key bindings for Option Cursor left & Option Cursor right
 | |
| #
 | |
| # nirenjan: I don't use these because I find using the Option left & right to 
 | |
| # move between words more useful than shorter key presses to select panes
 | |
| # bind-key -n M-Left  select-pane -L
 | |
| # bind-key -n M-Right select-pane -R
 | |
| # bind-key -n M-Up    select-pane -U
 | |
| # bind-key -n M-Down  select-pane -D
 | |
| 
 | |
| # Ion3 style window switching
 | |
| # OSX Terminal.app, enable Use option as meta key
 | |
| #
 | |
| bind-key -n M-0 select-window -t :10
 | |
| bind-key -n M-1 select-window -t :1
 | |
| bind-key -n M-2 select-window -t :2
 | |
| bind-key -n M-3 select-window -t :3
 | |
| bind-key -n M-4 select-window -t :4
 | |
| bind-key -n M-5 select-window -t :5
 | |
| bind-key -n M-6 select-window -t :6
 | |
| bind-key -n M-7 select-window -t :7
 | |
| bind-key -n M-8 select-window -t :8
 | |
| bind-key -n M-9 select-window -t :9
 | |
| 
 | |
| 
 | |
| # Defaults
 | |
| # bind-key        C-b send-prefix
 | |
| # bind-key        C-o rotate-window
 | |
| # bind-key        C-z suspend-client
 | |
| # bind-key      Space next-layout
 | |
| # bind-key          ! break-pane
 | |
| # bind-key          " split-window
 | |
| # bind-key          # list-buffers
 | |
| # bind-key          $ command-prompt -I #S "rename-session '%%'"
 | |
| # bind-key          % split-window -h
 | |
| # bind-key          & confirm-before -p "kill-window #W? (y/n)" kill-window
 | |
| # bind-key          ' command-prompt -p index "select-window -t ':%%'"
 | |
| # bind-key          ( switch-client -p
 | |
| # bind-key          ) switch-client -n
 | |
| # bind-key          , command-prompt -I #W "rename-window '%%'"
 | |
| # bind-key          - delete-buffer
 | |
| # bind-key          . command-prompt "move-window -t '%%'"
 | |
| # bind-key          0 select-window -t :0
 | |
| # bind-key          1 select-window -t :1
 | |
| # bind-key          2 select-window -t :2
 | |
| # bind-key          3 select-window -t :3
 | |
| # bind-key          4 select-window -t :4
 | |
| # bind-key          5 select-window -t :5
 | |
| # bind-key          6 select-window -t :6
 | |
| # bind-key          7 select-window -t :7
 | |
| # bind-key          8 select-window -t :8
 | |
| # bind-key          9 select-window -t :9
 | |
| # bind-key          : command-prompt
 | |
| # bind-key          ; last-pane
 | |
| # bind-key          = choose-buffer
 | |
| # bind-key          ? list-keys
 | |
| # bind-key          D choose-client
 | |
| # bind-key          L switch-client -l
 | |
| # bind-key          [ copy-mode
 | |
| # bind-key          ] paste-buffer
 | |
| # bind-key          c new-window
 | |
| # bind-key          d detach-client
 | |
| # bind-key          f command-prompt "find-window '%%'"
 | |
| # bind-key          i display-message
 | |
| # bind-key          l last-window
 | |
| # bind-key          n next-window
 | |
| # bind-key          o select-pane -t :.+
 | |
| # bind-key          p previous-window
 | |
| # bind-key          q display-panes
 | |
| # bind-key          r refresh-client
 | |
| # bind-key          s choose-session
 | |
| # bind-key          t clock-mode
 | |
| # bind-key          w choose-window
 | |
| # bind-key          x confirm-before -p "kill-pane #P? (y/n)" kill-pane
 | |
| # bind-key          { swap-pane -U
 | |
| # bind-key          } swap-pane -D
 | |
| # bind-key          ~ show-messages
 | |
| # bind-key      PPage copy-mode -u
 | |
| # bind-key -r      Up select-pane -U
 | |
| # bind-key -r    Down select-pane -D
 | |
| # bind-key -r    Left select-pane -L
 | |
| # bind-key -r   Right select-pane -R
 | |
| # bind-key        M-1 select-layout even-horizontal
 | |
| # bind-key        M-2 select-layout even-vertical
 | |
| # bind-key        M-3 select-layout main-horizontal
 | |
| # bind-key        M-4 select-layout main-vertical
 | |
| # bind-key        M-5 select-layout tiled
 | |
| # bind-key        M-n next-window -a
 | |
| # bind-key        M-o rotate-window -D
 | |
| # bind-key        M-p previous-window -a
 | |
| # bind-key -r    M-Up resize-pane -U 5
 | |
| # bind-key -r  M-Down resize-pane -D 5
 | |
| # bind-key -r  M-Left resize-pane -L 5
 | |
| # bind-key -r M-Right resize-pane -R 5
 | |
| # bind-key -r    C-Up resize-pane -U
 | |
| # bind-key -r  C-Down resize-pane -D
 | |
| # bind-key -r  C-Left resize-pane -L
 | |
| # bind-key -r C-Right resize-pane -R
 | |
| #
 | |
| # bind-key -t  vi-edit    C-c cancel
 | |
| # bind-key -t  vi-edit    C-h backspace
 | |
| # bind-key -t  vi-edit    Tab complete
 | |
| # bind-key -t  vi-edit  Enter enter
 | |
| # bind-key -t  vi-edit    C-u delete-line
 | |
| # bind-key -t  vi-edit    C-w delete-word
 | |
| # bind-key -t  vi-edit Escape switch-mode
 | |
| # bind-key -t  vi-edit BSpace backspace
 | |
| # bind-key -t  vi-edit     DC delete
 | |
| # bind-key -t  vi-edit   Home start-of-line
 | |
| # bind-key -t  vi-edit    End end-of-line
 | |
| # bind-key -t  vi-edit     Up history-up
 | |
| # bind-key -t  vi-edit   Down history-down
 | |
| # bind-key -t  vi-edit   Left cursor-left
 | |
| # bind-key -t  vi-edit  Right cursor-right
 | |
| # bind-key -ct vi-edit    C-c cancel
 | |
| # bind-key -ct vi-edit    C-h backspace
 | |
| # bind-key -ct vi-edit  Enter enter
 | |
| # bind-key -ct vi-edit      $ end-of-line
 | |
| # bind-key -ct vi-edit      0 start-of-line
 | |
| # bind-key -ct vi-edit      B previous-space
 | |
| # bind-key -ct vi-edit      D delete-end-of-line
 | |
| # bind-key -ct vi-edit      E next-space-end
 | |
| # bind-key -ct vi-edit      W next-space
 | |
| # bind-key -ct vi-edit      X backspace
 | |
| # bind-key -ct vi-edit      ^ start-of-line
 | |
| # bind-key -ct vi-edit      a switch-mode-append
 | |
| # bind-key -ct vi-edit      b previous-word
 | |
| # bind-key -ct vi-edit      d delete-line
 | |
| # bind-key -ct vi-edit      e next-word-end
 | |
| # bind-key -ct vi-edit      h cursor-left
 | |
| # bind-key -ct vi-edit      i switch-mode
 | |
| # bind-key -ct vi-edit      j history-down
 | |
| # bind-key -ct vi-edit      k history-up
 | |
| # bind-key -ct vi-edit      l cursor-right
 | |
| # bind-key -ct vi-edit      p paste
 | |
| # bind-key -ct vi-edit      w next-word
 | |
| # bind-key -ct vi-edit      x delete
 | |
| # bind-key -ct vi-edit BSpace backspace
 | |
| # bind-key -ct vi-edit     DC delete
 | |
| # bind-key -ct vi-edit     Up history-up
 | |
| # bind-key -ct vi-edit   Down history-down
 | |
| # bind-key -ct vi-edit   Left cursor-left
 | |
| # bind-key -ct vi-edit  Right cursor-right
 | |
| #
 | |
| # bind-key -t vi-copy    C-b page-up
 | |
| # bind-key -t vi-copy    C-c cancel
 | |
| # bind-key -t vi-copy    C-e scroll-down
 | |
| # bind-key -t vi-copy    C-f page-down
 | |
| # bind-key -t vi-copy    C-h cursor-left
 | |
| # bind-key -t vi-copy  Enter copy-selection
 | |
| # bind-key -t vi-copy    C-y scroll-up
 | |
| # bind-key -t vi-copy Escape clear-selection
 | |
| # bind-key -t vi-copy  Space begin-selection
 | |
| # bind-key -t vi-copy      $ end-of-line
 | |
| # bind-key -t vi-copy      , jump-reverse
 | |
| # bind-key -t vi-copy      / search-forward
 | |
| # bind-key -t vi-copy      0 start-of-line
 | |
| # bind-key -t vi-copy      1 start-number-prefix
 | |
| # bind-key -t vi-copy      2 start-number-prefix
 | |
| # bind-key -t vi-copy      3 start-number-prefix
 | |
| # bind-key -t vi-copy      4 start-number-prefix
 | |
| # bind-key -t vi-copy      5 start-number-prefix
 | |
| # bind-key -t vi-copy      6 start-number-prefix
 | |
| # bind-key -t vi-copy      7 start-number-prefix
 | |
| # bind-key -t vi-copy      8 start-number-prefix
 | |
| # bind-key -t vi-copy      9 start-number-prefix
 | |
| # bind-key -t vi-copy      : goto-line
 | |
| # bind-key -t vi-copy      ; jump-again
 | |
| # bind-key -t vi-copy      ? search-backward
 | |
| # bind-key -t vi-copy      B previous-space
 | |
| # bind-key -t vi-copy      D copy-end-of-line
 | |
| # bind-key -t vi-copy      E next-space-end
 | |
| # bind-key -t vi-copy      F jump-backward
 | |
| # bind-key -t vi-copy      G history-bottom
 | |
| # bind-key -t vi-copy      H top-line
 | |
| # bind-key -t vi-copy      J scroll-down
 | |
| # bind-key -t vi-copy      K scroll-up
 | |
| # bind-key -t vi-copy      L bottom-line
 | |
| # bind-key -t vi-copy      M middle-line
 | |
| # bind-key -t vi-copy      N search-reverse
 | |
| # bind-key -t vi-copy      T jump-to-backward
 | |
| # bind-key -t vi-copy      W next-space
 | |
| # bind-key -t vi-copy      ^ back-to-indentation
 | |
| # bind-key -t vi-copy      b previous-word
 | |
| # bind-key -t vi-copy      e next-word-end
 | |
| # bind-key -t vi-copy      f jump-forward
 | |
| # bind-key -t vi-copy      g history-top
 | |
| # bind-key -t vi-copy      h cursor-left
 | |
| # bind-key -t vi-copy      j cursor-down
 | |
| # bind-key -t vi-copy      k cursor-up
 | |
| # bind-key -t vi-copy      l cursor-right
 | |
| # bind-key -t vi-copy      n search-again
 | |
| # bind-key -t vi-copy      q cancel
 | |
| # bind-key -t vi-copy      t jump-to-forward
 | |
| # bind-key -t vi-copy      v rectangle-toggle
 | |
| # bind-key -t vi-copy      w next-word
 | |
| # bind-key -t vi-copy BSpace cursor-left
 | |
| # bind-key -t vi-copy  NPage page-down
 | |
| # bind-key -t vi-copy  PPage page-up
 | |
| # bind-key -t vi-copy     Up cursor-up
 | |
| # bind-key -t vi-copy   Down cursor-down
 | |
| # bind-key -t vi-copy   Left cursor-left
 | |
| # bind-key -t vi-copy  Right cursor-right
 | |
| # bind-key -t vi-copy   C-Up scroll-up
 | |
| # bind-key -t vi-copy C-Down scroll-down
 | |
| #
 | |
| # bind-key -t vi-choice    C-b page-up
 | |
| # bind-key -t vi-choice    C-c cancel
 | |
| # bind-key -t vi-choice    C-e scroll-down
 | |
| # bind-key -t vi-choice    C-f page-down
 | |
| # bind-key -t vi-choice  Enter choose
 | |
| # bind-key -t vi-choice    C-y scroll-up
 | |
| # bind-key -t vi-choice      j down
 | |
| # bind-key -t vi-choice      k up
 | |
| # bind-key -t vi-choice      q cancel
 | |
| # bind-key -t vi-choice  NPage page-down
 | |
| # bind-key -t vi-choice  PPage page-up
 | |
| # bind-key -t vi-choice     Up up
 | |
| # bind-key -t vi-choice   Down down
 | |
| # bind-key -t vi-choice   C-Up scroll-up
 | |
| # bind-key -t vi-choice C-Down scroll-down
 |