christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get <c-j>, <c-h>, <c-l>, <c-k> to work with lazy.nvim on neovim, other keys work fine

sdondley opened this issue · comments

I've been using this plugin for a few years now so I'm familiar with it. I'm trying to get it working on a new machine running neovim with lazy.nvim. <c-j,h,l,k> keys all work fine between tmux panes outside of vim. However, I can't get them to respond between vim splits.

I have this dropped directly into the last part of my init.vim file:

vim.cmd([[
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_disable_when_zoomed = 0
noremap <silent> <c-h> :up<cr>:TmuxNavigateLeft<cr>
noremap <silent> <c-j> :<C-U>TmuxNavigateDown<cr>
noremap <silent> <leader>y :<C-U>TmuxNavigateUp<cr>
noremap <silent> <c-l> :up<cr>:TmuxNavigateRight<cr>
]])

The <leader>y mapping works perfectly fine. But <c-j> does not. I disabled all other plugins but it still did not help.

Any ideas?

I believe you're running into the same issue as #349 and #343. Mind giving those a scan and seeing if the suggestions in there sort you out?

Thanks. I clearly don't know what I'm doing with lazy.nvim. I can't figure out how to use the keymaps.lua file:

image

It doesn't seem to work with vim.cmd or the suggestion at LazyVim/LazyVim#277 (comment)

What baffles me is :verb map <c-j> reports: <C-J> * :<C-U>TmuxNavigateDown<CR>

@christoomey OMFG, problem was apk add procps package not in my dockerfile: https://github.com/christoomey/vim-tmux-navigator#switching-between-host-panes-doesnt-work-when-docker-is-running

Funny thing is I'm the one who made that pull request to the docs for this very problem several months ago.

But I didn't possibly think this could be the issue since it was working fine with <leader>y.

Happens to the best of us. At least you did the noble thing back when and documented for future travelers (now including you) to find 🙂

I disabled the keymap etc in ~/.local/share/nvim/lazy/LazyVim/lua/lazyvim/config/keymaps.lua, then define your own for vim-tmux-navigator