tmux.conf 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ##### My (demuredemeanor) tmux config, a work in progress
  2. # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
  3. # https://notabug.org/demure/dotfiles/
  4. # legacy repo http://github.com/demure/dotfiles
  5. #
  6. # Note to self: set=set-option; setw=set-window-option; setenv=set-environment;
  7. ### Main Settings ### {{{
  8. ## Fix glitch with underlined text in Terminal.app and hanging Prompt (iOS)
  9. ## From https://github.com/terlar/dotfiles/blob/master/tmux.conf
  10. ## Assume http://sourceforge.net/mailarchive/message.php?msg_id=30825085 is origin
  11. set -ag terminal-overrides ",*:XT@"
  12. #new-session ## tmux attach makes new, if not running
  13. set -ga update-environment 'DISPLAY' # Maybe fix DISPLAY?
  14. set -g base-index 1 ## Window numbering starts at 1
  15. set -g pane-base-index 1 ## Pane numbering starts at 1
  16. setw -g automatic-rename on ## Auto set window title
  17. setw -g aggressive-resize on ## Aggressive windows: For screen size, of diff connections, on diff windows
  18. set -g default-terminal "tmux-256color"
  19. #set -g default-terminal "screen-256color"
  20. set -g history-limit 10000 ## Scroll back history
  21. set -g display-panes-time 4000 ## Increase show pane time
  22. set -g renumber-windows on ## Make windows auto renumber
  23. set -g lock-command vlock ## Use vlock as console lock
  24. set -g mouse on ## Mouse
  25. ### End Main Settings ### }}}
  26. ### Key Bindings ### {{{
  27. unbind C-z ## Unbind C-z so I don't suspend, and free for bind
  28. #unbind C-b ## Unbind C-b, so I can make C-z the prefix
  29. set -g prefix C-z ## Change prefix key to C-z
  30. bind-key C-z last-window ## Make <prefix>C-z go to last window
  31. #unbind C-a
  32. bind-key C-a send-prefix ## Make <prefix>C-a send C-z literally
  33. ## Join windows: <prefix> s, <prefix> j
  34. bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
  35. bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
  36. ## URL grab: <prefix> u
  37. bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
  38. ## Reload tmux.conf: <prefix> R
  39. bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
  40. ## Lock screen
  41. bind-key -T prefix X confirm-before -p "lock tmux? (y/n)" lock-session
  42. ## Better Bindings for Splitting
  43. bind h split-window -h
  44. bind v split-window -v
  45. ### Paste Buffer Bindings
  46. bind b list-buffers ## List paste buffers
  47. #bind p paste-buffer ## Paste from the top paste buffer
  48. bind P choose-buffer ## Choose which buffer to paste from
  49. ### vi Mode for Scroll Back ### {{{
  50. setw -g mode-keys vi
  51. #unbind [
  52. bind Escape copy-mode
  53. unbind p
  54. bind p paste-buffer
  55. #bind-key -t vi-copy 'v' begin-selection
  56. #bind-key -t vi-copy 'y' copy-selection
  57. bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
  58. #bind-key -t vi-copy Escape cancel
  59. #bind-key -t vi-copy 'Y' copy-end-of-line
  60. #bind-key -t vi-copy 'V' select-line
  61. ### End vi Mode ### }}}
  62. ### Move Window Numbers ### {{{
  63. ## <prefix> Shift left/right
  64. # Inspired by https://superuser.com/questions/343572/how-do-i-reorder-tmux-windows
  65. bind-key S-Left swap-window -t -1
  66. bind-key S-Right swap-window -t +1
  67. ### End Window Numbers ### }}}
  68. ### End Key Bindings ### }}}
  69. ### Theming Settings ### {{{
  70. ## Terminal emulator window title
  71. set -g set-titles on
  72. set -g set-titles-string '#S:#I.#P #W'
  73. ## Notifying if other windows has activities
  74. setw -g monitor-activity on
  75. set -g visual-activity on
  76. ## Clock
  77. setw -g clock-mode-colour green
  78. setw -g clock-mode-style 24
  79. ### Status Bar ### {{{
  80. set -g status-bg black
  81. set -g status-fg white
  82. set -g status-interval 10
  83. ## Left Status Bar
  84. set -g status-left-length 15
  85. ## TODO: update to use %hidden once 3.2 is on my devices
  86. %if "#{==:#{host},moving-computer-of-doom}"
  87. ## Set for laptop
  88. S_HOST="doom"
  89. %elif "#{m:*-of-doom,#{host}}"
  90. ## Truncate personal host names
  91. S_HOST="#{s/-of-doom//:host}"
  92. %else
  93. ## Limit hostnames to 10 char
  94. S_HOST="#{=10:host}"
  95. %endif
  96. set -g status-left "#[fg=green,bg=#282A2E]$S_HOST #[fg=#282A2E,bg=black]#[default]"
  97. ## Right Status Bar
  98. set -g status-right-length 60
  99. ## Show pane title|command, tmux session, datetime
  100. set -g status-right '\
  101. #[fg=#454A4F,bg=black]#[fg=white,bg=#454A4F]#{?pane_in_mode,#[fg=yellow] #{pane_mode} ,}\
  102. #[fg=#282A2E,bg=#454A4F]#[fg=white,bg=#282A2E] #{?#{!=:#{pane_title},#{host}},#{=15:pane_title},#{=15:pane_current_command}} \
  103. #[fg=#454A4F,bg=#282A2E]#[fg=white,bg=#454A4F] #{=10:session_name} \
  104. #[fg=#282A2E,bg=#454A4F]#[fg=cyan,bold,bg=#282A2E] %Y-%m-%d  %H:%M#[default]'
  105. ## Window Status Bar
  106. setw -g window-status-format ' #[fg=cyan,dim]#I#[default] #W '
  107. setw -g window-status-separator ''
  108. ## Highlighting the active window in status bar
  109. setw -g window-status-current-format '#[fg=black,bg=blue]#[bg=blue,fg=cyan]#I#[bg=blue,fg=white] #W#[bold] #F#[none]#[fg=blue,bg=black]#[default]'
  110. ## Inactive windows
  111. setw -g window-status-last-style 'underscore'
  112. setw -g window-status-activity-style 'fg=blue,bold'
  113. setw -g window-status-bell-style 'fg=red'
  114. ### End Status Bar ### }}}
  115. ### Message/Message Command ### {{{
  116. set -g message-style 'fg=white,bg=cyan,bright'
  117. set -g message-command-style 'fg=white,bg=cyan,bright'
  118. ### End Message ### }}}
  119. ### Pane Colors ### {{{
  120. set -g pane-border-style 'fg=white'
  121. set -g pane-active-border-style 'fg=cyan'
  122. set -g pane-border-lines double
  123. #set -g pane-border-status off
  124. ### End Pane Colors ### }}}
  125. ### End Theming Settings ### }}}