Domanda

Just found about the autocomplete feature in Sublime Text 2.

Example auto complete file:

{
        "scope": "text.html - source - meta.tag, punctuation.definition.tag.begin",

        "completions":
        [
                { "trigger": "a", "contents": "<a href=\"$1\">$0</a>" },
                { "trigger": "abbr", "contents": "<abbr>$0</abbr>" },
                { "trigger": "acronym", "contents": "<acronym>$0</acronym>" }
        ]
}

I tried to search for a similar thing for Vim, but haven't been able to find anything.

Does anything like this exist for Vim? Preferably if it uses simple to generate format, like JSON, YAML, etc.

È stato utile?

Soluzione

I think you are looking for SnipMate, a good tutorial from Jeffrey Way: Vim Essential Plugin: SnipMate

Other plugins that can do something like you want: SparkUp or Zen Coding.vim

Altri suggerimenti

A more recent alternative to SnipMate seems to seems UltiSnips, I haven't tried it myself though.

There is also vim's built in abbreviations support, but I don't think they support anything more complex than expanding a short text to a longer text. Still quite useful though.

Did you try neocomplcache or autocomplpop? They seem to do what you want.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top