-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vim -> Tmux doesn't work! #387
Comments
A couple of questions just to confirm:
Presuming neither of those resolve it, can you test out the following:
I'm seeing the following output, for context.
|
it's not working with me too. am using nvchad |
-- No longer needed, using tmux navigation integration
-- navigate = {
-- { mode = "n", keymap = "<C-l>", action = "<C-w>l", desc = "pane left" },
-- { mode = "n", keymap = "<C-h>", action = "<C-w>h", desc = "pane right" },
-- { mode = "n", keymap = "<C-j>", action = "<C-w>j", desc = "pane up" },
-- { mode = "n", keymap = "<C-k>", action = "<C-w>k", desc = "pane down" },
-- }, hey @alex-belost I had my keymaps to navigate between neovim panes, I think this made a conflict with vim-tmux-navigator I want to mention the the above mappings didn't cause me any trouble at a certain point, this happened recently I am using:
|
I am also using Nvchad and it doesnt work, the command works fine but the keybinds don't.
|
I'm having some similar struggles. Navigation between Vim panes works fine, as does navigation between non-Vim tmux panes; non-Vim to vim does work but Vim to non-Vim does not. I am still able to navigate out of a Vim pane into a tmux pane using Additionally, I don't get any output from
I'm using
On a NixOS 24.11 system and using home-manager 24.11 to manage my Neovim and tmux configs:
|
@ahmedsayedabdelsalam , @supinie I've been tinkering with nvchad and ran into a similar issue. Doing the following worked: --- for nvchad users, this is in the ~/.config/nvim/lua/mappings.lua file
local unmap = vim.keymap.del
--- This fixes an issue with the vim-tmux-navigator + nvchad in which the base nvchad
--- mapping were conflicting with vim-tmux-navigator ones.
unmap("n", "<c-h>")
unmap("n", "<c-j>")
unmap("n", "<c-k>")
unmap("n", "<c-l>")
map("n", "<c-h>", "<cmd>:TmuxNavigateLeft<cr>")
map("n", "<c-j>", "<cmd>:TmuxNavigateDown<cr>")
map("n", "<c-k>", "<cmd>:TmuxNavigateUp<cr>")
map("n", "<c-l>", "<cmd>:TmuxNavigateRight<cr>")
map("n", "<c-\\>", "<cmd>:TmuxNavigatePrevious<cr>") So, for me, it simply appears it was a conflicting mapping issue. N.B. My tmux-navigator plugin is set as |
@TheCoconutChef, I just tried your method, unfortunately I don't think the root cause is the same as I get an error trying to unmap a mapping that does not exist. I did try re-doing the maps without the unmapping and with |
This worked for me. Thanks a lot! |
The reason it was breaking for me was that Ctrl + {h,j,k,l} is already mapped in lazyvim. I have no idea if this is a good idea or not (EDIT I figured out a better way to do this below so check that out before you do this one), but this is what I ended up getting to work in LazyVim. {
"christoomey/vim-tmux-navigator",
keys = {
{
"<c-h>",
function ()
vim.keymap.del("n", "<c-h>");
return "<cmd><C-U>TmuxNavigateLeft<cr>"
end,
desc="Tmux Navigate Left"
},
{
"<c-j>",
function ()
vim.keymap.del("n", "<c-j>");
return "<cmd><C-U>TmuxNavigateDown<cr>"
end,
desc="Tmux Navigate Down"
},
{
"<c-k>",
function ()
vim.keymap.del("n", "<c-k>");
return "<cmd><C-U>TmuxNavigateUp<cr>"
end,
desc="Tmux Navigate Up"
},
{
"<c-l>",
function ()
vim.keymap.del("n", "<c-l>");
return "<cmd><C-U>TmuxNavigateRight<cr>"
end,
desc="Tmux Navigate Right"
},
},
}, |
Ooops that last one was a little odd. I think I just need to provide the remap option to neovim instead of deleting the keymap which is much cleaner and probably the normal way people would do it in lazyvim: {
"christoomey/vim-tmux-navigator",
remap = true,
keys = {
{
"<c-h>",
"<cmd><C-U>TmuxNavigateLeft<cr>",
desc="Tmux Navigate Left"
},
{
"<c-j>",
"<cmd><C-U>TmuxNavigateDown<cr>",
desc="Tmux Navigate Down"
},
{
"<c-k>",
"<cmd><C-U>TmuxNavigateUp<cr>",
desc="Tmux Navigate Up"
},
{
"<c-l>",
"<cmd><C-U>TmuxNavigateRight<cr>",
desc="Tmux Navigate Right"
},
},
}, Final Edit actually it appears remap isn't even an available option so I don't know why it wasn't working before, but this is my minimal config. Maybe I had an uninstalled dependency. {
"christoomey/vim-tmux-navigator",
keys = {
{
"<c-h>",
"<cmd><C-U>TmuxNavigateLeft<cr>",
desc="Tmux Navigate Left"
},
{
"<c-j>",
"<cmd><C-U>TmuxNavigateDown<cr>",
desc="Tmux Navigate Down"
},
{
"<c-k>",
"<cmd><C-U>TmuxNavigateUp<cr>",
desc="Tmux Navigate Up"
},
{
"<c-l>",
"<cmd><C-U>TmuxNavigateRight<cr>",
desc="Tmux Navigate Right"
},
},
}, |
I had this configuration on a Mac book iterm2 and it works, but on windows using wsl2, ran into the same error.
|
Output from
:TmuxNavigatorProcessList
Nvim build:
LazyVim
Tmux config:
Output from
ps
:command:
tty
:/dev/ttys005
command:
tmux display '#{pane_tty}'
->/dev/ttys004
The text was updated successfully, but these errors were encountered: