tmux.conf 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan --single < /tmp/tmux-buffer || urlview < /tmp/tmux-buffer"'
  39. bind-key U capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlscan" 'urlscan --single --compact --run "tuir {}" < /tmp/tmux-buffer'
  40. ## Reload tmux.conf: <prefix> R
  41. bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
  42. ## Lock screen
  43. bind-key -T prefix X confirm-before -p "lock tmux? (y/n)" lock-session
  44. ## Better Bindings for Splitting
  45. bind h split-window -h
  46. bind v split-window -v
  47. ### Paste Buffer Bindings
  48. bind b list-buffers ## List paste buffers
  49. #bind p paste-buffer ## Paste from the top paste buffer
  50. bind P choose-buffer ## Choose which buffer to paste from
  51. ### vi Mode for Scroll Back ### {{{
  52. setw -g mode-keys vi
  53. #unbind [
  54. bind Escape copy-mode
  55. unbind p
  56. bind p paste-buffer
  57. #bind-key -t vi-copy 'v' begin-selection
  58. #bind-key -t vi-copy 'y' copy-selection
  59. bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
  60. #bind-key -t vi-copy Escape cancel
  61. #bind-key -t vi-copy 'Y' copy-end-of-line
  62. #bind-key -t vi-copy 'V' select-line
  63. ### End vi Mode ### }}}
  64. ### Move Window Numbers ### {{{
  65. ## <prefix> Shift left/right
  66. # Inspired by https://superuser.com/questions/343572/how-do-i-reorder-tmux-windows
  67. bind-key S-Left swap-window -t -1
  68. bind-key S-Right swap-window -t +1
  69. ### End Window Numbers ### }}}
  70. ### End Key Bindings ### }}}
  71. ### Theming Settings ### {{{
  72. ## Terminal emulator window title
  73. set -g set-titles on
  74. set -g set-titles-string '#S:#I.#P #W'
  75. ## Notifying if other windows has activities
  76. setw -g monitor-activity on
  77. set -g visual-activity on
  78. ## Clock
  79. setw -g clock-mode-colour green
  80. setw -g clock-mode-style 24
  81. ### Status Bar ### {{{
  82. set -g status-bg black
  83. set -g status-fg white
  84. set -g status-interval 10
  85. ## Left Status Bar
  86. set -g status-left-length 15
  87. ## TODO: update to use %hidden once 3.2 is on my devices
  88. %if "#{==:#{host},moving-computer-of-doom}"
  89. ## Set for laptop
  90. S_HOST="doom"
  91. %elif "#{m:*-of-doom,#{host}}"
  92. ## Truncate personal host names
  93. S_HOST="#{s/-of-doom//:host}"
  94. %else
  95. ## Limit hostnames to 10 char
  96. S_HOST="#{=10:host}"
  97. %endif
  98. set -g status-left "#[fg=green,bg=#282A2E] $S_HOST #[fg=#282A2E,bg=black]#[default]"
  99. ## Right Status Bar
  100. set -g status-right-length 60
  101. ## Show pane title|command, tmux session, datetime
  102. set -g status-right '\
  103. #[fg=#454A4F,bg=black]#[fg=white,bg=#454A4F]#{?pane_in_mode,#[fg=yellow] #{pane_mode} ,}\
  104. #[fg=#282A2E,bg=#454A4F]#[fg=white,bg=#282A2E] #{?#{!=:#{pane_title},#{host}},#{=15:pane_title},#{=15:pane_current_command}} \
  105. #[fg=#454A4F,bg=#282A2E]#[fg=white,bg=#454A4F] #{=10:session_name} \
  106. #[fg=#282A2E,bg=#454A4F]#[fg=cyan,bold,bg=#282A2E] %Y-%m-%d  %H:%M #[default]'
  107. ## Window Status Bar
  108. setw -g window-status-format ' #[fg=cyan,dim]#I#[default] #W '
  109. setw -g window-status-separator ''
  110. ## Highlighting the active window in status bar
  111. 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]'
  112. ## Inactive windows
  113. setw -g window-status-last-style 'underscore'
  114. setw -g window-status-activity-style 'fg=blue,bold'
  115. setw -g window-status-bell-style 'fg=red'
  116. ### End Status Bar ### }}}
  117. ### Message/Message Command ### {{{
  118. set -g message-style 'fg=white,bg=cyan,bright'
  119. set -g message-command-style 'fg=white,bg=cyan,bright'
  120. ### End Message ### }}}
  121. ### Pane Colors ### {{{
  122. set -g pane-border-style 'fg=white'
  123. set -g pane-active-border-style 'fg=cyan'
  124. set -g pane-border-lines double
  125. #set -g pane-border-status off
  126. ### End Pane Colors ### }}}
  127. ### End Theming Settings ### }}}