christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.07k stars 319 forks source link

"Not an editor command: ^UTmuxNavigateRight" after changing keys table in lazy.nvim #397

Open istrupin opened 5 days ago

istrupin commented 5 days ago

Hello! I just got turned onto this plugin, and the default configuration seems to work great!

However, I already have my <C-h/j/k/l> keys bound, so I wanted to switch my key bindings on the neovim side to the standard <c-w>h/j/k/l that I've been using.

When I try to set this in lazy.nvim's keys table, I receive the "E492: Not an editor command: ^UTmuxNavigateRight" error whenever I try to navigate (the error changes for right/left/up/down).

My config looks like this:

return {
    "christoomey/vim-tmux-navigator",
    cmd = {
        "TmuxNavigateLeft",
        "TmuxNavigateDown",
        "TmuxNavigateUp",
        "TmuxNavigateRight",
        "TmuxNavigatePrevious",
    },
    keys = {
        { "<c-w>h", "<cmd><C-U>TmuxNavigateLeft<cr>" },
        { "<c-w>j", "<cmd><C-U>TmuxNavigateDown<cr>" },
        { "<c-w>k", "<cmd><C-U>TmuxNavigateUp<cr>" },
        { "<c-w>l", "<cmd><C-U>TmuxNavigateRight<cr>" },
        { "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" }
    },
}
christoomey commented 2 days ago

Hmm, I'm not certain as I'm not yet on neovim / lazy.nvim, but I think the <C-U> might be causing the issue. Can you try without the <C-U> in the keys table?

istrupin commented 2 days ago

Thanks so much for getting back to me so quickly!

That did indeed seem to solve the problem for me! Interesting that the <C-U> didn't mess up the behavior of the original h/j/k/l mappings in the readme at all.

I also tried the original h/j/k/l mappings without the <C-U> and those worked too!

I'm curious -- what's the purpose of the <C-U> in the readme mappings?

Anyway, I really appreciate the help!