Thursday, December 29, 2011

Re: mutt and vim playing together

Hi Kai!

On Do, 29 Dez 2011, Kai Weber wrote:

> * Marc Weber <marco-oweber@gmx.de>:
>
> > > So everytime I edit a mail the first line and following manually inserted blank
> > > lines are highlighted.
> > Why do you need this?
> > Use syntax commands instead.
>
> Syntax highlighting is not what I look for.
>
> What I want to achieve is jumping to the first blank line where I can start
> typing my mail instantly. So I search for ^$ and vim jumps to the first
> occurrence (with the consequences I wrote in my first mail).
>
> But thinking about it... my solution could be to jump at the end of the file.
> Now I have in my muttrc
>
> set editor = "vim +$"
>
> Seems to work so far.

You really should put your settings into ~/.vim/after/ftplugin/mail.vim
(you can leave out the after directory, depending on whether you want
your settings to apply before or after sourcing the provided filetype
scripts which are distributed with vim, e.g.
/usr/share/vim/vim73/ftplugin/mail.vim) and leave your mutt setting to
set editor=vim

For this to work, you need at least an
:filetype on
in your .vimrc, so vim will source for each filetype a matching file in
your runtime path.

Also since you want Vim to position the cursor on the first empty line
without having the highlight option apply, you can simply dump into the
filetype plugin this:

call cursor(1,1)
call search('^$')

See also the faq and the help:
http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.1
:h 43.1
:h ftplugins


regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment