Vim 网站上的说明说只需将文件放入 /syntax 文件夹中。这一切都很好。但是,为了使用该语法,我必须
:set syntax=go
每一次设置以下内容。所以,我知道我做错了。我只是不知道是什么。
以下是环顾四周的一些东西,
我的 HTML5 语法集来自 Rodrigo 的 HTML5 全功能和语法 vimball 文件< /a>.尽管这使用一些安装脚本来使其运行。
据我所知,这将是我第一次手动添加语法文件。
另外,我的 VIMRUNTIME
没有设置,因为没有syntax.vim 文件,所以通过阅读文档,我看到它通过 synload.vim 检查文件,
我什至阅读了“制作你自己的语法文件"部分,其内容与上面的 syntax=go 相同代码> 选项。我是否应该按照 新文件类型部分?
如何默认启用 GO 语法突出显示?
这是针对 Mac Snow Leopard 的。
我不认为这很复杂,但我决定留下我浏览过的所有不同文档。 GO 和 Vim 说只添加文件。但它绝对不会自动检测到它
The instructions on the Vim site says to just put the file in the /syntax folder. This works all right and well. But, for me to use the syntax I must set the following
:set syntax=go
Every single time. So, I know I am doing something wrong. I just don't know what.
Here are some things from looking around,
My HTML5 syntax set is from Rodrigo's HTML5 omnicomplete function and syntax vimball file. Though this uses some installation script to get it going.
As far as I can tell this would be my first manual adding of syntax file.
Also, my VIMRUNTIME
is not set, well because there is no syntax.vim file, so from reading the documentation I see it checks for files via synload.vim
I even read the "Making Your Own Syntax Files" section, which says that same as above with the syntax=go
option. Am I supposed to be detecting the .go filetype as described in new filetype section?
How can I enable syntax highlighting for GO by default?
This is for Mac Snow Leopard.
I don't think it is this complicated but I decided to leave all the different documentation I skimmed. GO and Vim say to just add the file. But it is definitely not detecting it automatically
发布评论
评论(2)
如果您在
~/.vimrc
文件中使用以下行进行文件类型检测:那么您可以将该文件放在以下文件夹中:
或者对于 Windows
要使文件类型检测正常工作,需要autocmd 位于 ftDetect 文件夹中的文件中:
内容为:
If you are using filetype detection in your
~/.vimrc
file with the following line:then you can place the file in the following folder:
or for windows
For the filetype detection to work, would would want the autocmd in a file in the ftdetect folder:
and the contents would be:
使用自动命令:
au BufRead,BufNewFile *.go setlocal filetype=go
Use autocmd:
au BufRead,BufNewFile *.go setlocal filetype=go