aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-12-08 21:41:21 +0300
committereug-vs <eug-vs@keemail.me>2020-12-08 21:41:21 +0300
commit51c5742d5b8e1d86debd3bdb9370facc6a0c7db1 (patch)
treeab79125d20fc3ff86c5f94872b21af6d60ed9425
parent2923cc086a8ffde74cfadbeb866b9839ff458875 (diff)
downloaddotfiles-51c5742d5b8e1d86debd3bdb9370facc6a0c7db1.tar.gz
feat: add tmux configutation
-rw-r--r--.config/nvim/vim-plug/plugins.vim2
-rw-r--r--.tmux.conf34
2 files changed, 36 insertions, 0 deletions
diff --git a/.config/nvim/vim-plug/plugins.vim b/.config/nvim/vim-plug/plugins.vim
index 0663b4f..9c8b641 100644
--- a/.config/nvim/vim-plug/plugins.vim
+++ b/.config/nvim/vim-plug/plugins.vim
@@ -5,4 +5,6 @@ call plug#begin('~/.config/nvim/autoload/plugged')
Plug 'shougo/defx.nvim',
Plug 'kristijanhusak/defx-icons'
Plug 't9md/vim-choosewin'
+ " Tmux navigator
+ Plug 'christoomey/vim-tmux-navigator'
call plug#end()
diff --git a/.tmux.conf b/.tmux.conf
new file mode 100644
index 0000000..87427cb
--- /dev/null
+++ b/.tmux.conf
@@ -0,0 +1,34 @@
+set -g default-terminal "screen-256color"
+
+# Use C-a as prefix
+unbind C-b
+set-option -g prefix C-a
+bind-key C-a send-prefix
+
+# Smart pane switching with awareness of Vim splits.
+# See: https://github.com/christoomey/vim-tmux-navigator
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
+ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
+bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
+bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
+bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
+bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
+tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
+if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
+if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
+
+bind-key -T copy-mode-vi 'C-h' select-pane -L
+bind-key -T copy-mode-vi 'C-j' select-pane -D
+bind-key -T copy-mode-vi 'C-k' select-pane -U
+bind-key -T copy-mode-vi 'C-l' select-pane -R
+bind-key -T copy-mode-vi 'C-\' select-pane -l
+
+# Split panes using | and -
+bind | split-window -h
+bind - split-window -v
+unbind '"'
+
+# Copy
+bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'nbind %