dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 70c835ca88c41d53fc7d86fa0af9f90b878f8442
parent 0e6cd26877d9729e4adec81847ea41fa0d9ad946
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Sun, 26 Nov 2017 19:41:13 -0500

use Meta as tmux 'prefix'

Diffstat:
Mlinks/.tmux.conf | 45++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/links/.tmux.conf b/links/.tmux.conf @@ -4,6 +4,7 @@ set-option -g prefix C-a # Set prefix to <C-a> bind-key a send-prefix # Send <C-a> with <C-a>a bind R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded" +bind-key -n M-R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded" set -g history-limit 10000 # lines to keep in hisoty set-option -g display-panes-time 3000 # Timeout for pane-numbering in ms @@ -53,6 +54,7 @@ set -g status-right-length 40 #### NAVIGATION +# With C-a prefix bind -r h select-pane -L # navigate left with <C-a>h bind -r j select-pane -D # navigate down with <C-a>j bind -r k select-pane -U # navigate up with <C-a>k @@ -62,6 +64,28 @@ bind -r J resize-pane -D 5 # resize pane down with <C-a>J bind -r K resize-pane -U 5 # resize pane up with <C-a>K bind -r L resize-pane -R 5 # resize pane right with <C-a>L +# Navigate panes with Meta (alt) modifier + hjkl +bind -r -n M-h select-pane -L # navigate left with <C-a>h +bind -r -n M-j select-pane -D # navigate down with <C-a>j +bind -r -n M-k select-pane -U # navigate up with <C-a>k +bind -r -n M-l select-pane -R # navigate right with <C-a>l +bind -r -n M-H resize-pane -L 5 # resize pane left with <C-a>H +bind -r -n M-J resize-pane -D 5 # resize pane down with <C-a>J +bind -r -n M-K resize-pane -U 5 # resize pane up with <C-a>K +bind -r -n M-L resize-pane -R 5 # resize pane right with <C-a>L + +# Navigate windows with Meta (alt) modifier + number keys +bind -n M-1 select-window -t :=1 +bind -n M-2 select-window -t :=2 +bind -n M-3 select-window -t :=3 +bind -n M-4 select-window -t :=4 +bind -n M-5 select-window -t :=5 +bind -n M-6 select-window -t :=6 +bind -n M-7 select-window -t :=7 +bind -n M-8 select-window -t :=8 +bind -n M-9 select-window -t :=9 +bind -n M-0 select-window -t :=10 + # Smart pane switching with awareness of vim splits bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-h) || tmux select-pane -L" bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-j) || tmux select-pane -D" @@ -72,6 +96,9 @@ bind-key C-s last-window # go to last window with <C-a><C-s> bind-key C-a last-pane # go to last pane with <C-a><C-a> bind-key -r n next-window # next window with <C-a>n +bind-key -n -r M-n next-window # next window with <M-n> +bind-key -n -r M-b previous-window # previous window with <M-n> + #### LAYOUT CHANGING BINDINGS @@ -79,19 +106,31 @@ bind-key -r n next-window # next window with <C-a>n bind-key '"' split-window -c "#{pane_current_path}" bind-key '%' split-window -h -c "#{pane_current_path}" +bind-key -n M-'"' split-window -c "#{pane_current_path}" +bind-key -n M-'%' split-window -h -c "#{pane_current_path}" + bind -r z resize-pane -Z # toggle pane zoom with <C-a>z bind -r y next-layout # cycle to next pane layout with <C-a>y bind -r Y previous-layout # cycle to previous pane layout with <C-a>Y bind -r r rotate-window # rotate panes with <C-a>r +bind-key -n M-z resize-pane -Z # toggle pane zoom with <M-z> +bind-key -n -r M-y next-layout # cycle to next pane layout with <M-y> +bind-key -n -r M-Y previous-layout # cycle to previous pane layout with <M-Y> +bind-key -n -r M-r rotate-window # rotate panes with <M-r> + bind -r Left swap-window -t -1 # Swap window left bind -r Right swap-window -t +1 # Swap window right +bind-key -n -r M-B swap-window -t -1 # Swap window left +bind-key -n -r M-N swap-window -t +1 # Swap window right + #### CLIPBOARD # enable reattach-to-user-namespace which fixes pasteboard access and launchctl if-shell 'uname | grep -qi Darwin' 'set-option -g default-command "reattach-to-user-namespace -l zsh"' -bind Space copy-mode # enter copy mode with <C-a><Space> +bind Space copy-mode # enter copy mode with <C-a><Space> +bind-key -n M-Space copy-mode # enter copy mode with <M-Space> bind -T copy-mode-vi v send-keys -X begin-selection # start "visual" with v # Copy (yank) with y @@ -117,6 +156,7 @@ bind-key O split-window -p 25 '$SHELL -c "offlineimap"' \; select-pane -l # Use nested bindings (<C-a>l) for grouping process launch bindings bind l switchc -Tlaunch +bind-key -n M-l switchc -Tlaunch bind -Tlaunch m new-window -n mutt "mutt" bind -Tlaunch v new-window -n vim "vim" bind -Tlaunch r new-window -n rss "feednix" @@ -129,9 +169,12 @@ bind -Tlaunch h split-window -l 8 "htop" #bind-key Enter new-window bind-key Enter new-window \ "tmux set status-right-length `echo $(tput cols)/2|bc|tr -d '\n'`; $SHELL" +bind-key -n M-Enter new-window \ + "tmux set status-right-length `echo $(tput cols)/2|bc|tr -d '\n'`; $SHELL" # Use nested bindings (<C-a>m) for grouping music-control bindings bind m switchc -Tmpd +bind-key -n M-m switchc -Tmpd bind -Tmpd v new-window -n vimpc "vimpc" bind -Tmpd p display "#(mpc toggle | tr '\n' ' ')" bind -Tmpd s display "#(mpc stop | tr '\n' ' ')"