New answers tagged


Using lua api (nvim) we can do: line, col = unpack(vim.api.nvim_win_get_cursor(0)) vim.cmd [[ normal 4X]] vim.cmd [[ normal u]] vim.api.nvim_win_set_cursor({0}, {line , col}) The first line saves line and column, the second line erases 4 chars, the third one gets back one action and the last one restores the line and cursor positions. Your question helped ...


Here’s one way: first press yy to copy line after press dd to delete line and finally press p to paste That is, press yyddp.


The secret weapon is v. Specifically, you can convert a command that by default operates in a linewise manner to characterwise operation by typing v after the command and before the motion, e.g. compare dk to dvk. With that in hand we just need to identify the (normally linewise) command that, used in conjunction with v, gets the desired effect. A good ...

Top 50 recent answers are included