Vim html.erb snippets?? snipMate Need a vim tip

2019-03-12 19:22发布

When I'm in an html.erb file, I get no snipMate snippets.

I would like both HTML and Ruby, or just HTML would be fine, How would I do this?

Would I need to write a set of snippets?

If so, is there a way of pulling in existing snippets without copying them?

Is there a way of telling vim to go into html mode when it sees .html erb?

7条回答
smile是对你的礼貌
2楼-- · 2019-03-12 19:45

Snippets are stored in directory called snippets somewhere in your ~/.vim folder.

If you look there, there is usually one file per filetype, there is a c.snippets, a ruby.snippets, so it seems what you have to do is to create an erb.snippets there with what you want.

Eventually you could copy the content of ruby.snippets and html.snippets into your new erb.snippets.

Alternatively you can search on github, some people have posted their own erb.snippets configuration. For example, there is a nice collection there : https://github.com/scrooloose/snipmate-snippets

The best thing would to try first to open a snippet file and look at the syntax, it is pretty easy to create your own snippet depending on what you use the most.

查看更多
登录 后发表回答