From 818d05050a4c3795975df92efce5c208239edb28 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Sat, 20 Jul 2019 04:00:27 -0400 Subject: [PATCH] vim-tmux-navigator working on nzxt --- dot_tmux.conf => dot_tmux.conf.tmpl | 37 +++++++++++++++++++---------- dot_vimrc.tmpl | 26 ++++++++------------ key_files.tmpl | 3 ++- 3 files changed, 36 insertions(+), 30 deletions(-) rename dot_tmux.conf => dot_tmux.conf.tmpl (69%) diff --git a/dot_tmux.conf b/dot_tmux.conf.tmpl similarity index 69% rename from dot_tmux.conf rename to dot_tmux.conf.tmpl index b9e47f9..1c059b2 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf.tmpl @@ -1,4 +1,4 @@ -# basic {{{ +# basic [[[ # reload config file (change file location to your the tmux.conf you want to use) bind r source-file ~/.tmux.conf @@ -11,18 +11,32 @@ set -g mouse on # clear rename prompt bind-key , command-prompt "rename-window '%%'" -# }}} # +# ]]] # -# panes{{{ +# panes[[[ bind h split-window -h bind v split-window -v unbind '"' unbind % -# vim-tmux-navigator{{{ +# 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-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" +bind-key -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R" +bind-key -n M-\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l" +bind-key -T copy-mode-vi M-h select-pane -L +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 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" @@ -33,12 +47,9 @@ 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 -# bind-key -T copy-mode-vi M-h select-pane -L -# 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 -# }}} +{{ end }} + +# ]]] # kill panes without confirmation bind-key x kill-pane @@ -50,9 +61,9 @@ bind-key & kill-window # bind -n C-Left select-pane -L # bind -n C-l select-pane -R -# }}} +# ]]] -# plugins {{{ +# plugins [[[ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' @@ -64,4 +75,4 @@ set -g @plugin 'christoomey/vim-tmux-navigator' run -b '~/.tmux/plugins/tpm/tpm' -# }}} plugins # +# ]]] plugins # diff --git a/dot_vimrc.tmpl b/dot_vimrc.tmpl index a5ca305..449310e 100644 --- a/dot_vimrc.tmpl +++ b/dot_vimrc.tmpl @@ -271,27 +271,21 @@ Plug 'scrooloose/nerdtree' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'christoomey/vim-tmux-navigator' + " mappings [[[ " + let g:tmux_navigator_no_mappings = 1 + {{ if eq .linux_os "arch" }} + nnoremap :TmuxNavigateDown + nnoremap :TmuxNavigateUp + nnoremap :TmuxNavigateLeft + nnoremap :TmuxNavigateRight + {{ end }} " nnoremap :TmuxNavigateDown " nnoremap :TmuxNavigateUp " nnoremap :TmuxNavigateLeft " nnoremap :TmuxNavigateRight - " nnoremap j :TmuxNavigateDown - " nnoremap k :TmuxNavigateUp - " nnoremap h :TmuxNavigateLeft - " nnoremap l :TmuxNavigateRight - " nnoremap :TmuxNavigateDown - " nnoremap :TmuxNavigateUp - " nnoremap :TmuxNavigateLeft - " nnoremap :TmuxNavigateRight - " nnoremap :TmuxNavigateDown - " nnoremap :TmuxNavigateUp - " nnoremap :TmuxNavigateLeft - " nnoremap :TmuxNavigateRight - " nnoremap :TmuxNavigateDown - " nnoremap :TmuxNavigateUp - " nnoremap :TmuxNavigateLeft - " nnoremap :TmuxNavigateRight + + " ]]] mappings " " ]]] vim-plug " " Mappings [[[ " diff --git a/key_files.tmpl b/key_files.tmpl index 46b7730..9a9206c 100644 --- a/key_files.tmpl +++ b/key_files.tmpl @@ -13,6 +13,7 @@ r ~/linux-config/dot_config/ranger/rc.conf.tmpl sr ~/linux-config/configs/ranger/shortcuts.conf ss ~/.shortcuts st ~/st/config.def.h +t ~/linux-config/dot_tmux.conf.tmpl u ~/linux-config/dot_Xresources.tmpl v ~/linux-config/dot_vimrc.tmpl x ~/linux-config/dot_config/fish/config.fish.tmpl @@ -38,7 +39,7 @@ mc ~/coding/mf-site/assets/sass/main.scss mi ~/coding/mf-site/ideas.md ne ~/linux-config/configs/neofetch/config.conf re README.md -t todo.md +td todo.md tt txt/todo.md tm ~/.vim/plugged/vim-snippets/UltiSnips/texmath.snippets tp /tmp/