mlsamuelson.com

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.

No comments

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Find Me Around

User login