Skip to content

Instantly share code, notes, and snippets.

@rtfpessoa
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save rtfpessoa/10585147 to your computer and use it in GitHub Desktop.

Select an option

Save rtfpessoa/10585147 to your computer and use it in GitHub Desktop.

Revisions

  1. Rodrigo Fernandes revised this gist Aug 13, 2015. 1 changed file with 23 additions and 7 deletions.
    30 changes: 23 additions & 7 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,17 @@ set-option -g default-command "which reattach-to-user-namespace > /dev/null && r
    bind x kill-pane
    bind q kill-window

    # Some tweaks
    set -g focus-events on
    set -g display-time 5000
    set -g status-interval 5

    # Copy mode
    bind Escape copy-mode

    # History limit
    set -g history-limit 50000

    # Ring the bell if any background window rang a bell
    set -g bell-action any

    @@ -71,12 +82,6 @@ bind E setw synchronize-panes off
    # client connected to *that window*. Much more reasonable.
    # setw -g aggressive-resize on

    # Copy mode
    bind Escape copy-mode

    # History limit
    set -g history-limit 30000

    # Better scrooling (Sane scrolling)
    set -g terminal-overrides ",xterm*:XT:smcup@:rmcup@"
    set -g mode-mouse on
    @@ -191,11 +196,22 @@ set -g message-fg colour16
    set -g message-bg colour221
    set -g message-attr bold
    set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W #[fg=colour252,bg=colour234]⮀"
    set -g window-status-current-format "#[fg=black,bg=colour39,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"
    set -g window-status-current-format "#[fg=black,bg=green,bold] #I: #W #[fg=green,bg=colour234,nobold]⮀"
    set -g status-left-length 100
    set -g status-left "#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour234,bg=colour234,bold] "
    set -g status-right-length 100
    set -g status-right "#[fg=yellow] %A, %d %b %Y #[fg=green]::%l:%M:%S %p :: #[fg=blue]S #S : W #I : P #P ::"

    # Keep parent environment
    set -ga update-environment -r

    # List of plugins
    set -g @plugin 'tmux-plugins/tpm'
    set -g @plugin 'tmux-plugins/tmux-sidebar'

    # Sidebard plugin config
    set -g @sidebar-tree-command 'tree -C -L 2'
    set -g @sidebar-tree-width '40'

    # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
    run-shell '/Users/rtfpessoa/.tmux/plugins/tpm/tpm'
  2. Rodrigo Fernandes revised this gist Aug 9, 2015. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -191,9 +191,11 @@ set -g message-fg colour16
    set -g message-bg colour221
    set -g message-attr bold
    set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W #[fg=colour252,bg=colour234]⮀"
    set -g window-status-current-format "#[fg=black,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"
    set -g status-left "#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold] "
    set -g status-right " #[fg=yellow]%A, %d %b %Y #[fg=green]::%l:%M:%S %p :: #[fg=blue]S #S : W #I : P #P ::"
    set -g window-status-current-format "#[fg=black,bg=colour39,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"
    set -g status-left-length 100
    set -g status-left "#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour234,bg=colour234,bold] "
    set -g status-right-length 100
    set -g status-right "#[fg=yellow] %A, %d %b %Y #[fg=green]::%l:%M:%S %p :: #[fg=blue]S #S : W #I : P #P ::"

    # Keep parent environment
    set -ga update-environment -r
  3. Rodrigo Fernandes revised this gist Aug 9, 2015. 1 changed file with 4 additions and 10 deletions.
    14 changes: 4 additions & 10 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -181,11 +181,7 @@ bind-key -t vi-copy y copy-pipe "pbcopy"
    unbind -t vi-copy Enter
    bind-key -t vi-copy Enter copy-pipe "pbcopy"

    # Old status
    # set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"

    # color scheme (styled as vim-powerline)
    set -g status-left-length 52
    set -g status-right-length 451
    set -g status-fg white
    set -g status-bg colour234
    @@ -194,12 +190,10 @@ set -g pane-active-border-fg colour39
    set -g message-fg colour16
    set -g message-bg colour221
    set -g message-attr bold
    set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
    set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W "
    set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=black,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"

    # Local config
    if-shell "[ -f ~/.tmux.conf.user ]" 'source ~/.tmux.conf.user'
    set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W #[fg=colour252,bg=colour234]⮀"
    set -g window-status-current-format "#[fg=black,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"
    set -g status-left "#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold] "
    set -g status-right " #[fg=yellow]%A, %d %b %Y #[fg=green]::%l:%M:%S %p :: #[fg=blue]S #S : W #I : P #P ::"

    # Keep parent environment
    set -ga update-environment -r
  4. Rodrigo Fernandes revised this gist Aug 9, 2015. 1 changed file with 50 additions and 19 deletions.
    69 changes: 50 additions & 19 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -9,16 +9,28 @@ set-option -g default-shell /bin/zsh

    # colors please
    set -g default-terminal "screen-256color"
    set-option -g default-command "reattach-to-user-namespace -l zsh"
    setw -g xterm-keys on
    set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages
    set-window-option -g xterm-keys on

    # Patch for OS X pbpaste and pbcopy under tmux.
    # set-option -g default-command "reattach-to-user-namespace -l zsh"
    set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"

    # no confirmation on quit pane or window
    bind x kill-pane
    bind q kill-window

    # Ring the bell if any background window rang a bell
    set -g bell-action any

    # Default termtype. If the rcfile sets $TERM, that overrides this value.
    set -g default-terminal screen-256color

    # Keep your finger on ctrl, or don't
    bind-key ^D detach-client

    # clear on tmux
    bind -n C-k send-keys -R \; send-keys C-l \; clear-history

    @@ -33,7 +45,7 @@ set-window-option -g utf8 on

    # force a reload of the config file
    unbind r
    bind r source-file ~/.tmux.conf
    bind r source-file ~/.tmux.conf \; display "Reloaded!"

    # quick pane cycling
    unbind ^A
    @@ -47,7 +59,12 @@ set -g base-index 1 # start windows numbering at 1
    setw -g pane-base-index 1 # make pane numbering consistent with windows

    # No delay between comands
    set -s escape-time 0
    set -sg escape-time 0

    # easily toggle synchronization (mnemonic: e is for echo)
    # sends input to all panes in a given window.
    bind e setw synchronize-panes on
    bind E setw synchronize-panes off

    # Rather than constraining window size to the maximum size of any client
    # connected to the *session*, constrain window size to the maximum size of any
    @@ -70,12 +87,6 @@ set -g mouse-select-window on
    setw -g alternate-screen on
    set-window-option -g mode-mouse on

    # Cool window name
    set -g status-bg black
    set -g status-fg white
    set -g status-left ""
    set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"

    # Allows us to use C-a a <command> to send commands to a TMUX session inside
    # another TMUX session
    bind-key a send-prefix
    @@ -97,7 +108,7 @@ bind -n S-right next
    bind -n C-left swap-window -t -1
    bind -n C-right swap-window -t +1

    # Remap window navigation to vim
    # Pane resize in all four directions using vi bindings.
    unbind-key j
    bind-key j select-pane -D
    unbind-key k
    @@ -107,9 +118,15 @@ bind-key h select-pane -L
    unbind-key l
    bind-key l select-pane -R

    # Split panes
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    # Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
    bind -r H resize-pane -L 5
    bind -r J resize-pane -D 5
    bind -r K resize-pane -U 5
    bind -r L resize-pane -R 5

    # Create splits and vertical splits
    bind-key | split-window -h -p 50 -c "#{pane_current_path}"
    bind-key - split-window -v -p 50 -c "#{pane_current_path}"

    # Misc

    @@ -145,12 +162,6 @@ bind < swap-pane -U # swap current pane with the previous one
    # maximize current pane
    bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane'

    # pane resizing
    bind -r H resize-pane -L 5
    bind -r J resize-pane -D 5
    bind -r K resize-pane -U 5
    bind -r L resize-pane -R 5

    # window navigation
    bind -r C-h previous-window # select previous window
    bind -r C-l next-window # select next window
    @@ -170,5 +181,25 @@ bind-key -t vi-copy y copy-pipe "pbcopy"
    unbind -t vi-copy Enter
    bind-key -t vi-copy Enter copy-pipe "pbcopy"

    # Old status
    # set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"

    # color scheme (styled as vim-powerline)
    set -g status-left-length 52
    set -g status-right-length 451
    set -g status-fg white
    set -g status-bg colour234
    set -g pane-border-fg colour245
    set -g pane-active-border-fg colour39
    set -g message-fg colour16
    set -g message-bg colour221
    set -g message-attr bold
    set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
    set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W "
    set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=black,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"

    # Local config
    if-shell "[ -f ~/.tmux.conf.user ]" 'source ~/.tmux.conf.user'

    # Keep parent environment
    set -ga update-environment -r
  5. Rodrigo Fernandes revised this gist Aug 9, 2015. No changes.
  6. Rodrigo Fernandes revised this gist Aug 8, 2015. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -87,6 +87,9 @@ set -g visual-activity on
    # Highlight active window
    set-window-option -g window-status-current-bg red

    # New window keep path
    bind c new-window -c "#{pane_current_path}"

    # Switch windows
    bind -n S-down new-window
    bind -n S-left prev
    @@ -105,8 +108,8 @@ unbind-key l
    bind-key l select-pane -R

    # Split panes
    bind | split-window -h
    bind - split-window -v
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"

    # Misc

    @@ -166,3 +169,6 @@ bind-key -t vi-copy y copy-pipe "pbcopy"
    # Update default binding of `Enter` to also use copy-pipe
    unbind -t vi-copy Enter
    bind-key -t vi-copy Enter copy-pipe "pbcopy"

    # Keep parent environment
    set -ga update-environment -r
  7. Rodrigo Fernandes revised this gist Aug 8, 2015. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,9 @@
    # Tmux config
    #

    # set Zsh as your default Tmux shell
    set-option -g default-shell /bin/zsh

    # colors please
    set -g default-terminal "screen-256color"
    set-option -g default-command "reattach-to-user-namespace -l zsh"
    @@ -20,12 +23,13 @@ bind q kill-window
    bind -n C-k send-keys -R \; send-keys C-l \; clear-history

    # ctrl + a ftw
    set -g prefix2 C-a # GNU-Screen compatible prefix
    bind C-a send-prefix -2
    # set -g prefix2 C-a # GNU-Screen compatible prefix
    # bind C-a send-prefix -2

    # utf8 ftw
    set -g status-utf8 on # expect UTF-8
    setw -g utf8 on
    set-window-option -g utf8 on

    # force a reload of the config file
    unbind r
    @@ -48,7 +52,7 @@ set -s escape-time 0
    # Rather than constraining window size to the maximum size of any client
    # connected to the *session*, constrain window size to the maximum size of any
    # client connected to *that window*. Much more reasonable.
    setw -g aggressive-resize on
    # setw -g aggressive-resize on

    # Copy mode
    bind Escape copy-mode
  8. Rodrigo Fernandes revised this gist Aug 2, 2015. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,10 @@ set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages
    set-window-option -g xterm-keys on

    # no confirmation on quit pane or window
    bind x kill-pane
    bind q kill-window

    # clear on tmux
    bind -n C-k send-keys -R \; send-keys C-l \; clear-history

    @@ -117,9 +121,6 @@ set -g status-interval 10 # redraw status line every 10 seconds
    # 24 hour clock
    setw -g clock-mode-style 24

    # kill window
    bind q confirm kill-window

    # create new session
    bind C-c new-session

  9. Rodrigo Fernandes revised this gist Aug 1, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ set -s quiet on # disable various messages
    set-window-option -g xterm-keys on

    # clear on tmux
    bind-key C send-keys "clear" \; send-keys "Enter" \; clear-history
    bind -n C-k send-keys -R \; send-keys C-l \; clear-history

    # ctrl + a ftw
    set -g prefix2 C-a # GNU-Screen compatible prefix
    @@ -62,7 +62,7 @@ set -g mouse-select-window on
    setw -g alternate-screen on
    set-window-option -g mode-mouse on

    # Cool window name ???
    # Cool window name
    set -g status-bg black
    set -g status-fg white
    set -g status-left ""
  10. Rodrigo Fernandes revised this gist May 10, 2015. 1 changed file with 4 additions and 23 deletions.
    27 changes: 4 additions & 23 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -50,36 +50,17 @@ setw -g aggressive-resize on
    bind Escape copy-mode

    # History limit
    set -g history-limit 10000
    set -g history-limit 30000

    # Better scrooling (Sane scrolling)
    set -g terminal-overrides ",xterm*:XT:smcup@:rmcup@"
    set -g mode-mouse on
    set -g mouse-select-pane on
    setw -g mode-mouse on
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
    set -g mouse-select-pane on
    set -g mouse-select-window on
    set-option -g mouse-select-pane on
    set-option -g mouse-select-window on
    set-window-option -g mode-mouse on
    set -g terminal-overrides ",xterm*:XT:smcup@:rmcup@"
    setw -g alternate-screen on

    # Toggle mouse on with ^B m
    bind m \
    set -g mode-mouse on \;\
    set -g mouse-resize-pane on \;\
    set -g mouse-select-pane on \;\
    set -g mouse-select-window on \;\
    display 'Mouse: ON'

    # Toggle mouse off with ^B M
    bind M \
    set -g mode-mouse off \;\
    set -g mouse-resize-pane off \;\
    set -g mouse-select-pane off \;\
    set -g mouse-select-window off \;\
    display 'Mouse: OFF'
    set-window-option -g mode-mouse on

    # Cool window name ???
    set -g status-bg black
  11. Rodrigo Fernandes revised this gist May 10, 2015. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,9 @@ set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages
    set-window-option -g xterm-keys on

    # clear on tmux
    bind-key C send-keys "clear" \; send-keys "Enter" \; clear-history

    # ctrl + a ftw
    set -g prefix2 C-a # GNU-Screen compatible prefix
    bind C-a send-prefix -2
    @@ -38,9 +41,6 @@ setw -g pane-base-index 1 # make pane numbering consistent with windows
    # No delay between comands
    set -s escape-time 0

    # Clear on tmux
    bind -n C-k send-keys -R \; clear-history

    # Rather than constraining window size to the maximum size of any client
    # connected to the *session*, constrain window size to the maximum size of any
    # client connected to *that window*. Much more reasonable.
    @@ -136,9 +136,6 @@ set -g status-interval 10 # redraw status line every 10 seconds
    # 24 hour clock
    setw -g clock-mode-style 24

    # clear both screen and history
    bind -n C-l send-keys C-l \; run 'tmux clear-history'

    # kill window
    bind q confirm kill-window

  12. Rodrigo Fernandes revised this gist May 10, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # cat << ►_◄ > /dev/null

    #
  13. Rodrigo Fernandes revised this gist May 10, 2015. 1 changed file with 15 additions and 42 deletions.
    57 changes: 15 additions & 42 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,17 @@

    # cat << ►_◄ > /dev/null

    #
    # Tmux config
    #

    #set -g prefix C-a
    #unbind C-b
    #bind C-a send-prefix
    # colors please
    set -g default-terminal "screen-256color"
    set-option -g default-command "reattach-to-user-namespace -l zsh"
    setw -g xterm-keys on
    set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages
    set-window-option -g xterm-keys on

    # ctrl + a ftw
    set -g prefix2 C-a # GNU-Screen compatible prefix
    @@ -24,12 +29,6 @@ bind r source-file ~/.tmux.conf
    unbind ^A
    bind ^A select-pane -t :.+

    # colors please
    set -g default-terminal "screen-256color"
    setw -g xterm-keys on
    set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages

    # Repeat for last active window
    bind-key C-a last-window

    @@ -55,7 +54,6 @@ bind Escape copy-mode
    set -g history-limit 10000

    # Better scrooling (Sane scrolling)
    set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
    set -g mode-mouse on
    set -g mouse-select-pane on
    setw -g mode-mouse on
    @@ -65,7 +63,7 @@ set -g mouse-select-window on
    set-option -g mouse-select-pane on
    set-option -g mouse-select-window on
    set-window-option -g mode-mouse on
    set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
    set -g terminal-overrides ",xterm*:XT:smcup@:rmcup@"
    setw -g alternate-screen on

    # Toggle mouse on with ^B m
    @@ -82,30 +80,21 @@ bind M \
    set -g mouse-resize-pane off \;\
    set -g mouse-select-pane off \;\
    set -g mouse-select-window off \;\
    display 'Mouse: OFF'

    # Emacs style
    bind -t emacs-copy 'p' scroll-up
    bind -t emacs-copy 'n' scroll-down
    bind -t emacs-copy 'i' scroll-up
    bind -t emacs-copy 'k' scroll-down
    display 'Mouse: OFF'

    # Cool window name ???
    set -g status-bg black
    set -g status-fg white
    set -g status-left ""
    set -g status-right "#[fg=green]#H"

    # Example of using a shell command in the status line
    #set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
    set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"

    # Allows us to use C-a a <command> to send commands to a TMUX session inside
    # another TMUX session
    bind-key a send-prefix

    # Activity monitoring
    #setw -g monitor-activity on
    #set -g visual-activity on
    setw -g monitor-activity on
    set -g visual-activity on

    # Highlight active window
    set-window-option -g window-status-current-bg red
    @@ -151,22 +140,9 @@ setw -g clock-mode-style 24
    # clear both screen and history
    bind -n C-l send-keys C-l \; run 'tmux clear-history'

    # activity
    set -g monitor-activity on
    set -g visual-activity off

    # tmux theme, colors and status line
    # available themes:
    # - powerline (a powerline inspired theme)
    # - powerline_patched_font (a powerline inspired theme using a patched font)
    tmux_conf_theme=powerline


    # kill window
    bind q confirm kill-window

    # -- navigation ----------------------------------------------------------------

    # create new session
    bind C-c new-session

    @@ -195,9 +171,6 @@ bind -r C-h previous-window # select previous window
    bind -r C-l next-window # select next window
    bind Space last-window # move to last active window

    # toggle mouse
    bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"

    # vi-keys everywhere; anything else would be uncivilized
    setw -g mode-keys vi
    set -g status-keys vi
    @@ -206,8 +179,8 @@ setw -g xterm-keys on
    # Setup 'v' to begin selection as in Vim
    bind-key -t vi-copy r rectangle-toggle
    bind-key -t vi-copy v begin-selection
    bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
    bind-key -t vi-copy y copy-pipe "pbcopy"

    # 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"
    bind-key -t vi-copy Enter copy-pipe "pbcopy"
  14. Rodrigo Fernandes revised this gist May 9, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # cat << ►_◄ > /dev/null

    #
  15. Rodrigo Fernandes revised this gist May 9, 2015. 1 changed file with 174 additions and 93 deletions.
    267 changes: 174 additions & 93 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,98 +1,64 @@

    # cat << ►_◄ > /dev/null

    #
    # Tmux Configuration
    # rtfpessoa (13-04-2014)
    # Tmux config
    #

    # Set the default terminal mode to 256color mode
    set -g default-terminal "screen-256color"
    #set -g prefix C-a
    #unbind C-b
    #bind C-a send-prefix

    ### screen-like keybindings
    unbind C-b
    set -g prefix C-a
    bind C-a send-prefix
    bind a send-prefix
    bind A command-prompt "rename-window %%"
    setw -g automatic-rename off
    # ctrl + a ftw
    set -g prefix2 C-a # GNU-Screen compatible prefix
    bind C-a send-prefix -2

    bind Escape copy-mode
    # default is too slow which is annoying during heavy-use of the copy buffer
    set -s escape-time 100
    # utf8 ftw
    set -g status-utf8 on # expect UTF-8
    setw -g utf8 on

    # vi-keys everywhere; anything else would be uncivilized
    setw -g mode-keys vi
    set -g status-keys vi
    # force a reload of the config file
    unbind r
    bind r source-file ~/.tmux.conf

    # quick pane cycling
    unbind ^A
    bind ^A select-pane -t :.+

    # colors please
    set -g default-terminal "screen-256color"
    setw -g xterm-keys on
    set -sg repeat-time 600 # increase repeat timeout
    set -s quiet on # disable various messages

    # Moving between windows/panes
    bind C-a last-window
    bind " " next-window
    bind BSpace previous-window
    bind '"' choose-window
    set -g mouse-select-pane on
    bind h select-pane -L
    bind j select-pane -D
    bind k select-pane -U
    bind l select-pane -R
    bind H command-prompt "resize-pane -L %1"
    bind J command-prompt "resize-pane -D %1"
    bind K command-prompt "resize-pane -U %1"
    bind L command-prompt "resize-pane -R %1"
    bind y setw synchronize-panes

    # splits
    bind C new-window -c "#{pane_current_path}"
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    bind r next-layout
    bind R previous-layout

    # maximizing and restoring panes.
    bind x resize-pane -Z

    # pre-configured window and pane layouts
    bind W run "tmux renamew work; tmux splitw -l 3; tmux selectp -U"

    # nice, big scrollback buffer (lines)
    set -g history-limit 10000
    # Repeat for last active window
    bind-key C-a last-window

    # read and write and delete paste buffer
    bind > command-prompt -p "Write buffer to xclip:" \
    "run 'tmux save-buffer -b %1 - | xclip -i -select clipboard'"
    bind < command-prompt -p "Read from xclip into buffer:" \
    "run 'xclip -o -selection clipboard | tmux load-buffer -b %1 -'"
    bind + command-prompt "delete-buffer -b %1"
    # Zero is cool for programming but not for keyboards
    set -g base-index 1 # start windows numbering at 1
    setw -g pane-base-index 1 # make pane numbering consistent with windows

    # toggle activity/silence monitoring
    bind m setw monitor-activity
    bind M command-prompt -p "monitor-silence (seconds)" "setw monitor-silence %%"
    # No delay between comands
    set -s escape-time 0

    # set xterm window status
    set-option -g set-titles on
    set-option -g set-titles-string '#H ###I.#P #W (#S)'
    # Clear on tmux
    bind -n C-k send-keys -R \; clear-history

    ### Colors
    set -g status-bg black
    set -g status-fg white
    set -g message-bg green
    set -g message-fg black
    setw -g window-status-bell-attr blink
    setw -g window-status-bell-bg green
    setw -g window-status-bell-fg black
    setw -g window-status-current-bg white
    setw -g window-status-current-fg blue

    ### Status bar
    set -g status-right-length 50
    set -g status-right "#[fg=magenta] @#H #[fg=cyan]%Y-%m-%d #[fg=yellow]%a #[fg=green]%H:%M #[fg=blue]#(uptime|sed -e 's/.*: //g' -e 's/,//g')#[default]"

    ### Copy Mode
    bind s copy-mode
    bind -t emacs-copy 'p' scroll-up
    bind -t emacs-copy 'n' scroll-down
    bind -t emacs-copy 'i' scroll-up
    bind -t emacs-copy 'k' scroll-down
    # Rather than constraining window size to the maximum size of any client
    # connected to the *session*, constrain window size to the maximum size of any
    # client connected to *that window*. Much more reasonable.
    setw -g aggressive-resize on

    # Copy mode
    bind Escape copy-mode

    # Mouse support - set to on if you want to use the mouse
    # History limit
    set -g history-limit 10000

    # Better scrooling (Sane scrolling)
    set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
    set -g mode-mouse on
    set -g mouse-select-pane on
    setw -g mode-mouse on
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
    @@ -117,17 +83,132 @@ bind M \
    set -g mouse-resize-pane off \;\
    set -g mouse-select-pane off \;\
    set -g mouse-select-window off \;\
    display 'Mouse: OFF'
    display 'Mouse: OFF'

    # Emacs style
    bind -t emacs-copy 'p' scroll-up
    bind -t emacs-copy 'n' scroll-down
    bind -t emacs-copy 'i' scroll-up
    bind -t emacs-copy 'k' scroll-down

    # Cool window name ???
    set -g status-bg black
    set -g status-fg white
    set -g status-left ""
    set -g status-right "#[fg=green]#H"

    # enable activity alerts
    setw -g monitor-activity on
    set -g visual-activity on
    # Example of using a shell command in the status line
    #set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"

    # Allows us to use C-a a <command> to send commands to a TMUX session inside
    # another TMUX session
    bind-key a send-prefix

    # Activity monitoring
    #setw -g monitor-activity on
    #set -g visual-activity on

    # Highlight active window
    set-window-option -g window-status-current-bg red

    # Switch windows
    bind -n S-down new-window
    bind -n S-left prev
    bind -n S-right next
    bind -n C-left swap-window -t -1
    bind -n C-right swap-window -t +1

    # Remap window navigation to vim
    unbind-key j
    bind-key j select-pane -D
    unbind-key k
    bind-key k select-pane -U
    unbind-key h
    bind-key h select-pane -L
    unbind-key l
    bind-key l select-pane -R

    # Split panes
    bind | split-window -h
    bind - split-window -v

    # Misc

    setw -g automatic-rename on # rename window to reflect current program
    # renumber windows when a window is closed
    set -g renumber-windows on

    set -g set-titles on # set terminal title
    set -g set-titles-string '#h ❐ #S ● #I #W'

    set -g display-panes-time 800 # slightly longer pane indicators display time
    set -g display-time 1000 # slightly longer status messages display time

    set -g status-interval 10 # redraw status line every 10 seconds

    # 24 hour clock
    setw -g clock-mode-style 24

    # clear both screen and history
    bind -n C-l send-keys C-l \; run 'tmux clear-history'

    # activity
    set -g monitor-activity on
    set -g visual-activity off

    # tmux theme, colors and status line
    # available themes:
    # - powerline (a powerline inspired theme)
    # - powerline_patched_font (a powerline inspired theme using a patched font)
    tmux_conf_theme=powerline


    # kill window
    bind q confirm kill-window

    # -- navigation ----------------------------------------------------------------

    # create new session
    bind C-c new-session

    # find session
    bind C-f command-prompt -p find-session 'switch-client -t %%'

    # pane navigation
    bind -r h select-pane -L # move left
    bind -r j select-pane -D # move down
    bind -r k select-pane -U # move up
    bind -r l select-pane -R # move right
    bind > swap-pane -D # swap current pane with the next one
    bind < swap-pane -U # swap current pane with the previous one

    # maximize current pane
    bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane'

    # pane resizing
    bind -r H resize-pane -L 5
    bind -r J resize-pane -D 5
    bind -r K resize-pane -U 5
    bind -r L resize-pane -R 5

    # window navigation
    bind -r C-h previous-window # select previous window
    bind -r C-l next-window # select next window
    bind Space last-window # move to last active window

    # toggle mouse
    bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"

    # vi-keys everywhere; anything else would be uncivilized
    setw -g mode-keys vi
    set -g status-keys vi
    setw -g xterm-keys on

    # Center the window list
    set -g status-justify centre
    # Setup 'v' to begin selection as in Vim
    bind-key -t vi-copy r rectangle-toggle
    bind-key -t vi-copy v begin-selection
    bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

    # Maximize and restore a pane
    unbind Up
    bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
    unbind Down
    bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
    # 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"
  16. rtfpessoa revised this gist Apr 13, 2014. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -100,6 +100,24 @@ set -g mouse-select-window on
    set-option -g mouse-select-pane on
    set-option -g mouse-select-window on
    set-window-option -g mode-mouse on
    set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
    setw -g alternate-screen on

    # Toggle mouse on with ^B m
    bind m \
    set -g mode-mouse on \;\
    set -g mouse-resize-pane on \;\
    set -g mouse-select-pane on \;\
    set -g mouse-select-window on \;\
    display 'Mouse: ON'

    # Toggle mouse off with ^B M
    bind M \
    set -g mode-mouse off \;\
    set -g mouse-resize-pane off \;\
    set -g mouse-select-pane off \;\
    set -g mouse-select-window off \;\
    display 'Mouse: OFF'

    # enable activity alerts
    setw -g monitor-activity on
  17. rtfpessoa created this gist Apr 13, 2014.
    115 changes: 115 additions & 0 deletions .tmux.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,115 @@
    #
    # Tmux Configuration
    # rtfpessoa (13-04-2014)
    #

    # Set the default terminal mode to 256color mode
    set -g default-terminal "screen-256color"

    ### screen-like keybindings
    unbind C-b
    set -g prefix C-a
    bind C-a send-prefix
    bind a send-prefix
    bind A command-prompt "rename-window %%"
    setw -g automatic-rename off

    bind Escape copy-mode
    # default is too slow which is annoying during heavy-use of the copy buffer
    set -s escape-time 100

    # vi-keys everywhere; anything else would be uncivilized
    setw -g mode-keys vi
    set -g status-keys vi
    setw -g xterm-keys on

    # Moving between windows/panes
    bind C-a last-window
    bind " " next-window
    bind BSpace previous-window
    bind '"' choose-window
    set -g mouse-select-pane on
    bind h select-pane -L
    bind j select-pane -D
    bind k select-pane -U
    bind l select-pane -R
    bind H command-prompt "resize-pane -L %1"
    bind J command-prompt "resize-pane -D %1"
    bind K command-prompt "resize-pane -U %1"
    bind L command-prompt "resize-pane -R %1"
    bind y setw synchronize-panes

    # splits
    bind C new-window -c "#{pane_current_path}"
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    bind r next-layout
    bind R previous-layout

    # maximizing and restoring panes.
    bind x resize-pane -Z

    # pre-configured window and pane layouts
    bind W run "tmux renamew work; tmux splitw -l 3; tmux selectp -U"

    # nice, big scrollback buffer (lines)
    set -g history-limit 10000

    # read and write and delete paste buffer
    bind > command-prompt -p "Write buffer to xclip:" \
    "run 'tmux save-buffer -b %1 - | xclip -i -select clipboard'"
    bind < command-prompt -p "Read from xclip into buffer:" \
    "run 'xclip -o -selection clipboard | tmux load-buffer -b %1 -'"
    bind + command-prompt "delete-buffer -b %1"

    # toggle activity/silence monitoring
    bind m setw monitor-activity
    bind M command-prompt -p "monitor-silence (seconds)" "setw monitor-silence %%"

    # set xterm window status
    set-option -g set-titles on
    set-option -g set-titles-string '#H ###I.#P #W (#S)'

    ### Colors
    set -g status-bg black
    set -g status-fg white
    set -g message-bg green
    set -g message-fg black
    setw -g window-status-bell-attr blink
    setw -g window-status-bell-bg green
    setw -g window-status-bell-fg black
    setw -g window-status-current-bg white
    setw -g window-status-current-fg blue

    ### Status bar
    set -g status-right-length 50
    set -g status-right "#[fg=magenta] @#H #[fg=cyan]%Y-%m-%d #[fg=yellow]%a #[fg=green]%H:%M #[fg=blue]#(uptime|sed -e 's/.*: //g' -e 's/,//g')#[default]"

    ### Copy Mode
    bind s copy-mode
    bind -t emacs-copy 'p' scroll-up
    bind -t emacs-copy 'n' scroll-down
    bind -t emacs-copy 'i' scroll-up
    bind -t emacs-copy 'k' scroll-down

    # Mouse support - set to on if you want to use the mouse
    setw -g mode-mouse on
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
    set -g mouse-select-window on
    set-option -g mouse-select-pane on
    set-option -g mouse-select-window on
    set-window-option -g mode-mouse on

    # enable activity alerts
    setw -g monitor-activity on
    set -g visual-activity on

    # Center the window list
    set -g status-justify centre

    # Maximize and restore a pane
    unbind Up
    bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
    unbind Down
    bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp