hydra.nvim
hydra.nvim copied to clipboard
cursor jumps out of window on window movements, windowing wiki page
Consider
local Hydra = require('hydra')
M.window_hdyra = Hydra({
body = '<C-w>',
heads = {
{ 'h', '<C-w>h' },
{ 'j', '<C-w>j' },
{ 'k', '<C-w>k' },
{ 'l', '<C-w>l' },
{ '<Esc>', nil, { exit = true, desc = false } },
},
})
And having 2 windows positioned side by side.
From the left one starting, pressing C-w l (activates hydra), l
moves the cursor to the commandline window,
Also, I dont understand why the example in the wiki uses { 'k', pcmd('wincmd k', 'E11', 'close') },.
Personally I would favor having a simpler example to get people started with hydra: only 1. movements hjkl, 2. basic resizing (<,>,+,-,=), 3. splits (s,v), 4. simple swap C-w shift, 5. closing and only window (c, o), 6. exiting
Personally I think buffers are more efficiently managed in combination with harpoon + :b and autocompleter (I use nvim-comp).
Combining both seems like overkill to me, at least for starters.
I would suggest for the wiki to offer a simpler mapping without external plugins as more minimalistic example:
-- keep windowing simple and fast
M.window_hdyra = Hydra({
body = '<C-w>',
heads = {
{ 'h', '<C-w>h' },
{ 'j', '<C-w>j' },
{ 'k', '<C-w>k' },
{ 'l', '<C-w>l' },
{ 's', '<C-w>s' },
{ 'v', '<C-w>v' },
{ '+', '<C-w>+' },
{ '-', '<C-w>-' },
-- neovim is slower on moving lines (<- and -> movements of window)
{ '>', '<C-w>>' },
{ '<', '<C-w><' },
{ '=', '<C-w>=' },
{ 'q', '<cmd>close<CR>' },
{ 'o', '<cmd>only<CR>' },
--{ '<S>', '<C-w><S>' }, -- TODO figure out how to remap this
--{ '_', '<C-w>_' },
--{ '|', '<C-w>|' }, -- requires prefixed numbers => other hydra heaad
{ '<Esc>', nil, { exit = true, desc = false } },
},
})
One possible side effect of this is that if key frequency is too fast, then keeping > pressed will deactivate of the hydra and do indentation instead.
The underlying bug is fixed and pressing < and > continuously works.
It still looks like the cursor jumps out, but I guess that is for drawing?! Anyway, the use case is solved.