1

I have the linediff.vim plugin installed. Its main command :Linediff only works for visual mode, to which I'd like to add a keymap for this command.

I'm using Neovim's Lua API, so I tried this:

vim.keymap.set('x', '<leader>ld', "<Cmd>'<,'>Linediff<CR>")

But when I try to use it, I get the error E20: Mark not set.

I also experimented with using nvim_create_user_command() to try and achieve this, but didn't really get anywhere as I ran into various errors due to not fully grokking its API.

1 Answer 1

2

In Vim I think you would do

xnoremap <leader>ld :LineDiff<enter>

taking advantage of : inserting marks. The problem with <Cmd> is it doesn’t switch modes… so probably : is the right thing to do here.

1
  • That worked. Thanks a lot!
    – Jethro Cao
    Oct 7, 2023 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.