Recently, I need to use vim to edit a text file with the .cl suffix, but vim always automatically highlights the .cl file in the .lisp syntax. To disable file highlighting, add the following statement to .vimrc:
autocmd BufNewFile,BufRead *.cl set filetype=
This successfully cancels syntax highlighting. But at the same time, I found that the .cl file still maintains the automatic indentation habit of lisp files. I want its indentation habits to maintain those of java or python, so I changed them to
autocmd BufNewFile,BufRead *.cl set filetype=python
But without success. My .vim file already has set autoindent set. How should I solve it?
I accidentally saw a post today, and it said that nolisp is available. Then I tried it myself and it worked. I think it may be that vim automatically recognizes the *.cl file as a lisp file and then sets lisp. As long as you cancel the setting, the indentation of the new line will be the same as the previous line. In addition, I found that the filetype does not need to be set to Python. I just need indentation similar to Python and do not need syntax highlighting. Attached is my .vimrc related settings:
You can refer to the content in the link below. The reason is probably because you have set up the
BufNewFile
,而*.cl
fileAlready existed before.
Reference:
1. http://vimcdoc.sourceforge.net/doc/autocmd.html#autocmd-events