aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/%HOME%/.tmux.conf
blob: d6a397307e118f98294ce83516b30a1491c7d15e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11



                                                                               






                                                                                                  



                                                                               


                                      
                       
 





                                                                             


                                 






















                                                                           
                                                                             
 



                                         
                                                                               
              
                                                                               
 

                                  

                                        
 
























                                                                            



                        
 


                                                                               












                                                     




                                                                         
                                                                             
                                                        

                                                                            
 


                                                                               
 
                                 
 



                                                                  
 
                                                                   
# -----------------------------------------------------------------------------
# Sources
# -----------------------------------------------------------------------------

# [1]: https://wiki.archlinux.org/index.php/tmux
# [2]: https://gist.github.com/Lartza/6a7a62466a8a3e436234412d9b1c5066
# [3]: http://mutelight.org/practical-tmux
# [4]: https://github.com/tmux-plugins/tmux-sensible
# [5]: https://github.com/tmux-plugins/tmux-yank
# [6]: https://github.com/greymd/dotfiles/blob/333c46dab103d4316a83744dec28605dc2cbc4ab/.tmux.conf

# -----------------------------------------------------------------------------
# General settings
# -----------------------------------------------------------------------------

# C-b is hella uncomfortable to press.
unbind C-b
set -g prefix C-j
bind -n M-j send-prefix

# The default seems to be "screen" on my machine, and if I ssh to a remote
# system, all the 256 colors might not be supported. Check using this script:
# https://superuser.com/a/285400. I'm eager to see what kinds of trouble it
# will bring me.
set -g default-terminal "screen-256color"

# Why launch a login shell?
set -g default-command "${SHELL}"

# Numbering starts at 1 instead of 0.
set -g base-index 1
set-window-option -g pane-base-index 1

# I'm not sure about this. Still, it's recommended by tmux-sensible, etc.
set -s escape-time 0

# Enable mouse support. You can now scroll inside panes. It automatically
# enters copy mode though, which you can exit by pressing q. Right click to
# bring up the emulator's context window won't work though, hold Shift for
# that.
set -g mouse on

# Default is only 2000 lines?!
set -g history-limit 50000

# Show tmux messages for a longer time (0.75 seconds is the default).
set -g display-time 4000

# Refresh the status line more often (every 15 second is the default).
set -g status-interval 5

# The following settings I don't totally understand/need, but they looked
# sensible enough, and they were recommended by at least some of the sources.

set -g focus-events on

set-window-option -g aggressive-resize on

# -----------------------------------------------------------------------------
# Key bindings
# -----------------------------------------------------------------------------

# X to kill the current session.
bind X confirm-before kill-session
# A to kill all but the current session.
bind A confirm-before 'kill-session -a'

# R to reload this file.
bind R source-file ~/.tmux.conf \; display "Reloaded!"

# According to tmux-sensible, it's more natural to use default readline-like
# key bindings in the command prompt; I sorta agree.
set -g status-keys emacs

# Start new windows/panes in the current directory.
bind c new-window -c "#{pane_current_path}"
# The defaults for pane splitting are the dumbest bindings I've ever seen.
bind - split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"

# Switch between panes quicker.
bind -n M-1 select-pane -t 1
bind -n M-2 select-pane -t 2
bind -n M-3 select-pane -t 3
bind -n M-4 select-pane -t 4
bind -n M-5 select-pane -t 5
bind -n M-6 select-pane -t 6
bind -n M-7 select-pane -t 7
bind -n M-8 select-pane -t 8
bind -n M-9 select-pane -t 9
bind -n M-0 select-pane -t 0

bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R

# -----------------------------------------------------------------------------
# Key bindings: copy mode
# -----------------------------------------------------------------------------

# I looked up useful bindings here[2] and there[5].

# Don't care if $EDITOR is not set up, I'm a vim guy.
set -g mode-keys vi

# This I'm unsure about.
bind Escape copy-mode
# This I'm sure about.
bind-key -T copy-mode-vi v send -X begin-selection

# Using the system clipboard.

# y to copy to the system clipboard.
# Y to immediately insert in the current pane.
# M-y is y and Y combined.
# ! to copy excluding line endings (most useful for one-line selections).

if-shell 'uname | grep -q -F CYGWIN' 'source-file ~/.config/tmux/cygwin.conf'
if-shell 'uname | grep -q -F Linux && command -v xsel' \
                                     'source-file ~/.config/tmux/linux.conf'
if-shell 'uname | grep -q -F Darwin' 'source-file ~/.config/tmux/macos.conf'

# -----------------------------------------------------------------------------
# User interface
# -----------------------------------------------------------------------------

set -g status-right "%d %b %H:%M"

# Might not work so well depending on your color scheme.

set -g status-style fg=white,bg=blue
set-window-option -g window-status-current-style fg=black,bg=white

set-window-option -g pane-active-border-style bg=colour7,fg=colour9