SHARE
TWEET

tmux.conf

jv2112 Jun 29th, 2014 (edited) 183 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # cat << ►_◄ > /dev/null
  2.  
  3.  
  4. # -- general -------------------------------------------------------------------
  5.  
  6. set -g default-terminal "screen-256color" # colors!
  7. setw -g xterm-keys on
  8. set -s escape-time 0                      # fastest command sequences
  9. set -sg repeat-time 600                   # increase repeat timeout
  10. set -s quiet on                           # disable various messages
  11.  
  12. set -g prefix2 C-a                        # GNU-Screen compatible prefix
  13. bind C-a send-prefix -2
  14.  
  15. # uncomment to force vi-style key bindings
  16. # emacs is the default unless $EDITOR or $VISUAL contain 'vi'
  17. #set -g status-keys vi
  18. #setw -g mode-keys vi
  19.  
  20. set -g status-utf8 on                     # expect UTF-8
  21. setw -g utf8 on
  22.  
  23. set -g history-limit 5000                 # boost history
  24.  
  25. # edit configuration
  26. bind e new-window -n '~/.tmux.conf' '${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"'
  27.  
  28. # reload configuration
  29. bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
  30.  
  31. # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
  32. if 'which -s reattach-to-user-namespace' 'set -g default-command "tmux rename-window initializing; tmux set -w automatic-rename; reattach-to-user-namespace $SHELL -l"'
  33.  
  34.  
  35. # ----------------- Python --------------------- #
  36. bind-key M-p new-window -n Python -c $HOME/Python/ \; \
  37.         send-keys 'clear' 'Enter' \; \
  38.         send-keys 'bpython' 'Enter'  \; \
  39.         split-window -v -p 70 -c $HOME/Python/ \; \
  40.         select-pane -t 1
  41.  
  42.  
  43. # --------------- Music ------------------------- #
  44. bind-key M-t new-window -n Tunes -c $HOME \; \
  45.         send-keys 'clear && pianobar' 'Enter' 'tux2112@comcast.net' 'Enter' 'jasl2112' 'Enter' \; \
  46.         #split-window -h -p 50 -t 2 \; \
  47.         select-pane -t 1
  48.  
  49. # ------------- File Manangement --------------- #
  50. bind-key M-f  new-window -n FM -c $HOME \; \
  51.         send-keys 'ranger /home/joe/' 'Enter' \; \
  52.  
  53. # ------------------ IRSSI ---------------------- #
  54. bind-key M-c new-window -n IRSSI -c $HOME \; \
  55.         send-keys 'weechat' 'Enter' \; \
  56.  
  57. #------------------- Redit ------------------------#
  58. bind-key M-r new-window -n Redit -c $HOME \; \
  59.         send-keys 'rtv' 'Enter' \; \
  60.         select-pane -t 1
  61.  
  62. # -------------System Monitor ---------------------#
  63. bind-key M-g new-window -n Glances -c $HOME \; \
  64.         send-keys 'glances' 'Enter' \; \
  65.  
  66.  
  67. # -- display -------------------------------------------------------------------
  68.  
  69. set -g base-index 1         # start windows numbering at 1
  70. setw -g pane-base-index 1   # make pane numbering consistent with windows
  71.  
  72. setw -g automatic-rename on # rename window to reflect current program
  73. # renumber windows when a window is closed
  74. set -g renumber-windows on
  75.  
  76. set -g set-titles on                        # set terminal title
  77. set -g set-titles-string '#h ❐ #S ● #I #W'
  78.  
  79. set -g display-panes-time 800 # slightly longer pane indicators display time
  80. set -g display-time 1000      # slightly longer status messages display time
  81.  
  82. set -g status-interval 10     # redraw status line every 10 seconds
  83.  
  84. # 24 hour clock
  85. setw -g clock-mode-style 24
  86.  
  87. # clear both screen and history
  88. bind -n C-l send-keys C-l \; run 'tmux clear-history'
  89.  
  90. # activity
  91. set -g monitor-activity on
  92. set -g visual-activity off
  93.  
  94. # tmux theme, colors and status line
  95. # available themes:
  96. #   - powerline (a powerline inspired theme)
  97. #   - powerline_patched_font (a powerline inspired theme using a patched font)
  98. tmux_conf_theme=powerline
  99.  
  100.  
  101. # -- navigation ----------------------------------------------------------------
  102.  
  103. # create new session
  104. bind C-c new-session
  105.  
  106. # find session
  107. bind C-f command-prompt -p find-session 'switch-client -t %%'
  108.  
  109. # pane navigation
  110. bind -r h select-pane -L  # move left
  111. bind -r j select-pane -D  # move down
  112. bind -r k select-pane -U  # move up
  113. bind -r l select-pane -R  # move right
  114. bind > swap-pane -D       # swap current pane with the next one
  115. bind < swap-pane -U       # swap current pane with the previous one
  116.  
  117. # maximize current pane
  118. bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane'
  119.  
  120. # pane resizing
  121. bind -r H resize-pane -L 2
  122. bind -r J resize-pane -D 2
  123. bind -r K resize-pane -U 2
  124. bind -r L resize-pane -R 2
  125.  
  126. # window navigation
  127. bind -r C-h previous-window # select previous window
  128. bind -r C-l next-window     # select next window
  129. bind Space last-window      # move to last active window
  130.  
  131. # toggle mouse
  132. bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"
  133.  
  134.  
  135. # -- list choice ---------------------------------------------------------------
  136.  
  137. bind -t vi-choice h tree-collapse
  138. bind -t vi-choice l tree-expand
  139. run 'tmux bind -t vi-choice K start-of-list 2> /dev/null'
  140. run 'tmux bind -t vi-choice J end-of-list 2> /dev/null'
  141. bind -t vi-choice H tree-collapse-all
  142. bind -t vi-choice L tree-expand-all
  143. bind -t vi-choice Escape cancel
  144.  
  145.  
  146. # -- edit mode -----------------------------------------------------------------
  147.  
  148. # the following vi-copy bindings match my vim settings
  149. #   see https://github.com/gpakosz/.vim.git
  150. bind -ct vi-edit H start-of-line
  151. bind -ct vi-edit L end-of-line
  152. bind -ct vi-edit q cancel
  153. bind -ct vi-edit Escape cancel
  154.  
  155.  
  156. # -- copy mode -----------------------------------------------------------------
  157.  
  158. bind Enter copy-mode # enter copy mode
  159. bind b list-buffers  # list paster buffers
  160. bind p paste-buffer  # paste from the top pate buffer
  161. bind P choose-buffer # choose which buffer to paste from
  162.  
  163. # the following vi-copy bindings match my vim settings
  164. #   see https://github.com/gpakosz/.vim.git
  165. bind -t vi-copy v begin-selection
  166. bind -t vi-copy C-v rectangle-toggle
  167. bind -t vi-copy y copy-selection
  168. bind -t vi-copy Escape cancel
  169. bind -t vi-copy H start-of-line
  170. bind -t vi-copy L end-of-line
  171.  
  172. # copy to Mac OSX pasteboard
  173. if 'which -s reattach-to-user-namespace' 'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
  174.  
  175.  
  176. # -- user defined --------------------------------------------------------------
  177.  
  178. if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
  179.  
  180.  
  181. # -- 8< ------------------------------------------------------------------------
  182.  
  183. run 'cut -c3- ~/.tmux.conf | sh -s apply_theme $tmux_conf_theme'
  184. run 'cut -c3- ~/.tmux.conf | sh -s apply_configurable_bindings $tmux_conf_new_windows_retain_current_path $tmux_conf_new_panes_retain_current_path'
  185. run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $name; done;'
  186.  
  187.  
  188. # ►_◄
  189. #
  190. # # exit the script if any statement returns a non-true return value
  191. # set -e
  192. #
  193. # apply_theme() {
  194. #   case "$1" in
  195. #     powerline_patched_font)
  196. #       left_separator=''
  197. #       left_separator_black=''
  198. #       right_separator=''
  199. #       right_separator_black=''
  200. #       session_symbol=''
  201. #       ;;
  202. #     powerline)
  203. #       left_separator='|'
  204. #       left_separator_black=' '
  205. #       right_separator='|'
  206. #       right_separator_black=' '
  207. #       ;;
  208. #   esac
  209. #
  210. #   case "$1" in
  211. #     powerline*)
  212. #
  213. #       # panes
  214. #       pane_border_fg=colour238        # light gray
  215. #       pane_active_border_fg=colour39  # light blue
  216. #
  217. #       tmux set -g pane-border-style fg=$pane_border_fg \; set -g pane-active-border-style fg=$pane_active_border_fg
  218. #       #uncomment for fat borders
  219. #       #tmux set -ga pane-border-style bg=$pane_border_fg \; set -ga pane-active-border-style bg=$pane_active_border_fg
  220. #
  221. #       display_panes_active_colour=colour39 # light blue
  222. #       display_panes_colour=colour39        # light blue
  223. #       tmux set -g display-panes-active-colour $display_panes_active_colour \; set -g display-panes-colour $display_panes_colour
  224. #
  225. #       # messages
  226. #       message_fg=colour16           # black
  227. #       message_bg=colour226          # yellow
  228. #       message_attr=bold
  229. #       tmux set -g message-style fg=$message_fg,bg=$message_bg,$message_attr
  230. #
  231. #       message_command_fg=colour16   # black
  232. #       message_command_bg=colour160  # light yellow
  233. #       tmux set -g message-command-style fg=$message_command_fg,bg=$message_command_bg,$message_attr
  234. #
  235. #       # windows mode
  236. #       mode_fg=colour16   # black
  237. #       mode_bg=colour226  # yellow
  238. #       mode_attr=bold
  239. #       tmux setw -g mode-style fg=$mode_fg,bg=$mode_bg,$mode_attr
  240. #
  241. #       # status line
  242. #       status_fg=colour253 # white
  243. #       status_bg=colour232 # dark gray
  244. #       tmux set -g status-style fg=$status_fg,bg=$status_bg
  245. #
  246. #       session_fg=colour16  # black
  247. #       session_bg=colour226 # yellow
  248. #       status_left="#[fg=$session_fg,bg=$session_bg,bold] ❐ #S #[fg=$session_bg,bg=$status_bg,nobold]$left_separator_black"
  249. #       tmux set -g status-left-length 32 \; set -g status-left "$status_left"
  250. #
  251. #       window_status_fg=colour245 # light gray
  252. #       window_status_bg=colour232 # dark gray
  253. #       window_status_format="#I #W"
  254. #       tmux setw -g window-status-style fg=$window_status_fg,bg=$window_status_bg \; setw -g window-status-format "$window_status_format"
  255. #
  256. #       window_status_current_fg=colour16 # black
  257. #       window_status_current_bg=colour39 # light blue
  258. #       window_status_current_format="#[fg=$window_status_bg,bg=$window_status_current_bg]$left_separator_black#[fg=$window_status_current_fg,bg=$window_status_current_bg,bold] #I $left_separator #W #[fg=$window_status_current_bg,bg=$status_bg,nobold]$left_separator_black"
  259. #       tmux setw -g window-status-current-format "$window_status_current_format"
  260. #       tmux set -g status-justify left
  261. #
  262. #       window_status_activity_fg=default
  263. #       window_status_activity_bg=default
  264. #       window_status_activity_attr=underscore
  265. #       tmux setw -g window-status-activity-style fg=$window_status_activity_fg,bg=$window_status_activity_bg,$window_status_activity_attr
  266. #
  267. #       window_status_bell_fg=colour226 # yellow
  268. #       window_status_bell_bg=default
  269. #       window_status_bell_attr=blink,bold
  270. #       tmux setw -g window-status-bell-style fg=$window_status_bell_fg,bg=$window_status_bell_bg,$window_status_bell_attr
  271. #
  272. #       window_status_last_fg=colour39 # light blue
  273. #       window_status_last_attr=default
  274. #       tmux setw -g window-status-last-style $window_status_last_attr,fg=$window_status_last_fg
  275. #
  276. #       time_date_fg=colour245  # light gray
  277. #       time_date_bg=colour232  # dark gray
  278. #       whoami_fg=colour254     # white
  279. #       whoami_bg=colour160     # red
  280. #       host_fg=colour16        # black
  281. #       host_bg=colour254       # white
  282. #       status_right="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto})} #[fg=$time_date_fg,nobold]$right_separator %R $right_separator %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_black#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) $right_separator_black#[fg=$host_fg,bg=$host_bg,bold] #h "
  283. #       tmux set -g status-right-length 64 \; set -g status-right "$status_right"
  284. #
  285. #       # clock
  286. #       clock_mode_colour=colour39  # light blue
  287. #       tmux setw -g clock-mode-colour $clock_mode_colour
  288. #       ;;
  289. #   esac
  290. # }
  291. #
  292. # circled_digit() {
  293. #   circled_digits='⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'
  294. #   if [ $1 -lt 20 ] 2>/dev/null ; then
  295. #     echo ${circled_digits:$1:1}
  296. #   else
  297. #     echo $1
  298. #   fi
  299. # }
  300. #
  301. # maximize_pane() {
  302. #   tmux -q -L swap-pane-test -f /dev/null new-session -d \; new-window \; new-window \; swap-pane -t :1 \; kill-session || { tmux display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'; exit; }
  303. #   __current_pane=$(tmux display -p '#{pane_id}')
  304. #
  305. #   __dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_title}' | grep -o '^1 %.\+%.\+$' || true)
  306. #   __restore=$(echo "${__dead_panes}" | sed -n -E -e "s/^1 ${__current_pane} \[\+\](%[0-9]+)$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t ${__current_pane}/p" -e "s/^1 (%[0-9]+) \[\+\]${__current_pane}$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t \1/p" )
  307. #
  308. #   if [ x"${__restore}" = x ] ; then
  309. #     [ x"$(tmux list-panes | wc -l | sed 's/^ *//g')" = x1 ] && tmux display "Can't maximize with only one pane" && return
  310. #     __window=$(tmux new-window -P "exec maximized+ 2> /dev/null | tmux setw remain-on-exit on && printf '\033]2;%s\033\\' [+]${__current_pane}")
  311. #     __window=${__window%.*}
  312. #
  313. #     __guard=100
  314. #     while ( [ x"$(tmux list-panes -t ${__window} -F '#{session_name}:#{window_index} #{pane_dead}')" != x"${__window} "1 ] && [ x"${__guard}" != x0 ] ) ; do sleep 0.01 ; _guard=$((__guard - 1)) ; done
  315. #     if [ x"${__guard}" = 0 ] ; then
  316. #       exit 1
  317. #     fi
  318. #
  319. #     __new_pane=$(tmux display -p '#{pane_id}')
  320. #     tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}"
  321. #   else
  322. #     ${__restore} || tmux kill-pane
  323. #   fi
  324. # }
  325. #
  326. # toggle_mouse() {
  327. #   old=$(tmux show -g -w | grep mode-mouse | cut -d' ' -f2)
  328. #   new=""
  329. #
  330. #   if [ "$old" = "on" ] ; then
  331. #     new="off"
  332. #   else
  333. #     new="on"
  334. #   fi
  335. #
  336. #   tmux set -g mode-mouse $new \;\
  337. #        set -g mouse-resize-pane $new \;\
  338. #        set -g mouse-select-pane $new \;\
  339. #        set -g mouse-select-window $new \;\
  340. #        display "mouse: $new"
  341. # }
  342. #
  343. # battery() {
  344. #   battery_symbol=$1
  345. #   battery_symbol_count=$2
  346. #   if [ $battery_symbol_count = auto ]; then
  347. #     columns=$(tmux display -p '#{client_width}' || echo 80)
  348. #     if [ $columns -ge 80 ]; then
  349. #       battery_symbol_count=10
  350. #     else
  351. #       battery_symbol_count=5
  352. #     fi
  353. #   fi
  354. #   battery_full_fg=colour160
  355. #   battery_full_bg=colour16
  356. #   battery_empty_fg=colour254
  357. #   battery_empty_bg=colour16
  358. #
  359. #   battery_symbol_heart_full=♥
  360. #   battery_symbol_heart_empty=♥
  361. #   battery_symbol_block_full=◼
  362. #   battery_symbol_block_empty=◻
  363. #   eval battery_symbol_full='$battery_symbol_'"$battery_symbol"'_full'
  364. #   eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
  365. #
  366. #   uname_s=$(uname -s)
  367. #   if [ $uname_s = Darwin ]; then
  368. #     batt=$(pmset -g batt)
  369. #     percentage=$(echo $batt |egrep -o [0-9]+%) || return
  370. #     charge="${percentage%%%} / 100"
  371. #   elif [ $uname_s = Linux ]; then
  372. #     batpath=/sys/class/power_supply/BAT0
  373. #     if [ ! -d $batpath ]; then
  374. #       batpath=/sys/class/power_supply/BAT1
  375. #     fi
  376. #     batfull=$batpath/energy_full
  377. #     batnow=$batpath/energy_now
  378. #     if [ ! -r $batfull -o ! -r $batnow ]; then
  379. #       return
  380. #     fi
  381. #     charge="$(cat $batnow) / $(cat $batfull)" || return
  382. #   fi
  383. #
  384. #   full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
  385. #   [ $full -gt 0 ] && \
  386. #     printf '#[fg=%s,bg=%s]' $battery_full_fg $battery_full_bg && \
  387. #     printf "%0.s$battery_symbol_full" $(seq 1 $full)
  388. #   empty=$(($battery_symbol_count - $full))
  389. #   [ $empty -gt 0 ] && \
  390. #     printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_empty_bg && \
  391. #     printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
  392. # }
  393. #
  394. # apply_configurable_bindings() {
  395. #   windows_retain_current_path=${1:-false}
  396. #   if [ x"$windows_retain_current_path" = x"true" -o x"$windows_retain_current_path" = x"1" ] ; then
  397. #     tmux bind c new-window -c '#{pane_current_path}'
  398. #   else
  399. #     tmux bind c new-window
  400. #   fi
  401. #
  402. #   panes_retain_current_path=${2:-true}
  403. #   if [ x"$panes_retain_current_path" = x"true" -o x"$panes_retain_current_path" = x"1" ] ; then
  404. #     tmux  bind h split-window -h -c "#{pane_current_path}"  \;\
  405. #           bind _ split-window -h -c "#{pane_current_path}"    \;\
  406. #           bind v split-window -v -c "#{pane_current_path}"    \;\
  407. #           bind - split-window -v -c "#{pane_current_path}"
  408. #   else
  409. #     tmux  bind h split-window -h  \;\
  410. #           bind _ split-window -h    \;\
  411. #           bind v split-window -v    \;\
  412. #           bind - split-window -v
  413. #   fi
  414. # }
  415. #
  416. # $@
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top