Rocking the Vim terminal in a GUI cut and paste world

When I first started using Vim as my full time editor, one thing that tripped me up was copying and pasting to and from Vim where I run it in the terminal. Line numbers wanted to come with my copys, and indentation on code went wacky with my pastes into Vim. A couple quick, temporary settings changes, though, and Vim handles everything just fine.

When pasting to Vim in the terminal, if line indentation gets out of hand, progressively indenting each line. Fix it by turning paste on:

:set paste

Revert back from paste mode (which I've noticed causes some keybindings to stop working) with:
:set nopaste

If you use line numbers, turn them off when copying multiple lines:

:set nonu

Turn your line numbers back on with:
:set nu

Hope this helps someone soldiering their way up the Vim learning curve. (It's worth it.)

If anyone else has tips on this subject, share 'em in the comments.

Find Me Around

User login