format indent for/while

0 views
Skip to first unread message

bill lam

unread,
Dec 17, 2008, 10:15:33 PM12/17/08
to vim_use
I found that some programming keywords such as for/while, indent the
block when gq

for this block,

for sdfjkls klsjf klj sdfj
ksfjkl skljf sklfj kl s fsdf
sfjksldfjkl sdf skljf
sdkfjklsjdfskljfj sdf
sdfsl;kfl;ksf sf sdfsdf sdf

after gq} became

for sdfjkls klsjf klj sdfj
ksfjkl skljf sklfj kl s fsdf
sfjksldfjkl sdf skljf
sdkfjklsjdfskljfj sdf
sdfsl;kfl;ksf sf sdfsdf sdf

it shows the same behavior for ft= empty or other types. What should
be done to stop this indent?

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩017 王維 西施詠
艷色天下重 西施寧久微 朝為越溪女 暮作吳宮妃 賤日豈殊眾 貴來方悟稀
邀人傅脂粉 不自著羅衣 君寵益嬌態 君憐無是非 當時浣紗伴 莫得同車歸
持謝鄰家子 效顰安可希

Tony Mechelynck

unread,
Dec 18, 2008, 2:18:02 AM12/18/08
to vim_use
On 18/12/08 04:15, bill lam wrote:
> I found that some programming keywords such as for/while, indent the
> block when gq
>
> for this block,
>
> for sdfjkls klsjf klj sdfj
> ksfjkl skljf sklfj kl s fsdf
> sfjksldfjkl sdf skljf
> sdkfjklsjdfskljfj sdf
> sdfsl;kfl;ksf sf sdfsdf sdf
>
> after gq} became
>
> for sdfjkls klsjf klj sdfj
> ksfjkl skljf sklfj kl s fsdf
> sfjksldfjkl sdf skljf
> sdkfjklsjdfskljfj sdf
> sdfsl;kfl;ksf sf sdfsdf sdf
>
> it shows the same behavior for ft= empty or other types. What should
> be done to stop this indent?
>

:help 'formatoptions'
:help 'cindent'
:help 'indentexpr'
:help :filetype-indent-off
:help :filetype-overview

And to know the value of an option and where it was set, e.g.
'formatoptions':

:verbose set fo?

To see how filetype detection is currently set:

:filetype

with no arguments.


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

bill lam

unread,
Dec 18, 2008, 2:53:54 AM12/18/08
to vim...@googlegroups.com
On Thu, 18 Dec 2008, Tony Mechelynck wrote:
> :help 'formatoptions'
> :help 'cindent'
> :help 'indentexpr'
> :help :filetype-indent-off
> :help :filetype-overview

Thanks for pointers, I just found it is caused by smartindent which
uses cinw which contains for/while and other common c keywords. I
disabled smartindent and the problem gone.

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

唐詩090 唐玄宗 經鄒魯祭孔子而歎之
夫子何為者 栖栖一代中 地猶鄹氏邑 宅即魯王宮
歎鳳嗟身否 傷麟怨道窮 今看兩楹奠 當與夢時同

Reply all
Reply to author
Forward
0 new messages