Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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