Advertisement
kaushalmodi

.tmux.conf

Jan 29th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 10.50 KB | None | 0 0
  1. # Time-stamp: <2014-01-30 16:54:02 kmodi>
  2. # Running tmux dev build 1.9
  3.  
  4. ################################################################################
  5. # PREFIX
  6. set   -g prefix C-z
  7. unbind C-b # unbind the default binding to send prefix key to the application
  8. # Often you'll run a tmux inside another tmux and need a command sequence to
  9. # send things to the inner session. With below binding that can be accomplished
  10. # using "PREFIX Z <command>"
  11. bind   Z send-prefix
  12.  
  13. # Source config
  14. unbind r # unbind default binding to force redraw of attached client
  15. bind   r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ."
  16.  
  17. ################################################################################
  18. # Pane Management (no pun intended)
  19. set   -g pane-base-index 1   # start pane indices at 1
  20. bind   o select-pane -t :.+  # cycle panes
  21. bind   O select-pane -t :.-  # cycle panes in reverse
  22. bind   z resize-pane -Z      # zoom/unzoom the current pane
  23. # Convert a window from current or any other session to a pane
  24. bind   j command-prompt -p "Join pane from [sess:]win# (ex: kmodi:3 or 2(from current session)):" "join-pane -s '%%'"
  25. # Convert a pane to a window in current or any other session
  26. bind   J command-prompt -p "Send pane to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "join-pane -t '%%'"
  27. # If the window has >1 panes kill them without confirming. But confirm before kill
  28. # the last pane (along with its window) in a window
  29. bind   x if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
  30.     "confirm-before -p \"Kill the only pane in window? It will kill this window too! (y/n)\" kill-pane" \
  31.     "kill-pane"
  32. # resize pane
  33. bind -r C-h resize-pane -L 2
  34. bind -r C-j resize-pane -D 2
  35. bind -r C-k resize-pane -U 2
  36. bind -r C-l resize-pane -R 2
  37. # pane border colors
  38. set  -g pane-active-border-fg yellow
  39. set  -g pane-border-fg        colour235
  40. # PREFIX Up, Down, Right, Left : Move cursor from one pane to another
  41. # PREFIX Space                 : Cycle through different pane layouts
  42. # PREFIX !                     : break-pane, convert the current pane to a window
  43. # PREFIX ;                     : last-pane, switch to the last active pane
  44. # PREFIX C-o                   : rotate-window, rotate panes in the current window
  45.  
  46. ################################################################################
  47. # Window Management
  48. set   -g base-index 1 # start window indices at 1
  49. # automatically renumber the windows
  50. # http://unix.stackexchange.com/questions/21742/renumbering-windows-in-tmux
  51. set   -g renumber-windows on
  52. unbind & # unbind default binding for `split-window -h`
  53. bind   - split-window -v  # vertical split
  54. bind   | split-window -h  # horizontal split
  55. unbind c # unbind default binding for `new-window`
  56. # bind   c new-window -c $PWD # DOESN'T WORK!!
  57. bind C-f command-prompt -p "New window:" "new-window -n %1"
  58. bind C-r command-prompt -p "New name for this window:" "rename-window '%%'"
  59. unbind l # unbind default binding for `last-window`
  60. bind C-z last-window # switch to last active window
  61. unbind t # unbind default binding to show time
  62. bind   t swap-window -t 1 # swap the current window's position with window # 1, move it to the top
  63. # Move the current window to another window index in the same or any other session
  64. bind   m command-prompt -p "Move window to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "move-window -t '%%'"
  65. # Move or bring a window from a different session to the current one
  66. bind   M command-prompt -p "Move the window from sess:win# (ex: kmodi:3):" "move-window -s '%%'"
  67. bind   N move-window -r # renumber the windows
  68. bind   < swap-window -t -1 # move window one position to the left
  69. unbind , # unbind default binding for `rename-window`
  70. bind   , swap-window -t -1 # move window one position to the left
  71. bind   > swap-window -t +1 # move window one position to the right
  72. unbind . # unbind default binding to move window to user provided index
  73. bind   . swap-window -t +1 # move window one position to the right
  74. unbind & # unbind default binding for `kill-window`
  75. bind C-c confirm-before -p "Kill this window? (y/n)" kill-window
  76. # PREFIX # : switches to window with index=#
  77. # PREFIX p : previous-window
  78. # PREFIX n : next-window
  79. # PREFIX w : choose-window, choose window interactively
  80.  
  81. ################################################################################
  82. # Session Management
  83. bind C-t command-prompt -p "New name for this session:" "rename-session '%%'"
  84. unbind L # unbind default binding for `switch-client -l`
  85. bind   b switch-client -l # switch to previously selected session
  86. # PREFIX s : choose-session, select a session to switch to
  87. # tmux kill-session -t NAME/SESSIONNUMBER # Kill session
  88.  
  89. ################################################################################
  90. # Enable Mouse actions
  91. set   -g mouse-resize-pane on
  92. set   -g mouse-select-pane on
  93. set   -g mouse-select-window on
  94. set   -g mouse-utf8 on
  95. setw  -g mode-mouse on
  96.  
  97. ################################################################################
  98. # window title
  99. set   -g set-titles on
  100. set   -g set-titles-string '#W W#I/#{session_windows} P#P/#{window_panes} [#h:#S]'
  101.  
  102. ################################################################################
  103. # Status Bar
  104. set   -g status-utf8 on
  105. set   -g status-justify centre
  106. set   -g status-bg black
  107. set   -g status-fg colour240
  108. set   -g status-left-length 10
  109. set   -g status-left ' #[fg=white,bold][#S] '
  110. set   -g status-right-length 20
  111. set   -g status-right ' #[fg=white]%l:%M %b %d %a '
  112.  
  113. # # tmux-powerline
  114. # # https://github.com/erikw/tmux-powerline
  115. # set -g status-left-length 30
  116. # set -g status-right-length 30
  117. # set -g status-left "#(~/usr_local/scripts/tmux-powerline/powerline.sh left)"
  118. # set -g status-right "#(~/usr_local/scripts/tmux-powerline/powerline.sh right)"
  119.  
  120. # Message font customization
  121. set   -g message-bg yellow
  122. set   -g message-fg white
  123. set   -g message-attr bold
  124.  
  125. # Highlight the active window name
  126. setw  -g window-status-current-fg   white
  127. setw  -g window-status-current-bg   yellow
  128. # Possible attribute values:
  129. # none, bold/bright, dim, underscore, blink, reverse, hidden, or italics
  130. setw  -g window-status-current-attr bold
  131.  
  132. # Notify when a window has activity
  133. # This quick snippet will have tmux notify you in the status area when a
  134. # window has activity:
  135. setw  -g monitor-activity on
  136. set   -g visual-activity  off # Displays a message telling that an activity happened
  137. setw  -g window-status-activity-fg   white
  138. setw  -g window-status-activity-bg   red
  139. setw  -g window-status-activity-attr none
  140. # It lets me know that there is activity in a non-active window
  141. # To try this, enter `sleep 10 && echo “Hi”` in a window and switch to
  142. # another window.
  143.  
  144. # Notify when a window has a content alert
  145. setw  -g monitor-content "--[A-Za-z][A-Za-z]sim Done--" # This string appears when a sim finishes, alert then
  146. # setw  -g monitor-content "" # Disable monitor-content
  147. set   -g visual-content  on # Displays a message telling that a content alert was triggered
  148. setw  -g window-status-content-fg   black
  149. setw  -g window-status-content-bg   green
  150. setw  -g window-status-content-attr none
  151.  
  152. # Move focus to command prompt. tmux commands can be entered there directly
  153. # without using the `tmux` prefix and it also supports auto-complete.
  154. bind C-x command-prompt # default command-prompt binding "PREFIX :" also works
  155.  
  156. ################################################################################
  157. # audible and visual bells
  158. set   -g bell-action any
  159. set   -g bell-on-alert off
  160. set   -g visual-bell on
  161.  
  162. ################################################################################
  163. # COPY & PASTE
  164. # Copy tmux buffer to X clipboard
  165. bind C-w run -b "tmux show-buffer | xclip -selection clipboard -i"
  166. # Paste from X clipboard into tmux
  167. bind C-y run -b "exec </dev/null; xclip -o | tmux load-buffer - ; tmux paste-buffer"
  168.  
  169. ################################################################################
  170. # Execute same command in all windows
  171. # Source: http://stackoverflow.com/questions/9250884/send-command-to-all-window-in-tmux
  172. bind C-e command-prompt -p "Session:,Command:" "run-shell \"tmux list-windows -t %1 \| cut -d: -f1\|xargs -I\{\} tmux send-keys -t %1:\{\} %2 Enter\""
  173.  
  174. ################################################################################
  175. # Miscellaneous
  176. # When a smaller terminal connects to a tmux client, it shrinks to fit it. The
  177. # clients attached with bigger displays see this constrained view.
  178. # aggressive-resize makes it such that the window is only resized if the smaller
  179. # client is actively looking at it.
  180. setw  -g aggressive-resize on
  181. setw  -g mode-keys         emacs # Use emacs keybindings in copy mode
  182. setw  -g status-keys       emacs
  183. set   -s escape-time       0 # Allows for faster key repetition
  184. set   -g default-terminal  "xterm-256color" # "xterm"
  185. set   -g history-limit     500000
  186.  
  187. ################################################################################
  188. # end of tmux configuration
  189. ################################################################################
  190.  
  191. # set is equivalent to set-option
  192. # setw -> set-window-option
  193. # bind -> bind-key
  194. # unbind -> unbind-key
  195. # display -> display-message
  196. # if -> if-shell
  197.  
  198. # Colo'u'r table
  199. # http://guns.github.io/xterm-color-table.vim/images/xterm-color-table.png
  200.  
  201. # CHARACTER PAIR       REPLACED WITH
  202. #    #(command)        First line of command’s output
  203. #    #[attributes]     Colour or attribute change
  204. #    #H                Hostname of local host
  205. #    #I                Current window index
  206. #    #P                Current pane index
  207. #    #S                Session name
  208. #    #T                Current window title
  209. #    #W                Current window name
  210. #    ##                A literal ‘#’
  211.  
  212. # Variables used in time format
  213. # Source: http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Commontimeformatvariables
  214. # %y = year in numbers (2-digit)
  215. # %Y = year in numbers (4-digit)
  216. # %m = month in number (eg: 12)
  217. # %B = full month name (eg: December)
  218. # %b = short month name (eg: Dec)
  219. # %d = day in numbers, with leading zeros (eg: 08)
  220. # %e = day in numbers, no leading zeros (eg: 8)
  221. # %A = full weekday name (eg: Sunday)
  222. # %a = short weekday name (eg: Sun)
  223. # %H = hours in 24-clock, with leading zeros
  224. # %k = hours in 24-clock, no leading zeros
  225. # %l = hours in 12-clock, with leading zeros
  226. # %p = am/pm
  227. # %T = time in 24-hour notation (%H:%M:%S)
  228.  
  229. # PREFIX ? : list-keys, display key bindings
  230.  
  231. # How do I know which tmux version I am running?
  232. # tmux -V
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement