christoomey / vim-tmux-navigator

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

Cannot switch from nvim to tmux pane #381

Closed sklbz closed 2 months ago

sklbz commented 3 months ago

I have neovim with nvchad config. I added the following lines into ~/.config/nvim/lua/plugins/init.lua

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

The package has been installed but the only command working is <leader>h. The tmux package works just fine.

Here are the informations provided by neofetch about my OS.

OS: Arch Linux on Windows 10 x86_64
Kernel: 5.15.133.1-microsoft-standard-WSL2
Uptime: 10 hours, 43 mins
Packages: 212 (pacman)
Shell: bash 5.2.21
Terminal: Windows Terminal
CPU: Intel i7-9750H (12) @ 2.592GHz
GPU: e35e:00:00.0 Microsoft Corporation Basic Render Driver
Memory: 495MiB / 7865MiB
sklbz commented 2 months ago

Finally solved the problem by adding some config in init.lua. I m currently on my phone so can t show the code but will post later

christoomey commented 2 months ago

@sklbz appreciate the note and would welcome additional detail when/if you get a moment!

sklbz commented 2 months ago

Here are the lines I added to my ~/.config/nvim/init.lua

vim.keymap.set('n', '<c-k>', ':wincmd k<CR>')
vim.keymap.set('n', '<c-j>', ':wincmd j<CR>')
vim.keymap.set('n', '<c-h>', ':wincmd h<CR>')
vim.keymap.set('n', '<c-l>', ':wincmd l<CR>')
ahmedsayedabdelsalam commented 1 month ago

still not working, am using nvchad latest version.