Skip to content
Discussion options

You must be logged in to vote

The following pattern is supported in 0.79.0 and later:

vim.keymap.set('n', 'j', function()
    if vim.v.count == 0 then
        return 'gj'
    else
        return vim.v.count1 .. 'j'
    end
end, { expr = true, silent = true })

vim.keymap.set('n', 'k', function()
    if vim.v.count == 0 then
        return 'gk'
    else
        return vim.v.count1 .. 'k'
    end
end, { expr = true, silent = true })

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LexiAgneboGudmunds
Comment options

Answer selected by saberzero1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants