如果您希望 Vim 识别新的文件扩展名,请不要在 .vimrc 中修改 augroup,请将设置放在正确的位置。请参阅 :help ftdetect
If you only want to use Vim's syntax highlighting, then you can set the filetype of every LESS file to be a CSS file.
To do this, you can add au BufNewFile,BufRead *.less set filetype=css to your .vimrc file.
au stands for autocommand, so the above line reads "on events BufNewFile or BufRead, if the file has a less extension, then set the filetype option to css".
Keep in mind that this is not the recommended way. According to the Vim tips Wiki:
If there is a new file extension that you want Vim to recognize, don't muck about with augroup in your .vimrc, put the settings in the right place. See :help ftdetect
发布评论
评论(4)
http://leafo.net/lessphp/vim/
检查安装文件以获取说明。
http://leafo.net/lessphp/vim/
Check the INSTALL file for instructions.
还有一些 github 存储库:
https://github.com/groenewege/vim-less< /p>
https://github.com/lunaru/vim-less
There are also a couple of github repos:
https://github.com/groenewege/vim-less
https://github.com/lunaru/vim-less
如果你只想使用Vim的语法高亮,那么你可以将每个LESS文件的文件类型设置为CSS文件。
为此,您可以将
au BufNewFile,BufRead *.less set filetype=css
添加到.vimrc
文件中。au
代表autocommand
,因此上面的行显示为“在事件BufNewFile
或BufRead
上,如果文件具有less
扩展名,然后将filetype
选项设置为css
”。请记住,这不是推荐的方法。根据 Vim Tips Wiki:
If you only want to use Vim's syntax highlighting, then you can set the filetype of every LESS file to be a CSS file.
To do this, you can add
au BufNewFile,BufRead *.less set filetype=css
to your.vimrc
file.au
stands forautocommand
, so the above line reads "on eventsBufNewFile
orBufRead
, if the file has aless
extension, then set thefiletype
option tocss
".Keep in mind that this is not the recommended way. According to the Vim tips Wiki:
将此行粘贴到您的 .vimrc 中:
au
是autocmd
的简写。因此,这读作“当我读取或打开以 .less 结尾的新文件时,自动将文件类型设置为 CSS”。Paste this line into your .vimrc:
au
is a shorthand forautocmd
. So this reads as "when I read or open a new file that ends in .less, automatically set the filetype as CSS".