1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2026-01-08 15:14:11 +01:00

significantly refactored code, and added support for file-based snippets and delimeters before snippet triggers.

This commit is contained in:
Michael Sanders
2009-02-25 15:02:34 -05:00
parent 465abbe37e
commit 48b5d02a89
31 changed files with 552 additions and 1920 deletions

View File

@@ -1,7 +1,7 @@
*snipMate.txt* Plugin for using TextMate-style snippets in Vim.
Snippets *snippet* *snippets* *snipMate*
Last Change: February 13, 2009
Last Change: February 21, 2009
|snipMate-description| Description
|snipMate-usage| Usage
@@ -39,7 +39,34 @@ be updated.
==============================================================================
USAGE *snipMate-usage*
Snippets should be installed in the 'after' directory, usually located in
There are two ways to make snippets: file-based and command-based. File-based
snippets are simply plain text files named after the trigger of the snippet
and placed in the directory of the filetype (<filetype>/<trigger>.snippet);
command-based snippets are snippets defined using the |Snipp| and |GlobalSnip|
commands. File-based snippets have the advantage of being easier to read, but
do not support some special characters in snippet triggers, while
command-based snippets are obviously convenient for short snippets but can
quickly get unreadable.
*file-snippets* *'snippets'*
File-based snippets by default are looked for in the 'snippets' directory
inside your home '.vim' directory, typically located in
'~/.vim/snippets/<filetype>'. To change that location or add another one,
edit '~/.vim/after/plugin/snipMate.vim' and use the |ExtractSnips()|function.
ExtractSnips({directory}, {filetype}) *ExtractSnips()*
ExtractSnips() extracts *.snippet files from the specified directory and
defines them as snippets for the given filetype; to define a global snippet,
use '_' for the {filetype} argument.
*ResetSnips()*
The ResetSnips() function removes all snippets from memory. This is useful to
put at the top of a snippet setup file if you would like to :source it
multiple times.
*command-snippets*
Command-based should be installed in the 'after' directory, usually located in
'~/.vim/after'. Filetype specific snippets should be installed in
'after/ftplugin', such as 'after/ftplugin/<filetype>_snips.vim'.
See |ftplugins|. Global snippets should be installed in 'after/plugin'.
@@ -87,6 +114,11 @@ to add: >
to the top of your snippets files.
*snipMate-expandtab* *snipMate-indenting*
If you would like your snippets to use spaces instead of tabs, just enable
'expandtab' and set 'softtabstop' to your preferred amount of spaces. If
'softtabstop' is not set, 'shiftwidth' is used instead.
==============================================================================
SYNTAX *snipMate-syntax* *snipMate-${#}*
@@ -184,14 +216,13 @@ to this: >
FEATURES *snipMate-features*
snipMate.vim has the following features among others:
- The syntax of snippets is very similar to TextMate's allowing
- The syntax of snippets is very similar to TextMate's, allowing
easy conversion.
- The position of the snippet is kept transparently (i.e. it does not use
regexes from text inserted in the buffer to track your position), which
allows you to escape out of an incomplete snippet, something particularly
useful in Vim.
- Variables in snippets are updated as-you-type
- Snippets can have multiple matches
markers/placeholders written to the buffer), which allows you to escape
out of an incomplete snippet, something particularly useful in Vim.
- Variables in snippets are updated as-you-type.
- Snippets can have multiple matches.
- Snippets can be out of order. For instance, in a do...while loop, the
condition can be added before the code.