How to enter SmartResizeMode with Wezterm leader key #125
-
I'd like to enter local function split_nav(resize_or_move, key)
return {
key = key,
mods = resize_or_move == 'resize' and 'META' or 'CTRL',
action = wezterm.action_callback(function(win, pane)
if is_vim(pane) then
-- pass the keys through to vim/nvim
win:perform_action({
SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' },
}, pane)
else
if resize_or_move == 'resize' then
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
else
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
end
end
end),
}
end
config.keys = {
leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 2000 },
keys = {
-- pane management
{
key = "\\",
mods = 'LEADER',
action = act.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = "-",
mods = 'LEADER',
action = act.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = 'x',
mods = 'LEADER',
action = wezterm.action.CloseCurrentPane { confirm = true },
},
-- smart-splits.nvim
-- move between split panes
split_nav('move', 'h'),
split_nav('move', 'j'),
split_nav('move', 'k'),
split_nav('move', 'l'),
-- resize panes
split_nav('resize', 'h'),
split_nav('resize', 'j'),
split_nav('resize', 'k'),
split_nav('resize', 'l'),
},
}
return config Here are my NeoVim mappings in my local M = {}
M.general = {
n = {
-- moving between splits (smart-splits.nvim)
["<C-h>"] = { "<cmd> SmartCursorMoveLeft <CR>"},
["<C-l>"] = { "<cmd> SmartCursorMoveRight <CR>"},
["<C-j>"] = { "<cmd> SmartCursorMoveDown <CR>"},
["<C-k>"] = { "<cmd> SmartCursorMoveUp <CR>"},
},
}
return M I've configured Moving between Wezterm panes and NeoVim works great with the above configuration. I would just like to figure out how to use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I don't think there is a way to do what you're asking, due to how In order to do what you want, you would need a way to have Wezterm's However there is no way to map I would recommend just choosing another leader mapping, like maybe {
key = 'r',
mods = 'LEADER',
action = wezterm.action_callback(function(win, pane)
if is_vim(pane) then
-- pass the keys through to vim/nvim
-- send '<C-a>'
win:perform_action({
SendKey = { key ='a', mods = 'CTRL' },
}, pane)
-- send 'r'
win:perform_action({
SendKey = { key ='r' },
}, pane)
end
end) And then on the Neovim side just set the mapping on |
Beta Was this translation helpful? Give feedback.
@mrjones2014 thanks for the quick reply. I figured that was the case. I ultimately decided to map it to
<LEADER>r
as you suggested, which works just fine. The only reason I was looking for a persistent resize with just using the<LEADER>
key (CTRL-a
in my case) was because that's how I had it setup withtmux
. However, I've been able to replacetmux
with WezTerm +smart-splits
so I'm ok with adding anr
to my original keybinding. I was able to imitate yourSmartResizeMode
(persistent resize) outside of NeoVim using WezTerm'skey_tables
. So now I get persistent resize in NeoVim as well as non-NeoVim panes. Thanks again for the plugin.Here's my config in case this helps someone in the future: