tmux: better dwm emulation

This commit is contained in:
dogeystamp 2023-07-31 13:46:24 -04:00
parent 0d42fc2946
commit 6166d0e554
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 45 additions and 7 deletions

View File

@ -1,6 +1,6 @@
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# unbind C-b
# set-option -g prefix C-a
# bind-key C-a send-prefix
set -g default-shell "/bin/fish"
@ -30,7 +30,9 @@ set -g command-alias[108] layouttile='run-shell "dwm.tmux layouttile"'
set -g command-alias[109] float='run-shell "dwm.tmux float"'
set -g command-alias[110] incmfact='run-shell "dwm.tmux incmfact"'
set -g command-alias[111] decmfact='run-shell "dwm.tmux decmfact"'
set -g command-alias[112] window0='run-shell "dwm.tmux window 0"'
# count from 1 like real dwm
set -g base-index 1
set -g command-alias[113] window1='run-shell "dwm.tmux window 1"'
set -g command-alias[114] window2='run-shell "dwm.tmux window 2"'
set -g command-alias[115] window3='run-shell "dwm.tmux window 3"'
@ -40,15 +42,49 @@ set -g command-alias[118] window6='run-shell "dwm.tmux window 6"'
set -g command-alias[119] window7='run-shell "dwm.tmux window 7"'
set -g command-alias[120] window8='run-shell "dwm.tmux window 8"'
set -g command-alias[121] window9='run-shell "dwm.tmux window 9"'
set -g command-alias[112] window10='run-shell "dwm.tmux window 10"'
set-hook -g pane-exited 'run-shell "dwm.tmux layouttile"'
# these keybinds are odd because vim already has ctrl-hjkl for buffers
# and i'm already running dwm outside
bind e newpane
bind w newpanecurdir
bind c killpane
bind c new-window
bind j nextpane
bind k prevpane
bind -n C-b zoom
bind -n C-a zoom
bind h decmfact
bind l incmfact
bind 1 window1
bind 2 window2
bind 3 window3
bind 4 window4
bind 5 window5
bind 6 window6
bind 7 window7
bind 8 window8
bind 9 window9
bind 0 window10
# sane dwm emulation when not already in dwm
bind -n M-1 window1
bind -n M-2 window2
bind -n M-3 window3
bind -n M-4 window4
bind -n M-5 window5
bind -n M-6 window6
bind -n M-7 window7
bind -n M-8 window8
bind -n M-9 window9
bind -n M-0 window10
bind -n M-j nextpane
bind -n M-k prevpane
bind -n M-Enter zoom
# dwm binds unfortunately don't transmit over terminal (i think)
bind -n M-n newpane
bind -n C-M-n newpanecurdir
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi V send -X select-line
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

View File

@ -77,7 +77,9 @@ decmfact() {
window() {
window=$1
tmux selectw -t $window
if ! tmux selectw -t $window; then
tmux neww -t $window
fi
}
if [ $# -lt 1 ]; then