3 questions about editing with vim in mutt

This is a discussion on 3 questions about editing with vim in mutt within the Mutt forums in Other Technologies category; Hello! I have 3 questions about editing mails with vim. 1.- I have in my .muttrc set editor='vim + -c "set textwidth=72 expandtab"' While editing a new mail the width stays by 72 ... but if I try to insert some new content on a previous line, vim seems to forget this and generate lines that exceeds the 72 columns. Do you have this problem too? Is there any solutions? 2.- While replying to a mail I want to insert a comment in a specific collumn (before "Here I want ..." in the text below). > word1 word2 ... wordn ...

Go Back   Application Development Forum > Other Technologies > Mutt

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 05-11-2004, 11:19 AM
Vlad Ghitulescu
Guest
 
Default 3 questions about editing with vim in mutt

Hello!


I have 3 questions about editing mails with vim.

1.- I have in my .muttrc

set editor='vim + -c "set textwidth=72 expandtab"'

While editing a new mail the width stays by 72 ... but if I try to
insert some new content on a previous line, vim seems to forget this
and generate lines that exceeds the 72 columns. Do you have this problem
too? Is there any solutions?


2.- While replying to a mail I want to insert a comment in a specific
collumn (before "Here I want ..." in the text below).

> word1 word2 ... wordn Here I want to insert
> a new line ... wordn+1 wordn+2 ...


If I do so, the reply-mail looks like this:

> word1 word2 ... wordn

My comment ...
Here I want to insert
> a new line ... wordn+1 wordn+2 ...


The rest of the phrase ("Here I want to insert") have no "> " anymore!
What I want is:

> word1 word2 ... wordn

My comment ...


> Here I want to insert
> a new line ... wordn+1 wordn+2 ...


that means:

- 2 times CarriageReturn (for insert 2 lines)
- ESC (to return to command mode)
- j (to positionate the cursor on "Here ...")
- i (switch to insert mode)
- "> "
- ESC (to return to command mode)
- 3 times k (to positionate the cursor right under the original line ">
word1 word2 ... wordn")
- i (switch to insert mode)

Is there's a was to have such a makro in mutt while editing with vim?


3.- When I want to reply to an email, the vim starts with the cursor at
the bottom. How can I tell vim to start with the cursor at the top?


3 times thanks! :-)


Regards,
Vlad
Reply With Quote
  #2  
Old 05-11-2004, 12:44 PM
Mike Hunter
Guest
 
Default Re: 3 questions about editing with vim in mutt

On 11 May 2004 08:19:39 -0700, Vlad Ghitulescu wrote:
> Hello!
>
>
> I have 3 questions about editing mails with vim.
>
> 1.- I have in my .muttrc
>
> set editor='vim + -c "set textwidth=72 expandtab"'
>
> While editing a new mail the width stays by 72 ... but if I try to
> insert some new content on a previous line, vim seems to forget this
> and generate lines that exceeds the 72 columns. Do you have this problem
> too? Is there any solutions?


That's probably considered a feature of vim, but in that situation I hit the
offending paragraph with 'gqip' and it is recombobulated.

> 2.- While replying to a mail I want to insert a comment in a specific
> collumn (before "Here I want ..." in the text below).
>
> > word1 word2 ... wordn Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> If I do so, the reply-mail looks like this:
>
> > word1 word2 ... wordn

> My comment ...
> Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> The rest of the phrase ("Here I want to insert") have no "> " anymore!
> What I want is:
>
> > word1 word2 ... wordn

> My comment ...
>
>
> > Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> that means:
>
> - 2 times CarriageReturn (for insert 2 lines)
> - ESC (to return to command mode)
> - j (to positionate the cursor on "Here ...")
> - i (switch to insert mode)
> - "> "
> - ESC (to return to command mode)
> - 3 times k (to positionate the cursor right under the original line ">
> word1 word2 ... wordn")
> - i (switch to insert mode)
>
> Is there's a was to have such a makro in mutt while editing with vim?


Good question...

> 3.- When I want to reply to an email, the vim starts with the cursor at
> the bottom. How can I tell vim to start with the cursor at the top?


The bottom is the correct place, because top-posting is evil. Hope that
clears it up for you

Mike
Reply With Quote
  #3  
Old 05-11-2004, 02:44 PM
Paul Walker
Guest
 
Default Re: 3 questions about editing with vim in mutt

On 11 May 2004 08:19:39 -0700, Vlad Ghitulescu wrote:

> Is there's a was to have such a makro in mutt while editing with vim?


You want a macro in vim, not mutt. mutt doesn't get involved in the editing
if you're using an external editor. comp.editors can probably help.

> 3.- When I want to reply to an email, the vim starts with the cursor at
> the bottom. How can I tell vim to start with the cursor at the top?


You don't, because that's evil...

--
Paul

136. If I build a bomb, I will simply remember which wire to cut if it
has to be deactivated and make every wire red.
Reply With Quote
  #4  
Old 05-11-2004, 04:21 PM
joe@jolomo.net
Guest
 
Default Re: 3 questions about editing with vim in mutt

Not so long ago, Paul Walker wrote:
> On 11 May 2004 08:19:39 -0700, Vlad Ghitulescu wrote:


> > Is there's a was to have such a makro in mutt while editing with vim?


> You want a macro in vim, not mutt. mutt doesn't get involved in the editing
> if you're using an external editor. comp.editors can probably help.


What I use is the wonderful "par" program (like an enhanced "fmt")
Stick this line

===================
}ap ** {!}par q
===================

in your vimrc file. Put your cursor on the paragraph of text
that you want prefixed with "> ", then press asterisk twice.

If you don't already have it, you can find par here
http://www.nicemice.net/par/

--
Joe Morris
Live music in Atlanta http://jolomo.net/atlanta/shows.html
Reply With Quote
  #5  
Old 05-11-2004, 08:57 PM
Gary Johnson
Guest
 
Default Re: 3 questions about editing with vim in mutt

Vlad Ghitulescu <Vlad.Linux@gmx.de> wrote:
> Hello!
>
>
> I have 3 questions about editing mails with vim.
>
> 1.- I have in my .muttrc
>
> set editor='vim + -c "set textwidth=72 expandtab"'
>
> While editing a new mail the width stays by 72 ... but if I try to
> insert some new content on a previous line, vim seems to forget this
> and generate lines that exceeds the 72 columns. Do you have this problem
> too? Is there any solutions?


As someone else suggested, the simplest solution to this is to
execute 'gqip' when you're done editing that paragraph. See

:help gq
:help ip

and related sections. If you want the formatting to be automatic,
and you are using vim 6.2, you might consider adding 'a' and
possibly 'w' to your 'formatoptions', like this:

set fo+=a

or

set fo+=aw

See

:help formatoptions
:help fo-table

The side-effects of setting just 'a' without the 'w' drive me crazy,
so I set both for e-mail and news postings. All in all, it works
pretty well, although I sometimes have to execute ":set fo-=a" while
editing a message to prevent vim from reformatting some stuff I
don't want it to.

> 2.- While replying to a mail I want to insert a comment in a
> specific collumn (before "Here I want ..." in the text below).
>
> > word1 word2 ... wordn Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> If I do so, the reply-mail looks like this:
>
> > word1 word2 ... wordn

> My comment ...
> Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> The rest of the phrase ("Here I want to insert") have no "> " anymore!
> What I want is:
>
> > word1 word2 ... wordn

> My comment ...
>
>
> > Here I want to insert
> > a new line ... wordn+1 wordn+2 ...

>
> that means:
>
> - 2 times CarriageReturn (for insert 2 lines)
> - ESC (to return to command mode)
> - j (to positionate the cursor on "Here ...")
> - i (switch to insert mode)
> - "> "
> - ESC (to return to command mode)
> - 3 times k (to positionate the cursor right under the original line ">
> word1 word2 ... wordn")
> - i (switch to insert mode)
>
> Is there's a was to have such a makro in mutt while editing with vim?


There is a script at vim.sourceforge.net that contains a lot of
macros for editing e-mail and newsgroup articles that may contain
just what you're looking for. I don't know the name off hand.
Otherwise, there are some other 'formatoptions' settings that may
make this easier. If you add 'r' to your 'formatoptions' setting,
e.g.,

set fo+=r

and if you do _not_ have 'o' in your 'formatoptions', then you could
insert your comment like this:

1. Move cursor to the space between "wordn" and "Here".
2. Type 'r<CR>' (the letter 'r' followed by a carriage return
or the Enter key).
3. Type 'O'.
4. Type your comment ("My comment ...") followed by two
carriage returns, then <Esc>.

I don't think it gets much simpler than that. I suppose you could
define a macro to execute the 'r<CR>O' if you wanted to save a few
keystrokes. See

:help 05.3
:help 40.3
:help mapping

for more on vim mappings (macros). You can define such mappings on
the command line as you have done for setting textwidth and
expandtab, or you can create your own filetype plugin for "mail"
settings. Adding a plugin can seem daunting at first, but it's
really not difficult. Start by reading

:help plugin

If you want to do that and have any more questions, just ask here or
better yet, in comp.editors.

> 3.- When I want to reply to an email, the vim starts with the cursor at
> the bottom. How can I tell vim to start with the cursor at the top?


As others have said: don't put your text at the top of a reply.
But you may want to put the cursor there anyway so that you can
start re-reading the text you're replying to from the top. The
reason that the cursor is at the bottom is that you told vim to put
it there by including '+' in your 'editor' definition:

> set editor='vim + -c "set textwidth=72 expandtab"'


Just take that out, like this

set editor='vim -c "set textwidth=72 expandtab"'

and the cursor should start at the top.

HTH,
Gary
Reply With Quote
  #6  
Old 05-12-2004, 01:38 AM
Ben Finney
Guest
 
Default Re: 3 questions about editing with vim in mutt

On Wed, 12 May 2004 00:57:37 +0000 (UTC), Gary Johnson wrote:
> Vlad Ghitulescu <Vlad.Linux@gmx.de> wrote:
>> 3.- When I want to reply to an email, the vim starts with the cursor
>> at the bottom. How can I tell vim to start with the cursor at the
>> top?

>
> As others have said: don't put your text at the top of a reply.
> But you may want to put the cursor there anyway so that you can
> start re-reading the text you're replying to from the top.


Or, better, so that you can trim the irrelevant parts of the quoted
material as you reply in-line (not just underneath the entire message).

--
\ "I was in the first submarine. Instead of a periscope, they had |
`\ a kaleidoscope. 'We're surrounded.'" -- Steven Wright |
_o__) |
Ben Finney <http://bignose.squidly.org/>
Reply With Quote
  #7  
Old 05-12-2004, 07:52 AM
Scott
Guest
 
Default Re: 3 questions about editing with vim in mutt

On 2004-05-12, Ben Finney <bignose-hates-spam@and-benfinney-does-too.id.au> wrote:
> On Wed, 12 May 2004 00:57:37 +0000 (UTC), Gary Johnson wrote:
>> Vlad Ghitulescu <Vlad.Linux@gmx.de> wrote:
>>> 3.- When I want to reply to an email, the vim starts with the cursor
>>> at the bottom. How can I tell vim to start with the cursor at the
>>> top?

>>
>> As others have said: don't put your text at the top of a reply.
>> But you may want to put the cursor there anyway so that you can
>> start re-reading the text you're replying to from the top.

>
> Or, better, so that you can trim the irrelevant parts of the quoted
> material as you reply in-line (not just underneath the entire message).


Really. I try not to get involved in the "top posting is evil" stuff,
but that kind of kneejerk, overwhelming single rule approach to anything
is misguided. Be intelligent about what you quote. Insert your new
text interleaved, above, or below as appropriate to the particular
situation in order to maximize clarity. Trust your own intelligence and
be sure to use it.
Reply With Quote
  #8  
Old 05-13-2004, 06:12 AM
Vlad Ghitulescu
Guest
 
Default Re: 3 questions about editing with vim in mutt

Scott <swb@employees.org> wrote in message news:<slrnca43vk.11o.swb@sbrim-w2k01.amer.cisco.com>...
> On 2004-05-12, Ben Finney <bignose-hates-spam@and-benfinney-does-too.id.au> wrote:
> > On Wed, 12 May 2004 00:57:37 +0000 (UTC), Gary Johnson wrote:
> >> Vlad Ghitulescu <Vlad.Linux@gmx.de> wrote:
> >>> 3.- When I want to reply to an email, the vim starts with the cursor
> >>> at the bottom. How can I tell vim to start with the cursor at the
> >>> top?
> >>
> >> As others have said: don't put your text at the top of a reply.
> >> But you may want to put the cursor there anyway so that you can
> >> start re-reading the text you're replying to from the top.

> >
> > Or, better, so that you can trim the irrelevant parts of the quoted
> > material as you reply in-line (not just underneath the entire message).

>
> Really. I try not to get involved in the "top posting is evil" stuff,

I'll try hard too :-) ... even if I STILL REALLY want to know what's so bad to
start at the top :-)


> but that kind of kneejerk,

You know, as no-english speaker I have to admire this language sometime
:-)))


> overwhelming single rule approach to anything
> is misguided. Be intelligent about what you quote. Insert your new
> text interleaved, above, or below as appropriate to the particular
> situation in order to maximize clarity. Trust your own intelligence and
> be sure to use it.

;^) Thanks for the advice, that let me hope, I can put a (silly)
question again and become an intelligent answer ... the knowledge has a
beginning, but no end & the ignorance has no beginning, but an end ;-)
Reply With Quote
  #9  
Old 05-13-2004, 09:25 AM
Ben Finney
Guest
 
Default Re: 3 questions about editing with vim in mutt

On 13 May 2004 03:12:16 -0700, Vlad Ghitulescu wrote:
> I'll try hard too :-) ... even if I STILL REALLY want to know what's
> so bad to start at the top :-)


A: Because it messes up the normal order of reading.
Q: Why is top-posting wrong?
A: Top-posting.
Q: What is one of the most annoying posting habits?

--
\ "One time a cop pulled me over for running a stop sign. He |
`\ said, 'Didn't you see the stop sign?' I said, 'Yeah, but I |
_o__) don't believe everything I read.'" -- Steven Wright |
Ben Finney <http://bignose.squidly.org/>
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:43 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.