-
Notifications
You must be signed in to change notification settings - Fork 42
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
Default keybindings work within tmux panes but not nvim panes using Lazy #92
Comments
Heho, can you please try to set
explicitly? Maybe we have a bug in the settings resolvement. Kind regards |
Are you using Lazy.nvim by any chance? I had the same problem as here (LazyVim/LazyVim#277), and had to override the default settings, by adding to keymaps.lua : -- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
-- Move to window using the <ctrl> hjkl keys
local Util = require("lazyvim.util")
local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the keymap if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
end
map("n", "<C-h>", "<cmd>lua require'tmux'.move_left()<cr>", { desc = "Go to left window" })
map("n", "<C-j>", "<cmd>lua require'tmux'.move_bottom()<cr>", { desc = "Go to lower window" })
map("n", "<C-k>", "<cmd>lua require'tmux'.move_top()<cr>", { desc = "Go to upper window" })
map("n", "<C-l>", "<cmd>lua require'tmux'.move_right()<cr>", { desc = "Go to right window" }) Hopefully that solves your problem! |
#92 (comment) |
can we do anything on this side to enable this by default? |
Had the same problem and was driving me insane! Thank you @LeoAdL!!! |
I guess this is the solution. Im pinning and closing the issue. tyvm for all the investigation! |
Hi!
I recently installed the plugin, however looks like there is no way I can make
<C-hjlk>
work.I'm using the default configuration as mentioned in the readme, navigation within tmux panes works good but never across neovim splits.
Neovim config
tmux config
Curiously enough executing
:lua require('tmux').move_right()
(or any of the other variants) works well. I've tried to set up the keymaps manually with no success. I also tried binding the actions to a different set of bindings:This works as expected, and is what I'm using now as a fallback while trying to solve this since ideally I prefer tmux bindings and nvim bindings to be the same
I tried to deactivate other plugins just in case they might be overwriting the specific default bindings but I had no luck with that either.
Any Idea on how to troubleshoot this one?
Thanks!
The text was updated successfully, but these errors were encountered: