[m-dev.] Turning off Vim's cindent for C files

Ralph Becket rafe at cs.mu.OZ.AU
Fri Jun 10 17:23:57 AEST 2005


After some fiddling, I've worked out a way to convince Vim to only use
autoindent and not cindent for .c files (I don't want Vim to add newlines and tabs etc. whenever I type a `{', for instance).

Even though my .vim/ftplugin/c.vim file contains

	setlocal nocindent
	setlocal nosmartindent

cindent is still somehow turned back on by the time I get to edit a .c
file.

My solution is to have the following in your .vim/after/filetype.vim file:

	augroup filetypedetect
	  ... whatever else you have in this autocommand group ...
	  au! BufRead,BufNewFile  *.c               set nocindent
	augroup END

Peace at last!

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list