silent command switch

0 views
Skip to first unread message

bill lam

unread,
Dec 17, 2008, 9:24:16 AM12/17/08
to vim_use
Hi,
I use the following to write email using vim
set editor="vim -c 'set spell tw=70 et' '+/^$' "

This usually works very well except when there is no empty in the
file, then vim complains an error and need manual <CR>. How to use the
silent keyword to make it ignore error in this context?

Thanks in advance.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩023 綦毋潛 春泛若耶溪
幽意無斷絕 此去隨所偶 晚風吹行舟 花路入溪口 際夜轉西壑 隔山望南斗
潭煙飛溶溶 林月低向後 生事且瀰漫 願為持竿叟

Christian Ebert

unread,
Dec 17, 2008, 12:55:23 PM12/17/08
to vim...@googlegroups.com
* bill lam on Wednesday, December 17, 2008 at 22:24:16 +0800

> I use the following to write email using vim
> set editor="vim -c 'set spell tw=70 et' '+/^$' "
>
> This usually works very well except when there is no empty in the
> file, then vim complains an error and need manual <CR>. How to use the
> silent keyword to make it ignore error in this context?

Try (untested):

set editor="vim -c \"set spell tw=70 et\" \"+call search('^$')\""

However you might have to experiment with the "\" escapes for it
to work. Much easier to move this stuff into
~/.vim/after/ftplugin/mail.vim

c

--
\black\trash movie _C O W B O Y_ _C A N O E_ _C O M A_
Ein deutscher Western/A German Western
-->> http://www.blacktrash.org/underdogma/ccc.html
-->> http://www.blacktrash.org/underdogma/ccc-en.html

bill lam

unread,
Dec 18, 2008, 1:36:26 AM12/18/08
to vim...@googlegroups.com
On Wed, 17 Dec 2008, Christian Ebert wrote:
> set editor="vim -c \"set spell tw=70 et\" \"+call search('^$')\""

Thanks this work.



> However you might have to experiment with the "\" escapes for it
> to work. Much easier to move this stuff into
> ~/.vim/after/ftplugin/mail.vim

I can confirm set ft? gives mail. How does vim know this filetyp?
The file name of the temp file is /tmp/mutt-blahblah without file
extension.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

唐詩179 王維 奉和聖製從蓬萊向興慶閣道中留春雨中春望之作應制
渭水自縈秦塞曲 黃山舊遶漢宮斜 鑾輿迥出千門柳 閣道迴看上苑花
雲裡帝城雙鳳闕 雨中春樹萬人家 為乘陽氣行時令 不是宸遊玩物華

Tony Mechelynck

unread,
Dec 18, 2008, 2:40:09 AM12/18/08
to vim...@googlegroups.com
On 18/12/08 07:36, bill lam wrote:
> On Wed, 17 Dec 2008, Christian Ebert wrote:
>> set editor="vim -c \"set spell tw=70 et\" \"+call search('^$')\""
>
> Thanks this work.
>
>> However you might have to experiment with the "\" escapes for it
>> to work. Much easier to move this stuff into
>> ~/.vim/after/ftplugin/mail.vim
>
> I can confirm set ft? gives mail. How does vim know this filetyp?
> The file name of the temp file is /tmp/mutt-blahblah without file
> extension.
>

I think that anything starting mutt- is detected as "mail" filetype by
the autocommands defined at line 1013 and 2358 of
$VIMRUNTIME/filetype.vim (current version, dated 2008 Dec 08), provided
that there are 6 letters, digits, dashes, underscores, and/or (except in
special cases like muttrc.vim) dots after "mutt" for a total of 10
characters. However, that would match mutt-blahb or mutt-foo35 but not
mutt-blahblah -- or would it?


Best regards,
Tony.
--
"The sooner you fall behind, the more time you'll have to catch up!"

bill lam

unread,
Dec 18, 2008, 2:50:32 AM12/18/08
to vim...@googlegroups.com
On Thu, 18 Dec 2008, Tony Mechelynck wrote:
> I think that anything starting mutt- is detected as "mail" filetype by
> the autocommands defined at line 1013 and 2358 of
> $VIMRUNTIME/filetype.vim (current version, dated 2008 Dec 08), provided
> that there are 6 letters, digits, dashes, underscores, and/or (except in
> special cases like muttrc.vim) dots after "mutt" for a total of 10
> characters. However, that would match mutt-blahb or mutt-foo35 but not
> mutt-blahblah -- or would it?

Yes, you are correct. Those blah are just place-holders, a real
example is mutt-b2j-1000-11918-162 , the middle string is the name of
my server, and those digits will be randomly generated each time a
temperature is needed.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

唐詩306 鄭畋 馬嵬坡
玄宗回馬楊妃死 雲雨難忘日月新 終是聖明天子事 景陽宮井又何人

bill lam

unread,
Dec 18, 2008, 2:57:07 AM12/18/08
to vim...@googlegroups.com
On Thu, 18 Dec 2008, bill lam wrote:
> temperature is needed.

temp file (I was reading weather report just before reply)

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

唐詩193 杜甫 詠懷古跡五首之四
蜀主征吳幸三峽 崩年亦在永安宮 翠華想像空山裡 玉殿虛無野寺中
古廟杉松巢水鶴 歲時伏臘走村翁 武侯祠屋常鄰近 一體君臣祭祀同

Reply all
Reply to author
Forward
0 new messages