Wednesday, February 14, 2007

Vim: Soft Wrap

Here's another Vim tip, which I'm surprised it took me so long to find out. To make Vim "soft wrap" text, like Microsoft Word does, use ":set wrap linebreak textwidth=0".

13 comments:

NoahGift said...

dude you rock! I was just thinking...hmmm I bet Shannon knows and boom...gotcha on google :)

Shannon -jj Behrens said...

hahaha

That's awesome!

sam said...

Thanx dude.I love this feature.

Nick said...

thnx!

Anonymous said...

# aptitude remove gedit

Finally! I can now use vim for prose as well as code. Cheers!

Shannon -jj Behrens said...

Hahaha, nice ;)

The only thing I wish is that it would treat soft wrapped text the way Emacs and Microsoft Word do. I.e., if you press up (i.e. k), it should go up a line on the screen, whether or not there was a \n involved. Oh well. I wonder if there's a setting for that too.

silwilin said...

thanks!!!
@Shannon -jj Behrens:
:map j gj
:map k gk
:map [Up] gk
:map [Down] gj

Just use '<' '>' instead of '[' and ']'

Shannon -jj Behrens said...

silwilin, thanks!!!

ke said...

The quality of my life has just improved drastically. Thanks silwilin and Shannon!

Anonymous said...

how to you revert the command?

Shannon -jj Behrens said...

Opening a new window or tab is probably the fastest way.

Sand said...

Thanks a ton, this really helped.

Matt said...

Thanks this was very helpful.