Snippets vs. Abbreviations in Vim

后端 未结 4 1823
再見小時候
再見小時候 2021-02-15 12:40

What advantages and/or disadvantages are there to using a \"snippets\" plugin, e.g. snipmate, ultisnips, for VIM as opposed to simply using the builtin \"abbreviations\"

4条回答
  •  后悔当初
    2021-02-15 13:18

    snippets are like the built-in :abbreviate on steroids, usually with:

    • parameter insertions: You can insert (type or select) text fragments in various places inside the snippet. An abbreviation just expands once.
    • mirroring: Parameters may be repeated (maybe even in transformed fashion) elsewhere in the snippet, usually updated as you type.
    • multiple stops inside: You can jump from one point to another within the snippet, sometimes even recursively expand snippets within one.

    There are three things to evaluate in a snippet plugin: First, the features of the snippet engine itself, second, the quality and breadth of snippets provided by the author or others; third, how easy it is to add new snippets.

提交回复
热议问题