Skip to content

Instantly share code, notes, and snippets.

@abhirup-dev
Forked from rajanand02/tmux.conf
Last active March 2, 2021 17:25
Show Gist options
  • Select an option

  • Save abhirup-dev/b27de6bc75c8e706631f283546321f61 to your computer and use it in GitHub Desktop.

Select an option

Save abhirup-dev/b27de6bc75c8e706631f283546321f61 to your computer and use it in GitHub Desktop.

Revisions

  1. abhirup-dev revised this gist Sep 9, 2020. 1 changed file with 0 additions and 27 deletions.
    27 changes: 0 additions & 27 deletions tmux.conf
    Original file line number Diff line number Diff line change
    @@ -46,11 +46,6 @@ bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel

    ## Overriding copy-mode binding
    bind -n 'PageUp' copy-mode
    # source-file ~/.tmux/plugins/tmux-themepack/basic.tmuxtheme
    # set -g @plugin 'mattdavis90/base16-tmux'
    # set -g @colors-base16 'default-dark'
    # set -g @plugin 'dracula/tmux'
    # neovim colors in tmux

    ## only this line might not be enough
    set -g default-terminal "xterm-256color"
    @@ -60,28 +55,6 @@ set-option -ga terminal-overrides ",xterm-256color:RGB" # older tmux? replace "R
    ## For better ESC speed in vim
    set-option -sg escape-time 10

    # # Enabling copy on WSL
    # # bind -n M-w run -b "tmux show-buffer | clip.exe"
    #
    # # List of plugins
    # set -g @plugin 'tmux-plugins/tpm'
    # set -g @plugin 'tmux-plugins/tmux-yank'
    # set -g @plugin 'tmux-plugins/tmux-resurrect'
    # set -g @plugin 'tmux-plugins/tmux-continuum'
    #
    # run-shell ~/.tmux/plugins/tmux-yank/yank.tmux
    # run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
    # run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
    #
    # set -g @yank_with_mouse on
    # set -g @continuum-restore 'on'
    #
    # run -b '~/.tmux/plugins/tpm/tpm'
    # # for vim
    # set -g @resurrect-strategy-vim 'session'
    # # for neovim
    # set -g @resurrect-strategy-nvim 'session'
    #
    # Send the same command to all panes/windows/sessions
    # Source: https://scripter.co/command-to-every-pane-window-session-in-tmux/
    bind E command-prompt -p "Command:" \
  2. abhirup-dev revised this gist Sep 9, 2020. 1 changed file with 103 additions and 124 deletions.
    227 changes: 103 additions & 124 deletions tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,127 +1,105 @@
    # set prefix to control-f
    set -g prefix C-f

    #unbind system defined prefix
    unbind C-b

    # helps in faster key repetition
    set -sg escape-time 0

    # start session number from 1 rather than 0
    set -g prefix C-z
    bind-key C-a send-prefix

    # split panes using | and -
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    bind c new-window -c "#{pane_current_path}"
    unbind '"'
    unbind %

    bind N new

    # switch panes using Alt-arrow without prefix
    bind -n M-Left select-pane -L
    bind -n M-Right select-pane -R
    bind -n M-Up select-pane -U
    bind -n M-Down select-pane -D
    bind -n M-h select-pane -L
    bind -n M-l select-pane -R
    bind -n M-k select-pane -U
    bind -n M-j select-pane -D

    bind m resize-pane -Z

    # reload config

    # Enable mouse mode (tmux 2.1 and above)
    set -g mouse on

    ######################
    ### DESIGN CHANGES ###
    ######################

    # loud or quiet?
    set -g visual-activity off
    set -g visual-bell off
    set -g visual-silence off
    setw -g monitor-activity off
    set -g bell-action none

    ## VI mode (https://sanctum.geek.nz/arabesque/vi-mode-in-tmux/)
    set-window-option -g mode-keys vi
    bind-key -T copy-mode-vi 'v' send -X begin-selection
    bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel

    ## Overriding copy-mode binding
    bind -n 'PageUp' copy-mode
    # source-file ~/.tmux/plugins/tmux-themepack/basic.tmuxtheme
    # set -g @plugin 'mattdavis90/base16-tmux'
    # set -g @colors-base16 'default-dark'
    # set -g @plugin 'dracula/tmux'
    # neovim colors in tmux

    ## only this line might not be enough
    set -g default-terminal "xterm-256color"
    ## Needs this line also to overrides the default color
    set-option -ga terminal-overrides ",xterm-256color:RGB" # older tmux? replace "RGB" with "Tc"
    # set-default colorset-option -ga terminal-overrides ",xterm-256color:Tc"
    ## For better ESC speed in vim
    set-option -sg escape-time 10

    # # Enabling copy on WSL
    # # bind -n M-w run -b "tmux show-buffer | clip.exe"
    #
    # # List of plugins
    # set -g @plugin 'tmux-plugins/tpm'
    # set -g @plugin 'tmux-plugins/tmux-yank'
    # set -g @plugin 'tmux-plugins/tmux-resurrect'
    # set -g @plugin 'tmux-plugins/tmux-continuum'
    #
    # run-shell ~/.tmux/plugins/tmux-yank/yank.tmux
    # run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
    # run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
    #
    # set -g @yank_with_mouse on
    # set -g @continuum-restore 'on'
    #
    # run -b '~/.tmux/plugins/tpm/tpm'
    # # for vim
    # set -g @resurrect-strategy-vim 'session'
    # # for neovim
    # set -g @resurrect-strategy-nvim 'session'
    #
    # Send the same command to all panes/windows/sessions
    # Source: https://scripter.co/command-to-every-pane-window-session-in-tmux/
    bind E command-prompt -p "Command:" \
    "run \"tmux list-panes -a -F '##{session_name}:##{window_index}.##{pane_index}' \
    | xargs -I PANE tmux send-keys -t PANE '%1' Enter\""

    # Send command only to current session
    bind C-e command-prompt -p "Command:" \
    "run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}' \
    | xargs -I PANE tmux send-keys -t PANE '%1' Enter\""

    # Start window numbering at 1
    set -g base-index 1

    # start pane number from 1 similar to windows
    set -g pane-base-index 1

    # Make the current window the first window
    bind T swap-window -t 1

    # source .tmux.conf file
    bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"

    # dont mess up with other ctrl-a options by pressing ctrl-a twice
    bind C-a send-prefix

    # vertical split
    bind | split-window -h

    # horizontal split
    bind - split-window -v

    # pane movement similar to vim
    bind h select-pane -L
    bind j select-pane -D
    bind k select-pane -U
    bind l select-pane -R

    # resize panes
    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

    # to cycle through windows
    bind -r C-h select-window -t :-
    bind -r C-l select-window -t :+
    bind b previous-window

    # enable mouse
    setw -g mode-mouse on

    # allow mouse to select windows and panes
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
    set -g mouse-select-window on

    # Toggle mouse on
    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
    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'
    #Note: hold shift key to select the text using mouse

    # set 256 color
    set -g default-terminal "screen-256color"

    # monitor activities in other windows
    setw -g monitor-activity on
    set -g visual-activity on

    # enable vi mode
    setw -g mode-keys vi

    # remap copy paste keys
    unbind [
    bind y copy-mode
    unbind p
    bind p paste-buffer
    bind -t vi-copy 'v' begin-selection
    bind -t vi-copy 'y' copy-selection

    # copy to system clipboard
    bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"

    # paste from system clipboard
    bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

    # maximizing and restoring panes
    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


    # switch between sessions
    bind -r ( switch-client -p
    bind -r ) switch-client -n

    # set zsh as default shell
    set -g default-command /bin/zsh
    set -g default-shell /bin/zsh

    # recording program output to a log
    bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"


    # don't allow tmux to rename the window based on commands running
    set-window-option -g allow-rename off
    #
    set -g lock-after-time 300
    set -g lock-command "cmatrix -s"
    # include status line powerline theme

    # status bar theme
    bind -r [ switch-client -p
    bind -r ] switch-client -n

    # status bar theme - from https://gist.github.com/rajanand02/9407361
    set -g status-bg 'colour235'
    set -g message-command-fg 'colour222'
    set -g status-justify 'centre'
    @@ -144,7 +122,8 @@ setw -g window-status-activity-attr 'none'
    setw -g window-status-activity-fg 'colour154'
    setw -g window-status-separator ''
    setw -g window-status-bg 'colour235'
    set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) '
    setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'
    set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r '
    # to see custom timezone https://stackoverflow.com/a/39868365/9587133
    setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I #W #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'
  3. @rajanand02 rajanand02 revised this gist Jul 26, 2014. 1 changed file with 31 additions and 9 deletions.
    40 changes: 31 additions & 9 deletions tmux.conf
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@
    # set prefix to control-a
    set -g prefix C-a
    # set prefix to control-f
    set -g prefix C-f

    # include them
    #unbind system defined prefix
    unbind C-b

    @@ -14,8 +13,11 @@ set -g base-index 1
    # start pane number from 1 similar to windows
    set -g pane-base-index 1

    # Make the current window the first window
    bind T swap-window -t 1

    # source .tmux.conf file
    bind r source-file ~/.tmux.conf \; display "Reloaded!"
    bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"

    # dont mess up with other ctrl-a options by pressing ctrl-a twice
    bind C-a send-prefix
    @@ -26,7 +28,7 @@ bind | split-window -h
    # horizontal split
    bind - split-window -v

    # pane movement simlar to vim
    # pane movement similar to vim
    bind h select-pane -L
    bind j select-pane -D
    bind k select-pane -U
    @@ -41,6 +43,7 @@ bind -r L resize-pane -R 5
    # to cycle through windows
    bind -r C-h select-window -t :-
    bind -r C-l select-window -t :+
    bind b previous-window

    # enable mouse
    setw -g mode-mouse on
    @@ -50,6 +53,23 @@ set -g mouse-select-pane on
    set -g mouse-resize-pane on
    set -g mouse-select-window on

    # Toggle mouse on
    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
    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'
    #Note: hold shift key to select the text using mouse

    # set 256 color
    set -g default-terminal "screen-256color"

    @@ -62,7 +82,7 @@ setw -g mode-keys vi

    # remap copy paste keys
    unbind [
    bind Escape copy-mode
    bind y copy-mode
    unbind p
    bind p paste-buffer
    bind -t vi-copy 'v' begin-selection
    @@ -92,13 +112,15 @@ set -g default-shell /bin/zsh
    # recording program output to a log
    bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"

    # show battery status
    set -g status-right "#(~/battery Discharging) | #[fg=cyan]%d %b %R"

    # don't allow tmux to rename the window based on commands running
    set-window-option -g allow-rename off
    #
    set -g lock-after-time 300
    set -g lock-command "cmatrix -s"
    # include status line powerline theme

    # status line theme
    # status bar theme

    set -g status-bg 'colour235'
    set -g message-command-fg 'colour222'
  4. @rajanand02 rajanand02 created this gist Mar 7, 2014.
    128 changes: 128 additions & 0 deletions tmux.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,128 @@
    # set prefix to control-a
    set -g prefix C-a

    # include them
    #unbind system defined prefix
    unbind C-b

    # helps in faster key repetition
    set -sg escape-time 0

    # start session number from 1 rather than 0
    set -g base-index 1

    # start pane number from 1 similar to windows
    set -g pane-base-index 1

    # source .tmux.conf file
    bind r source-file ~/.tmux.conf \; display "Reloaded!"

    # dont mess up with other ctrl-a options by pressing ctrl-a twice
    bind C-a send-prefix

    # vertical split
    bind | split-window -h

    # horizontal split
    bind - split-window -v

    # pane movement simlar to vim
    bind h select-pane -L
    bind j select-pane -D
    bind k select-pane -U
    bind l select-pane -R

    # resize panes
    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

    # to cycle through windows
    bind -r C-h select-window -t :-
    bind -r C-l select-window -t :+

    # enable mouse
    setw -g mode-mouse on

    # allow mouse to select windows and panes
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
    set -g mouse-select-window on

    # set 256 color
    set -g default-terminal "screen-256color"

    # monitor activities in other windows
    setw -g monitor-activity on
    set -g visual-activity on

    # enable vi mode
    setw -g mode-keys vi

    # remap copy paste keys
    unbind [
    bind Escape copy-mode
    unbind p
    bind p paste-buffer
    bind -t vi-copy 'v' begin-selection
    bind -t vi-copy 'y' copy-selection

    # copy to system clipboard
    bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"

    # paste from system clipboard
    bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

    # maximizing and restoring panes
    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


    # switch between sessions
    bind -r ( switch-client -p
    bind -r ) switch-client -n

    # set zsh as default shell
    set -g default-command /bin/zsh
    set -g default-shell /bin/zsh

    # recording program output to a log
    bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"

    # show battery status
    set -g status-right "#(~/battery Discharging) | #[fg=cyan]%d %b %R"

    # don't allow tmux to rename the window based on commands running
    set-window-option -g allow-rename off

    # status line theme

    set -g status-bg 'colour235'
    set -g message-command-fg 'colour222'
    set -g status-justify 'centre'
    set -g status-left-length '100'
    set -g status 'on'
    set -g pane-active-border-fg 'colour154'
    set -g message-bg 'colour238'
    set -g status-right-length '100'
    set -g status-right-attr 'none'
    set -g message-fg 'colour222'
    set -g message-command-bg 'colour238'
    set -g status-attr 'none'
    set -g status-utf8 'on'
    set -g pane-border-fg 'colour238'
    set -g status-left-attr 'none'
    setw -g window-status-fg 'colour121'
    setw -g window-status-attr 'none'
    setw -g window-status-activity-bg 'colour235'
    setw -g window-status-activity-attr 'none'
    setw -g window-status-activity-fg 'colour154'
    setw -g window-status-separator ''
    setw -g window-status-bg 'colour235'
    set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) '
    setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
    setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'