1
- IMPORTANT: comment on: [ What about merging whith Ultisnip using its engine] ( https://github.com/garbas/vim-snipmate/issues/114 )
2
-
3
1
Snipmate & UltiSnip Snippets
4
2
============================
5
3
6
4
This repository contains snippets files for various programming languages.
7
5
8
- It is community-maintained and many people have contributed snippet files and other
9
- improvements already.
6
+ It is community-maintained and many people have contributed snippet files and
7
+ other improvements already.
10
8
11
9
Contents
12
- ========
10
+ --------
13
11
14
- snippets/*: snippets using snipmate format
15
- UltiSnips/*: snippets using UltiSnips format
12
+ - ` snippets/* ` : snippets using snipmate format
13
+ - ` UltiSnips/* ` : snippets using UltiSnips format
16
14
17
- Snippet engines
18
- ===============
15
+ Snippet engines supporting vim-snippets
16
+ ----------------------------------------
19
17
20
18
There are different forks of snippet engines which allow the user to insert
21
- sippets by typing the name of a snippet hitting the expansion mapping.
19
+ snippets by typing the name of a snippet hitting the expansion mapping.
20
+
21
+ - [ github.com/SirVer/ultisnips] ( https://github.com/SirVer/ultisnips ) :
22
+ python, supports all snippets in this repo.
23
+ - [ github.com/garbas/vim-snipmate] ( https://github.com/garbas/vim-snipmate ) :
24
+ VimL, snipmate-snippets, engine sometimes behaves strange. Supports
25
+ snippets/*
26
+ - [ github.com/Shougo/neosnippet] ( https://github.com/Shougo/neosnippet.vim ) :
27
+ VimL, supports snippets/* with some configuration.
28
+ - [ github.com/drmingdrmer/xptemplate] ( https://github.com/drmingdrmer/xptemplate ) :
29
+ Totally different syntax, does not read snippets contained in this file, but
30
+ it is also very powerful. It does not support vim-snippets (just listing it
31
+ here for completness)
32
+
33
+ There tries to be a more comprehensive list (which still is incomplete) here:
34
+ http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html
35
+
36
+ UltiSnips has additional features such as high speed, nesting snippets,
37
+ expanding snippets in snippets and offers powerful transformations on text in
38
+ snippets (like visual selections or placeholder texts).
39
+
40
+ Which one to use? If you have python give
41
+ [ SirVer/ultisnips] ( https://github.com/SirVer/ultisnips ) a try because its fast
42
+ and has the most features.
22
43
23
- garbas/vim-snipmate [4]:
24
- VimL, snipmate-snippets, engine sometimes behaves strange, supports
25
- rewriting snippets on the fly (eg adding a second version with folding
26
- markers)
44
+ If you have VimL only (vim without python support) your best option is using
45
+ [ garbas/vim-snipmate] ( https://github.com/garbas/vim-snipmate ) and cope with the
46
+ minor bugs found in the engine.
27
47
28
- MarcWeber/UltiSnips [6]:
29
- python, snipmate-snippets and UltiSnips-snippets
30
48
31
- SirVer/ultisnips [7]:
32
- python, UltiSnips-snippets
49
+ Q: Should "snipmate be deprecated in favour of UltiSnips"?
33
50
34
- github.com/Shougo/neosnippet [5]:
35
- viml, has a compatible mode allowing to reuse most snipmate snippets ?
51
+ A: No, because snimpate is VimL, and UltiSnips requires Python.
52
+ Some people want to use snippets without having to install Vim with Python
53
+ support. Yes - this sucks.
36
54
37
- XPTemplate:
38
- totally different syntax, does not read snippets contained in this file,
39
- but it is also very powerful
55
+ One solution would be: Use snippets if they are good enough, but allow overriding them
56
+ in UltiSnips. This would avoid most duplication while still serving most users.
57
+ AFAIK there is a nested-placeholder branch for snipmate too. snipmate is still
58
+ improved by Adnan Zafar. So maybe time is not ready to make a final decision yet.
40
59
41
- ... there are some more, but they have less features which is why I don't
42
- mention them here
60
+ [ github issue/discussion] ( https://github.com/honza/vim-snippets/issues/363 )
43
61
44
- UltiSnips engine has additional features such as "nested snippets".
62
+ Installation
63
+ ------------
45
64
46
- Which one to use? If you have python give MarcWeber/UltiSnips a try because its
47
- fast and supports all important features. You can prefer the UltiSnip versions
48
- of the snippets by setting the "always_use_first_snippet" option to 1.
65
+ First be aware that there are many options, see "Snippet engines" above.
66
+ Second be aware than there are [ tons of plugin managers] ( http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html )
67
+ which is why Marc Weber thinks that it doesn't make sense to repeat the same
68
+ repetitive information everywhere.
49
69
50
- If you have VimL only (vim without python support) your best option is using
51
- garbas/vim-snipmate and cope with the minor bugs found in the engine.
70
+ * Recommended way:*
71
+ [ vim-addon-manager] ( vim-addon-manager ) (because Marc Weber wrote it for exactly
72
+ this reason, it supports simple dependency management). Eg you're done by this
73
+ line in your .vimrc:
74
+
75
+ ```
76
+ " assuming you want to use snipmate snippet engine
77
+ ActivateAddons vim-snippets snipmate
78
+ ```
79
+
80
+ [ vim-pi] ( https://bitbucket.org/vimcommunity/vim-pi/issue/90/we-really-need-a-web-interface )
81
+ Is the place to discuss plugin managers and repository resources.
82
+
83
+ About how to install snipate see [ snipmate@garbas] ( https://github.com/garbas/vim-snipmate )
84
+
85
+ (Bundle, Pathogen, git clone - keywords to make people find this link by ctrl-f search)
86
+ I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vimrc:
87
+ [ See this pull request] ( https://github.com/honza/vim-snippets/pull/307/files ) .
88
+
89
+ TROUBLE
90
+ =======
91
+ If you still have trouble getting this to work create a github ticket, ask on
92
+ irc or the mailinglist.
93
+
94
+ Policies / for contributors
95
+ ---------------------------
96
+
97
+ Some snippets are useful for almost all languages, so let's try to have the same
98
+ triggers for them:
99
+
100
+ ```
101
+ if : if without else
102
+ ife: if $1 else $2
103
+ eif : else if ($1) { .. }
104
+ el : else ..
105
+ wh : while (cond) ...
106
+ ```
107
+
108
+ Don't add useless placeholder default texts like
109
+ ```
110
+ if (${1:condition}){
111
+ ${2:some code here}
112
+ }
113
+ ```
114
+ instead use:
115
+
116
+ ```
117
+ if (${1}){
118
+ ${2}
119
+ }
120
+ ```
121
+
122
+ Exception: Functions which are used less often, such as Vim's matchall(), matchstr()
123
+ functions which case hints may be helpful to remember order. In the VimL case
124
+ get vim-dev plugin which has function completion
125
+
126
+ Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks
127
+
128
+ Open questions:
129
+ What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ?
130
+ Which additional policies to add?
131
+ Discuss at: https://github.com/honza/vim-snippets/issues/230
132
+
133
+ * folding markers* :
134
+ Until further work is done on ` vim-snipmate ` , please don't add folding markers
135
+ into snippets. ` vim-snipmate ` has some comments about how to patch all snippets
136
+ on the fly adding those.
137
+
138
+ Currently all snippets from UltiSnips have been put into UltiSnips - some work
139
+ on merging should be done (dropping duplicates etc). Also see engines section above.
52
140
53
141
Related repositories
54
- ====================
142
+ --------------------
55
143
We also encourage people to maintain sets of snippets for particular use cases
56
144
so that all users can benefit from them. People can list their snippet repositories here:
57
145
@@ -62,45 +150,68 @@ so that all users can benefit from them. People can list their snippet reposito
62
150
63
151
Installation using VAM: "github: rbonvall /snipmate-snippets-bib"
64
152
153
+ Future - ideas - examples
154
+ -------------------------
155
+
156
+ [ overview snippet engines] ( http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html )
157
+ If you have ideas you can add them to that list of "snippet engine features by example".
158
+
159
+
65
160
Historical notes
66
- ================
161
+ ----------------
67
162
68
163
[ vim-snipmate] [ 1 ] was originally started by [ Michael Sanders] [ 2 ] who has now
69
164
unfortunately abandoned the project. [ Rok Garbas] [ 3 ] is now maintaining a
70
165
[ fork] [ 4 ] of the project in hopes of improving the existing code base.
71
166
167
+ Versions / dialects / ..
168
+ ========================
169
+ There are some issues, such as newer language versions may require other
170
+ snippets than older. If this exists we currently recommend doing this:
171
+
172
+ add snippets/ruby.snippets (common snippets)
173
+ add snippets/ruby-1.8.snippets (1.8 only)
174
+ add snippets/ruby-1.9.snippets (1.9 only)
175
+
176
+ then configure github.com/garbas/vim-snipmate this way:
177
+
178
+
179
+ ``` vim
180
+ let g:snipMate = {}
181
+ let g:snipMate.scope_aliases = {}
182
+ let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
183
+ ```
184
+
185
+ If it happens that you work on a project requiring ruby-1.8 snippets instead,
186
+ consider using vim-addon-local-vimrc and override the filetypes.
187
+
188
+ Well - of course it may not make sense to create a new file for each
189
+ ruby-library-version triplet. Sometimes postfixing a name such as
190
+
191
+ migrate_lib_20_down
192
+ migrate_lib_20_up
193
+
194
+ will do it then if syntax has changed.
195
+
72
196
73
197
Language maintainers
74
198
--------------------
75
199
76
200
No one can really be proficient in all programming languages. If you would like
77
201
to maintain snippets for a language, please get in touch.
78
202
203
+ Notes: People are interested in snippets - and their interest may wane again.
204
+ This list is kept up-to-date on a best effort basis.
205
+
79
206
* Python - [ honza] ( http://github.com/honza )
80
207
* Javascript - [ honza] ( http://github.com/honza )
81
208
* HTML Django - [ honza] ( http://github.com/honza )
82
209
* Markdown - [ honza] ( http://github.com/honza )
83
210
* Ruby - [ taq] ( http://github.com/taq )
84
211
* PHP - [ chrisyue] ( http://github.com/chrisyue )
85
-
86
- Contributing notes
87
- ------------------
88
-
89
- Until further work is done on ` vim-snipmate ` , please don't add folding markers
90
- into snippets. ` vim-snipmate ` has some comments about how to patch all snippets
91
- on the fly adding those.
92
-
93
- Because MarcWeber/UltiSnips [ 6] supports also snipmate-snippets there is no
94
- need to duplicate all snippets - only those snippets who use advanced UltiSnips
95
- features should be duplicated in UltiSnips (?)
96
-
97
- Currently all snippets from UltiSnips have been put into UltiSnips - some work
98
- on merging should be done (dropping duplicates etc)
99
-
100
- Authors
101
- -------
102
-
103
- For a list of authors, please see the ` AUTHORS ` files.
212
+ * Scala - [ gorodinskiy] ( https://github.com/gorodinskiy )
213
+ * Falcon - [ steveno] ( https://github.com/steveno )
214
+ * Elixir - [ iurifq] ( https://github.com/iurifq )
104
215
105
216
License
106
217
-------
@@ -113,6 +224,4 @@ terms of the MIT license.
113
224
[ 2 ] : http://github.com/msanders
114
225
[ 3 ] : http://github.com/garbas
115
226
[ 4 ] : http://github.com/garbas/vim-snipmate
116
- [ 5 ] : http://github.com/Shougo/neosnippet
117
- [ 6 ] : http://github.com/MarcWeber/UltiSnips
118
227
[ 7 ] : http://github.com/SirVer/ultisnips
0 commit comments