christoomey/vim-tmux-navigator

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

Opened this issue · 4 comments

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>" }
    },
}

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?

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!

I had the same issue. After deleting the it started working well. I am also curious about the purpose of prepending . I appreciate the nice plugin!

Mine is for lazy.nvim + colemak users

  {
    "christoomey/vim-tmux-navigator",
    cmd = {
      "TmuxNavigateLeft",
      "TmuxNavigateDown",
      "TmuxNavigateUp",
      "TmuxNavigateRight",
      "TmuxNavigatePrevious",
    },
    keys = {
      { "<c-h>", "<cmd>TmuxNavigateLeft<cr>" },
      { "<c-n>", "<cmd>TmuxNavigateDown<cr>" },
      { "<c-e>", "<cmd>TmuxNavigateUp<cr>" },
      { "<c-i>", "<cmd>TmuxNavigateRight<cr>" },
      { "<c-\\>", "<cmd>TmuxNavigatePrevious<cr>" },
    },
  },

I have the same issue in NVChad, had to drop the following into my mappings.lua file

-- Disable the existing key mappings for tmux navigation
nomap('n', '') -- Unbind for window left
nomap('n', '') -- Unbind for window down
nomap('n', '') -- Unbind for window up
nomap('n', '') -- Unbind for window right

map("n", "", "TmuxNavigateDown")
map("n", "", "TmuxNavigateUp")
map("n", "", "TmuxNavigateRight")
map("n", "<c-\>", "TmuxNavigatePrevious")