dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

tmux.conf (10771B)


      1 #############################################################################
      2 #               _                                          __               #
      3 #              | |_ _ __ ___  _   ___  __  ___ ___  _ __  / _|              #
      4 #              | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_               #
      5 #              | |_| | | | | | |_| |>  < | (_| (_) | | | |  _|              #
      6 #             (_)__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_|                #
      7 #                                                                           #
      8 #############################################################################
      9 
     10 #############################################################################
     11 #                               base settings                               #
     12 #############################################################################
     13 
     14 # set default terminal and shell
     15 set -g  default-terminal        "st-256color"
     16 set -g  default-shell           /bin/ksh
     17 
     18 # enable mouse mode
     19 set -g  mouse                   on
     20 
     21 # 1-based index
     22 set -g  base-index              1
     23 set -g  pane-base-index         1
     24 
     25 # use vi keys where possible
     26 setw -g mode-keys               vi
     27 set -g  status-keys             vi
     28 
     29 # misc. settings
     30 set -s  escape-time             0
     31 set -g  renumber-windows        on
     32 
     33 # set window titles
     34 set -g  set-titles              on
     35 set -g  set-titles-string       "[#S] #W: #T"
     36 
     37 #############################################################################
     38 #                               functionality                               #
     39 #############################################################################
     40 
     41 # bind prefix to M-` instead
     42 unbind  -T root         C-b
     43 set -g  prefix          M-`
     44 
     45 # copy mode extensions
     46 bind    -T copy-mode-vi v       send -X begin-selection
     47 bind    -T copy-mode-vi C-v     send -X rectangle-toggle \;                 \
     48                                 send -X begin-selection
     49 bind    -T copy-mode-vi y       send -X copy-pipe-and-cancel                \
     50                                 'xclip -i -sel p -f | xclip -i -sel c'
     51 bind    -T copy-mode-vi Enter   send -X copy-pipe-and-cancel                \
     52                                 'xclip -i -sel p -f | xclip -i -sel c'
     53 bind    -T copy-mode-vi MouseDragEnd1Pane                                   \
     54                                 send -X copy-pipe-and-cancel                \
     55                                 'xclip -i -sel p -f | xclip -i -sel c'
     56 bind    -T copy-mode-vi Escape  send -X cancel
     57 bind    -T prefix       v       run "xclip -o -sel p | tmux loadb -" \; pasteb
     58 bind    -T prefix       V       run "xclip -o -sel c | tmux loadb -" \; pasteb
     59 bind    -n MouseDown3Pane       run "xclip -o -sel p | tmux loadb -" \; pasteb
     60 bind    -n C-MouseDown3Pane     run "xclip -o -sel c | tmux loadb -" \; pasteb
     61 
     62 # split panes using | and - instead
     63 unbind  -T prefix       '"'
     64 unbind  -T prefix       %
     65 bind    -T prefix       \       split-window -h -c "#{pane_current_path}"
     66 bind    -T prefix       -       split-window -v -c "#{pane_current_path}"
     67 
     68 # quick reload config using 'r'
     69 bind    -T prefix       r       source-file ~/.config/tmux/tmux.conf \;     \
     70                                 display "config reloaded"
     71 
     72 # switch panes using hjkl (dwm like)
     73 bind    -T root         M-j     select-pane -t :.+
     74 bind    -T root         M-k     select-pane -t :.-
     75 bind    -T root         M-J     swap-pane -s :. -t :.+ \; select-pane -t :.+
     76 bind    -T root         M-K     swap-pane -s :. -t :.- \; select-pane -t :.-
     77 
     78 # misc. key bindings
     79 unbind  -T prefix       c
     80 bind    -T root         M-z     resize-pane -Z
     81 bind    -T prefix       w       new-window -c "#{pane_current_path}"
     82 bind    -T prefix       u       run -b "fzf-url.tmux"
     83 bind    -T prefix       m       run -b "fzf-move-to.tmux"
     84 bind    -T prefix       C       send-keys "C-c" \;                          \
     85                                 send-keys "clear && tmux clear-history" \;  \
     86                                 send-keys "Enter"
     87 bind    -T prefix       /       copy-mode \; send-key ?
     88 bind    -T prefix       H       run "fzf-history.tmux"
     89 
     90 
     91 # mouse scrolling
     92 unbind  -T root         WheelUpPane
     93 unbind  -T copy-mode    WheelUpPane
     94 unbind  -T copy-mode    WheelDownPane
     95 unbind  -T copy-mode-vi WheelUpPane
     96 unbind  -T copy-mode-vi WheelDownPane
     97 unbind  -T prefix       '`'
     98 bind    -T prefix       '`'     copy-mode
     99 bind    -T root         C-WheelUpPane                                       \
    100                                 if-shell -F -t = "#{mouse_any_flag}"        \
    101                                 "send-keys -M"                              \
    102                                 "if -Ft= \"#{pane_in_mode}\"                \
    103                                 \"send-keys -M\" \"copy-mode -et=\""
    104 bind    -T copy-mode-vi WheelUpPane                                         \
    105                                 select-pane \; send-keys -X -N 1 scroll-up
    106 bind    -T copy-mode-vi WheelDownPane                                       \
    107                                 select-pane \; send-keys -X -N 1 scroll-down
    108 bind    -T copy-mode-vi C-WheelUpPane                                       \
    109                                 select-pane \; send-keys -X -N 5 scroll-up
    110 bind    -T copy-mode-vi C-WheelDownPane                                     \
    111                                 select-pane \; send-keys -X -N 5 scroll-down
    112 bind    -T copy-mode-vi K       select-pane \; send-keys -X -N 5 scroll-up
    113 bind    -T copy-mode-vi J       select-pane \; send-keys -X -N 5 scroll-down
    114 
    115 # double and tripple click, to select word and line
    116 bind    -T copy-mode-vi DoubleClick1Pane                                    \
    117                                 select-pane \;                              \
    118                                 send -X select-word \;                      \
    119                                 send -X copy-pipe                           \
    120                                 "xclip -i -sel p -f | xclip -i -sel c"
    121 bind    -T root         DoubleClick1Pane                                    \
    122                                 select-pane \;                              \
    123                                 copy-mode -M \;                             \
    124                                 send -X select-word \;                      \
    125                                 send -X copy-pipe                           \
    126                                 "xclip -i -sel p -f | xclip -i -sel c"
    127 bind    -T copy-mode-vi TripleClick1Pane                                    \
    128                                 select-pane \;                              \
    129                                 send -X select-line \;                      \
    130                                 send -X copy-pipe                           \
    131                                 "xclip -i -sel p -f | xclip -i -sel c"
    132 bind    -T root         TripleClick1Pane                                    \
    133                                 select-pane \;                              \
    134                                 copy-mode -M \;                             \
    135                                 send -X select-line \;                      \
    136                                 send -X copy-pipe                           \
    137                                 "xclip -i -sel p -f | xclip -i -sel c"
    138 
    139 # nrowgrid implementation for tmux
    140 bind    -T root         M-Enter split-window -b -t :.1                      \
    141                                 -c "#{pane_current_path}" \;                \
    142                                 run "nrowgrid.tmux" \;                      \
    143                                 select-pane -t :.1
    144 bind    -T root         M-=     run "nrowgrid.tmux ++"
    145 bind    -T root         M--     run "nrowgrid.tmux --"
    146 set-hook -g after-kill-pane     'run "nrowgrid.tmux"'
    147 set-hook -g pane-exited         'run "nrowgrid.tmux"'
    148 
    149 #############################################################################
    150 #                               look and feel                               #
    151 #############################################################################
    152 
    153 # quiet
    154 set -g  visual-activity         off
    155 set -g  visual-bell             off
    156 set -g  visual-silence          off
    157 setw -g monitor-activity        off
    158 set -g  bell-action             none
    159 
    160 # modes
    161 setw -g clock-mode-colour       'colour6'
    162 setw -g mode-style              'fg=colour0,bg=colour6'
    163 
    164 # panes
    165 set -g  pane-border-style       'bg=colour0,fg=colour5'
    166 set -g pane-active-border-style 'bg=colour0,fg=colour11'
    167 
    168 # statusbar
    169 set -g  status-interval         5
    170 set -g  status-position         top
    171 set -g  status-justify          left
    172 set -g  status-right-length     80
    173 set -g  status-style            'bg=colour0,fg=colour15'
    174 set -g  status-right-style      'bg=colour0,fg=colour15'
    175 set -g  status-right            '#(/bin/hostname) #[                        \
    176                                 fg=colour5,bg=colour0]#[                   \
    177                                 fg=colour6,bg=colour5                       \
    178                                 ] #(status.tmux battery) #[                \
    179                                 ] #(status.tmux temp) #[                   \
    180                                 ] #(status.tmux cpu) #[                    \
    181                                 ] #(status.tmux mem) #[                    \
    182                                 ] #(status.tmux pkg) #[                    \
    183                                 fg=colour5,bg=colour6,reverse]#[           \
    184                                 fg=colour0,bg=colour6,noreverse             \
    185                                 ] %Y-%m-%d  %R #[                          \
    186                                 ]#{?client_prefix,#[                        \
    187                                 ]#[fg=colour1]#[reverse                    \
    188                                 bg=colour0]#[fg=colour1] PREFIX #[          \
    189                                 ],#[                                        \
    190                                 bg=colour6,fg=colour0]#[                   \
    191                                 bg=colour0,fg=colour1] NORMAL }'
    192 set -g  status-left             ''
    193 
    194 # window tabs
    195 setw -g window-status-format    '#[                                         \
    196                                 fg=colour5,bg=colour2] #I #[                \
    197                                 fg=colour2,bg=colour5] #W '
    198 setw -g window-status-current-format                                        \
    199                                 '#[                                         \
    200                                 fg=colour5,bg=colour6] #I #[                \
    201                                 fg=colour6,bg=colour5] #W '
    202 
    203 # messages
    204 set -g  message-style           'bg=colour5,fg=colour6'
    205 setw -g message-command-style   'fg=colour0,bg=colour6'