Unleash your inner root

3

Vim: Eating paste is bad for you

As a long time vim user in the programming world there is one situation which always makes me cringe: That moment where there is something from the internet that you need to paste into your editor. Without fail the formatting takes a disastrous turn, causing whatever you were pasting to go from the Mona Lisa, to picasso’s self portrait. It’s terrible.

I’ve spent ton’s of time mastering silly block select/cut/delete tricks to help fix broken formatting…Those day’s are behind me though! Today I learned about paste mode. It’s so simple! Before you paste into your editor simply issue this command:

:set paste

Presto, You paste, all the auto formatting options in vim are disabled, and it pastes beautifully, and when you’re done?

:set nopaste

Shortest tutorial of all times? Maybe. Most useful tutorial of all times? Quite possibly!

formattingpastevim

Brandon.Graves • May 10, 2016


Previous Post

Next Post

Comments

  1. Reverett May 28, 2016 - 10:30 am Reply

    eh, or just use pico/nano/emacs like a real person 😛

    • Brandon.Graves June 2, 2016 - 7:32 am Reply

      If you had said “use emacs” I would have brushed it off as a “my editor is better than your editor” comment…But seriously, pico/nano? What are we cave men? When you have to write something down do you use a chisel and stone tablet? :p

      • Reverett June 2, 2016 - 1:16 pm Reply

        we upgrade to papyrus paper next fiscal year! 😀 which is a good thing too, my chisel is getting kind of dull… 😛

Leave a Reply

Your email address will not be published / Required fields are marked *

%d bloggers like this: