- 
            
      
        
      
    Star
      
          
          (131)
      
  
You must be signed in to star a gist  - 
              
      
        
      
    Fork
      
          
          (45)
      
  
You must be signed in to fork a gist  
- 
      
 - 
        
Save snuggs/800936 to your computer and use it in GitHub Desktop.  
| ############################################################################ | |
| # _ | |
| # | |_ _ __ ___ _ ___ __ | |
| # | __| '_ ` _ \| | | \ \/ / | |
| # | |_| | | | | | |_| |> < | |
| # \__|_| |_| |_|\__,_/_/\_\ | |
| # | |
| # Cheatsheets: | |
| # https://devhints.io/tmux | |
| # `property not found` issue: | |
| # - https://github.com/tmux/tmux/issues/1689 | |
| # - https://github.com/tmux/tmux/wiki/FAQ#how-do-i-translate--fg--bg-and--attr-options-into--style-options | |
| # | |
| ############################################################################ | |
| ############################################################################ | |
| # Reset Prefix | |
| ############################################################################ | |
| # remap prefix to Control + a | |
| set -g prefix C-a | |
| bind-key a send-prefix # for nested tmux sessions | |
| # bind C-a send-prefix | |
| unbind C-b | |
| ############################################################################ | |
| # Global options | |
| ############################################################################ | |
| set-window-option -q -g utf8 on | |
| set-window-option -g history-limit 50000 # large history | |
| set-window-option -g default-terminal "xterm-256color" # or screen-256color | |
| set-window-option -g terminal-overrides 'xterm*:XT:smcup@:rmcup@' | |
| set-window-option -g escape-time 10 | |
| set-window-option -g repeat-time 600 | |
| set-window-option -g display-time 4000 | |
| set-window-option -g focus-events on | |
| set-window-option -g visual-bell on | |
| set-window-option -g bell-action other | |
| set-window-option -g visual-activity on | |
| set-window-option -g monitor-activity on | |
| set-window-option -g xterm-keys on # for vim | |
| #############################################################################& | |
| # Copy & Pasta | |
| # http://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future | |
| ############################################################################ | |
| # Use vim keybindings in copy mode | |
| set-window-option -g mode-keys vi | |
| # vi movement keys | |
| set-window-option -g status-keys vi | |
| # Setup 'v' to begin selection as in Vim | |
| bind-key -T copy-mode-vi v send -X begin-selection | |
| bind-key -T copy-mode-vi y send -X copy-pipe "reattach-to-user-namespace termux-clipboard-set" | |
| # Update default binding of `Enter` to also use copy-pipe | |
| # unbind -t vi-copy Enter | |
| # bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
| ############################################################################ | |
| # Unbindings | |
| ############################################################################ | |
| #unbind [ # copy mode bound to escape key | |
| unbind j | |
| unbind C-b # unbind default leader key | |
| unbind '"' # unbind horizontal split | |
| unbind % # unbind vertical split | |
| unbind '(' # unbind kill previous session | |
| ############################################################################ | |
| # Bindings | |
| ############################################################################ | |
| # reload tmux conf | |
| bind-key r source-file ~/.tmux.conf | |
| #bind Escape copy-mode | |
| # break-pane | |
| bind-key Enter resize-pane -Z | |
| # join-pane [-dhv] [-l size | -p percentage] [-s src-pane] | |
| # [-t:dst-window.dst-pane] (destination window (dot) destination pane | |
| # (alias: joinp) | |
| # | |
| #bind C-j command-prompt "joinp" | |
| #bind C-j command-prompt "join-pane" | |
| #bind-key j command-prompt "join-pane -s '%%'" | |
| #bind-key j command-prompt "joinp -t:0" | |
| #bind-key Space command-prompt "joinp -t:%%" # %% = prompt for window.pane [-V|H] # vert|hor split | |
| ############################################################################ | |
| # layouts | |
| ############################################################################ | |
| # Issue with special characters for tmux > 3.x | |
| # - https://github.com/tmux/tmux/issues/1827 | |
| bind-key 'C-r' rotate-window | |
| bind-key '-' split-window -v # split pane horizontally | |
| bind-key '\' split-window -h # split pane vertically | |
| # layouts tiled, even-horizontal, even-vertical, main-horizontal, main-vertical | |
| bind-key 'C-=' select-layout "tiled" | |
| bind-key 'C--' select-layout "even-vertical" | |
| bind-key 'C-\' select-layout "even-horizontal" | |
| ############################################################################ | |
| # Status Bar | |
| ############################################################################ | |
| # Titles (window number, program name, active (or not) | |
| set-window-option -g set-titles on | |
| set-window-option -g set-titles-string '#H:#S.#I.#P #W #T' | |
| set-window-option -g status on | |
| set-window-option -g status-interval 5 | |
| set-window-option -g status-position top | |
| set-window-option -g status-justify left # left, centre, right | |
| # https://unix.stackexchange.com/questions/60968/tmux-bottom-bar-color-change/60969 | |
| set -g status-style fg=default,bold,bg=default | |
| set-window-option -g status-left-length 70 | |
| set-window-option -g status-left '#[fg=colour143,dim]🕛 %m-%d %R#(acpi | cut -d ',' -f 2) 💻 #[fg=colour132,dim]#S ' | |
| set-window-option -g status-right-length 70 | |
| set-window-option -g status-right '👉 #[fg=magenta,dim,italics]#T #[default]' | |
| # set-window-option -g window-status-separator '|' | |
| set-window-option -g window-status-separator '' | |
| set-window-option -g window-status-format ' #F#W ' | |
| set-window-option -g window-status-style fg=magenta,dim,bg=default | |
| set-window-option -g window-status-current-format '#[default]|👇#F#W|' | |
| set-window-option -g window-status-current-style fg=colour13,bold,bg=colour234 | |
| set-window-option -g message-command-style fg=colour132,bg=default | |
| set-window-option -g message-style fg=colour132,bold,reverse,bg=default | |
| ############################################################################ | |
| # windows | |
| ############################################################################ | |
| # focus on first window | |
| # select-window -t 0 | |
| # terminal color | |
| set-window-option -g window-style fg=colour248,bg=colour0 | |
| # use mouse # More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ | |
| set-window-option -g mouse on | |
| # colors | |
| # - https://jonasjacek.github.io/colors/ | |
| # - https://man.openbsd.org/tmux.1#STYLES | |
| set-window-option -g mode-style fg=colour0,bold,bg=magenta | |
| set-window-option -g pane-border-style fg=colour250,bold,bg=colour232 | |
| set-window-option -g pane-active-border-style fg=colour13,bold,bg=colour232 | |
| # Automatically set window title | |
| set-window-option -g automatic-rename | |
| # Clipboard integration | |
| # ctrl+c to send to clipboard | |
| bind C-c run "tmux save-buffer - | xclip -i -sel clipboard" | |
| # ctrl+v to paste from clipboard | |
| bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" | |
| # paste from right click | |
| unbind-key MouseDown3Pane | |
| bind-key -n MouseDown3Pane run " \ | |
| X=$(xclip -o -sel clipboard); \ | |
| tmux set-buffer \"$X\"; \ | |
| tmux paste-buffer -p; \ | |
| tmux display-message 'pasted!' \ | |
| " | |
| # Selection with mouse should copy to clipboard right away, in addition to the default action. | |
| unbind -n -Tcopy-mode-vi MouseDragEnd1Pane | |
| bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null" | |
| # Drag to re-order windows | |
| bind-key -n MouseDrag1Status swap-window -t= | |
| # Double click on the window list to open a new window | |
| bind-key -n DoubleClick1Status command-prompt 'new-window -n%%' | |
| bind-key C-j previous-window | |
| bind-key A command-prompt 'rename-window %%' | |
| bind-key C-n command-prompt 'new-window -n%%' | |
| bind-key C-a last-window # C-a C-a for last active window | |
| # By default, all windows in a session are constrained to the size of the | |
| # smallest client connected to that session, | |
| # even if both clients are looking at different windows. | |
| # It seems that in this particular case, Screen has the better default | |
| # where a window is only constrained in size if a smaller client | |
| # is actively looking at it. | |
| setw -g aggressive-resize on | |
| # kill -9 | |
| bind-key 'C-9' kill-window | |
| bind-key 'C-(' send -X kill-session | |
| ############################################################################ | |
| # panes | |
| ############################################################################ | |
| # Navigation --------------------------------------------------------------- | |
| # use the vim motion keys to move between panes | |
| bind-key h select-pane -L | |
| bind-key j select-pane -D | |
| bind-key k select-pane -U | |
| bind-key l select-pane -R | |
| # kill | |
| bind-key 9 kill-pane | |
| set-window-option -g display-panes-colour colour250 | |
| set-window-option -g display-panes-active-colour colour128 | |
| #previous pane | |
| bind-key C-up prev | |
| bind-key C-left prev | |
| #next pane | |
| bind-key C-right next | |
| bind-key C-down next | |
| # Resizing --------------------------------------------------------------- | |
| bind-key C-h resize-pane -L 7 | |
| bind-key C-j resize-pane -D 7 | |
| bind-key C-k resize-pane -U 7 | |
| bind-key C-l resize-pane -R 7 | |
| # use vim motion keys while in copy mode | |
| # setw -g mode-keys vi | 
| #!/bin/bash | |
| # Setup a work space called `WEBRTC` with 5 windows 1-2-2 | |
| # first window has 1 pane. | |
| # The first pane set at 65%, split vertically, set to root and running vim | |
| # pane 2 is split vertically at 25% and 50% horizontally running `npm run watch/styles` | |
| # pane 3 is split vertically at 25% and 50% horizontally running `npm run watch/scripts` | |
| # pane 3 is split vertically at 10% and 50% horizontally running `npm run watch/templates` | |
| # pane 4 is split vertically at 10% and 50% horizontally running `npm run watch/browser` | |
| # note: `api` aliased to `cd ~/path/to/work` | |
| session=ANDROID | |
| # set up tmux | |
| tmux start-server | |
| # create a new tmux session, starting vim from a saved session in the new window | |
| tmux new-session -d -s $session -n '🕶️ devPunks' | |
| # # Select pane 1 run vim | |
| #tmux select-pane -t :0 | |
| tmux send-keys "pwd; vim -c 'NERDTree'" C-m | |
| #tmux split-window -t 0 -v -p 70 -c "$(pwd)" | |
| # Split pane 1 vertically by 70% | |
| tmux split-window -t 0 -h -p 30 -c "$(pwd)" | |
| tmux select-pane -t 1 | |
| tmux send-keys "git status" C-m # watch/styles | |
| tmux split-window -t 1 -v -p 30 -c "$(pwd)" | |
| tmux select-pane -t 2 | |
| # tmux send-keys "pwd" C-m # watch/templates | |
| # tmux split-window -t 1 -h -p 40 -c "$(pwd)" | |
| # tmux select-pane -t 3 | |
| # tmux send-keys "pwd" C-m # watch/scripts | |
| # tmux split-window -t 2 -h -p 40 -c "$(pwd)" | |
| # tmux select-pane -t 4 | |
| # tmux send-keys "pwd" C-m # watch/browser | |
| tmux -2 attach -t $session | 
@alexserver Good question. Let me know if you find such a configuration setting. :-)
where "ctrl+b" and "shift+:"
great, thanks
On Mac OS, I am unable to double click and select a word or line to copy text etc.
I am on tmux --head
my .tmux.conf contains:
set-option -g mouse on
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-select-window on
setw -g mouse-resize-pane on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
Appreciate any help :)
Thanks.
hey, a question: what does the status-keys do? I don't see a change between emacs and vi. Could someone please give me a hint?
@sumoto:
Have you tried "option+mouse-select"?
Thank you for this!
@ryanjohnston @sumonto @adham90 @dragonxlwang WOW that awkward moment when you check out old gists and see comments showing appreciation. Talk about made my day!
@snuggs try out tmuxinator rather than ide.sh!
@sumonto @ryanjohnston @KangChiaPin @dragonxlwang @alexserver Updated! Fixed all the bugs (that i didn't know existed due to my ancient tmux version).
https://gist.github.com/snuggs/800936/revisions
Cheers 🍺 🍻
is there any config to let select/copy text ?