0

How do we have neovim to drag up current selected multi lines as

vim.api.nvim_set_keymap('x', 'I', ":m '<-2<CR>", { noremap = true, silent = true })

or:

vim.api.nvim_set_keymap('x', 'I', ":move '<-2<CR>", { noremap = true, silent = true })

failed?

1
  • I can't reproduce your problem your problem. How do you select the line (using the keyboard or the mouse)? Could you share more information about the version of Neovim you are using and the Operating System you are running (Windows, Linux, macOS)? Commented Jun 3 at 7:08

1 Answer 1

0

I would do:

vim.api.nvim_set_keymap('v', 'I', ":move '<-2<CR>", { noremap = true, silent = true })

The x flag make the mapping only working in Visual mode.

If you select the text using the mouse you switch Neovim to Select mode in such case it is better to use the v flag that make the mapping active on both the Visual mode the Select mode.

1
  • 2
    I wonder if this is something Neovim did differently; the mouse in Vim uses Visual mode.
    – D. Ben Knoble
    Commented Jun 3 at 14:44

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.