Closed rwijtvliet closed 3 months ago
Can probably do something like this https://github.com/tjdevries/stackmap.nvim
@rwijtvliet could you test #193 and see if it works for you?
I think the issue is solved! When exiting resize mode, the keys are correct again.
There is one thing that I'm not sure about, but that's probably due to an error in my config. And that is, that the resize_keys
are ignored. When I enter resize mode, I have to use hjkl
, not hnts
, even though I have resize_keys={'h', 'n', 't', 's'}
. Do you spot an error here?
(...)
require('smart-splits').setup {
opts = {
ignored_filetypes = { 'nofile', 'quickfix', 'qf', 'prompt' },
ignored_buftypes = { 'nofile' },
resize_mode = {
quit_key = '<Esc>', -- key to exit persistent resize mode
resize_keys = { 'h', 'n', 't', 's' }, -- !!!!
silent = false,
hooks = {
on_enter = function()
vim.notify 'Entering window resize mode, press <esc> to exit.'
end,
on_leave = function()
vim.notify 'Resize finished.'
require('bufresize').register()
end,
},
at_edge = 'stop',
},
},
}
-- Wanted mappings for navigation (dvorak keyboard)
vim.keymap.set('', 'h', 'h', { desc = 'Move left' }) -- for completeness
vim.keymap.set('', 'n', "v:count == 0 ? 'gj' : 'j'", { expr = true, desc = 'move down' })
vim.keymap.set('', 't', "v:count == 0 ? 'gk' : 'k'", { expr = true, desc = 'move up' })
vim.keymap.set('', 's', 'l', { desc = 'move right' })
vim.keymap.set('', 'H', 'H', { desc = 'Move cursor to top of screen' }) -- for completeness
vim.keymap.set('', 'S', 'L', { desc = 'Move cursor to bottom of screen' })
vim.keymap.set('n', 'T', 'K', { remap = true, desc = 'Help' })
vim.keymap.set('n', 'j', 's', {desc = 'substitute character'})
vim.keymap.set('', 'k', 't', {desc = 'Till (fwrd)'})
vim.keymap.set('n', '<A-b>', function() require('smart-splits').start_resize_mode() end, { desc = 'Resize' })
(...)
I'd like to fix this error before I give the final feedback
It looks like you copy/pasted from lazy.nvim or something, as your entire plugin config is nested under opts = {}
. That would be why your config is not respected.
Yep, that was it. Works now, many thanks!
Hi, I use nvchad which has a default mapping of the Esc key to ":noh
@beatmax should be fixed in latest commit on master
. Issue was basically checking <ESC>
vs. <Esc>
vs. <esc>
.
Thanks @mrjones2014 . It's better now, but there's still an issue which can be reproduced like this:
Thanks.
Could you open another issue with a minimal reproducible init.lua
for that? I don't use nvchad and don't have the time to support every bespoke setup.
Sure, no problem. I expected it can be reproduced without nvchad. I'll try to confirm it and open a new ticket. Thanks! Edit: Created #216.
Similar Issues
Neovim Version
0.9.5
Multiplexer Integration
I don't use one
Multiplexer Version
No response
Steps to Reproduce
Expected Behavior
Mapping is preserved
Actual Behavior
Mapping is reset to vim standard
Minimal Configuration to Reproduce
Additional Details and/or Screenshots
See the code above, which includes a workaround in the
on_leave
function.