Die Fähigkeit, zwischen den Fenstern zu wechseln, ist in Tmux mit vim gebrochen

727
Thermatix

Ok, also laufe ich vim in tmux und vor kurzem (heute tatsächlich) kann ich plötzlich nicht ctrl+hjklmehr zwischen tmux und vim wechseln, stattdessen klingelt es einfach und weigert sich zu wechseln.

Wenn ich den tmux-Bereich mit der Maus auswähle, kann ich wieder zum vim-Bereich ctrl+hjklwechseln, kann aber wieder nicht zurückschalten, es sei denn, ich verwende die Maus (ich weiß, ich weiß).

Das Problem tritt nur in dem Bereich auf, in dem vim geladen ist.

In meinem habe tmux.confich:

# smart pane switching with awareness of vim splits bind -n C-h run "(tmux display-message -p '#' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" bind -n C-j run "(tmux display-message -p '#' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" bind -n C-k run "(tmux display-message -p '#' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" bind -n C-l run "(tmux display-message -p '#' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" bind -n C-\ run "(tmux display-message -p '#' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" 

und ich habe die folgenden Keybindings in meiner vim-config:

so ~/.vim/config/key_codes.vim  " Buffer switching nnoremap <S-l> :bnext<CR> nnoremap <S-h> :bprev<CR>  " \d delete buffer nnoremap <S-x> :Kwbd<CR>   "tagbar toggling map <F8> :TagbarToggle<CR>  map <F7> :NERDTreeToggle<CR>  " Increment numbers nnoremap <A-a> <C-a> nnoremap <A-x> <C-x>  nmap <C-W>! <Plug>Kwbd  nmap <C-p> :CommandT<CR>  map <Leader>c :call vroom#RunTestFile()<CR> map <Leader>s :call vroom#RunNearestTest()<CR> " \t to jump to test file map <leader>t :A<CR> " \t to jump to related file map <leader>r :r<cr> " \E to open file explorer in root map <leader>E :Explore .<cr> " \e to open file explorer in current dir map <leader>e :Explore<cr>  "nerd tree mapings " map <C-n> <plug>NERDTreeFocusToggle<CR>  " shift plus arrow for selection mode " shift+arrow selection map <Del> <Esc>x1i vmap <Del> <Esc>x1v  "multi-cursor mappings" let g:multi_cursor_next_key='<C-n>' let g:multi_cursor_prev_key='<C-p>' let g:multi_cursor_skip_key='<C-x>' let g:multi_cursor_quit_key='<Esc>'  " Removing escape ino jj <esc> cno jj <c-c> vno v <esc>  " Remove highlights with leader + enter nmap <Leader><CR> :nohlsearch<cr>  " Ruby hash syntax conversion nnoremap <F12> :%s/:\([^ ]*\)\(\s*\)=>/\1:/g<return>  " bind K to grep word under cursor vmap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR> 

key_codes.vim:

function Allmap(mapping) execute 'map' a:mapping execute 'map!' a:mapping endfunction   call Allmap(' <ESC>[A <Up>') call Allmap(' <ESC>[B <Down>') call Allmap(' <ESC>[C <Right>') call Allmap(' <ESC>[D <Left>') call Allmap(' <ESC>[F <End>') call Allmap(' <ESC>[H <Home>') call Allmap(' <ESC>[5~ <PageUp>') call Allmap(' <ESC>[6~ <PageDown>') call Allmap(' <ESC>[k4~ <C-Left>') call Allmap(' <ESC>[5D <C-Left>') call Allmap(' <ESC>Od <C-Left>') call Allmap(' <ESC>[k6~ <C-Right>') call Allmap(' <ESC>[5C <C-Right>') call Allmap(' <ESC>Oc <C-Right>') call Allmap(' <ESC>[1;2 <S>') call Allmap(' <ESC>[1;2A <S-Up>') call Allmap(' <ESC>[1;2B <S-Down>') call Allmap(' <ESC>[1;2C <S-Right>') call Allmap(' <ESC>[1;2D <S-Left>') call Allmap(' <ESC>[1;2d <S-d>') call Allmap(' <ESC>[1;2x <S-x>') call Allmap(' <ESC>[1;2s <S-s>') call Allmap(' <ESC>[3~ <Del>') call Allmap(' <ESC>[1;2h <S-h>') call Allmap(' <ESC>[1;2l <S-l>') 

und weil es wichtig sein könnte, meine dotfiles .

BEARBEITEN: Halten Sie die Strg-Taste gedrückt und drücken Sie, um hden Cursor nach links zu bewegen und dasselbe zu tun, aber mit lcases, wenn der Cursor in Nerdtree blinkt. Dann blinkt er sofort zum Haupttextpuffer zurück.

Dasselbe passiert mit jund kaußer, es bewegt den Cursor nach unten und weigert sich, nach oben zu wechseln.

1

1 Antwort auf die Frage

0
Thermatix

Ok, also auf Empfehlung von jemand anderem habe ich ein Plugin namens vim-tmux-navigator installiert :

Bundle "tmux-plugins/vim-tmux" 

Und es hat mein Problem behoben, obwohl ich nicht glücklich bin, dass ich ein Plugin installieren musste, um die Funktionalität wiederherzustellen, die ich hatte, bevor es nicht mehr funktionierte. Zumindest funktionierte es jetzt auf der Brightside. Ich musste meine nicht ändern tmux-conf als was ich schon hatte, war gut genug.