Search code examples
viminsertspacepasteyank

Pasting text in vim. A tedious operation?


I've been using vim for somewhat longer than a year now and during this time I have never feel really comfortable with the way vim works with yanking and pasting text (or maybe it is just me not using it in the most efficient way)

For example, I have the word "World" yanked onto a register, and I want to paste it after "Hello". (Note that there are no spaces on either of the words). So, what I would do is

Hello
    |

Place cursor here, and press "p". Then, what I will end up with is

HelloWorld

So, in order to avoid this, I have always to swith into insert mode, insert a espace, and go back into normal mode (or either make sure that the yanked word has a space before it). Be as it may, this is quite annoying behaviour I can't think of a solution for... Am I missing something here?

Suggestions will be appreciated. Thanks


Solution

  • option zero

    just live with what you have now.

    option one

    create a mapping for your workflow. for example

    nnoremap <leader>p i<space><esc>p
    

    option two

    :set ve=all
    

    then you could move your cursor to anywhere and paste

    option three

    you could in insert mode use <c-o> do normal mode stuff or <c-r> to get register values

    I recommend option zero