Przeglądaj źródła

Enhance mouse handling

Kevin Heinicke 8 lat temu
rodzic
commit
f4141dab64
2 zmienionych plików z 15 dodań i 3 usunięć
  1. 1 3
      nvimrc
  2. 14 0
      tmux.conf

+ 1 - 3
nvimrc

@@ -34,6 +34,7 @@ Plug 'tpope/vim-unimpaired'
 Plug 'othree/yajs.vim'
 Plug 'tpope/vim-surround'
 Plug 'christoomey/vim-tmux-navigator'
+Plug 'roxma/vim-tmux-clipboard'
 
 " All of your Plugins must be added before the following line
 call plug#end()  " required
@@ -51,9 +52,6 @@ set wildignore+=*/node_modules/*
 " Make watchdogs possible
 set backupcopy=yes
 
-" see https://github.com/tmux/tmux/issues/543
-set clipboard=unnamed
-
 " jump between split lines
 map j gj
 map k gk

+ 14 - 0
tmux.conf

@@ -3,7 +3,21 @@ set -g @plugin 'tmux-plugins/tpm'
 set -g @plugin 'tmux-plugins/tmux-sensible'
 set -g @plugin 'christoomey/vim-tmux-navigator'
 
+# enable mouse support
 set -g mouse on
+# ... and enable mouse mode toggling
+bind m run "\
+    tmux show-options -g | grep -q \"mouse on\";\
+    if [ \$? -eq 0 ];\
+        then toggle=off;\
+    else\
+        toggle=on;\
+    fi;\
+    tmux display-message \"mouse is now: \$toggle\";\
+    tmux set-option -g mouse \$toggle;"
+
+# required for vim-clipboard integration
+set -g focus-events on
 
 # allow scroll while in input mode
 bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"