Text wrapping in vim- yippee!

on

A quick nerd moment:  VIM (Vi IMproved) –a lot of people who write software use this text editor to write code– has automatic new line breaks when your line hits a certain length!  You can set this in your VIMRC file (preferences file) using set textwidth=(put the number of characters you want on a line here).  I used 80, since this is the industry standard.

I know I’m late to the party, but I LOVE not having to keep track of how long my lines are, and my code is more readable to boot!  I don’t have to worry about lines wrapping down into the next one (it’s hard to tell what line you’re on then) if a window is on the narrower side.

Non-developers: you know how annoying it is to get one of those emails where you need to keep scrolling to the right because the text isn’t formatted right for your email client (it comes in as one long line, because there aren’t line breaks within a paragraph).  This setting fixes that kind of problem (run on lines) for computer code.

Note: set textwidth=80 was already in the  VIMRC file I have on my laptop at home (thanks to the VIMRC file passed on to me by the BF), so this was a change for work (where I do the majority of my code-writing).

Do you have any  favorite code-editing tricks?

Leave a Reply

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