Vim
Vim copied to clipboard
Selecting your pasted text (`gp`)
Hey,
Like in http://vim.wikia.com/wiki/Selecting_your_pasted_text I'm looking for a way to select the text I've just pasted visually in order to indent/format/sed it.
Any help would be appreciated.
I'd also like to have this. Requires https://github.com/VSCodeVim/Vim/issues/2004 to be implemented. Please upvote that issue to show your support for that feature.
Until gp is natively supported I'm using the following (line-wide) emulation (includes a final k since the '] marker seems to wrap to the next line):
{
"vim.normalModeKeyBindingsNonRecursive": [
{ "before": [ "g", "p" ], "after": [ "V", "'", "]", "k" ] },
]
}
gp pastes with slightly different behavior than p... Isn't the issue that gv works incorrectly?
If you're referring to my workaround mapping @J-Fields then yes it could be. '] seems be the major culprit since it appears to point to the line after the last when pasting multi-line text.
The simplest repro I could find is:
- Create a new file with
1 0 2 0 - Select both lines using Shift+v (visual line mode)
- Press y p
- Buffer should become
1 0 1 0 2 0 2 0 - Press ' ]
- Editor should move cursor to line 3, column 3 (the third
0), but instead it moves to line 4, column 1 (the last2)