[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vi linewrap question



egm2@jps.net (Eric G . Miller) wrote:
>On Fri, Dec 31, 1999 at 02:54:24PM -0700, Nate Duehr wrote:
>> Okay, I'm fairly new to vi after living in a uMacs/Emacs world for a
>> number of years...
>> 
>> When using vi with mutt for mail, I have to type carriage returns
>> manually to avoid linewrap.  Is there any way to teach vi to linewrap
>> at 72 columns?  
>
>:set textwidth=72
>
>> Also, I know there's a way to pass vi options from mutt
>> which would keep vi from doing this unless I was in mutt, but
>> I don't remember where that is either.
>
>1) Replace vi with vim (it's VI-iMproved !)
>
>2) Create a vimrc or whatever you want to call it, an put it in
>~/.mutt . Then in your ~/.mutt/muttrc have line like:
>set editor='vim -u $HOME/.mutt/vimrc'

Like the man says - or else, rather than hacking your ~/.muttrc, do as I
do and take advantage of vim's ability to recognize filetypes. Put the
following in your ~/.vimrc:

syntax on

augroup myauto
	au!
	au FileType mail	set textwidth=72
augroup END

This will work for anything vim recognizes as mail, which includes mutt
temporary files, so you don't need to do anything special to mutt to get
this to work.

(I don't think this will work with the vim-5.3 in slink; you'll need at
least vim-5.4 to have the FileType autocommand. potato is on vim-5.5.)

-- 
Colin Watson                                           [cjw44@cam.ac.uk]


Reply to: