Guest User

My ~/.tmux.conf

a guest
May 26th, 2024
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.23 KB | Source Code | 0 0
  1. # Set Ctrl-a as the prefix key, similar to GNU Screen
  2. set-option -g prefix C-a
  3. unbind-key C-b
  4.  
  5. # Toggle between the last active window
  6. bind-key C-a last-window
  7. bind-key a send-prefix  # Allows sending a prefix as a literal character to the applications
  8. bind-key A command-prompt "rename-window '%%'"  # Rename current window
  9.  
  10. # Bindings for various tmux functions
  11. bind-key d detach-client
  12. bind-key D choose-client
  13. bind-key x confirm-before -p "kill-pane #P? (y/n)" kill-pane
  14. bind-key X confirm-before -p "kill-window #W? (y/n)" kill-window
  15. bind-key ']' paste-buffer
  16. bind-key '[' copy-mode
  17. bind-key ' ' next-window
  18. bind-key Bspace previous-window
  19.  
  20. # Window and pane creation
  21. bind-key c new-window
  22. bind-key '%' split-window -v
  23. bind-key '|' split-window -h
  24. bind-key \\ split-window -v
  25. bind-key '"' split-window -v  
  26. bind-key Tab select-pane -t :.+
  27. bind-key BTab select-pane -t :.-
  28.  
  29. # Navigation between windows
  30. bind-key n next-window
  31. bind-key p previous-window
  32. bind-key l last-window
  33. bind-key f command-prompt "find-window '%%'"
  34.  
  35. # Miscellaneous
  36. bind-key w list-windows
  37. bind-key t clock-mode
  38. bind-key C-t swap-pane -U
  39. bind-key , command-prompt "rename-window '%%'"
  40. bind-key . command-prompt "move-window -t '%%'"
  41. bind-key ':' command-prompt
  42. bind-key '$' command-prompt -I '#' "rename-session '%%'" # Rename session with a prompt
  43.  
  44. # bash to see all color names:
  45. # for i in {0..255}; do \
  46.       printf "\x1b[38;5;${i}mcolor%-5i\x1b[0m" $i ; \
  47.       if ! (( ($i + 1 ) % 8 )); then echo ; fi ; \
  48.   done
  49.  
  50.  
  51. # Setup the status bar
  52. set -g status on
  53. set -g status-justify left
  54. set -g status-style bg=black,fg=white
  55. set -g status-interval 60  # Update the status line every minute
  56. set -g status-left " "
  57. set -g status-right "[#S] @#H - %Y-%m-%d %H:%M"
  58. set -g window-status-current-format "#[fg=white,bg=darkblue]#I:#W"
  59. set -g window-status-format "#I-#W"
  60. set -g mouse on # Enable mouse support
  61. set -g default-terminal "screen-256color" # default terminal to 256 colors
  62. set -ga terminal-overrides ',*256color*:bce' # Make sure back color erase (bce) is enabled
  63. set -g bell-action any # listen to alerts from all windows
  64. set -g monitor-bell on # notice bell in windows
  65. set -g visual-bell off # only propagate bell, don't warn user, as it hangs tmux for a second
  66. set -g visual-activity both # send bell *and* notify when activity (if monitor-activity)
  67.  
  68. setw -g mode-keys vi # Use vi-style keys in copy mode
  69. setw -g mouse on # Allow scroll wheel to scroll history
  70.  
  71. # Reload the configuration without restarting tmux
  72. bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded!"
  73.  
  74. # Help key bindings
  75. bind-key ? list-keys
  76.  
  77.  
  78. # pt2
  79. # More keybindings for comprehensive control
  80. # noexist bind-key M mark-pane
  81. bind-key '}' next-layout
  82. bind-key '{' previous-layout
  83. bind-key C-z suspend-client
  84. bind-key Z resize-pane -Z
  85.  
  86. # Killing and detaching
  87. bind-key K confirm-before -p "kill-server? (y/n)" kill-server
  88. bind-key k confirm-before -p "kill-window #W? (y/n)" kill-window
  89.  
  90. # Buffer and search
  91. #bind-key > command-prompt -p "capture-pane -S '%%'" "save-buffer '%%'"
  92. #bind-key < command-prompt -p "load-buffer '%%'" "paste-buffer '%%'"
  93. bind-key = choose-buffer
  94. bind-key P paste-buffer
  95.  
  96. # Resize panes
  97. bind-key - resize-pane -L 5
  98. bind-key + resize-pane -R 5
  99. bind-key < resize-pane -D 5
  100. bind-key > resize-pane -U 5
  101.  
  102. # Misc functions
  103. bind-key b list-buffers
  104. bind-key C-o rotate-window
  105. bind-key C-q last-pane
  106.  
  107. # Session and window naming
  108. bind-key C-s command-prompt "rename-session '%%'"
  109. bind-key C-w command-prompt "rename-window '%%'"
  110.  
  111. # Setup escape and other special keys
  112. bind-key Escape copy-mode
  113. bind-key C-[ copy-mode
  114. bind-key C-] paste-buffer
  115.  
  116. # Ensure the command line is setup
  117. bind-key : command-prompt
  118.  
  119. # Reload tmux config on the fly
  120. bind-key R source-file ~/.tmux.conf \; display-message "Config reloaded!"
  121.  
  122. # Specific layouts
  123. bind-key ! break-pane
  124. # bind-key '"' split-window -v
  125.  
  126. # Search and command prompts
  127. bind-key / command-prompt "search-forward '%%'"
  128. bind-key ? list-keys
  129.  
  130. # Adjustments for handling pane resizing
  131. bind-key C-Left resize-pane -L 5
  132. bind-key C-Right resize-pane -R 5
  133. bind-key C-Up resize-pane -U 5
  134. bind-key C-Down resize-pane -D 5
  135.  
  136. # Rotate and adjust panes
  137. bind-key C-o rotate-window -D
  138. bind-key C-p select-pane -U
  139. bind-key C-n select-pane -D
  140. bind-key C-b select-pane -L
  141. bind-key C-f select-pane -R
  142.  
  143. # Session management
  144. bind-key s list-sessions
  145. bind-key S choose-session
  146.  
  147. #pt3
  148.  
  149. # More window management
  150. bind-key '0' select-window -t :=0
  151. bind-key '1' select-window -t :=1
  152. bind-key '2' select-window -t :=2
  153. bind-key '3' select-window -t :=3
  154. bind-key '4' select-window -t :=4
  155. bind-key '5' select-window -t :=5
  156. bind-key '6' select-window -t :=6
  157. bind-key '7' select-window -t :=7
  158. bind-key '8' select-window -t :=8
  159. bind-key '9' select-window -t :=9
  160.  
  161. # More misc keybindings
  162. bind-key C-b send-keys C-b  # Useful for applications that need Ctrl-B
  163. bind-key C-c send-keys C-c  # Standard interrupt key in the shell
  164. bind-key C-d detach-client  # Slightly more intuitive binding for detaching
  165. bind-key C-e command-prompt "send-keys '%%'"  # Send arbitrary commands
  166. bind-key C-k clear-history  # Clear the history in the current pane
  167.  
  168. # More resizing options for panes
  169. bind-key M-Left  resize-pane -L 5
  170. bind-key M-Right resize-pane -R 5
  171. bind-key M-Up    resize-pane -U 5
  172. bind-key M-Down  resize-pane -D 5
  173.  
  174. # Create a new window with a specific command
  175. bind-key C command-prompt -p "Command:" "new-window -n '%%' '%%'"
  176.  
  177. # Copy mode enhancements
  178. #noexist bind-key v begin-selection
  179. #noexist bind-key y copy-selection
  180.  
  181. # Scroll mode
  182. bind-key PgUp copy-mode -u
  183.  
  184. # Ensure all special and function keys are configured properly
  185. bind-key F1 display-panes
  186. bind-key F2 list-commands
  187. bind-key F3 previous-window
  188. bind-key F4 next-window
  189.  
  190. # Provide help
  191. bind-key F12 display-message "For help, press ?"
  192.  
  193. # Final touches on visual settings
  194.  
  195. # Enable logging for troubleshooting
  196. set -g @verbose_logging on
  197.  
  198. #pt4
  199.  
  200. # Additional movement and interaction commands
  201. bind-key ';' last-pane  # Toggle to the last active pane
  202. bind-key '=' choose-buffer  # List and choose buffers
  203. #bind-key '"' split-window -v  # Vertical split
  204. #bind-key '%' split-window -h  # Horizontal split
  205. bind-key C-o rotate-window  # Rotate all panes in the current window
  206. bind-key m select-pane -M  # Toggle mouse mode on/off for pane selection
  207.  
  208. # Additional command prompts for quick actions
  209. bind-key ':' command-prompt  # Enter command mode
  210. bind-key C-k command-prompt "kill-window -t ':%%'"  # Kill specified window
  211. bind-key C-z command-prompt "suspend-client '%%'"  # Suspend client
  212.  
  213. # Pane selection and arrangement
  214. bind-key space next-layout  # Cycle through pre-defined pane layouts
  215. bind-key C-space previous-layout  # Cycle reverse through pane layouts
  216. bind-key C-Up command-prompt -p "resize-pane -U '%%'"  # Resize pane upward by entered amount
  217. bind-key C-Down command-prompt -p "resize-pane -D '%%'"  # Resize pane downward
  218. bind-key C-Left command-prompt -p "resize-pane -L '%%'"  # Resize pane to the left
  219. bind-key C-Right command-prompt -p "resize-pane -R '%%'"  # Resize pane to the right
  220.  
  221. # Enhanced search and navigate capabilities in copy mode
  222. bind-key '/' command-prompt "search-forward '%%'"  # Search forward in copy mode
  223. bind-key '?' command-prompt "search-backward '%%'"  # Search backward in copy mode
  224.  
  225. # Register and buffer management
  226. #bind-key '>' command-prompt -p "save-buffer '%%'" "save-buffer '%%'"  # Save buffer to a file
  227. #bind-key '<' load-buffer  # Load buffer from file
  228.  
  229. # Detailed window and pane management
  230. bind-key '*' list-panes  # List all panes in the current window
  231. bind-key '#' list-windows  # List all windows in the current session
  232. bind-key '!' break-pane  # Convert the current pane into a new window
  233.  
  234. # Function keys for quick access to common tasks
  235. bind-key F1 display-panes  # Display pane numbers
  236. bind-key F2 list-sessions  # List all sessions
  237. bind-key F3 previous-window  # Switch to previous window
  238. bind-key F4 next-window  # Switch to next window
  239. bind-key F5 source-file ~/.tmux.conf \; display-message "Configuration reloaded"  # Reload tmux configuration
  240.  
  241. # Custom scripts and tools integration
  242. bind-key F12 run-shell "tmux-custom-script.sh"  # Run a custom shell script
  243.  
  244.  
Tags: tmux
Advertisement
Add Comment
Please, Sign In to add comment