Is there a way to select (or paste) text without trailing/ending whitespace?

eg. To copy the whole line I press y, to paste it somewhere else I use p, but it pastes the whole text with the trailing EOL character too.

The same case using Windows standard:
home, shift+end, ctrl+c, ctrl+v
(allows me to paste the selected text inline)

I'd like to have similar behavior in vim.
I'd like to avoid any macros, as I'm using PHPStorm plugin emulating vim, so not all sophistocated command are working there.


Instead of yanking the entire line (with the trailing newline) with yy, use 0y$ instead.

If you want no surrounding whitespace at all, _yg_ would be possible in Vim.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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