From f0824e5b9ff1f4f8bdab37a6c9d5b98eaaf659aa Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Tue, 23 Jul 2019 07:18:48 -0400 Subject: [PATCH] tmux: customize status bar, GUI bindings (Alt) --- .chezmoiignore | 2 +- dot_config/fish/config.fish.tmpl | 4 +- dot_config/fish/functions/man-vim.fish | 3 + dot_config/fish/functions/refresh-config.fish | 7 + dot_config/i3/config.tmpl | 17 +- dot_config/i3blocks/i3blocks.conf.tmpl | 8 +- dot_tmux.conf.tmpl | 151 +++++++++++++++--- dot_vimrc.tmpl | 3 +- key_aliases.tmpl | 34 +++- key_dirs.tmpl | 3 +- key_files.tmpl | 2 + scripts/executable_vim-man | 2 +- txt/todo.md | 5 +- 13 files changed, 193 insertions(+), 48 deletions(-) create mode 100644 dot_config/fish/functions/man-vim.fish create mode 100644 dot_config/fish/functions/refresh-config.fish diff --git a/.chezmoiignore b/.chezmoiignore index 16adaf3..f2ada34 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -1,6 +1,6 @@ README.md -{{ if .gui }} +{{ if not .gui }} .config/i3/ .config/i3blocks/ .config/mpv/ diff --git a/dot_config/fish/config.fish.tmpl b/dot_config/fish/config.fish.tmpl index fc33b0f..936d429 100755 --- a/dot_config/fish/config.fish.tmpl +++ b/dot_config/fish/config.fish.tmpl @@ -75,7 +75,6 @@ end abbr ab "abbr" abbr abe "abbr -e" -abbr rf "chezmoi apply && sync-shortcuts && source ~/.config/fish/key_abbr.fish > /dev/null" abbr rfc "chezmoi apply && source ~/.config/fish/config.fish" abbr xf "fish_config" abbr f. "cd .." @@ -106,9 +105,10 @@ abbr grmb "git-delete-branch" # ]]] git # abbr hs "scan-history" abbr hst "$EDITOR ~/.local/share/fish/fish_history" -abbr mt "math" +abbr mat "math" abbr pgr "grep-pdf" abbr pgrf "grep-pdf-file" +abbr rf "refresh-config" abbr rs "redshift-set" abbr shrm "shred-rm" abbr thes "thesaurus" diff --git a/dot_config/fish/functions/man-vim.fish b/dot_config/fish/functions/man-vim.fish new file mode 100644 index 0000000..dd56788 --- /dev/null +++ b/dot_config/fish/functions/man-vim.fish @@ -0,0 +1,3 @@ +function man-vim + nvim -c ":Man $argv[1]" -c "only" +end diff --git a/dot_config/fish/functions/refresh-config.fish b/dot_config/fish/functions/refresh-config.fish new file mode 100644 index 0000000..37ed7ec --- /dev/null +++ b/dot_config/fish/functions/refresh-config.fish @@ -0,0 +1,7 @@ +function refresh-config + chezmoi apply + and sync-shortcuts + and source ~/.config/fish/key_abbr.fish > /dev/null + and tmux source-file ~/.tmux.conf + and fish +end diff --git a/dot_config/i3/config.tmpl b/dot_config/i3/config.tmpl index 29e81e2..d90d0fd 100755 --- a/dot_config/i3/config.tmpl +++ b/dot_config/i3/config.tmpl @@ -135,7 +135,7 @@ bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle # focus the parent container -bindsym $mod+a focus parent +# bindsym $mod+a focus parent # focus the child container #bindsym $mod+d focus child @@ -241,18 +241,15 @@ bindsym shift+x kill # backgrounds [[[ # set $make_st_script "/home/kevin/st/make-st.sh" +# test -{{ if eq .chezmoi.fullHostname "x1-carbon" }} bindsym Control+$mod+q exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/bright/editing") && $make_st_script bindsym Control+$mod+w exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/dim/non-editing") && $make_st_script -bindsym Control+$mod+z exec feh --bg-fill ~/Pictures/Backgrounds/dim/black.jpg -{{ else }} -bindsym $mod+q exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/bright/editing") && $make_st_script -bindsym $mod+w exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/dim/non-editing") && $make_st_script -# bindsym $mod+w exec ~/linux-config/scripts/bg-chooser -{{ end }} bindsym $mod+r exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/dim/editing") && $make_st_script bindsym $mod+y exec wal -i $($scripts_path/shuffler "$HOME/Pictures/Backgrounds/bright/non-editing") && $make_st_script +{{ if eq .chezmoi.fullHostname "x1-carbon" }} +bindsym Control+$mod+z exec feh --bg-fill ~/Pictures/Backgrounds/dim/black.jpg +{{ end }} # ]]] backgrounds # @@ -352,8 +349,8 @@ set $ws15 "15" # ws bindings [[[ # -bindsym $mod+h workspace prev -bindsym $mod+l workspace next +# bindsym $mod+h workspace prev +# bindsym $mod+l workspace next bindsym $mod+1 workspace $ws1 bindsym $mod+2 workspace $ws2 diff --git a/dot_config/i3blocks/i3blocks.conf.tmpl b/dot_config/i3blocks/i3blocks.conf.tmpl index 99ef437..c1eb04f 100755 --- a/dot_config/i3blocks/i3blocks.conf.tmpl +++ b/dot_config/i3blocks/i3blocks.conf.tmpl @@ -68,10 +68,10 @@ WIDTH=220 # sys.monitoring [[[ # {{ if eq .chezmoi.fullHostname "nzxt" }} -[wifi] -label= -instance=wlp4s0 -interval=10 +# [wifi] +# label= +# instance=wlp4s0 +# interval=10 [temperature] label= diff --git a/dot_tmux.conf.tmpl b/dot_tmux.conf.tmpl index 1c059b2..1ac6ab8 100644 --- a/dot_tmux.conf.tmpl +++ b/dot_tmux.conf.tmpl @@ -8,24 +8,25 @@ set-option -g prefix C-Space bind-key C-Space send-prefix # Enable mouse mode (tmux 2.1 and above) set -g mouse on -# clear rename prompt -bind-key , command-prompt "rename-window '%%'" -# ]]] # - -# panes[[[ - -bind h split-window -h -bind v split-window -v +set -s escape-time 0 unbind '"' unbind % -# vim-tmux-navigator[[[ - is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -{{ if .gui }} +bind v split-window -v + +# ]]] # + +{{ if .gui }}# [[[ + +bind-key , command-prompt "rename-session '%%'" +bind-key -n M-d detach + +# panes [[[ # + bind-key -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L" bind-key -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D" bind-key -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U" @@ -36,7 +37,35 @@ bind-key -T copy-mode-vi M-j select-pane -D bind-key -T copy-mode-vi M-k select-pane -U bind-key -T copy-mode-vi M-l select-pane -R bind-key -T copy-mode-vi M-\ select-pane -l -{{ else }} + +bind-key -n M-Enter split-window -h +# bind-key -n M-v split-window -h + +bind-key -n M-q kill-pane + +# ]]] panes # + +# windows [[[ # + +bind-key -n M-w new-window +bind x kill-window +bind-key -n M-a command-prompt "rename-window '%%'" +# bind-key , command-prompt "rename-window '%%'" + +bind-key -n M-p previous-window +bind-key -n M-n next-window +bind-key -n C-S-[ swap-window -t -1 +bind-key -n C-S-] swap-window -t +1 + +# ]]] windows # + +bind-key -n M-c copy-mode + +# ]]] +{{ else }}# [[[ + +# panes [[[ # + bind-key -n C-Left if-shell "$is_vim" "send-keys C-Left" "select-pane -L" bind-key -n C-Down if-shell "$is_vim" "send-keys C-Down" "select-pane -D" bind-key -n C-Up if-shell "$is_vim" "send-keys C-Up" "select-pane -U" @@ -47,13 +76,6 @@ bind-key -T copy-mode-vi C-Down select-pane -D bind-key -T copy-mode-vi C-Up select-pane -U bind-key -T copy-mode-vi C-Right select-pane -R bind-key -T copy-mode-vi C-\ select-pane -l -{{ end }} - -# ]]] - -# kill panes without confirmation -bind-key x kill-pane -bind-key & kill-window # switch panes using Alt-arrow without prefix # bind -n C-Down select-pane -D @@ -61,18 +83,105 @@ bind-key & kill-window # bind -n C-Left select-pane -L # bind -n C-l select-pane -R +bind h split-window -h + +bind-key x kill-pane + +# ]]] panes # + +bind-key -n C-Left previous-window +bind-key -n C-Right next-window + +bind-key & kill-window + +{{ end }}# ]]] + +# status bar [[[ # + +# +# Powerline Double Cyan - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 60 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar[[[ +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +# set -g status-left "#[fg=colour233,bg=colour39,bold] #S #[fg=colour39,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" +# set -g status-left "#[fg=colour233,bg=colour39,bold] #S:#P #[fg=colour39,bg=colour233,nobold]" +set -g status-left "#[fg=colour233,bg=colour240] #S #[fg=colour240,bg=colour235] #P #[fg=colour235,bg=colour233]" +# ]]] + +# Right side of status bar[[[ +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +# set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour39,bg=colour240]#[fg=colour233,bg=colour39,bold] #H " +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %a-%d-%m #[fg=colour39,bg=colour240]" # ]]] +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour81,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour39,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour39 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour39 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour39,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour39,fg=colour232 + +# ]]] status bar # + # plugins [[[ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'jimeh/tmux-themepack' -set -g @themepack 'powerline/double/blue' +# set -g @plugin 'jimeh/tmux-themepack' +# set -g @themepack 'powerline/double/blue' set -g @plugin 'christoomey/vim-tmux-navigator' run -b '~/.tmux/plugins/tpm/tpm' # ]]] plugins # + +# vim: fdm=marker ft=tmux.go-template diff --git a/dot_vimrc.tmpl b/dot_vimrc.tmpl index 449310e..8ec856d 100644 --- a/dot_vimrc.tmpl +++ b/dot_vimrc.tmpl @@ -363,7 +363,8 @@ nnoremap l Vgq " format this and next line nnoremap ll Vjgq " move cursor to middle of line -nnoremap m :call cursor(0, len(getline('.'))/2) +" nnoremap m :call cursor(0, len(getline('.'))/2) +nnoremap m :vert Man " apply normal command to selection vnoremap n q:anorm nnoremap nt :NERDTree diff --git a/key_aliases.tmpl b/key_aliases.tmpl index 197b835..d573f3e 100644 --- a/key_aliases.tmpl +++ b/key_aliases.tmpl @@ -30,7 +30,7 @@ mkgb "sudo grub-mkconfig -o /boot/grub/grub.cfg" b "bat" ba "bat *" grep "grep --color=auto -n" -grr "grep -r" +grpr "grep -r" # pk "pkill -f" cld "colordiff -wy --suppress-common-lines" @@ -77,6 +77,7 @@ ll "lsd -al" l "ls -a" ll "ls -al" {{ end }} +cwd "echo (pwd) | xclip -selection clipboard" smv "sudo mv" f "cd" fz "fzf" @@ -183,7 +184,9 @@ xpk "pkg list-installed | awk -F/ '{print \$1}' > ~/{{ .chezmoi.os }}-config/txt # ]]] pkg management # py "python" -pyt "pytest -vv" +# pyt "printf '\033c' && pytest -vvs" +pyt "clear && tmux clear-history && pytest -vvs" +pyts "clear && tmux clear-history && pytest -vv" pyu "python -m unittest" pipi "pip install" spipi "sudo pip install" @@ -224,13 +227,14 @@ kd "killall Discord && killall Discord && killall slack" kt "killall thunderbird" mp "mpv --volume=50" mra "man ranger" +mt "minetest" n "nvim" p3 "python3" pdft "pdftotext" pipes "pipes.sh -t 3" py "python" r "ranger" -rg "printf '\033c' && rg" +rgc "printf '\033c' && rg" rx "redshift -x" sn "sudo nvim" # sw "swex" @@ -289,6 +293,8 @@ wt "watson status" # git [[[ # g "git" +gi "git init" +gib "git init --bare" gstr "git config credential.helper store" gstrp "git config credential.helper store && git push" @@ -300,6 +306,9 @@ gba "git branch --no-merged && echo '' && git branch --merged" gbu "git branch --no-merged" gbm "git branch --merged" +gsm "git submodule add" +gsmp "git submodule foreach git pull" + gmg "git merge" gmgt "git mergetool" @@ -345,11 +354,14 @@ gsl "git shortlog" gcln "git clone" gs "git status -u" gf "git fetch origin" -gcho "git checkout" -gchon "git checkout -b" -gchom "git checkout master" + +gch "git checkout" +gchn "git checkout -b" +gchm "git checkout master" gchnw "git checkout -b wip" gchw "git checkout wip" +gchfh "git checkout HEAD --" + grom "git reset --hard origin/master" gheadm1 "git reset --hard HEAD~1" # show files in git repo @@ -528,6 +540,16 @@ jr "java -cp \"$CLASSPATH:out\"" # 263 wl6 "watson log --all --project=263 --tag=a3" wr6 "watson report --all --project=263 --tag=a3" +z6 "zathura --fork ~/school/263/Introduction-to-Algorithms-CLRs/Introduction\ to\ Algorithms\ -\ 3rd\ Edition.pdf" pd3 "pdflatex a3" # ]]] school # + +# games [[[ # + +mtc "minetestserver --gameid minetest --worldname Creative --terminal" +mth "minetestserver --gameid minetest --worldname Hevin --config hevin.conf --terminal" +mtt "minetestserver --gameid minimal --worldname Test --terminal" +# mtrsy "rsync -vr .minetest/ /mnt/linux-files/.minetest/" + +# ]]] games # diff --git a/key_dirs.tmpl b/key_dirs.tmpl index f04c429..1a4511a 100644 --- a/key_dirs.tmpl +++ b/key_dirs.tmpl @@ -85,4 +85,5 @@ al1 ~/school/algorithms/w1-union-find # ]]] sch # -pk /home/kevin/Downloads/gba/mgba/pokemon/emerald/1 +mtd ~/.minetest +pk ~/Downloads/gba/mgba/pokemon/emerald/1 diff --git a/key_files.tmpl b/key_files.tmpl index 9a9206c..7162fdd 100644 --- a/key_files.tmpl +++ b/key_files.tmpl @@ -63,3 +63,5 @@ wt ~/.config/watson/state.tmp # ]]] 309 # # ]]] sch # + +mta ~/.minetest/mods/custom_aliases/init.lua diff --git a/scripts/executable_vim-man b/scripts/executable_vim-man index 15fb2ac..226e3d0 100644 --- a/scripts/executable_vim-man +++ b/scripts/executable_vim-man @@ -1,4 +1,4 @@ #!/bin/bash man_choice=$(apropos . | awk '{ print $1 }' | dmenu -i) -nvim -c ":Man $man_choice" -c "resize 100" +nvim -c ":Man $man_choice" -c "only" diff --git a/txt/todo.md b/txt/todo.md index d39a1d6..3296a5d 100644 --- a/txt/todo.md +++ b/txt/todo.md @@ -1,3 +1,7 @@ +- tmux keybindings + - rename session/window + - detach + - suckless - dwm - layout @@ -12,4 +16,3 @@ - scripts - copy sync-shortcut - YCM -