Open Meyermagic opened 8 years ago
Hey @Meyermagic, based on your statement:
My window navigation bindings work in vim alone, and tmux alone (and behave identically), but vim nested inside tmux does not respond at all. Calling the TmuxNavigate* commands directly works as expected
This leads me to believe that something in the mapping from tmux->vim->tmux is broken. First thing that stands out to me is that it looks like you have duplicate / competing Vim mappings for " Split navigation
section with <C-w><C-J>
and the like, then at the bottom in the " Tmux integration
section.
If you're able to find an issue with the core plugin functionality (including using alt mappings as we intend to support that) then I'm happy to investigate and fix, but otherwise I will likely close this issue as we have limited time to support additional use cases.
My window navigation bindings work in vim alone, and tmux alone (and behave identically), but vim nested inside tmux does not respond at all. Calling the TmuxNavigate* commands directly works as expected
I have exactly the same issue and definitely no competing mappings using tmux 2.3 nvim 0.1.7
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n S-Up if-shell "$is_vim" "send-keys S-Up" "display-panes ; select-pane -U"
bind-key -n S-Down if-shell "$is_vim" "send-keys S-Down" "display-panes ; select-pane -D"
bind-key -n S-Left if-shell "$is_vim" "send-keys S-Left" "display-panes ; select-pane -L"
bind-key -n S-Right if-shell "$is_vim" "send-keys S-Right" "display-panes ; select-pane -R"
let g:tmux_navigator_no_mappings = 1
nnoremap <S-Up> :TmuxNavigateUp<CR>
nnoremap <S-Down> :TmuxNavigateDown<CR>
nnoremap <S-Left> :TmuxNavigateLeft<CR>
nnoremap <S-Right> :TmuxNavigateRight<CR>
It works flawlessly with the default key mappings (that are partially used for other things, so I cannot use them) but when I change it to Shift+<Arrow>
it only works tmux -> (tmux|nvim)
or inside nvim
if it is not running inside tmux
. As soon as the focus is inside nvim the key combinations have no effect anymore at all.
I would be happy to provide any more details.
Best regards Manuel
I found a workaround (based on #59) but I consider this a rather dirty solution:
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n S-Up if-shell "$is_vim" "send-keys C-w 'k'" "display-panes ; select-pane -U"
bind-key -n S-Down if-shell "$is_vim" "send-keys C-w 'j'" "display-panes ; select-pane -D"
bind-key -n S-Left if-shell "$is_vim" "send-keys C-w 'h'" "display-panes ; select-pane -L"
bind-key -n S-Right if-shell "$is_vim" "send-keys C-w 'l'" "display-panes ; select-pane -R"
let g:tmux_navigator_no_mappings = 1
" The following mappings work when nvim is NOT inside tmux
nnoremap <S-Up> :TmuxNavigateUp<CR>
nnoremap <S-Down> :TmuxNavigateDown<CR>
nnoremap <S-Left> :TmuxNavigateLeft<CR>
nnoremap <S-Right> :TmuxNavigateRight<CR>
" These mappings are used when nvim IS inside tmux
nnoremap <C-W>k :TmuxNavigateUp<CR>
nnoremap <C-W>j :TmuxNavigateDown<CR>
nnoremap <C-W>h :TmuxNavigateLeft<CR>
nnoremap <C-W>l :TmuxNavigateRight<CR>
So the tmux
commands send <C-W>(h|j|k|l)
to nvim
where I have a secondary set of key mappings to remap these to TmuxNavigate*
. Also I have to maintain the Shift
-based keymappings in case I am not inside tmux
.
Well, I face the exact same issue using
I doubt this is actually issue with your plugin, but I'd appreciate any help debugging the issue.
My window navigation bindings work in vim alone, and tmux alone (and behave identically), but vim nested inside tmux does not respond at all. Calling the TmuxNavigate* commands directly works as expected.
tmux 2.2 Neovim 0.1.4, packaged via https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/neovim/default.nix
~/.tmux.conf
Note that I've already adjusted the grep pattern to correctly match the process, ".nvim-wrapped".
~/.config/nvim/init.vim