Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------- Common Settings {{{
- #------------------------------------------------------
- # how to use tmux demo video: http://www.youtube.com/watch?v=ZNM1KfqpyGo
- # https://gist.github.com/1147532
- # http://crunchbanglinux.org/forums/post/236199/
- # https://gist.github.com/adinapoli/4723872
- # change prefix key to Ctrl-a; like GNU Screen
- unbind-key C-b
- set-option -g prefix C-a
- # goto last used window
- bind-key C-a last-window
- # Nested Tmux Session
- # send to tmux session within another tmux session; like screen
- bind-key a send-prefix
- # Lowers the delay time between the prefix key and other keys - fixes pausing in vim
- set-option -sg escape-time 0
- # reload .tmux.conf
- # killall tmux ; sometimes reloading config wont do shit
- bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
- # history size
- set-option -g history-limit 10000
- # enable shell hotkeys C-left/C-right
- # http://sigizmund.com/tmux-and-c-leftc-right/
- # set-window-option -g xterm-keys on
- # enable 256 color terminal
- # http://blog.sanctum.geek.nz/256-colour-terminals/
- set-option -g default-terminal "screen-256color"
- # start panes at 1 instead of 0
- set-window-option -g pane-base-index 1
- # pane divider color; non active pane
- set-option -g pane-border-fg green
- set-option -g pane-border-bg black
- # pane divider color; active pane
- # helps when you have more than two panes.
- # version 1.8 makes it easy to see 2 panes now
- set-option -g pane-active-border-fg white
- set-option -g pane-active-border-bg yellow
- # renumber windows sequentially after closing any of them
- # https://github.com/thoughtbot/dotfiles/blob/master/tmux.conf
- set-option -g renumber-windows on
- # renumber windows manually
- # https://github.com/jasoncodes/dotfiles/blob/master/config/tmux.conf
- bind-key R set renumber-windows on\; new-window\; kill-window\; set renumber-windows off\; display 'Renumbered'
- # set auto rename of windows base on command
- #set-window-option -g automatic-rename on
- # note: ohmyzsh users commet out DISABLE_AUTO_TITLE=true from zshrc to disable autorename
- # http://superuser.com/questions/306028/tmux-and-zsh-custom-prompt-bug-with-window-name
- #}}}
- #-------- Keybinding (Vim Style) {{{
- #------------------------------------------------------
- # vim keys in command prompt
- set-option -g status-keys vi
- # unicode
- set-window-option -g utf8 on
- # select panes
- bind-key k select-pane -U
- bind-key h select-pane -L
- bind-key j select-pane -D
- bind-key l select-pane -R
- # cycle windows/panes (no prefix)
- bind-key -n M-k select-pane -t :.- # prev pane
- bind-key -n M-j select-pane -t :.+ # next pane
- bind-key -n M-h select-window -t :- # previous window
- bind-key -n M-l select-window -t :+ # next window
- # resize panes
- bind-key -r J resize-pane -D 1
- bind-key -r K resize-pane -U 1
- bind-key -r H resize-pane -L 1
- bind-key -r L resize-pane -R 1
- # better pane split bindings
- bind-key \ split-window -h # vertical split
- bind-key - split-window -v # horizontal split
- # no confirmation when killing window/pane; by default is set to ask
- # http://unix.stackexchange.com/a/30283
- bind-key & kill-window
- bind-key x kill-pane
- # Sync panes - send what you're typing to other panes.
- bind-key C-s set-window-option synchronize-panes
- #}}}
- #-------- Copy Mode (Vim Style) {{{
- #------------------------------------------------------
- # This section of hotkeys mainly work in copy mode and no where else
- # vim keys in copy or choice mode
- set-window-option -g mode-keys vi
- # copying selection vim style
- # http://jasonwryan.com/blog/2011/06/07/copy-and-paste-in-tmux/
- # https://github.com/myfreeweb/dotfiles/blob/master/tmux.conf
- bind-key Escape copy-mode # enter copy mode; default [
- bind-key p paste-buffer # paste; default ]
- bind-key -t vi-copy v begin-selection # begin visual mode
- bind-key -t vi-copy V select-line # visual line
- bind-key -t vi-copy y copy-selection # yank
- bind-key -t vi-copy r rectangle-toggle # visual block toggle
- bind-key -t vi-copy Escape cancel # exit copy mode; or hit q
- # clear scrollback buffer
- # demo video: http://www.youtube.com/watch?v=xUB-quCdun0
- # http://stackoverflow.com/a/10553992
- # hit ctrl+l then ctrl+k
- bind-key -n C-k clear-history
- #}}}
- #-------- Mouse {{{
- #------------------------------------------------------
- # mouse to highlight and copy; to paste use prefix + ]
- # http://awhan.wordpress.com/2012/04/18/tmux-copy-paste-with-mouse/
- # use shift + mouse to bypass to use system highlighting mode
- # http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
- # Toggle mouse on
- bind-key m \
- set-option -g mode-mouse on \;\
- set-option -g mouse-resize-pane on \;\
- set-option -g mouse-select-pane on \;\
- set-option -g mouse-select-window on \;\
- display-message 'Mouse: ON'
- # Toggle mouse off
- bind-key M \
- set-option -g mode-mouse off \;\
- set-option -g mouse-resize-pane off \;\
- set-option -g mouse-select-pane off \;\
- set-option -g mouse-select-window off \;\
- display-message 'Mouse: OFF'
- # mouse wheel scrolling -- whole window not individual panes
- #set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
- # }}}
- #-------- Window / Pane Settings {{{
- #------------------------------------------------------
- # start window index on 1 instead of 0
- set-option -g base-index 1
- # start panes at 1 instead of 0
- set-window-option -g pane-base-index 1
- # pane divider color; non active pane
- set-option -g pane-border-fg green
- set-option -g pane-border-bg black
- # pane divider color; active pane
- # helps when you have more than two panes.
- # version 1.8 makes it easy to see 2 panes now
- set-option -g pane-active-border-fg white
- set-option -g pane-active-border-bg yellow
- # renumber windows sequentially after closing any of them
- # https://github.com/thoughtbot/dotfiles/blob/master/tmux.conf
- set-option -g renumber-windows on
- # renumber windows manually
- # https://github.com/jasoncodes/dotfiles/blob/master/config/tmux.conf
- bind-key R set renumber-windows on\; new-window\; kill-window\; set renumber-windows off\; display 'Renumbered'
- # set auto rename of windows base on command
- #set-window-option -g automatic-rename on
- # note: ohmyzsh users commet out DISABLE_AUTO_TITLE=true from zshrc to disable autorename
- # http://superuser.com/questions/306028/tmux-and-zsh-custom-prompt-bug-with-window-name
- #}}}
- #-------- Statusbar {{{
- #------------------------------------------------------
- # UTF-8 character support in the status bar
- set-option -g status-utf8 on
- # refresh the status bar every 1 second.
- set-option -g status-interval 1000
- # Time messages remain in the status bar. Lower this number
- # if this is too distracting.
- set-option -g display-time 4000
- # command/message line colors
- set-option -g message-fg white
- set-option -g message-bg black
- set-option -g message-attr bright
- # CENTER {{{
- # window notifications; display activity on other window
- set-window-option -g monitor-activity on
- set-option -g visual-activity on
- # statusbar colors
- set-option -g status-fg white
- set-option -g status-bg black
- set-option -g status-attr default
- # window title colors; non active
- set-window-option -g window-status-fg cyan
- set-window-option -g window-status-bg default
- set-window-option -g window-status-attr dim
- # window title colors; active
- set-window-option -g window-status-current-fg white #font
- set-window-option -g window-status-current-bg red #boarder
- set-window-option -g window-status-current-attr bright
- #}}}
- # LEFT SIDE {{{
- # in the status bar.
- set-option -g status-justify centre
- set-option -g status-left-length 40
- set-option -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
- #}}}
- # RIGHT SIDE {{{
- # use "man date" to set the clock to your liking
- set-option -g status-right "#[fg=blue]#(~/battery Discharging) | #[fg=cyan]%a %D %l:%M:%p"
- #}}}
- #}}}
- #-------- External Scripts {{{
- #------------------------------------------------------
- # default shell
- set-option -g default-command /bin/zsh
- set-option -g default-shell /bin/zsh
- # Run command on idle; screensaver
- # demo video: http://www.youtube.com/watch?v=s0T82aJn1DQ
- #set-option -g lock-after-time 10
- #set-option -g lock-command "/usr/bin/cmatrix -C blue"
- #}}}
- #-------- Layout {{{
- #------------------------------------------------------
- # demo video: http://www.youtube.com/watch?v=sxw-n5Du600
- # http://amjith.blogspot.com/2011/08/scripting-tmux-layouts.html
- # http://unix.stackexchange.com/a/17118
- # -v = split horizontal
- # -h = split veritical
- # work
- bind-key M-w new-window -n work -c $HOME \; \
- send-keys 'sudo su' 'Enter' \; \
- split-window -h -p 50 -t 1 \; \
- select-pane -t 1
- # chat
- bind-key M-c new-window -n chat -c $HOME \; \
- send-keys 'irc' 'Enter' \; \
- select-pane -t 1
- # torrent
- bind-key M-t new-window -n torrent -c $HOME \; \
- send-keys 'clear && figlet Torrentz EU && ~/Scripts/torrentzeu.sh' 'Enter' \; \
- split-window -v -p 50 -t 1 \; \
- send-keys 'clear && tpbs ' \; \
- split-window -h -p 60 -t 1 \; \
- send-keys 'cd /media/data/.blackbox/ && ranger' 'Enter' \; \
- split-window -h -p 60 -t 2 \; \
- send-keys '~/Scripts/blocklist.sh && transmission-daemon && sleep 3 && transmission-remote-cli' 'Enter' \; \
- select-pane -t 2
- # music
- bind-key M-m new-window -n music -c $HOME \; \
- send-keys 'ncmpcpp' 'Enter' \; \
- split-window -v -p 50 -t 1 \; \
- send-keys 'clear && cd ~/Music && spotify-cli' 'Enter' \; \
- split-window -h -p 50 -t 2 \; \
- send-keys 'clear && pandora-cli' 'Enter' \; \
- select-pane -t 1
- # fap
- bind-key M-f new-window -n fap -c $HOME \; \
- send-keys 'ranger ~/Storage/.blackbox' 'Enter' \; \
- split-window -v -p 50 -t 1 \; \
- send-keys 'clear && figlet Search Skeet CMX' 'Enter' \; \
- split-window -h -p 50 -t 1 \; \
- send-keys 'reddit_top -s pornvids' 'Enter' \; \
- split-window -h -p 50 -t 2 \; \
- send-keys 'clear && figlet Discover' 'Enter' \; \
- select-pane -t 2
- # stats
- bind-key M-s new-window -n stats -c $HOME \; \
- send-keys 'htop' 'Enter' \; \
- split-window -v -p 50 -t 1 \; \
- send-keys 'clear && figlet Freespace' 'Enter' \; \
- split-window -h -p 50 -t 1 \; \
- send-keys 't lsp | less' 'Enter' \; \
- split-window -h -p 50 -t 2 \; \
- send-keys 'df' 'Enter' \; \
- select-pane -t 2
- # news
- bind-key M-n new-window -n news -c $HOME \; \
- send-keys 'cortex linux' 'Enter' \; \
- split-window -h -p 50 -t 1 \; \
- send-keys 'newsbeuter' 'Enter' \; \
- split-window -v -p 50 -t 2 \; \
- send-keys 'pods' 'Enter' \; \
- split-window -h -p 50 -t 3 \; \
- send-keys 'cd Podcasts && ranger' 'Enter' \; \
- select-pane -t 1
- # video
- bind-key M-v new-window -n video -c $HOME \; \
- send-keys 'ranger ~/Videos' 'Enter' \; \
- split-window -v -p 50 -t 1 \; \
- send-keys 'clear && figlet youtube-viewer' 'Enter' \; \
- split-window -h -p 50 -t 1 \; \
- send-keys 'clear && figlet rtmpdump' 'Enter' \; \
- split-window -h -p 50 -t 2 \; \
- send-keys 'clear && figlet Freespace' 'Enter' \; \
- select-pane -t 2
- #}}}
- #-------- Zooming {{{
- #------------------------------------------------------
- # v1.8 comes with zooming already (prefix + z)
- # demo video: http://www.youtube.com/watch?v=6HesFWUpU18
- # this is for older version of tmux
- # Zoom Script (by jipumarino)
- # demo video: http://www.youtube.com/watch?v=gZ0NoRROxvo
- # https://github.com/jipumarino/tmux-zoom
- # if you use a different starting number in your window/pane
- # then change the number 0 to match it
- # $old_zoom_window.0 and $new_zoom_window.0
- bind-key -r Z run-shell "~/.scripts/tmux-zoom.sh"
- # Zoom Toggle Key ( modified by Gnomeye )
- # demo video: http://www.youtube.com/watch?v=6_PVJQvhBeI
- # https://github.com/gotbletu/shownotes/blob/master/tmux_maximize_pane.txt
- # if you use a different starting number in your window/pane
- # then change the number 0 to match it
- # bind-key } run-shell "if [[ $(tmux list-window) =~ tmux-zoom ]]; then tmux last-window; tmux swap-pane -s tmux-zoom.0; tmux kill-window -t tmux-zoom; else tmux new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read'; tmux swap-pane -s tmux-zoom.0; tmux select-window -t tmux-zoom;fi"
- # http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/
- # }}}
- #-------- Link Grabber {{{
- #------------------------------------------------------
- # This section is for grabbing links on the current pane/window without the mouse
- # and launching it with GUI or CLI browser
- # urlview; extract links and launch it
- # demo video: http://www.youtube.com/watch?v=guB4WuVFhtY
- # https://wiki.archlinux.org/index.php/Tmux#Browsing_URL.27s
- bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; \
- new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
- # http://does-not-exist.org/mail-archives/mutt-users/msg18479.html
- # to set default browser add to ~/.urlview
- # COMMAND exec >> /tmp/urlview.out 2>&1; set -x; $BROWSER
- # urlscan context view and url view
- # demo video: http://www.youtube.com/watch?v=c-3IdFufY5Q
- # compact view; show links only
- bind-key y capture-pane \; save-buffer /tmp/tmux-buffer \; \
- new-window -n "urlscan" '$SHELL -c "urlscan -c < /tmp/tmux-buffer"'
- # context view; show dialog near links
- bind-key Y capture-pane \; save-buffer /tmp/tmux-buffer \; \
- new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-buffer"'
- # w3m context view
- # demo video: http://www.youtube.com/watch?v=C7YPjbrTeCs
- # http://www.mail-archive.com/mutt-users@mutt.org/msg09657.html
- bind-key g capture-pane \; save-buffer /tmp/tmux-buffer \; \
- new-window -n "w3m" '$SHELL -c "w3m < /tmp/tmux-buffer"'
- # hit : to activate links
- # hit Esc then Shift+M to open GUI browser
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement