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

前端 未结 7 1052
灰色年华
灰色年华 2021-02-04 08:47

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 writ

7条回答
  •  温柔的废话
    2021-02-04 09:19

    You can assign multiple snippets scopes to a single filetype. (I've found that altering the filetype tends to break some syntax highlighting).

    You can check that the filetype for erb files is indeed 'eruby' with:

    :set filetype?
    

    If you're using the maintained fork of snipmate, it looks like you'll want both the eruby.snippets and eruby-rails.snippets from the snipmate-snippets repository (owned by honza, but I don't have enough reputation to link to it here) (see the INSTALL section of the snipmate README for proper setup).

    If you are using the maintained fork, I believe setting g:snipMate.scope_aliases in your .vimrc with the following will work for your example:

    let g:snipMate = {}
    let g:snipMate.scope_aliases = {}
    let g:snipMate.scope_aliases['eruby'] = 'eruby,eruby-rails'
    

    I've added a pull request to snipmate to have their documentation updated.

提交回复
热议问题