You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd used noremap <expr> to use a count-less pipe character | to toggle cursorline/cursorcolumn, and preserve its normal behavior (jumping to a column) when a count is used:
vim.cmd [[
noremap<expr>\|v:count ? '\|' : '<CMD>lua vim.wo.cursorline, vim.wo.cursorcolumn = not vim.wo.cursorline, not vim.wo.cursorline<CR>'
]]
vim.api.nvim_set_keymap('n',
'<C-d>',
vim.api.nvim_replace_termcodes([[(winheight(0)/3).'<C-d>']], true, false, false),
{noremap=true, expr = true, desc = 'jump-down a third of the window-height'})
I've tried to replicate this with which-key like so:
mappings.register({
['<C-d>'] = { function() vim.api.nvim_replace_termcodes([[(winheight(0)/3).'<C-d>']], true, false, false) end, 'jump-Down by 1/3 of window-height' }
}, {expr=true})
...but it does not work; the window is not scrolled at all.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
using
<expr>
I'd used
noremap <expr>
to use a count-less pipe character|
to togglecursorline
/cursorcolumn
, and preserve its normal behavior (jumping to a column) when a count is used:Is this possible using
which-key
?(Sorta similarly, I used
noremap <expr>
with av:count
ternary to tweak howj
/k
work when text is wrapped...)using
nvim_replace_termcodes
I had remapped normal-mode's
<C-d>
and<C-u>
to tweak how far the window is scrolled1 :I've tried to replicate this with
which-key
like so:...but it does not work; the window is not scrolled at all.
How can I migrate these mappings into
which-key
?(My work-in-progress mappings file can be found in the
nvim/whichkey/setup
branch.)Footnotes
…thanks to mroavi and ZeroKnight! ↩
Beta Was this translation helpful? Give feedback.
All reactions