Question

I downloaded vim and used it in a python file and the snippets worked perfectly. But when I tried to use snipMate in a .go file (golang) it didn't work. I read the documentation and couldn't find an answer but when I manually used the command ":set ft=go" the snippets worked. Why does snipMate automatically work for python and not go. Snippet files for both languages are supplied. How do I get snippets for go to automatically work?

Was it helpful?

Solution

It sounds like your .go files aren't getting set to the appropriate filetype. You can use

au BufRead,BufNewFile *.go setl ft=go

in your ~/.vimrc to remedy this.

The appropriate place for files like this is in your ~/.vim/ftdetect directory. For instance, you could create a file called ~/.vim/ftdetect/go.vim and put the command in there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top