Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Time-stamp: <2014-01-30 16:54:02 kmodi>
- # Running tmux dev build 1.9
- ################################################################################
- # PREFIX
- set -g prefix C-z
- unbind C-b # unbind the default binding to send prefix key to the application
- # Often you'll run a tmux inside another tmux and need a command sequence to
- # send things to the inner session. With below binding that can be accomplished
- # using "PREFIX Z <command>"
- bind Z send-prefix
- # Source config
- unbind r # unbind default binding to force redraw of attached client
- bind r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ."
- ################################################################################
- # Pane Management (no pun intended)
- set -g pane-base-index 1 # start pane indices at 1
- bind o select-pane -t :.+ # cycle panes
- bind O select-pane -t :.- # cycle panes in reverse
- bind z resize-pane -Z # zoom/unzoom the current pane
- # Convert a window from current or any other session to a pane
- bind j command-prompt -p "Join pane from [sess:]win# (ex: kmodi:3 or 2(from current session)):" "join-pane -s '%%'"
- # Convert a pane to a window in current or any other session
- bind J command-prompt -p "Send pane to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "join-pane -t '%%'"
- # If the window has >1 panes kill them without confirming. But confirm before kill
- # the last pane (along with its window) in a window
- bind x if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
- "confirm-before -p \"Kill the only pane in window? It will kill this window too! (y/n)\" kill-pane" \
- "kill-pane"
- # resize pane
- bind -r C-h resize-pane -L 2
- bind -r C-j resize-pane -D 2
- bind -r C-k resize-pane -U 2
- bind -r C-l resize-pane -R 2
- # pane border colors
- set -g pane-active-border-fg yellow
- set -g pane-border-fg colour235
- # PREFIX Up, Down, Right, Left : Move cursor from one pane to another
- # PREFIX Space : Cycle through different pane layouts
- # PREFIX ! : break-pane, convert the current pane to a window
- # PREFIX ; : last-pane, switch to the last active pane
- # PREFIX C-o : rotate-window, rotate panes in the current window
- ################################################################################
- # Window Management
- set -g base-index 1 # start window indices at 1
- # automatically renumber the windows
- # http://unix.stackexchange.com/questions/21742/renumbering-windows-in-tmux
- set -g renumber-windows on
- unbind & # unbind default binding for `split-window -h`
- bind - split-window -v # vertical split
- bind | split-window -h # horizontal split
- unbind c # unbind default binding for `new-window`
- # bind c new-window -c $PWD # DOESN'T WORK!!
- bind C-f command-prompt -p "New window:" "new-window -n %1"
- bind C-r command-prompt -p "New name for this window:" "rename-window '%%'"
- unbind l # unbind default binding for `last-window`
- bind C-z last-window # switch to last active window
- unbind t # unbind default binding to show time
- bind t swap-window -t 1 # swap the current window's position with window # 1, move it to the top
- # Move the current window to another window index in the same or any other session
- bind m command-prompt -p "Move window to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "move-window -t '%%'"
- # Move or bring a window from a different session to the current one
- bind M command-prompt -p "Move the window from sess:win# (ex: kmodi:3):" "move-window -s '%%'"
- bind N move-window -r # renumber the windows
- bind < swap-window -t -1 # move window one position to the left
- unbind , # unbind default binding for `rename-window`
- bind , swap-window -t -1 # move window one position to the left
- bind > swap-window -t +1 # move window one position to the right
- unbind . # unbind default binding to move window to user provided index
- bind . swap-window -t +1 # move window one position to the right
- unbind & # unbind default binding for `kill-window`
- bind C-c confirm-before -p "Kill this window? (y/n)" kill-window
- # PREFIX # : switches to window with index=#
- # PREFIX p : previous-window
- # PREFIX n : next-window
- # PREFIX w : choose-window, choose window interactively
- ################################################################################
- # Session Management
- bind C-t command-prompt -p "New name for this session:" "rename-session '%%'"
- unbind L # unbind default binding for `switch-client -l`
- bind b switch-client -l # switch to previously selected session
- # PREFIX s : choose-session, select a session to switch to
- # tmux kill-session -t NAME/SESSIONNUMBER # Kill session
- ################################################################################
- # Enable Mouse actions
- set -g mouse-resize-pane on
- set -g mouse-select-pane on
- set -g mouse-select-window on
- set -g mouse-utf8 on
- setw -g mode-mouse on
- ################################################################################
- # window title
- set -g set-titles on
- set -g set-titles-string '#W W#I/#{session_windows} P#P/#{window_panes} [#h:#S]'
- ################################################################################
- # Status Bar
- set -g status-utf8 on
- set -g status-justify centre
- set -g status-bg black
- set -g status-fg colour240
- set -g status-left-length 10
- set -g status-left ' #[fg=white,bold][#S] '
- set -g status-right-length 20
- set -g status-right ' #[fg=white]%l:%M %b %d %a '
- # # tmux-powerline
- # # https://github.com/erikw/tmux-powerline
- # set -g status-left-length 30
- # set -g status-right-length 30
- # set -g status-left "#(~/usr_local/scripts/tmux-powerline/powerline.sh left)"
- # set -g status-right "#(~/usr_local/scripts/tmux-powerline/powerline.sh right)"
- # Message font customization
- set -g message-bg yellow
- set -g message-fg white
- set -g message-attr bold
- # Highlight the active window name
- setw -g window-status-current-fg white
- setw -g window-status-current-bg yellow
- # Possible attribute values:
- # none, bold/bright, dim, underscore, blink, reverse, hidden, or italics
- setw -g window-status-current-attr bold
- # Notify when a window has activity
- # This quick snippet will have tmux notify you in the status area when a
- # window has activity:
- setw -g monitor-activity on
- set -g visual-activity off # Displays a message telling that an activity happened
- setw -g window-status-activity-fg white
- setw -g window-status-activity-bg red
- setw -g window-status-activity-attr none
- # It lets me know that there is activity in a non-active window
- # To try this, enter `sleep 10 && echo “Hi”` in a window and switch to
- # another window.
- # Notify when a window has a content alert
- setw -g monitor-content "--[A-Za-z][A-Za-z]sim Done--" # This string appears when a sim finishes, alert then
- # setw -g monitor-content "" # Disable monitor-content
- set -g visual-content on # Displays a message telling that a content alert was triggered
- setw -g window-status-content-fg black
- setw -g window-status-content-bg green
- setw -g window-status-content-attr none
- # Move focus to command prompt. tmux commands can be entered there directly
- # without using the `tmux` prefix and it also supports auto-complete.
- bind C-x command-prompt # default command-prompt binding "PREFIX :" also works
- ################################################################################
- # audible and visual bells
- set -g bell-action any
- set -g bell-on-alert off
- set -g visual-bell on
- ################################################################################
- # COPY & PASTE
- # Copy tmux buffer to X clipboard
- bind C-w run -b "tmux show-buffer | xclip -selection clipboard -i"
- # Paste from X clipboard into tmux
- bind C-y run -b "exec </dev/null; xclip -o | tmux load-buffer - ; tmux paste-buffer"
- ################################################################################
- # Execute same command in all windows
- # Source: http://stackoverflow.com/questions/9250884/send-command-to-all-window-in-tmux
- bind C-e command-prompt -p "Session:,Command:" "run-shell \"tmux list-windows -t %1 \| cut -d: -f1\|xargs -I\{\} tmux send-keys -t %1:\{\} %2 Enter\""
- ################################################################################
- # Miscellaneous
- # When a smaller terminal connects to a tmux client, it shrinks to fit it. The
- # clients attached with bigger displays see this constrained view.
- # aggressive-resize makes it such that the window is only resized if the smaller
- # client is actively looking at it.
- setw -g aggressive-resize on
- setw -g mode-keys emacs # Use emacs keybindings in copy mode
- setw -g status-keys emacs
- set -s escape-time 0 # Allows for faster key repetition
- set -g default-terminal "xterm-256color" # "xterm"
- set -g history-limit 500000
- ################################################################################
- # end of tmux configuration
- ################################################################################
- # set is equivalent to set-option
- # setw -> set-window-option
- # bind -> bind-key
- # unbind -> unbind-key
- # display -> display-message
- # if -> if-shell
- # Colo'u'r table
- # http://guns.github.io/xterm-color-table.vim/images/xterm-color-table.png
- # CHARACTER PAIR REPLACED WITH
- # #(command) First line of command’s output
- # #[attributes] Colour or attribute change
- # #H Hostname of local host
- # #I Current window index
- # #P Current pane index
- # #S Session name
- # #T Current window title
- # #W Current window name
- # ## A literal ‘#’
- # Variables used in time format
- # Source: http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Commontimeformatvariables
- # %y = year in numbers (2-digit)
- # %Y = year in numbers (4-digit)
- # %m = month in number (eg: 12)
- # %B = full month name (eg: December)
- # %b = short month name (eg: Dec)
- # %d = day in numbers, with leading zeros (eg: 08)
- # %e = day in numbers, no leading zeros (eg: 8)
- # %A = full weekday name (eg: Sunday)
- # %a = short weekday name (eg: Sun)
- # %H = hours in 24-clock, with leading zeros
- # %k = hours in 24-clock, no leading zeros
- # %l = hours in 12-clock, with leading zeros
- # %p = am/pm
- # %T = time in 24-hour notation (%H:%M:%S)
- # PREFIX ? : list-keys, display key bindings
- # How do I know which tmux version I am running?
- # tmux -V
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement