How to paste over without overwriting register

Use the following: xnoremap p pgvy this will reselect and re-yank any text that is pasted in visual mode. Edit: in order this to work with “xp you can do: xnoremap p pgv”@=v:register.’y'<cr> v:register expands to the last register name used in a normal mode command.

How do I use vim registers?

Registers in Vim let you run actions or commands on text stored within them. To access a register, you type “a before a command, where a is the name of a register. If you want to copy the current line into register k, you can type “kyy Or you can append to a register by … Read more

Make Vim show ALL white spaces as a character

As others have said, you could use :set list which will, in combination with :set listchars=… display invisible characters. Now, there isn’t an explicit option which you can use to show whitespace, but in listchars, you could set a character to show for everything BUT whitespace. For example, mine looks like this :set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< so, … Read more

Can I map Alt key in Vim?

To Mac users out there: for mapping ALT+hjkl, use instead the real character generated (find out which character using the combination while in INSERT mode), for example with my keyboard I get: <ALT+j> ==> ª <ALT+k> ==> º and so on. Solution found here on StackOverflow. I used this to move lines up and down … Read more

How to copy to clipboard in Vim?

The * register will do this. In Windows, + and * are equivalent. In unix there is a subtle difference between + and *: Under Windows, the * and + registers are equivalent. For X11 systems, though, they differ. For X11 systems, * is the selection, and + is the cut buffer (like clipboard). http://vim.wikia.com/wiki/Accessing_the_system_clipboard … Read more