2012-03-11 12:30:05 -04:00
|
|
|
*UltiSnips.txt* For Vim version 7.0 or later.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The Ultimate Plugin for Snippets in Vim~
|
2009-07-13 04:46:14 -04:00
|
|
|
|
|
|
|
UltiSnips *snippet* *snippets* *UltiSnips*
|
|
|
|
|
2010-08-20 04:04:55 -04:00
|
|
|
1. Description |UltiSnips-description|
|
2012-03-10 15:41:47 -05:00
|
|
|
1.1 Requirements |UltiSnips-requirements|
|
|
|
|
1.2 Acknowledgments |UltiSnips-acknowledgments|
|
2012-02-06 04:03:58 -05:00
|
|
|
2. Installation and Updating |UltiSnips-installnupdate|
|
2010-09-22 07:01:04 -04:00
|
|
|
3. Settings & Commands |UltiSnips-settings|
|
|
|
|
3.1 Commands |UltiSnips-commands|
|
2011-03-31 01:40:56 -04:00
|
|
|
3.2 Triggers |UltiSnips-triggers|
|
2012-09-06 13:38:41 -04:00
|
|
|
3.2.1 Using your own trigger functions |UltiSnips-trigger-functions|
|
2015-07-12 01:17:35 -04:00
|
|
|
3.2.2 Custom autocommands |UltiSnips-custom-autocommands|
|
|
|
|
3.2.3 Path to Python Module |UltiSnips-python-module-path|
|
2011-03-31 01:40:56 -04:00
|
|
|
3.3 Snippet Search Path |UltiSnips-snippet-search-path|
|
|
|
|
3.4 Warning About Select Mode Mappings |UltiSnips-warning-smappings|
|
|
|
|
3.5 Functions |UltiSnips-functions|
|
2014-02-19 15:04:52 -05:00
|
|
|
3.5.1 UltiSnips#AddSnippetWithPriority |UltiSnips#AddSnippetWithPriority|
|
2014-02-11 01:56:56 -05:00
|
|
|
3.5.2 UltiSnips#Anon |UltiSnips#Anon|
|
|
|
|
3.5.3 UltiSnips#SnippetsInCurrentScope |UltiSnips#SnippetsInCurrentScope|
|
2012-09-01 14:13:56 -04:00
|
|
|
3.6 Missing python support |UltiSnips-python-warning|
|
2010-08-20 04:04:55 -04:00
|
|
|
4. Syntax |UltiSnips-syntax|
|
2009-07-17 17:00:59 -04:00
|
|
|
4.1 Adding Snippets |UltiSnips-adding-snippets|
|
2011-03-31 02:01:32 -04:00
|
|
|
4.1.1 Character Escaping |UltiSnips-character-escaping|
|
2010-08-20 04:20:22 -04:00
|
|
|
4.2 Plaintext Snippets |UltiSnips-plaintext-snippets|
|
2012-01-11 15:33:16 -05:00
|
|
|
4.3 Visual Placeholder |UltiSnips-visual-placeholder|
|
|
|
|
4.4 Interpolation |UltiSnips-interpolation|
|
|
|
|
4.4.1 Shellcode |UltiSnips-shellcode|
|
|
|
|
4.4.2 VimScript |UltiSnips-vimscript|
|
|
|
|
4.4.3 Python |UltiSnips-python|
|
|
|
|
4.4.4 Global Snippets |UltiSnips-globals|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.5 Tabstops and Placeholders |UltiSnips-tabstops|
|
2009-07-15 14:11:47 -04:00
|
|
|
4.6 Mirrors |UltiSnips-mirrors|
|
|
|
|
4.7 Transformations |UltiSnips-transformations|
|
2009-07-15 15:06:11 -04:00
|
|
|
4.7.1 Replacement String |UltiSnips-replacement-string|
|
|
|
|
4.7.2 Demos |UltiSnips-demos|
|
A "clearsnippets" feature
=========================
It's difficult for the user to control which of the default
bundled snippets are active in his environment. The
'runtimepath' variable must be set to the root of the ultisnips
installation, which brings in all of the bundled snippets.
Though the user may individually override the definition of the
bundled snippets using the "!" flag, the method has a couple of
problems:
- There's no way to remove a snippet, only to override it (and
each snippet must be overridden individually).
- The "!" flag currently doesn't remove the overridden snippets
from the "list snippets" command.
It might be considered a feature that "!" doesn't actually
remove the snippets from the "list snippets" command, though
perhaps that's an unintended effect. In any case, it would be
more convenient to allow the user to selectively remove the
bundled snippets from his environment.
A patch is provided in the following branch to address these problems:
http://code.launchpad.net/~drmikehenry/ultisnips/clearsnippets
The branch's primary purpose is the addition of a
"clearsnippets" command that may be placed in a user's
~/.vim/UltiSnips/ft.snippets file. The user may clear all
lower-priority snippet for that file type with the line:
clearsnippets
Alternatively, he may clear individual snippets by listing their
triggers:
clearsnippets trigger1 trigger2
A few changes were made to the testing system as part of the
incorporation of this new feature. These changes include:
- The "extends" directive is now supported on multiple lines
throughout file.
- A completely empty .snippets file is now possible.
- The test.py scripts now handles most of the vim setup,
simplifying the running of the tests. The invocation of Vim
now reduces to:
vim -u NONE
Instructions for running the tests are included at top of
test.py, where they should be more visible to interested
users; UltiSnips.vim now just points to test.py's
instructions.
- A new function vim_quote() encodes an arbitrary string into a
singly-quoted Vim string, with embedded quotes escaped.
- SnippetsFileParser() now allows file_data to be passed
directly for unit testing, avoiding the need to create files
in the filesystem for test purposes.
- A new _error() function reports errors to the user. At
runtime, this function uses :echo_err in general, but also can
append error text to current buffer to check for expected
errors during unit tests.
- Added error checks to snippets file parsing, along with unit
tests for the parsing.
- Increased retries from 2 to 4 (on my system, occasionally the
timing still causes tests to fail).
2009-09-08 20:15:10 -04:00
|
|
|
4.8 Clearing snippets |UltiSnips-clearing-snippets|
|
2015-04-16 07:40:53 -04:00
|
|
|
4.9 Context snippets |UltiSnips-context-snippets|
|
2015-05-04 14:17:58 -04:00
|
|
|
4.10 Snippet actions |UltiSnips-snippet-actions|
|
|
|
|
4.10.1 Pre-expand actions |UltiSnips-pre-expand-actions|
|
|
|
|
4.10.2 Post-expand actions |UltiSnips-post-expand-actions|
|
|
|
|
4.10.3 Post-jump actions |UltiSnips-post-jump-actions|
|
2014-02-23 05:19:11 -05:00
|
|
|
5. UltiSnips and Other Plugins |UltiSnips-other-plugins|
|
2014-03-05 13:02:30 -05:00
|
|
|
5.1 Existing Integrations |UltiSnips-integrations|
|
|
|
|
5.2 Extending UltiSnips |UltiSnips-extending|
|
2013-03-25 04:07:49 -04:00
|
|
|
6. Helping Out |UltiSnips-helping|
|
|
|
|
7. Contact |UltiSnips-contact|
|
|
|
|
8. Contributors |UltiSnips-contributors|
|
2009-07-13 04:46:14 -04:00
|
|
|
|
|
|
|
This plugin only works if 'compatible' is not set.
|
|
|
|
{Vi does not have any of these features}
|
2012-03-10 15:41:47 -05:00
|
|
|
{only available when |+python| or |+python3| have been enabled at compile time}
|
2009-07-13 04:46:14 -04:00
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
==============================================================================
|
|
|
|
1. Description *UltiSnips-description*
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
UltiSnips provides snippet management for the Vim editor. A snippet is a short
|
|
|
|
piece of text that is either re-used often or contains a lot of redundant
|
|
|
|
text. UltiSnips allows you to insert a snippet with only a few key strokes.
|
|
|
|
Snippets are common in structured text like source code but can also be used
|
|
|
|
for general editing like, for example, inserting a signature in an email or
|
|
|
|
inserting the current date in a text file.
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
On my blog, http://www.sirver.net, I posted several short screencasts, which
|
|
|
|
make a great introduction to UltiSnips, illustrating its features and usage.
|
2012-01-08 15:14:31 -05:00
|
|
|
|
|
|
|
http://www.sirver.net/blog/2011/12/30/first-episode-of-ultisnips-screencast/
|
|
|
|
http://www.sirver.net/blog/2012/01/08/second-episode-of-ultisnips-screencast/
|
2012-02-05 08:44:58 -05:00
|
|
|
http://www.sirver.net/blog/2012/02/05/third-episode-of-ultisnips-screencast/
|
2012-03-31 10:40:12 -04:00
|
|
|
http://www.sirver.net/blog/2012/03/31/fourth-episode-of-ultisnips-screencast/
|
2012-01-08 15:14:31 -05:00
|
|
|
|
2015-07-18 12:05:36 -04:00
|
|
|
Also the excellent [Vimcasts](http://vimcats.org) dedicated three episodes to
|
|
|
|
UltiSnips:
|
|
|
|
|
|
|
|
http://vimcasts.org/episodes/meet-ultisnips/
|
|
|
|
http://vimcasts.org/episodes/ultisnips-python-interpolation/
|
|
|
|
http://vimcasts.org/episodes/ultisnips-visual-placeholder/
|
2012-01-08 15:14:31 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
1.1 Requirements *UltiSnips-requirements*
|
|
|
|
----------------
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2015-04-18 11:15:05 -04:00
|
|
|
This plugin works with Vim version 7.4 or later. It only works if the
|
2012-03-10 15:41:47 -05:00
|
|
|
'compatible' setting is not set.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2015-04-18 11:15:05 -04:00
|
|
|
This plugin is tested against Python 2.7, 3.3 or 3.4. All other versions are
|
|
|
|
unsupported, but might work.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The Python 2.x or Python 3.x interface must be available. In other words, Vim
|
|
|
|
must be compiled with either the |+python| feature or the |+python3| feature.
|
|
|
|
The following commands show how to test if you have python compiled in Vim.
|
|
|
|
They print '1' if the python version is compiled in, '0' if not.
|
|
|
|
|
|
|
|
Test if Vim is compiled with python version 2.x: >
|
|
|
|
:echo has("python")
|
2013-04-15 01:19:07 -04:00
|
|
|
The python version Vim is linked against can be found with: >
|
2012-10-25 01:18:27 -04:00
|
|
|
:py import sys; print(sys.version)
|
2009-07-13 06:28:58 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Test if Vim is compiled with python version 3.x: >
|
|
|
|
:echo has("python3")
|
2013-04-15 01:19:07 -04:00
|
|
|
The python version Vim is linked against can be found with: >
|
2012-10-25 01:18:27 -04:00
|
|
|
:py3 import sys; print(sys.version)
|
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
Note that Vim is maybe not using your system-wide installed python version, so
|
2012-10-25 01:18:27 -04:00
|
|
|
make sure to check the Python version inside of Vim.
|
2009-07-13 06:28:58 -04:00
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
UltiSnips attempts to auto-detect which python version is compiled into Vim.
|
2012-03-10 15:41:47 -05:00
|
|
|
Unfortunately, in some versions of Vim this detection does not work.
|
|
|
|
In that case you have to explicitly tell UltiSnips which version to use using
|
|
|
|
the 'UltiSnipsUsePythonVersion' global variable.
|
|
|
|
|
|
|
|
To use python version 2.x: >
|
|
|
|
let g:UltiSnipsUsePythonVersion = 2
|
|
|
|
|
|
|
|
To use python version 3.x: >
|
|
|
|
let g:UltiSnipsUsePythonVersion = 3
|
|
|
|
|
|
|
|
|
|
|
|
1.2 Acknowledgments *UltiSnips-acknowledgments*
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
UltiSnips was inspired by the snippets feature of TextMate
|
|
|
|
(http://macromates.com/), the GUI text editor for Mac OS X. Managing snippets
|
|
|
|
in Vim is not new. I want to thank Michael Sanders, the author of snipMate,
|
|
|
|
for some implementation details I borrowed from his plugin and for the
|
|
|
|
permission to use his snippets.
|
|
|
|
|
|
|
|
|
|
|
|
=============================================================================
|
|
|
|
2. Installation and Updating *UltiSnips-installnupdate*
|
2012-02-08 10:28:39 -05:00
|
|
|
|
2014-02-15 07:16:12 -05:00
|
|
|
The recommended way of getting ultisnips is to track SirVer/ultisnips on
|
|
|
|
github. The master branch is always stable.
|
|
|
|
|
2012-01-10 12:11:35 -05:00
|
|
|
Using Pathogen: *UltiSnips-using-pathogen*
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
If you are a pathogen user, you can track the official mirror of UltiSnips on
|
|
|
|
github: >
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2015-07-11 12:48:44 -04:00
|
|
|
$ cd ~/.vim/bundle && git clone git://github.com/SirVer/ultisnips.git
|
2012-01-10 12:11:35 -05:00
|
|
|
|
2014-03-04 11:54:30 -05:00
|
|
|
If you also want the default snippets, also track >
|
|
|
|
|
2015-07-27 03:22:05 -04:00
|
|
|
$ cd ~/.vim/bundle && git clone git://github.com/honza/vim-snippets.git
|
2014-03-04 11:54:30 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
See the pathogen documentation for more details on how to update a bundle.
|
|
|
|
|
2012-01-10 12:11:35 -05:00
|
|
|
|
2014-02-15 07:16:12 -05:00
|
|
|
Using a downloaded packet: *UltiSnips-using-a-downloaded-packet*
|
2009-07-13 06:28:58 -04:00
|
|
|
|
2014-02-15 07:16:12 -05:00
|
|
|
Download the packet and unpack into a directory of your choice. Then add this
|
|
|
|
directory to your Vim runtime path by adding this line to your vimrc file. >
|
2009-07-13 04:46:14 -04:00
|
|
|
set runtimepath+=~/.vim/ultisnips_rep
|
|
|
|
|
2012-10-23 13:14:00 -04:00
|
|
|
UltiSnips also needs that Vim sources files from the ftdetect/ directory.
|
|
|
|
Unfortunately, Vim only allows this directory in the .vim directory. You
|
|
|
|
therefore have to symlink/copy the files: >
|
|
|
|
mkdir -p ~/.vim/ftdetect/
|
|
|
|
ln -s ~/.vim/ultisnips_rep/ftdetect/* ~/.vim/ftdetect/
|
2012-10-17 04:13:34 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Restart Vim and UltiSnips should work. To access the help, use >
|
2009-07-15 10:28:33 -04:00
|
|
|
:helptags ~/.vim/ultisnips_rep/doc
|
|
|
|
:help UltiSnips
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2014-03-04 11:54:30 -05:00
|
|
|
UltiSnips comes without snippets. The default snippets can be found here:
|
|
|
|
https://github.com/honza/vim-snippets
|
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
=============================================================================
|
2012-03-10 15:41:47 -05:00
|
|
|
3. Settings & Commands *UltiSnips-settings*
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2010-09-22 07:01:04 -04:00
|
|
|
3.1 Commands *UltiSnips-commands*
|
|
|
|
------------
|
2011-04-27 14:51:04 -04:00
|
|
|
*:UltiSnipsEdit*
|
2014-03-06 03:10:48 -05:00
|
|
|
The UltiSnipsEdit command opens a private snippet definition file for the
|
|
|
|
current filetype. If no snippet file exists, a new file is created. If used as
|
|
|
|
UltiSnipsEdit! all public snippet files are taken into account too. If
|
|
|
|
multiple files match the search, the user gets to choose the file.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
There are several variables associated with the UltiSnipsEdit command.
|
|
|
|
|
|
|
|
*g:UltiSnipsEditSplit*
|
2013-04-15 01:19:07 -04:00
|
|
|
g:UltiSnipsEditSplit Defines how the edit window is opened. Possible
|
2012-03-10 15:41:47 -05:00
|
|
|
values:
|
|
|
|
|normal| Default. Opens in the current window.
|
|
|
|
|horizontal| Splits the window horizontally.
|
|
|
|
|vertical| Splits the window vertically.
|
2014-08-28 08:34:33 -04:00
|
|
|
|context| Splits the window vertically or
|
|
|
|
horizontally depending on context.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
*g:UltiSnipsSnippetsDir*
|
|
|
|
g:UltiSnipsSnippetsDir
|
|
|
|
Defines the directory private snippet definition
|
|
|
|
files are stored in. For example, if the variable
|
|
|
|
is set to "~/.vim/mydir/UltiSnips" and the current
|
|
|
|
'filetype' is "cpp", then :UltiSnipsEdit will open
|
2014-02-26 14:40:01 -05:00
|
|
|
"~/.vim/mydir/UltiSnips/cpp.snippets". Note that
|
|
|
|
directories named "snippets" are reserved for
|
|
|
|
snipMate snippets and cannot be used.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2014-12-06 12:43:46 -05:00
|
|
|
*g:UltiSnipsSnippetDirectories*
|
|
|
|
g:UltiSnipsSnippetDirectories
|
|
|
|
Defines the directories for looking for snippets.
|
|
|
|
Do not mix up this variable with previous one.
|
|
|
|
More information about that variable can
|
|
|
|
be found at section |UltiSnips-snippet-search-path|.
|
|
|
|
|
2014-12-06 12:53:19 -05:00
|
|
|
*g:UltiSnipsEnableSnipMate*
|
|
|
|
g:UltiSnipsEnableSnipMate
|
|
|
|
Enable looking for SnipMate snippets in
|
|
|
|
&runtimepath. UltiSnips will search only for
|
|
|
|
directories named 'snippets' while looking for
|
|
|
|
SnipMate snippets. Defaults to "1", so UltiSnips
|
|
|
|
will look for SnipMate snippets.
|
|
|
|
|
2014-03-06 03:10:48 -05:00
|
|
|
|
2012-04-01 10:42:34 -04:00
|
|
|
*:UltiSnipsAddFiletypes*
|
|
|
|
The UltiSnipsAddFiletypes command allows for explicit merging of other snippet
|
2013-04-15 01:19:07 -04:00
|
|
|
filetypes for the current buffer. For example, if you edit a .rst file but
|
2012-04-01 10:42:34 -04:00
|
|
|
also want the Lua snippets to be available you can issue the command >
|
|
|
|
|
|
|
|
:UltiSnipsAddFiletypes rst.lua
|
|
|
|
|
|
|
|
using the dotted filetype syntax. Order is important, the first filetype in
|
|
|
|
this list will be the one used for UltiSnipsEdit and the list is
|
|
|
|
ordered by evaluation priority. Consequently, you might add this to your
|
|
|
|
ftplugin/rails.vim >
|
|
|
|
|
|
|
|
:UltiSnipsAddFiletypes rails.ruby
|
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
I mention rails first because I want to edit rails snippets when using
|
|
|
|
UltiSnipsEdit and because rails snippets should overwrite equivalent ruby
|
2012-04-01 10:42:34 -04:00
|
|
|
snippets. The priority will now be rails -> ruby -> all. If you have some
|
|
|
|
special programming snippets that should have lower priority than your ruby
|
|
|
|
snippets you can call >
|
|
|
|
|
|
|
|
:UltiSnipsAddFiletypes ruby.programming
|
|
|
|
|
|
|
|
The priority will then be rails -> ruby -> programming -> all.
|
2010-09-22 07:01:04 -04:00
|
|
|
|
2011-03-31 01:40:56 -04:00
|
|
|
3.2 Triggers *UltiSnips-triggers*
|
|
|
|
------------
|
2010-09-22 07:01:04 -04:00
|
|
|
|
2014-10-08 09:08:33 -04:00
|
|
|
*g:UltiSnipsExpandTrigger* *g:UltiSnipsListSnippets*
|
|
|
|
*g:UltiSnipsJumpForwardTrigger* *g:UltiSnipsJumpBackwardTrigger*
|
2012-03-10 15:41:47 -05:00
|
|
|
You can define the keys used to trigger UltiSnips actions by setting global
|
|
|
|
variables. Variables define the keys used to expand a snippet, jump forward
|
|
|
|
and jump backwards within a snippet, and list all available snippets in the
|
2014-11-24 11:32:10 -05:00
|
|
|
current expand context. Be advised, that some terminal emulators don't send
|
|
|
|
<c-tab> to the running program. The variables with their default values are: >
|
2009-07-21 04:21:05 -04:00
|
|
|
g:UltiSnipsExpandTrigger <tab>
|
2009-08-16 14:55:08 -04:00
|
|
|
g:UltiSnipsListSnippets <c-tab>
|
2009-07-21 04:21:05 -04:00
|
|
|
g:UltiSnipsJumpForwardTrigger <c-j>
|
|
|
|
g:UltiSnipsJumpBackwardTrigger <c-k>
|
|
|
|
|
2014-02-16 08:02:06 -05:00
|
|
|
UltiSnips will only map the jump triggers while a snippet is active to
|
2014-07-20 12:05:30 -04:00
|
|
|
interfere as little as possible with other mappings.
|
2014-02-16 08:02:06 -05:00
|
|
|
|
|
|
|
The default value for g:UltiSnipsJumpBackwardTrigger interferes with the
|
|
|
|
built-in complete function: |i_CTRL-X_CTRL-K|. A workaround is to add the
|
|
|
|
following to your vimrc file or switching to a plugin like Supertab or
|
|
|
|
YouCompleteMe. >
|
2013-10-05 12:19:20 -04:00
|
|
|
inoremap <c-x><c-k> <c-x><c-k>
|
|
|
|
|
2012-09-06 13:38:41 -04:00
|
|
|
3.2.1 Using your own trigger functions *UltiSnips-trigger-functions*
|
|
|
|
--------------------------------------
|
|
|
|
|
2013-01-22 01:03:06 -05:00
|
|
|
For advanced users there are four functions that you can map directly to a
|
2012-09-06 13:38:41 -04:00
|
|
|
key and that correspond to some of the triggers previously defined:
|
2014-02-11 01:56:56 -05:00
|
|
|
g:UltiSnipsExpandTrigger <--> UltiSnips#ExpandSnippet
|
|
|
|
g:UltiSnipsJumpForwardTrigger <--> UltiSnips#JumpForwards
|
|
|
|
g:UltiSnipsJumpBackwardTrigger <--> UltiSnips#JumpBackwards
|
2012-09-06 13:38:41 -04:00
|
|
|
|
|
|
|
If you have g:UltiSnipsExpandTrigger and g:UltiSnipsJumpForwardTrigger set
|
2013-04-15 01:19:07 -04:00
|
|
|
to the same value then the function you are actually going to use is
|
2014-02-11 01:56:56 -05:00
|
|
|
UltiSnips#ExpandSnippetOrJump.
|
2012-09-06 13:38:41 -04:00
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
Each time any of the functions UltiSnips#ExpandSnippet,
|
2014-11-30 16:06:41 -05:00
|
|
|
UltiSnips#ExpandSnippetOrJump, UltiSnips#JumpForwards or
|
|
|
|
UltiSnips#JumpBackwards is called a global variable is set that contains the
|
|
|
|
return value of the corresponding function.
|
2012-09-06 13:38:41 -04:00
|
|
|
|
|
|
|
The corresponding variables and functions are:
|
2014-02-11 01:56:56 -05:00
|
|
|
UltiSnips#ExpandSnippet --> g:ulti_expand_res (0: fail, 1: success)
|
|
|
|
UltiSnips#ExpandSnippetOrJump --> g:ulti_expand_or_jump_res (0: fail,
|
2012-09-06 13:38:41 -04:00
|
|
|
1: expand, 2: jump)
|
2014-02-11 01:56:56 -05:00
|
|
|
UltiSnips#JumpForwards --> g:ulti_jump_forwards_res (0: fail, 1: success)
|
|
|
|
UltiSnips#JumpBackwards --> g:ulti_jump_backwards_res (0: fail, 1: success)
|
2012-09-06 13:38:41 -04:00
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
To see how these return values may come in handy, suppose that you want to map
|
2012-09-06 13:38:41 -04:00
|
|
|
a key to expand or jump, but if none of these actions is successful you want
|
2013-04-15 01:19:07 -04:00
|
|
|
to call another function. UltiSnips already does this automatically for
|
|
|
|
supertab, but this allows you individual fine tuning of your Tab key usage.
|
2012-09-06 13:38:41 -04:00
|
|
|
|
|
|
|
Usage is as follows: You define a function >
|
|
|
|
|
|
|
|
let g:ulti_expand_or_jump_res = 0 "default value, just set once
|
|
|
|
function! Ulti_ExpandOrJump_and_getRes()
|
2014-02-11 01:56:56 -05:00
|
|
|
call UltiSnips#ExpandSnippetOrJump()
|
2012-09-06 13:38:41 -04:00
|
|
|
return g:ulti_expand_or_jump_res
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
then you define your mapping as >
|
|
|
|
|
|
|
|
inoremap <NL> <C-R>=(Ulti_ExpandOrJump_and_getRes() > 0)?"":IMAP_Jumpfunc('', 0)<CR>
|
|
|
|
|
|
|
|
and if the you can't expand or jump from the current location then the
|
|
|
|
alternative function IMAP_Jumpfunc('', 0) is called.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2015-07-12 01:17:35 -04:00
|
|
|
3.2.2 Custom autocommands *UltiSnips-custom-autocommands*
|
|
|
|
-------------------------
|
|
|
|
|
2015-07-13 01:14:54 -04:00
|
|
|
Note Autocommands must *not* change the buffer in any way. If lines are added,
|
|
|
|
deleted, or modified it will confuse UltiSnips which might scramble your
|
|
|
|
snippets contents.
|
|
|
|
|
2015-07-12 01:17:35 -04:00
|
|
|
*UltiSnipsEnterFirstSnippet* *UltiSnipsExitLastSnippet*
|
|
|
|
For maximum compatibility with other plug-ins, UltiSnips sets up some special
|
|
|
|
state, include mappings and autocommands, when a snippet starts being
|
|
|
|
expanded, and tears them down once the last snippet has been exited. In order
|
|
|
|
to make it possible to override these "inner" settings, it fires the following
|
|
|
|
"User" autocommands:
|
|
|
|
|
|
|
|
UltiSnipsEnterFirstSnippet
|
|
|
|
UltiSnipsExitLastSnippet
|
|
|
|
|
|
|
|
For example, to call a pair of custom functions in response to these events,
|
|
|
|
you might do: >
|
|
|
|
|
|
|
|
autocmd! User UltiSnipsEnterFirstSnippet
|
|
|
|
autocmd User UltiSnipsEnterFirstSnippet call CustomInnerKeyMapper()
|
|
|
|
autocmd! User UltiSnipsExitLastSnippet
|
|
|
|
autocmd User UltiSnipsExitLastSnippet call CustomInnerKeyUnmapper()
|
|
|
|
|
|
|
|
Note that snippet expansion may be nested, in which case
|
|
|
|
|UltiSnipsEnterFirstSnippet| will fire only as the first (outermost) snippet
|
|
|
|
is entered, and |UltiSnipsExitLastSnippet| will only fire once the last
|
|
|
|
(outermost) snippet have been exited.
|
|
|
|
|
|
|
|
|
2015-07-13 01:14:54 -04:00
|
|
|
|
2015-07-12 01:17:35 -04:00
|
|
|
3.2.3 Path to Python module *UltiSnips-python-module-path*
|
2013-02-08 12:57:29 -05:00
|
|
|
---------------------------
|
|
|
|
|
2013-02-18 14:41:54 -05:00
|
|
|
For even more advanced usage, you can directly write python functions using
|
|
|
|
UltiSnip's python modules.
|
2013-02-08 12:57:29 -05:00
|
|
|
|
2013-02-18 14:41:54 -05:00
|
|
|
Here is a small example funtion that expands a snippet: >
|
2013-02-08 12:57:29 -05:00
|
|
|
|
|
|
|
function! s:Ulti_ExpandSnip()
|
|
|
|
Python << EOF
|
|
|
|
import sys, vim
|
|
|
|
from UltiSnips import UltiSnips_Manager
|
|
|
|
UltiSnips_Manager.expand()
|
|
|
|
EOF
|
|
|
|
return ""
|
|
|
|
endfunction
|
|
|
|
|
2011-03-31 01:40:56 -04:00
|
|
|
3.3 Snippet Search Path *UltiSnips-snippet-search-path*
|
|
|
|
-----------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
UltiSnips snippet definition files are stored in one or more directories.
|
2013-04-15 01:19:07 -04:00
|
|
|
There are several variables used to indicate those directories and to define
|
|
|
|
how UltiSnips loads snippets.
|
2011-03-31 01:40:56 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Snippet definition files are stored in snippet directories. A snippet
|
|
|
|
directory must be a subdirectory of a directory defined in the 'runtimepath'
|
|
|
|
option. The variable g:UltiSnipsSnippetDirectories defines a list of names
|
2014-02-26 14:40:01 -05:00
|
|
|
used for snippet directories. Note that "snippets" is reserved for snipMate
|
|
|
|
snippets and cannot be used. The default is shown below. >
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2014-02-26 02:23:01 -05:00
|
|
|
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
|
2011-08-28 15:47:31 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
UltiSnips will search each 'runtimepath' directory for the subdirectory names
|
|
|
|
defined in g:UltiSnipsSnippetDirectories in the order they are defined. For
|
|
|
|
example, if you keep your snippets in a .vim subdirectory called
|
|
|
|
"mycoolsnippets" and you want to make use of the default snippets that come
|
|
|
|
with UltiSnips, add the following to your vimrc file. >
|
2011-03-31 01:40:56 -04:00
|
|
|
let g:UltiSnipsSnippetDirectories=["UltiSnips", "mycoolsnippets"]
|
2014-02-26 02:23:01 -05:00
|
|
|
If you do not want to use the third party snippets that come with plugins,
|
|
|
|
define the variable accordingly: >
|
2012-03-10 15:41:47 -05:00
|
|
|
let g:UltiSnipsSnippetDirectories=["mycoolsnippets"]
|
|
|
|
|
2013-06-19 02:00:52 -04:00
|
|
|
You can also redefine the search path on a buffer by buffer basis by setting
|
2014-02-19 15:22:01 -05:00
|
|
|
the variable b:UltiSnipsSnippetDirectories. This variable takes precedence
|
2013-06-19 02:00:52 -04:00
|
|
|
over the global variable.
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|UltiSnips-adding-snippets| explains which files are parsed for a given filetype.
|
|
|
|
|
2014-12-06 12:43:46 -05:00
|
|
|
If only one directory is specified in this variable and this directory is
|
|
|
|
specified by absolute path, UltiSnips will not look for snippets in
|
|
|
|
&runtimepath, which can lead to significant speedup. So, the common case is:
|
|
|
|
|
|
|
|
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips']
|
|
|
|
|
|
|
|
However, you will not able to use snippets that are shipped with third party
|
|
|
|
plugins out of the box. You'll need to copy them into your chosen directory.
|
|
|
|
|
2011-03-31 01:40:56 -04:00
|
|
|
|
|
|
|
3.4 Warning About Select Mode Mappings *UltiSnips-warning-smappings*
|
2010-08-20 04:20:22 -04:00
|
|
|
--------------------------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Vim's help document for |mapmode-s| states: >
|
2010-08-20 04:20:22 -04:00
|
|
|
NOTE: Mapping a printable character in Select mode may confuse the user.
|
|
|
|
It's better to explicitly use :xmap and :smap for printable characters. Or
|
|
|
|
use :sunmap after defining the mapping.
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
However, most Vim plugins, including some default Vim plugins, do not adhere
|
|
|
|
to this. UltiSnips uses Select mode to mark tabstops in snippets for
|
|
|
|
overwriting. Existing Visual+Select mode mappings will interfere. Therefore,
|
|
|
|
UltiSnips issues a |:sunmap| command to remove each Select mode mapping for
|
|
|
|
printable characters. No other mappings are touched. In particular, UltiSnips
|
|
|
|
does not change existing normal, insert or visual mode mappings.
|
2010-08-20 04:20:22 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
If this behavior is not desired, you can disable it by adding this line to
|
|
|
|
your vimrc file. >
|
2010-08-20 04:20:22 -04:00
|
|
|
let g:UltiSnipsRemoveSelectModeMappings = 0
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
If you want to disable this feature for specific mappings only, add them to
|
|
|
|
the list of mappings to be ignored. For example, the following lines in your
|
|
|
|
vimrc file will unmap all Select mode mappings except those mappings
|
|
|
|
containing either the string "somePlugin" or the string "otherPlugin" in its
|
|
|
|
complete definition as listed by the |:smap| command. >
|
2010-08-20 04:20:22 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
let g:UltiSnipsRemoveSelectModeMappings = 1
|
|
|
|
let g:UltiSnipsMappingsToIgnore = [ "somePlugin", "otherPlugin" ]
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2011-03-31 01:40:56 -04:00
|
|
|
3.5 Functions *UltiSnips-functions*
|
2010-12-20 21:49:55 -05:00
|
|
|
-------------
|
|
|
|
|
2013-09-10 00:29:02 -04:00
|
|
|
UltiSnips provides some functions for extending core functionality.
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
3.5.1 UltiSnips#AddSnippetWithPriority *UltiSnips#AddSnippetWithPriority*
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
The first function is UltiSnips#AddSnippetWithPriority(trigger, value, description,
|
|
|
|
options, filetyp, priority). It adds a new snippet with the provided trigger, value,
|
2012-03-10 15:41:47 -05:00
|
|
|
description, and options to the current list of snippets. See
|
2014-02-19 15:04:52 -05:00
|
|
|
|UltiSnips-syntax| for details on the meaning of the function arguments. The
|
|
|
|
Priority is a number that defines which snippet should be preferred over
|
|
|
|
others. See the priority keyword in|UltiSnips-add-snippets|.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
3.5.2 UltiSnips#Anon *UltiSnips#Anon*
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
The second function is UltiSnips#Anon(value, ...). It expands an anonymous
|
2012-03-10 15:41:47 -05:00
|
|
|
snippet. Anonymous snippets are defined on the spot, expanded and immediately
|
|
|
|
discarded again. Anonymous snippets are not added to the global list of
|
|
|
|
snippets, so they cannot be expanded a second time unless the function is
|
|
|
|
called again. The function takes three optional arguments, in order: trigger,
|
|
|
|
description, options. Arguments coincide with the arguments of the
|
2014-02-19 15:04:52 -05:00
|
|
|
|UltiSnips#AddSnippetWithPriority| function of the same name. The trigger and
|
|
|
|
options arguments can change the way the snippet expands. The description is
|
|
|
|
unused at this point.
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
An example use case might be this line from a reStructuredText plugin file:
|
2011-07-26 10:21:57 -04:00
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
inoremap <silent> $$ $$<C-R>=UltiSnips#Anon(':latex:\`$1\`', '$$')<cr>
|
2011-07-26 10:21:57 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
This expands the snippet whenever two $ signs are typed.
|
2013-04-15 01:19:07 -04:00
|
|
|
Note: The right-hand side of the mapping starts with an immediate retype of
|
2012-03-10 15:41:47 -05:00
|
|
|
the '$$' trigger and passes '$$' to the function as the trigger argument.
|
|
|
|
This is required in order for UltiSnips to have access to the characters
|
|
|
|
typed so it can determine if the trigger matches or not.
|
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
3.5.3 UltiSnips#SnippetsInCurrentScope *UltiSnips#SnippetsInCurrentScope*
|
2013-06-10 12:27:48 -04:00
|
|
|
|
2014-02-11 01:56:56 -05:00
|
|
|
A third function is UltiSnips#SnippetsInCurrentScope which is the equivalent
|
2013-06-10 12:27:48 -04:00
|
|
|
of snipmate GetSnipsInCurrentScope function.
|
|
|
|
This function simply returns a vim dictionary with the snippets whose trigger
|
|
|
|
matches the current word.
|
|
|
|
This function does not add any new functionality to ultisnips directly but
|
|
|
|
allows to use third party plugins to integrate the current available snippets.
|
|
|
|
|
|
|
|
An example of such third party plugin is SnippetCompleteSnipMate which uses
|
|
|
|
the function GetSnipsInCurrentScope to integrate the current available
|
|
|
|
snippets with user defined abbreviations and provides these and a completion
|
|
|
|
menu.
|
|
|
|
This script is located in
|
|
|
|
http://www.vim.org/scripts/script.php?script_id=4276.
|
|
|
|
Note: If you check the above website it lists two dependencies: the
|
|
|
|
SnippetComplete plugin and snipmate.
|
|
|
|
You do need the SnippetComplete plugin but you obviously don't need snipmate,
|
|
|
|
you just have to define the function GetSnipsInCurrentScope. Put the following
|
|
|
|
in your vimrc:
|
|
|
|
|
|
|
|
function! GetSnipsInCurrentScope()
|
2014-02-11 01:56:56 -05:00
|
|
|
return UltiSnips#SnippetsInCurrentScope()
|
2013-06-10 12:27:48 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
As a second example on how to use this function consider the following
|
|
|
|
function and mapping definition:
|
|
|
|
|
|
|
|
function! ExpandPossibleShorterSnippet()
|
2014-02-11 01:56:56 -05:00
|
|
|
if len(UltiSnips#SnippetsInCurrentScope()) == 1 "only one candidate...
|
|
|
|
let curr_key = keys(UltiSnips#SnippetsInCurrentScope())[0]
|
2013-06-10 12:27:48 -04:00
|
|
|
normal diw
|
|
|
|
exe "normal a" . curr_key
|
|
|
|
exe "normal a "
|
|
|
|
return 1
|
|
|
|
endif
|
|
|
|
return 0
|
|
|
|
endfunction
|
2014-02-11 01:56:56 -05:00
|
|
|
inoremap <silent> <C-L> <C-R>=(ExpandPossibleShorterSnippet() == 0? '': UltiSnips#ExpandSnippet())<CR>
|
2013-06-10 12:27:48 -04:00
|
|
|
|
|
|
|
If the trigger for your snippet is lorem, you type lor, and you have no other
|
|
|
|
snippets whose trigger matches lor then hitting <C-L> will expand to whatever
|
|
|
|
lorem expands to.
|
|
|
|
|
2010-12-20 21:49:55 -05:00
|
|
|
|
2012-09-01 14:13:56 -04:00
|
|
|
3.6 Warning about missing python support *UltiSnips-python-warning*
|
2012-08-06 15:45:48 -04:00
|
|
|
----------------------------------------
|
|
|
|
|
|
|
|
When UltiSnips is loaded, it will check that the running Vim was compiled with
|
|
|
|
python support. If no support is detected, a warning will be displayed and
|
2012-09-01 14:13:56 -04:00
|
|
|
loading of UltiSnips will be skipped.
|
2012-08-06 15:45:48 -04:00
|
|
|
|
|
|
|
If you would like to suppress this warning message, you may add the following
|
|
|
|
line to your vimrc file.
|
|
|
|
|
|
|
|
let g:UltiSnipsNoPythonWarning = 1
|
|
|
|
|
|
|
|
This may be useful if your Vim configuration files are shared across several
|
|
|
|
systems where some of them may not have Vim compiled with python support.
|
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
=============================================================================
|
2012-03-10 15:41:47 -05:00
|
|
|
4. Syntax *UltiSnips-syntax*
|
|
|
|
|
|
|
|
This chapter describes how to write your own snippets and snippet definition
|
|
|
|
syntax. Examples are used to help illustrate.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
4.1 Adding Snippets *UltiSnips-adding-snippets*
|
|
|
|
-------------------
|
|
|
|
|
2011-03-31 01:40:56 -04:00
|
|
|
See |UltiSnips-snippet-search-path| for an explanation of where directories
|
2012-03-10 15:41:47 -05:00
|
|
|
with snippet definitions should be located.
|
|
|
|
|
|
|
|
Using a strategy similar to how Vim detects |ftplugins|, UltiSnips iterates
|
|
|
|
over the snippet definition directories looking for files with names of the
|
2012-05-11 04:24:22 -04:00
|
|
|
following patterns: ft.snippets, ft_*.snippets, or ft/*, where "ft" is the
|
2012-03-10 15:41:47 -05:00
|
|
|
'filetype' of the current document and "*" is a shell-like wildcard matching
|
|
|
|
any string including the empty string. The following table shows some typical
|
|
|
|
snippet filenames and their associated filetype.
|
|
|
|
|
|
|
|
snippet filename filetype ~
|
|
|
|
ruby.snippets ruby
|
|
|
|
perl.snippets perl
|
|
|
|
c.snippets c
|
2012-05-11 04:24:22 -04:00
|
|
|
c_my.snippets c
|
2012-03-10 15:41:47 -05:00
|
|
|
c/a c
|
|
|
|
c/b.snippets c
|
|
|
|
all.snippets *all
|
|
|
|
all/a.snippets *all
|
|
|
|
|
|
|
|
* The 'all' filetype is unique. It represents snippets available for use when
|
|
|
|
editing any document regardless of the filetype. A date insertion snippet, for
|
2013-04-15 01:19:07 -04:00
|
|
|
example, would fit well in the all.snippets file.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2013-01-21 05:52:45 -05:00
|
|
|
UltiSnips understands Vim's dotted filetype syntax. For example, if you define
|
|
|
|
a dotted filetype for the CUDA C++ framework, e.g. ":set ft=cuda.cpp", then
|
2013-01-22 01:03:06 -05:00
|
|
|
UltiSnips will search for and activate snippets for both the cuda and cpp
|
2013-01-21 05:52:45 -05:00
|
|
|
filetypes.
|
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
The snippets file syntax is simple. All lines starting with a # character are
|
|
|
|
considered comments. Comments are ignored by UltiSnips. Use them to document
|
|
|
|
snippets.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
A line beginning with the keyword 'extends' provides a way of combining
|
|
|
|
snippet files. When the 'extends' directive is included in a snippet file, it
|
|
|
|
instructs UltiSnips to include all snippets from the indicated filetypes.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The syntax looks like this: >
|
2009-08-02 05:57:43 -04:00
|
|
|
extends ft1, ft2, ft3
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2009-08-02 05:57:43 -04:00
|
|
|
For example, the first line in cpp.snippets looks like this: >
|
|
|
|
extends c
|
2012-03-10 15:41:47 -05:00
|
|
|
When UltiSnips activates snippets for a cpp file, it first looks for all c
|
|
|
|
snippets and activates them as well. This is a convenient way to create
|
2014-02-19 15:04:52 -05:00
|
|
|
specialized snippet files from more general ones. Multiple 'extends' lines are
|
2012-03-10 15:41:47 -05:00
|
|
|
permitted in a snippet file, and they can be included anywhere in the file.
|
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
|
|
|
|
A line beginning with the keyword 'priority' sets the priority for all
|
|
|
|
snippets defined in the current file after this line. The default priority for
|
|
|
|
a file is always 0. When a snippet should be expanded, UltiSnips will collect
|
2014-02-23 05:19:11 -05:00
|
|
|
all snippet definitions from all sources that match the trigger and keep only
|
2014-02-19 15:04:52 -05:00
|
|
|
the ones with the highest priority. For example, all shipped snippets have a
|
|
|
|
priority < 0, so that user defined snippets always overwrite shipped snippets.
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
A line beginning with the keyword 'snippet' marks the beginning of snippet
|
|
|
|
definition and a line starting with the keyword 'endsnippet' marks the end.
|
|
|
|
The snippet definition is placed between the lines. Here is a snippet of an
|
|
|
|
'if' statement for the Unix shell (sh) filetype.
|
|
|
|
|
|
|
|
snippet if "if ... then (if)"
|
|
|
|
if ${2:[[ ${1:condition} ]]}; then
|
|
|
|
${0:#statements}
|
|
|
|
fi
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
The start line takes the following form: >
|
2009-08-02 05:57:43 -04:00
|
|
|
|
2009-07-17 17:33:48 -04:00
|
|
|
snippet tab_trigger [ "description" [ options ] ]
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The tab_trigger is required, but the description and options are optional.
|
|
|
|
|
|
|
|
The 'tab_trigger' is the word or string sequence used to trigger the snippet.
|
|
|
|
Generally a single word is used but the tab_trigger can include spaces. If you
|
|
|
|
wish to include spaces, you must wrap the tab trigger in quotes. >
|
|
|
|
|
2010-08-08 21:15:34 -04:00
|
|
|
snippet "tab trigger" [ "description" [ options ] ]
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The quotes are not part of the trigger. To activate the snippet type: tab trigger
|
|
|
|
followed by the snippet expand character.
|
|
|
|
|
|
|
|
It is not technically necessary to use quotes to wrap a trigger with spaces.
|
|
|
|
Any matching characters will do. For example, this is a valid snippet starting
|
|
|
|
line. >
|
|
|
|
snippet !tab trigger! [ "description" [ options ] ]
|
|
|
|
|
|
|
|
Quotes can be included as part of the trigger by wrapping the trigger in
|
|
|
|
another character. >
|
2010-08-08 21:15:34 -04:00
|
|
|
snippet !"tab trigger"! [ "description" [ options ] ]
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
To activate this snippet one would type: "tab trigger"
|
|
|
|
|
|
|
|
The 'description' is a string describing the trigger. It is helpful for
|
|
|
|
documenting the snippet and for distinguishing it from other snippets with the
|
|
|
|
same tab trigger. When a snippet is activated and more than one tab trigger
|
|
|
|
match, UltiSnips displays a list of the matching snippets with their
|
|
|
|
descriptions. The user then selects the snippet they want.
|
|
|
|
|
|
|
|
The 'options' control the behavior of the snippet. Options are indicated by
|
|
|
|
single characters. The 'options' characters for a snippet are combined into
|
|
|
|
a word without spaces.
|
|
|
|
|
|
|
|
The options currently supported are: >
|
|
|
|
b Beginning of line - A snippet with this option is expanded only if the
|
|
|
|
tab trigger is the first word on the line. In other words, if only
|
|
|
|
whitespace precedes the tab trigger, expand. The default is to expand
|
|
|
|
snippets at any position regardless of the preceding non-whitespace
|
|
|
|
characters.
|
|
|
|
|
|
|
|
i In-word expansion - By default a snippet is expanded only if the tab
|
|
|
|
trigger is the first word on the line or is preceded by one or more
|
|
|
|
whitespace characters. A snippet with this option is expanded
|
|
|
|
regardless of the preceding character. In other words, the snippet can
|
|
|
|
be triggered in the middle of a word.
|
|
|
|
|
|
|
|
w Word boundary - With this option, the snippet is expanded if
|
|
|
|
the tab trigger start matches a word boundary and the tab trigger end
|
|
|
|
matches a word boundary. In other words the tab trigger must be
|
|
|
|
preceded and followed by non-word characters. Word characters are
|
2013-12-23 16:36:29 -05:00
|
|
|
defined by the 'iskeyword' setting. Use this option, for example, to
|
2012-03-10 15:41:47 -05:00
|
|
|
permit expansion where the tab trigger follows punctuation without
|
|
|
|
expanding suffixes of larger words.
|
|
|
|
|
|
|
|
r Regular expression - With this option, the tab trigger is expected to
|
|
|
|
be a python regular expression. The snippet is expanded if the recently
|
|
|
|
typed characters match the regular expression. Note: The regular
|
|
|
|
expression MUST be quoted (or surrounded with another character) like a
|
|
|
|
multi-word tab trigger (see above) whether it has spaces or not. A
|
|
|
|
resulting match is passed to any python code blocks in the snippet
|
2010-08-16 23:12:30 -04:00
|
|
|
definition as the local variable "match".
|
2011-03-31 02:01:32 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
t Do not expand tabs - If a snippet definition includes leading tab
|
|
|
|
characters, by default UltiSnips expands the tab characters honoring
|
|
|
|
the Vim 'shiftwidth', 'softtabstop', 'expandtab' and 'tabstop'
|
|
|
|
indentation settings. (For example, if 'expandtab' is set, the tab is
|
|
|
|
replaced with spaces.) If this option is set, UltiSnips will ignore the
|
|
|
|
Vim settings and insert the tab characters as is. This option is useful
|
|
|
|
for snippets involved with tab delimited formats, for example.
|
|
|
|
|
2012-11-13 11:07:43 -05:00
|
|
|
s Remove whitespace immediately before the cursor at the end of a line
|
|
|
|
before jumping to the next tabstop. This is useful if there is a
|
|
|
|
tabstop with optional text at the end of a line.
|
|
|
|
|
2015-02-14 08:20:03 -05:00
|
|
|
m Trim all whitespaces from right side of snippet lines. Useful when
|
|
|
|
snippet contains empty lines which should remain empty after expanding.
|
|
|
|
Without this option empty lines in snippets definition will have
|
|
|
|
indentation too.
|
2015-02-04 00:55:28 -05:00
|
|
|
|
2015-04-16 01:31:12 -04:00
|
|
|
e Context snippets - With this option expansion of snippet can be
|
2015-04-25 11:38:22 -04:00
|
|
|
controlled not only by previous characters in line, but by any given
|
|
|
|
python expression. This option can be specified along with other
|
|
|
|
options, like 'b'. See |UltiSnips-context-snippets| for more info.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The end line is the 'endsnippet' keyword on a line by itself. >
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
When parsing snippet files, UltiSnips chops the trailing newline character
|
|
|
|
from the 'endsnippet' end line.
|
|
|
|
|
|
|
|
|
|
|
|
4.1.1 Character Escaping: *UltiSnips-character-escaping*
|
|
|
|
|
|
|
|
In snippet definitions, the characters '`', '{', '$', '\' and "'" (single
|
|
|
|
quote) have special meaning. If you want to insert one of these characters
|
|
|
|
literally, escape them with a backslash, '\'.
|
2011-03-31 02:01:32 -04:00
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2010-08-20 04:20:22 -04:00
|
|
|
4.2 Plaintext Snippets *UltiSnips-plaintext-snippets*
|
2009-07-15 14:11:47 -04:00
|
|
|
----------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
To illustrate plaintext snippets, let's begin with a simple example. You can
|
|
|
|
try the examples yourself. Simply edit a new file with Vim. Example snippets
|
|
|
|
will be added to the 'all.snippets' file, so you'll want to open it in Vim for
|
|
|
|
editing as well. >
|
2009-07-15 14:11:47 -04:00
|
|
|
~/.vim/UltiSnips/all.snippets
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Add this snippet to 'all.snippets' and save the file.
|
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet bye "My mail signature"
|
|
|
|
Good bye, Sir. Hope to talk to you soon.
|
|
|
|
- Arthur, King of Britain
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
UltiSnips detects when you write changes to a snippets file and automatically
|
|
|
|
makes the changes active. So in the empty buffer, type the tab trigger 'bye'
|
|
|
|
and then press the <Tab> key.
|
|
|
|
|
|
|
|
bye<Tab> -->
|
2009-07-15 14:11:47 -04:00
|
|
|
Good bye, Sir. Hope to talk to you soon.
|
|
|
|
- Arthur, King of Britain
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The word 'bye' will be replaced with the text of the snippet definition.
|
|
|
|
|
|
|
|
|
2012-01-11 15:33:16 -05:00
|
|
|
4.3 Visual Placeholder *UltiSnips-visual-placeholder*
|
|
|
|
----------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Snippets can contain a special placeholder called ${VISUAL}. The ${VISUAL}
|
|
|
|
variable is expanded with the text selected just prior to expanding the
|
|
|
|
snippet.
|
|
|
|
|
|
|
|
To see how a snippet with a ${VISUAL} placeholder works, define a snippet with
|
|
|
|
the placeholder, use Vim's Visual mode to select some text, and then press the
|
|
|
|
key you use to trigger expanding a snippet (see g:UltiSnipsExpandTrigger). The
|
|
|
|
selected text is deleted, and you are dropped into Insert mode. Now type the
|
|
|
|
snippet tab trigger and press the key to trigger expansion. As the snippet
|
|
|
|
expands, the previously selected text is printed in place of the ${VISUAL}
|
|
|
|
placeholder.
|
|
|
|
|
|
|
|
The ${VISUAL} placeholder can contain default text to use when the snippet has
|
|
|
|
been triggered when not in Visual mode. The syntax is: >
|
|
|
|
${VISUAL:default text}
|
|
|
|
|
|
|
|
The ${VISUAL} placeholder can also define a transformation (see
|
|
|
|
|UltiSnips-transformations|). The syntax is: >
|
|
|
|
${VISUAL:default/search/replace/option}.
|
|
|
|
|
|
|
|
Here is a simple example illustrating a visual transformation. The snippet
|
|
|
|
will take selected text, replace every instance of "should" within it with
|
|
|
|
"is" , and wrap the result in tags.
|
|
|
|
|
2012-01-11 15:33:16 -05:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet t
|
2012-02-12 06:15:54 -05:00
|
|
|
<tag>${VISUAL:inside text/should/is/g}</tag>
|
2012-01-11 15:33:16 -05:00
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
Start with this line of text: >
|
2012-01-11 15:33:16 -05:00
|
|
|
this should be cool
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
Position the cursor on the word "should", then press the key sequence: viw
|
|
|
|
(visual mode -> select inner word). Then press <Tab>, type "t" and press <Tab>
|
|
|
|
again. The result is: >
|
2012-02-12 06:15:54 -05:00
|
|
|
-> this <tag>is</tag> be cool
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
If you expand this snippet while not in Visual mode (e.g., in Insert mode type
|
|
|
|
t<Tab>), you will get: >
|
2012-01-31 08:20:49 -05:00
|
|
|
<tag>inside text</tag>
|
2012-01-11 15:33:16 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2012-01-11 15:33:16 -05:00
|
|
|
4.4 Interpolation *UltiSnips-interpolation*
|
2009-07-15 14:11:47 -04:00
|
|
|
-----------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.4.1 Shellcode: *UltiSnips-shellcode*
|
|
|
|
|
|
|
|
Snippets can include shellcode. Put a shell command in a snippet and when the
|
|
|
|
snippet is expanded, the shell command is replaced by the output produced when
|
|
|
|
the command is executed. The syntax for shellcode is simple: wrap the code in
|
|
|
|
backticks, '`'. When a snippet is expanded, UltiSnips runs shellcode by first
|
|
|
|
writing it to a temporary script and then executing the script. The shellcode
|
|
|
|
is replaced by the standard output. Anything you can run as a script can be
|
|
|
|
used in shellcode. Include a shebang line, for example, #!/usr/bin/perl, and
|
|
|
|
your snippet has the ability to run scripts using other programs, perl, for
|
|
|
|
example.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Here are some examples. This snippet uses a shell command to insert the
|
|
|
|
current date.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet today
|
|
|
|
Today is the `date +%d.%m.%y`.
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
today<tab> ->
|
|
|
|
Today is the 15.07.09.
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
This example inserts the current date using perl.
|
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet today
|
|
|
|
Today is `#!/usr/bin/perl
|
|
|
|
@a = localtime(); print $a[3] . '.' . $a[4] . '.' . ($a[5]+1900);`.
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
today<tab> ->
|
|
|
|
Today is 15.6.2009.
|
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.4.2 VimScript: *UltiSnips-vimscript*
|
|
|
|
|
|
|
|
You can also use Vim scripts (sometimes called VimL) in interpolation. The
|
|
|
|
syntax is similar to shellcode. Wrap the code in backticks and to distinguish
|
|
|
|
it as a Vim script, start the code with '!v'. Here is an example that counts
|
|
|
|
the indent of the current line:
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet indent
|
|
|
|
Indent is: `!v indent(".")`.
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
(note the 4 spaces in front): indent<tab> ->
|
|
|
|
(note the 4 spaces in front): Indent is: 4.
|
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.4.3 Python: *UltiSnips-python*
|
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
Python interpolation is by far the most powerful. The syntax is similar to Vim
|
2012-03-10 15:41:47 -05:00
|
|
|
scripts except code is started with '!p'. Python scripts can be run using the
|
|
|
|
python shebang '#!/usr/bin/python', but using the '!p' format comes with some
|
|
|
|
predefined objects and variables, which can simplify and shorten code. For
|
|
|
|
example, a 'snip' object instance is implied in python code. Python code using
|
|
|
|
the '!p' indicator differs in another way. Generally when a snippet is
|
|
|
|
expanded the standard output of code replaces the code. With python code the
|
|
|
|
value of the 'rv' property of the 'snip' instance replaces the code. Standard
|
|
|
|
output is ignored.
|
|
|
|
|
|
|
|
The variables automatically defined in python code are: >
|
2010-08-20 04:04:55 -04:00
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
fn - The current filename
|
|
|
|
path - The complete path to the current file
|
|
|
|
t - The values of the placeholders, t[1] is the text of ${1}, etc.
|
|
|
|
snip - UltiSnips.TextObjects.SnippetUtil object instance. Has methods
|
|
|
|
that simplify indentation handling.
|
2015-04-16 01:31:12 -04:00
|
|
|
context - Result of context condition. See |UltiSnips-context-snippets|.
|
2010-05-16 18:34:44 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The 'snip' object provides the following methods: >
|
2010-05-16 18:34:44 -04:00
|
|
|
|
|
|
|
snip.mkline(line="", indent=None):
|
|
|
|
Returns a line ready to be appended to the result. If indent
|
|
|
|
is None, then mkline prepends spaces and/or tabs appropriate to the
|
2012-03-10 15:41:47 -05:00
|
|
|
current 'tabstop' and 'expandtab' variables.
|
2010-08-20 04:04:55 -04:00
|
|
|
|
2010-05-16 18:34:44 -04:00
|
|
|
snip.shift(amount=1):
|
2010-07-29 22:02:15 -04:00
|
|
|
Shifts the default indentation level used by mkline right by the
|
2012-03-10 15:41:47 -05:00
|
|
|
number of spaces defined by 'shiftwidth', 'amount' times.
|
2010-05-16 18:34:44 -04:00
|
|
|
|
|
|
|
snip.unshift(amount=1):
|
2010-07-29 22:02:15 -04:00
|
|
|
Shifts the default indentation level used by mkline left by the
|
2012-03-10 15:41:47 -05:00
|
|
|
number of spaces defined by 'shiftwidth', 'amount' times.
|
2010-05-16 18:34:44 -04:00
|
|
|
|
|
|
|
snip.reset_indent():
|
|
|
|
Resets the indentation level to its initial value.
|
2010-08-20 04:04:55 -04:00
|
|
|
|
2010-07-29 22:02:15 -04:00
|
|
|
snip.opt(var, default):
|
2012-03-10 15:41:47 -05:00
|
|
|
Checks if the Vim variable 'var' has been set. If so, it returns the
|
|
|
|
variable's value; otherwise, it returns the value of 'default'.
|
2010-07-29 22:02:15 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The 'snip' object provides some properties as well: >
|
2010-07-30 20:21:05 -04:00
|
|
|
|
2010-07-30 20:54:51 -04:00
|
|
|
snip.rv:
|
2012-03-10 15:41:47 -05:00
|
|
|
'rv' is the return value, the text that will replace the python block
|
|
|
|
in the snippet definition. It is initialized to the empty string. This
|
|
|
|
deprecates the 'res' variable.
|
2010-07-30 20:54:51 -04:00
|
|
|
|
|
|
|
snip.c:
|
2012-03-10 15:41:47 -05:00
|
|
|
The text currently in the python block's position within the snippet.
|
|
|
|
It is set to empty string as soon as interpolation is completed. Thus
|
|
|
|
you can check if snip.c is != "" to make sure that the interpolation
|
|
|
|
is only done once. This deprecates the "cur" variable.
|
2010-07-29 22:02:15 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
snip.v:
|
|
|
|
Data related to the ${VISUAL} placeholder. The property has two
|
|
|
|
attributes:
|
2013-04-01 10:20:24 -04:00
|
|
|
snip.v.mode ('v', 'V', '^V', see |visual-mode| )
|
2012-03-10 15:41:47 -05:00
|
|
|
snip.v.text The text that was selected.
|
2012-02-12 06:33:53 -05:00
|
|
|
|
2010-07-30 20:21:05 -04:00
|
|
|
snip.fn:
|
2012-03-10 15:41:47 -05:00
|
|
|
The current filename.
|
2010-07-30 20:21:05 -04:00
|
|
|
|
|
|
|
snip.basename:
|
2012-03-10 15:41:47 -05:00
|
|
|
The current filename with the extension removed.
|
2010-07-30 20:21:05 -04:00
|
|
|
|
|
|
|
snip.ft:
|
2012-03-10 15:41:47 -05:00
|
|
|
The current filetype.
|
2010-07-30 20:21:05 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
For your convenience, the 'snip' object also provides the following
|
|
|
|
operators: >
|
2010-05-16 18:34:44 -04:00
|
|
|
|
2010-07-29 22:02:15 -04:00
|
|
|
snip >> amount:
|
2012-03-10 15:41:47 -05:00
|
|
|
Equivalent to snip.shift(amount)
|
2010-07-29 22:02:15 -04:00
|
|
|
snip << amount:
|
2012-03-10 15:41:47 -05:00
|
|
|
Equivalent to snip.unshift(amount)
|
2010-07-29 22:02:15 -04:00
|
|
|
snip += line:
|
2012-03-10 15:41:47 -05:00
|
|
|
Equivalent to "snip.rv += '\n' + snip.mkline(line)"
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Any variables defined in a python block can be used in other python blocks
|
|
|
|
that follow within the same snippet. Also, the python modules 'vim', 're',
|
|
|
|
'os', 'string' and 'random' are pre-imported within the scope of snippet code.
|
|
|
|
Other modules can be imported using the python 'import' command.
|
|
|
|
|
|
|
|
Python code allows for very flexible snippets. For example, the following
|
|
|
|
snippet mirrors the first tabstop value on the same line but right aligned and
|
|
|
|
in uppercase.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet wow
|
2010-08-20 04:04:55 -04:00
|
|
|
${1:Text}`!p snip.rv = (75-2*len(t[1]))*' '+t[1].upper()`
|
2009-07-15 14:11:47 -04:00
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
wow<tab>Hello World ->
|
2010-08-20 04:04:55 -04:00
|
|
|
Hello World HELLO WORLD
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The following snippet uses the regular expression option and illustrates
|
|
|
|
regular expression grouping using python's match object. It shows that the
|
|
|
|
expansion of a snippet can depend on the tab trigger used to define the
|
|
|
|
snippet, and that tab trigger itself can vary.
|
2012-02-08 15:12:42 -05:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet "be(gin)?( (\S+))?" "begin{} / end{}" br
|
|
|
|
\begin{${1:`!p
|
|
|
|
snip.rv = match.group(3) if match.group(2) is not None else "something"`}}
|
2012-03-10 15:41:47 -05:00
|
|
|
${2:${VISUAL}}
|
2012-02-08 15:12:42 -05:00
|
|
|
\end{$1}$0
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
be<tab>center<c-j> ->
|
|
|
|
\begin{center}
|
|
|
|
|
|
|
|
\end{center}
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
be center<tab> ->
|
|
|
|
\begin{center}
|
|
|
|
|
|
|
|
\end{center}
|
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
The second form is a variation of the first; both produce the same result,
|
2012-03-10 15:41:47 -05:00
|
|
|
but it illustrates how regular expression grouping works. Using regular
|
|
|
|
expressions in this manner has some drawbacks:
|
|
|
|
1. If you use the <Tab> key for both expanding snippets and completion then
|
|
|
|
if you typed "be form<Tab>" expecting the completion "be formatted", you
|
|
|
|
would end up with the above SNAP instead, not what you want.
|
2012-02-08 15:12:42 -05:00
|
|
|
2. The snippet is harder to read.
|
|
|
|
|
|
|
|
|
2012-01-11 15:33:16 -05:00
|
|
|
4.4.4 Global Snippets: *UltiSnips-globals*
|
2010-08-16 23:12:30 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Global snippets provide a way to reuse common code in multiple snippets.
|
|
|
|
Currently, only python code is supported. The result of executing the contents
|
|
|
|
of a global snippet is put into the globals of each python block in the
|
|
|
|
snippet file. To create a global snippet, use the keyword 'global' in place of
|
|
|
|
'snippet', and for python code, you use '!p' for the trigger. For example, the
|
|
|
|
following snippet produces the same output as the last example . However, with
|
|
|
|
this syntax the 'upper_right' snippet can be reused by other snippets.
|
2010-08-16 23:12:30 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
global !p
|
|
|
|
def upper_right(inp):
|
|
|
|
return (75 - 2 * len(inp))*' ' + inp.upper()
|
|
|
|
endglobal
|
|
|
|
|
|
|
|
snippet wow
|
2010-08-20 04:04:55 -04:00
|
|
|
${1:Text}`!p snip.rv = upper_right(t[1])`
|
2010-08-16 23:12:30 -04:00
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
wow<tab>Hello World ->
|
2010-08-20 04:04:55 -04:00
|
|
|
Hello World HELLO WORLD
|
2010-08-16 23:12:30 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Python global functions can be stored in a python module and then imported.
|
2014-02-07 04:38:44 -05:00
|
|
|
This makes global functions easily accessible to all snippet files. Since Vim
|
2014-02-16 07:54:31 -05:00
|
|
|
7.4 you can just drop python files into ~/.vim/pythonx and import them
|
2014-02-07 04:38:44 -05:00
|
|
|
directly inside your snippets. For example to use
|
|
|
|
~/.vim/pythonx/my_snippets_helpers.py >
|
2011-12-31 09:10:54 -05:00
|
|
|
|
|
|
|
global !p
|
|
|
|
from my_snippet_helpers import *
|
2014-12-02 12:39:50 -05:00
|
|
|
endglobal
|
2010-08-16 23:12:30 -04:00
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.4 Tabstops and Placeholders *UltiSnips-tabstops* *UltiSnips-placeholders*
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
Snippets are used to quickly insert reused text into a document. Often the
|
|
|
|
text has a fixed structure with variable components. Tabstops are used to
|
|
|
|
simplify modifying the variable content. With tabstops you can easily place
|
|
|
|
the cursor at the point of the variable content, enter the content you want,
|
|
|
|
then jump to the next variable component, enter that content, and continue
|
|
|
|
until all the variable components are complete.
|
|
|
|
|
|
|
|
The syntax for a tabstop is the dollar sign followed by a number, for example,
|
|
|
|
'$1'. Tabstops start at number 1 and are followed in sequential order. The
|
|
|
|
'$0' tabstop is a special tabstop. It is always the last tabstop in the
|
2015-04-15 08:58:26 -04:00
|
|
|
snippet no matter how many tabstops are defined. If there is no '$0' defined,
|
|
|
|
'$0' tabstop will be defined at the end of snippet.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
Here is a simple example.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
2012-03-10 15:41:47 -05:00
|
|
|
snippet letter
|
|
|
|
Dear $1,
|
2009-07-15 14:11:47 -04:00
|
|
|
$0
|
2012-03-10 15:41:47 -05:00
|
|
|
Yours sincerely,
|
|
|
|
$2
|
2009-07-15 14:11:47 -04:00
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
2012-03-10 15:41:47 -05:00
|
|
|
letter<tab>Ben<c-j>Paul<c-j>Thanks for suggesting UltiSnips!->
|
|
|
|
Dear Ben,
|
|
|
|
Thanks for suggesting UltiSnips!
|
|
|
|
Yours sincerely,
|
|
|
|
Paul
|
|
|
|
|
|
|
|
You can use <c-j> to jump to the next tabstop, and <c-k> to jump to the
|
|
|
|
previous. The <Tab> key was not used for jumping forward because many people
|
|
|
|
(myself included) use <Tab> for completion. See |UltiSnips-triggers| for
|
|
|
|
help on defining different keys for tabstops.
|
|
|
|
|
2014-02-16 07:54:31 -05:00
|
|
|
It is often useful to have some default text for a tabstop. The default text
|
|
|
|
may be a value commonly used for the variable component, or it may be a word
|
|
|
|
or phrase that reminds you what is expected for the variable component. To
|
|
|
|
include default text, the syntax is '${1:value}'.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The following example illustrates a snippet for the shell 'case' statement.
|
|
|
|
The tabstops use default values to remind the user of what value is expected.
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet case
|
|
|
|
case ${1:word} in
|
|
|
|
${2:pattern} ) $0;;
|
|
|
|
esac
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
case<tab>$option<c-j>-v<c-j>verbose=true
|
|
|
|
case $option in
|
|
|
|
-v ) verbose=true;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
Sometimes it is useful to have a tabstop within a tabstop. To do this, simply
|
|
|
|
include the nested tabstop as part of the default text. Consider the following
|
|
|
|
example illustrating an HTML anchor snippet.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet a
|
2012-03-10 15:41:47 -05:00
|
|
|
<a href="${1:http://www.${2:example.com}}"</a>
|
2009-07-15 14:11:47 -04:00
|
|
|
$0
|
|
|
|
</a>
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
When this snippet is expanded, the first tabstop has a default value of
|
|
|
|
'http://www.example.com'. If you want the 'http://' schema, jump to the next
|
|
|
|
tabstop. It has a default value of 'example.com'. This can be replaced by
|
|
|
|
typing whatever domain you want.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
a<tab><c-j>google.com<c-j>Google ->
|
2009-07-15 14:11:47 -04:00
|
|
|
<a href="http://www.google.com">
|
2012-03-10 15:41:47 -05:00
|
|
|
Google
|
|
|
|
</a>
|
|
|
|
|
|
|
|
If at the first tabstop you want a different url schema or want to replace the
|
|
|
|
default url with a named anchor, '#name', for example, just type the value you
|
|
|
|
want.
|
|
|
|
|
|
|
|
a<tab>#top<c-j>Top ->
|
|
|
|
<a href="#top">
|
|
|
|
Top
|
2009-07-15 14:11:47 -04:00
|
|
|
</a>
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
In the last example, typing any text at the first tabstop replaces the default
|
|
|
|
value, including the second tabstop, with the typed text. So the second
|
|
|
|
tabstop is essentially deleted. When a tabstop jump is triggered, UltiSnips
|
|
|
|
moves to the next remaining tabstop '$0'. This feature can be used
|
|
|
|
intentionally as a handy way for providing optional tabstop values to the
|
|
|
|
user. Here is an example to illustrate.
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet a
|
|
|
|
<a href="$1"${2: class="${3:link}"}>
|
|
|
|
$0
|
|
|
|
</a>
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
Here, '$1' marks the first tabstop. It is assumed you always want to add a
|
|
|
|
value for the 'href' attribute. After entering the url and pressing <c-j>, the
|
|
|
|
snippet will jump to the second tabstop, '$2'. This tabstop is optional. The
|
|
|
|
default text is ' class="link"'. You can press <c-j> to accept the tabstop,
|
|
|
|
and the snippet will jump to the third tabstop, '$3', and you can enter the
|
|
|
|
class attribute value, or, at the second tabstop you can press the backspace
|
|
|
|
key thereby replacing the second tabstop default with an empty string,
|
|
|
|
essentially removing it. In either case, continue by pressing <c-j> and the
|
|
|
|
snippet will jump to the final tabstop inside the anchor.
|
|
|
|
|
|
|
|
a<tab>http://www.google.com<c-j><c-j>visited<c-j>Google ->
|
2009-07-15 14:11:47 -04:00
|
|
|
<a href="http://www.google.com" class="visited">
|
2012-03-10 15:41:47 -05:00
|
|
|
Google
|
|
|
|
</a>
|
|
|
|
|
|
|
|
a<tab>http://www.google.com<c-j><BS><c-j>Google ->
|
|
|
|
<a href="http://www.google.com">
|
|
|
|
Google
|
2009-07-15 14:11:47 -04:00
|
|
|
</a>
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The default text of tabstops can also contain mirrors, transformations or
|
2010-08-20 04:04:55 -04:00
|
|
|
interpolation.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
4.6 Mirrors *UltiSnips-mirrors*
|
|
|
|
-----------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Mirrors repeat the content of a tabstop. During snippet expansion when you
|
|
|
|
enter the value for a tabstop, all mirrors of that tabstop are replaced with
|
|
|
|
the same value. To mirror a tabstop simply insert the tabstop again using the
|
|
|
|
"dollar sign followed by a number" syntax, e.g., '$1'.
|
|
|
|
|
|
|
|
A tabstop can be mirrored multiple times in one snippet, and more than one
|
|
|
|
tabstop can be mirrored in the same snippet. A mirrored tabstop can have a
|
|
|
|
default value defined. Only the first instance of the tabstop need have a
|
|
|
|
default value. Mirrored tabstop will take on the default value automatically.
|
|
|
|
|
|
|
|
Mirrors are handy for start-end tags, for example, TeX 'begin' and 'end' tag
|
|
|
|
labels, XML and HTML tags, and C code #ifndef blocks. Here are some snippet
|
|
|
|
examples.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet env
|
|
|
|
\begin{${1:enumerate}}
|
|
|
|
$0
|
|
|
|
\end{$1}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
env<tab>itemize ->
|
|
|
|
\begin{itemize}
|
2010-08-20 04:04:55 -04:00
|
|
|
|
2009-07-15 15:06:11 -04:00
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet ifndef
|
|
|
|
#ifndef ${1:SOME_DEFINE}
|
|
|
|
#define $1
|
|
|
|
$0
|
|
|
|
#endif /* $1 */
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
ifndef<tab>WIN32 ->
|
|
|
|
#ifndef WIN32
|
|
|
|
#define WIN32
|
|
|
|
|
|
|
|
#endif /* WIN32 */
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
4.7 Transformations *UltiSnips-transformations*
|
|
|
|
-------------------
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Note: Transformations are a bit difficult to grasp so this chapter is divided
|
|
|
|
into two sections. The first describes transformations and their syntax, and
|
|
|
|
the second illustrates transformations with demos.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Transformations are like mirrors but instead of just copying text from the
|
|
|
|
original tabstop verbatim, a regular expression is matched to the content of
|
|
|
|
the referenced tabstop and a transformation is then applied to the matched
|
|
|
|
pattern. The syntax and functionality of transformations in UltiSnips follow
|
|
|
|
very closely to TextMate transformations.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
A transformation has the following syntax: >
|
|
|
|
${<tab_stop_no/regular_expression/replacement/options}
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The components are defined as follows: >
|
|
|
|
tab_stop_no - The number of the tabstop to reference
|
|
|
|
regular_expression - The regular expression the value of the referenced
|
|
|
|
tabstop is matched on
|
|
|
|
replacement - The replacement string, explained in detail below
|
|
|
|
options - Options for the regular expression
|
2009-07-15 15:06:11 -04:00
|
|
|
|
|
|
|
The options can be any combination of >
|
2012-03-10 15:41:47 -05:00
|
|
|
g - global replace
|
|
|
|
By default, only the first match of the regular expression is
|
|
|
|
replaced. With this option all matches are replaced.
|
|
|
|
i - case insensitive
|
|
|
|
By default, regular expression matching is case sensitive. With this
|
|
|
|
option, matching is done without regard to case.
|
2013-10-07 03:48:34 -04:00
|
|
|
a - ascii conversion
|
2013-10-19 09:26:44 -04:00
|
|
|
By default, transformation are made on the raw utf-8 string. With
|
|
|
|
this option, matching is done on the corresponding ASCII string
|
|
|
|
instead, for example 'à' will become 'a'.
|
|
|
|
This option required the python package 'unidecode'.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The syntax of regular expressions is beyond the scope of this document. Python
|
|
|
|
regular expressions are used internally, so the python 're' module can be used
|
|
|
|
as a guide. See http://docs.python.org/library/re.html.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
The syntax for the replacement string is unique. The next paragraph describes
|
|
|
|
it in detail.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.7.1 Replacement String: *UltiSnips-replacement-string*
|
|
|
|
|
|
|
|
The replacement string can contain $no variables, e.g., $1, which reference
|
|
|
|
matched groups in the regular expression. The $0 variable is special and
|
|
|
|
yields the whole match. The replacement string can also contain special escape
|
|
|
|
sequences: >
|
2013-04-15 01:19:07 -04:00
|
|
|
\u - Uppercase next letter
|
2009-07-15 15:06:11 -04:00
|
|
|
\l - Lowercase next letter
|
|
|
|
\U - Uppercase everything till the next \E
|
|
|
|
\L - Lowercase everything till the next \E
|
|
|
|
\E - End upper or lowercase started with \L or \U
|
|
|
|
\n - A newline
|
|
|
|
\t - A literal tab
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Finally, the replacement string can contain conditional replacements using the
|
|
|
|
syntax (?no:text:other text). This reads as follows: if the group $no has
|
|
|
|
matched, insert "text", otherwise insert "other text". "other text" is
|
|
|
|
optional and if not provided defaults to the empty string, "". This feature
|
|
|
|
is very powerful. It allows you to add optional text into snippets.
|
2009-07-15 15:06:11 -04:00
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.7.2 Demos: *UltiSnips-demos*
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Transformations are very powerful but often the syntax is convoluted.
|
|
|
|
Hopefully the demos below help illustrate transformation features.
|
|
|
|
|
|
|
|
Demo: Uppercase one character
|
2009-07-15 15:06:11 -04:00
|
|
|
------------------- SNIP -------------------
|
2012-03-10 15:41:47 -05:00
|
|
|
snippet title "Title transformation"
|
2009-07-15 15:06:11 -04:00
|
|
|
${1:a text}
|
|
|
|
${1/\w+\s*/\u$0/}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
title<tab>big small ->
|
|
|
|
big small
|
|
|
|
Big small
|
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Demo: Uppercase one character and global replace
|
2009-07-15 15:06:11 -04:00
|
|
|
------------------- SNIP -------------------
|
2012-03-10 15:41:47 -05:00
|
|
|
snippet title "Titlelize in the Transformation"
|
2009-07-15 15:06:11 -04:00
|
|
|
${1:a text}
|
|
|
|
${1/\w+\s*/\u$0/g}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
title<tab>this is a title ->
|
|
|
|
this is a title
|
|
|
|
This Is A Title
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2013-10-07 03:48:34 -04:00
|
|
|
Demo: ASCII transformation
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet ascii "Replace non ascii chars"
|
|
|
|
${1: an accentued text}
|
|
|
|
${1/.*/$0/a}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
ascii<tab>à la pêche aux moules
|
|
|
|
à la pêche aux moules
|
|
|
|
a la peche aux moules
|
|
|
|
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Demo: Regular expression grouping
|
|
|
|
This is a clever c-like printf snippet, the second tabstop is only shown
|
|
|
|
when there is a format (%) character in the first tabstop.
|
|
|
|
|
2009-07-15 15:06:11 -04:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet printf
|
|
|
|
printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
printf<tab>Hello<c-j> // End of line ->
|
|
|
|
printf("Hello\n"); // End of line
|
|
|
|
|
|
|
|
But
|
|
|
|
printf<tab>A is: %s<c-j>A<c-j> // End of line ->
|
|
|
|
printf("A is: %s\n", A); // End of line
|
|
|
|
|
|
|
|
|
|
|
|
There are many more examples of what can be done with transformations in the
|
|
|
|
bundled snippets.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
A "clearsnippets" feature
=========================
It's difficult for the user to control which of the default
bundled snippets are active in his environment. The
'runtimepath' variable must be set to the root of the ultisnips
installation, which brings in all of the bundled snippets.
Though the user may individually override the definition of the
bundled snippets using the "!" flag, the method has a couple of
problems:
- There's no way to remove a snippet, only to override it (and
each snippet must be overridden individually).
- The "!" flag currently doesn't remove the overridden snippets
from the "list snippets" command.
It might be considered a feature that "!" doesn't actually
remove the snippets from the "list snippets" command, though
perhaps that's an unintended effect. In any case, it would be
more convenient to allow the user to selectively remove the
bundled snippets from his environment.
A patch is provided in the following branch to address these problems:
http://code.launchpad.net/~drmikehenry/ultisnips/clearsnippets
The branch's primary purpose is the addition of a
"clearsnippets" command that may be placed in a user's
~/.vim/UltiSnips/ft.snippets file. The user may clear all
lower-priority snippet for that file type with the line:
clearsnippets
Alternatively, he may clear individual snippets by listing their
triggers:
clearsnippets trigger1 trigger2
A few changes were made to the testing system as part of the
incorporation of this new feature. These changes include:
- The "extends" directive is now supported on multiple lines
throughout file.
- A completely empty .snippets file is now possible.
- The test.py scripts now handles most of the vim setup,
simplifying the running of the tests. The invocation of Vim
now reduces to:
vim -u NONE
Instructions for running the tests are included at top of
test.py, where they should be more visible to interested
users; UltiSnips.vim now just points to test.py's
instructions.
- A new function vim_quote() encodes an arbitrary string into a
singly-quoted Vim string, with embedded quotes escaped.
- SnippetsFileParser() now allows file_data to be passed
directly for unit testing, avoiding the need to create files
in the filesystem for test purposes.
- A new _error() function reports errors to the user. At
runtime, this function uses :echo_err in general, but also can
append error text to current buffer to check for expected
errors during unit tests.
- Added error checks to snippets file parsing, along with unit
tests for the parsing.
- Increased retries from 2 to 4 (on my system, occasionally the
timing still causes tests to fail).
2009-09-08 20:15:10 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
4.8 Clearing snippets *UltiSnips-clearing-snippets*
|
|
|
|
|
|
|
|
To remove snippets for the current file type, use the 'clearsnippets'
|
|
|
|
directive.
|
|
|
|
|
A "clearsnippets" feature
=========================
It's difficult for the user to control which of the default
bundled snippets are active in his environment. The
'runtimepath' variable must be set to the root of the ultisnips
installation, which brings in all of the bundled snippets.
Though the user may individually override the definition of the
bundled snippets using the "!" flag, the method has a couple of
problems:
- There's no way to remove a snippet, only to override it (and
each snippet must be overridden individually).
- The "!" flag currently doesn't remove the overridden snippets
from the "list snippets" command.
It might be considered a feature that "!" doesn't actually
remove the snippets from the "list snippets" command, though
perhaps that's an unintended effect. In any case, it would be
more convenient to allow the user to selectively remove the
bundled snippets from his environment.
A patch is provided in the following branch to address these problems:
http://code.launchpad.net/~drmikehenry/ultisnips/clearsnippets
The branch's primary purpose is the addition of a
"clearsnippets" command that may be placed in a user's
~/.vim/UltiSnips/ft.snippets file. The user may clear all
lower-priority snippet for that file type with the line:
clearsnippets
Alternatively, he may clear individual snippets by listing their
triggers:
clearsnippets trigger1 trigger2
A few changes were made to the testing system as part of the
incorporation of this new feature. These changes include:
- The "extends" directive is now supported on multiple lines
throughout file.
- A completely empty .snippets file is now possible.
- The test.py scripts now handles most of the vim setup,
simplifying the running of the tests. The invocation of Vim
now reduces to:
vim -u NONE
Instructions for running the tests are included at top of
test.py, where they should be more visible to interested
users; UltiSnips.vim now just points to test.py's
instructions.
- A new function vim_quote() encodes an arbitrary string into a
singly-quoted Vim string, with embedded quotes escaped.
- SnippetsFileParser() now allows file_data to be passed
directly for unit testing, avoiding the need to create files
in the filesystem for test purposes.
- A new _error() function reports errors to the user. At
runtime, this function uses :echo_err in general, but also can
append error text to current buffer to check for expected
errors during unit tests.
- Added error checks to snippets file parsing, along with unit
tests for the parsing.
- Increased retries from 2 to 4 (on my system, occasionally the
timing still causes tests to fail).
2009-09-08 20:15:10 -04:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
clearsnippets
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2014-07-26 04:36:13 -04:00
|
|
|
'clearsnippets' removes all snippets with a priority lower than the current
|
2014-08-02 08:59:42 -04:00
|
|
|
one. For example, the following cleares all snippets that have priority <= 1,
|
|
|
|
even though the example snippet is defined after the 'clearsnippets'.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2014-07-26 04:36:13 -04:00
|
|
|
------------------- SNIP -------------------
|
|
|
|
priority 1
|
|
|
|
clearsnippets
|
|
|
|
|
|
|
|
priority -1
|
|
|
|
snippet example "Cleared example"
|
2014-08-02 08:59:42 -04:00
|
|
|
This will never be expanded.
|
2014-07-26 04:36:13 -04:00
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2014-08-02 08:59:42 -04:00
|
|
|
To clear one or more specific snippet, provide the triggers of the snippets as
|
2014-07-26 04:36:13 -04:00
|
|
|
arguments to the 'clearsnippets' command. The following example will clear the
|
|
|
|
snippets 'trigger1' and 'trigger2'.
|
A "clearsnippets" feature
=========================
It's difficult for the user to control which of the default
bundled snippets are active in his environment. The
'runtimepath' variable must be set to the root of the ultisnips
installation, which brings in all of the bundled snippets.
Though the user may individually override the definition of the
bundled snippets using the "!" flag, the method has a couple of
problems:
- There's no way to remove a snippet, only to override it (and
each snippet must be overridden individually).
- The "!" flag currently doesn't remove the overridden snippets
from the "list snippets" command.
It might be considered a feature that "!" doesn't actually
remove the snippets from the "list snippets" command, though
perhaps that's an unintended effect. In any case, it would be
more convenient to allow the user to selectively remove the
bundled snippets from his environment.
A patch is provided in the following branch to address these problems:
http://code.launchpad.net/~drmikehenry/ultisnips/clearsnippets
The branch's primary purpose is the addition of a
"clearsnippets" command that may be placed in a user's
~/.vim/UltiSnips/ft.snippets file. The user may clear all
lower-priority snippet for that file type with the line:
clearsnippets
Alternatively, he may clear individual snippets by listing their
triggers:
clearsnippets trigger1 trigger2
A few changes were made to the testing system as part of the
incorporation of this new feature. These changes include:
- The "extends" directive is now supported on multiple lines
throughout file.
- A completely empty .snippets file is now possible.
- The test.py scripts now handles most of the vim setup,
simplifying the running of the tests. The invocation of Vim
now reduces to:
vim -u NONE
Instructions for running the tests are included at top of
test.py, where they should be more visible to interested
users; UltiSnips.vim now just points to test.py's
instructions.
- A new function vim_quote() encodes an arbitrary string into a
singly-quoted Vim string, with embedded quotes escaped.
- SnippetsFileParser() now allows file_data to be passed
directly for unit testing, avoiding the need to create files
in the filesystem for test purposes.
- A new _error() function reports errors to the user. At
runtime, this function uses :echo_err in general, but also can
append error text to current buffer to check for expected
errors during unit tests.
- Added error checks to snippets file parsing, along with unit
tests for the parsing.
- Increased retries from 2 to 4 (on my system, occasionally the
timing still causes tests to fail).
2009-09-08 20:15:10 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
clearsnippets trigger1 trigger2
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2015-04-16 01:31:12 -04:00
|
|
|
4.9 Context snippets *UltiSnips-context-snippets*
|
|
|
|
|
|
|
|
Context snippets can be enabled by using 'e' option in snippet definition.
|
|
|
|
|
|
|
|
In that case snippet should be defined using this syntax: >
|
|
|
|
|
|
|
|
snippet tab_trigger "description" "expression" options
|
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
The 'expression' can be any python expression. If 'expression' evaluates to
|
|
|
|
'True', then this snippet will be chosen for expansion. The 'expression' must
|
|
|
|
be wrapped with double-quotes.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
The following python modules are automatically imported into the scope before
|
|
|
|
'expression' is evaluated: 're', 'os', 'vim', 'string', 'random'.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
Also, the following variables are defined:
|
2015-04-16 01:31:12 -04:00
|
|
|
'window' - alias for 'vim.current.window'
|
|
|
|
'buffer' - alias for 'vim.current.window.buffer'
|
2015-04-16 07:40:53 -04:00
|
|
|
'cursor' - alias for 'vim.current.cursor'
|
2015-04-16 01:31:12 -04:00
|
|
|
'line' and 'column' - aliases for cursor position
|
|
|
|
|
|
|
|
Keep in mind, that lines in vim numbered from 1, and lists in python starts
|
2015-04-25 11:38:22 -04:00
|
|
|
from 0, so to access the current line you need to use 'line-1'.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet r "return" "re.match('^\s+if err ', buffer[line-2])" be
|
|
|
|
return err
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
That snippet will expand to 'return err' only if the previous line is starting
|
2015-04-16 01:31:12 -04:00
|
|
|
from 'if err' prefix.
|
|
|
|
|
2015-04-27 05:42:21 -04:00
|
|
|
Note: context snippets prioritized over non-context ones. It makes possible to
|
|
|
|
use non-context snippets as fallback, if no context matched:
|
2015-04-16 01:31:12 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet i "if ..." b
|
|
|
|
if $1 {
|
|
|
|
$2
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet i "if err != nil" "re.match('^\s+[^=]*err\s*:?=', buffer[line-2])" be
|
|
|
|
if err != nil {
|
|
|
|
$1
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
That snippet will expand into 'if err != nil' if previous line will
|
2015-04-25 11:38:22 -04:00
|
|
|
match 'err :=' prefix, otherwise the default 'if' snippet will be expanded.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
2015-04-29 12:25:21 -04:00
|
|
|
It's a good idea to move context conditions to a separate module, so it can be
|
2015-04-25 11:38:22 -04:00
|
|
|
used by other UltiSnips users. In that case, module should be imported
|
2015-04-16 01:31:12 -04:00
|
|
|
using 'global' keyword, like this:
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
global !p
|
|
|
|
import my_utils
|
|
|
|
endglobal
|
|
|
|
|
|
|
|
snippet , "return ..., nil/err" "my_utils.is_return_argument(buffer, line, column)" ie
|
|
|
|
, `!p if my_utils.is_in_err_condition():
|
|
|
|
snip.rv = "err"
|
|
|
|
else:
|
|
|
|
snip.rv = "nil"`
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
That snippet will expand only if the cursor is located in the return statement,
|
|
|
|
and then it will expand either to 'err' or to 'nil' depending on which 'if'
|
2015-04-16 01:31:12 -04:00
|
|
|
statement it's located. 'is_return_argument' and 'is_in_err_condition' are
|
2015-04-25 11:38:22 -04:00
|
|
|
part of custom python module which is called 'my_utils' in this example.
|
2015-04-16 01:31:12 -04:00
|
|
|
|
2015-04-25 11:38:22 -04:00
|
|
|
Context condition can return any value which python can use as condition in
|
|
|
|
it's 'if' statement, and if it's considered 'True', then snippet will be
|
|
|
|
expanded. The evaluated value of 'condition' is available in the 'context'
|
|
|
|
variable inside the snippet:
|
2015-04-16 01:31:12 -04:00
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
snippet + "var +=" "re.match('\s*(.*?)\s*:?=', buffer[line-2])" ie
|
|
|
|
`!p snip.rv = context.group(1)` += $1
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
That snippet will expand to 'var1 +=' after line, which begins from 'var1 :='.
|
|
|
|
|
|
|
|
|
2015-05-04 14:17:58 -04:00
|
|
|
4.10 Snippets actions *UltiSnips-snippets-actions*
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
Snippet actions is an arbitrary python code which can be executed at specific
|
|
|
|
points in lifetime of the snippet.
|
|
|
|
|
|
|
|
There are three types of actions:
|
|
|
|
|
|
|
|
* Pre-expand - invoked just after trigger condition was matched, but before
|
|
|
|
snippet actually expanded;
|
|
|
|
* Post-expand - invoked after snippet was expanded and interpolations
|
|
|
|
was applied for the first time, but before jump on the first placeholder.
|
|
|
|
* Jump - invoked just after jump to the next/prev placeholder.
|
|
|
|
|
|
|
|
Specified code will be evaluated at stages defined above and same global
|
|
|
|
variables and modules will be available that are stated in
|
|
|
|
the *UltiSnips-context-snippets* section.
|
|
|
|
|
|
|
|
Note: special variable called 'buffer' should be used for all buffer
|
|
|
|
modifications. Not 'vim.current.buffer' and not 'vim.command("...")', because
|
|
|
|
of in that case UltiSnips will not be able to track changes buffer from
|
|
|
|
actions.
|
|
|
|
|
|
|
|
4.10.1 Pre-expand actions *UltiSnips-pre-expand-actions*
|
|
|
|
|
|
|
|
Pre-expand actions can be used to match snippet in one location and then
|
|
|
|
expand it in the different location. Some useful cases are: correcting
|
|
|
|
indentation for snippet; expanding snippet for function declaration in another
|
|
|
|
function body with moving expansion point beyond initial function; performing
|
|
|
|
extract method refactoring via expanding snippet in different place.
|
|
|
|
|
|
|
|
Pre-expand action declared as follows: >
|
|
|
|
pre_expand "python code here"
|
|
|
|
snippet ...
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
Buffer can be modified in pre-expand action code through variable called
|
|
|
|
'buffer', snippet expansion position will be automatically adjusted.
|
|
|
|
|
|
|
|
If cursor line (where trigger was matched) need to be modified, then special
|
|
|
|
variable named 'new_cursor' must be set to the desired cursor position. In
|
|
|
|
that case UltiSnips will not remove any matched trigger text and it should
|
|
|
|
be done manually in action code.
|
|
|
|
|
|
|
|
To addition to the scope variables defined above 'visual_content' will be also
|
|
|
|
declared and will contain text that was selected before snippet expansion
|
|
|
|
(similar to $VISUAL placeholder).
|
|
|
|
|
|
|
|
Following snippet will be expanded at 4 spaces indentation level no matter
|
|
|
|
where it was triggered.
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
pre_expand "buffer[line] = ' '*4; new_cursor = (line, 4)"
|
|
|
|
snippet d
|
|
|
|
def $1():
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
Following snippet will move the selected code to the end of file and create
|
|
|
|
new method definition for it:
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
pre_expand "del buffer[line]; buffer.append(''); new_cursor = (len(buffer)-1, 0)"
|
|
|
|
snippet x
|
|
|
|
def $1():
|
|
|
|
${2:${VISUAL}}
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
4.10.2 Post-expand actions *UltiSnips-post-expand-actions*
|
|
|
|
|
|
|
|
Post-expand actions can be used to perform some actions based on the expanded
|
|
|
|
snippet text. Some cases are: code style formatting (e.g. inserting newlines
|
|
|
|
before and after method declaration), apply actions depending on python
|
|
|
|
interpolation result.
|
|
|
|
|
|
|
|
Post-expand action declared as follows: >
|
|
|
|
post_expand "python code here"
|
|
|
|
snippet ...
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
Buffer can be modified in post-expand action code through variable called
|
|
|
|
'buffer', snippet expansion position will be automatically adjusted.
|
|
|
|
|
|
|
|
Variables 'snippet_start' and 'snippet_end' will be defined at the action code
|
|
|
|
scope and will point to positions of the start and end of expanded snippet
|
|
|
|
accordingly in the form '(line, column)'.
|
|
|
|
|
|
|
|
Note: 'snippet_start' and 'snippet_end' will automatically adjust to the
|
|
|
|
correct positions if post-action will insert or delete lines before expansion.
|
|
|
|
|
|
|
|
Following snippet will expand to method definition and automatically insert
|
|
|
|
additional newline after end of the snippet. It's very useful to create a
|
|
|
|
function that will insert as many newlines as required in specific context.
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
post_expand "buffer[snippet_end[0]+1:snippet_end[0]+1] = ['']"
|
|
|
|
snippet d "Description" b
|
|
|
|
def $1():
|
|
|
|
$2
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
4.10.3 Post-jump actions *UltiSnips-post-jump-actions*
|
|
|
|
|
|
|
|
Post-jump actions can be used to trigger some code based on user input into
|
|
|
|
the placeholders. Notable use cases: expand another snippet after jump or
|
|
|
|
anonymous snippet after last jump (e.g. perform move method refactoring and
|
|
|
|
then insert new method invokation); insert heading into TOC after last jump.
|
|
|
|
|
|
|
|
Jump-expand action declared as follows: >
|
|
|
|
post_jump "python code here"
|
|
|
|
snippet ...
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
Buffer can be modified in post-expand action code through variable called
|
|
|
|
'buffer', snippet expansion position will be automatically adjusted.
|
|
|
|
|
|
|
|
Next variables will be also defined in the action code scope:
|
|
|
|
* 'tabstop' - number of tabstop jumped onto;
|
|
|
|
* 'jump_direction' - '1' if jumped forward and '-1' otherwise;
|
|
|
|
* 'tabstops' - list with tabstop objects, see above;
|
|
|
|
* 'snippet_start' - (line, column) of start of the expanded snippet;
|
|
|
|
* 'snippet_end' - (line, column) of end of the expanded snippet;
|
|
|
|
|
|
|
|
Tabstop object has several useful properties:
|
|
|
|
* 'start' - (line, column) of the starting position of the tabstop (also
|
|
|
|
accessible as 'tabstop.line' and 'tabstop.col').
|
|
|
|
* 'end' - (line, column) of the ending position;
|
|
|
|
* 'current_text' - text inside the tabstop.
|
|
|
|
|
|
|
|
Following snippet will insert section in the Table of Contents in the vim-help
|
|
|
|
file:
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
post_jump "if tabstop == 0: insert_toc_item(tabstops[1], buffer)"
|
|
|
|
snippet s "section" b
|
|
|
|
`!p insert_delimiter_0(snip, t)`$1`!p insert_section_title(snip, t)`
|
|
|
|
`!p insert_delimiter_1(snip, t)`
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
|
|
|
'insert_toc_item' will be called after first jump and will add newly entered
|
|
|
|
section into the TOC for current file.
|
|
|
|
|
|
|
|
Note: It is also possible to trigger snippet expansion from the jump action.
|
|
|
|
In that case 'new_cursor' should be set to special value named '"keep"', so
|
|
|
|
UltiSnips will know that cursor is already at the required position.
|
|
|
|
|
|
|
|
Following example will insert method call at the end of file after user jump
|
|
|
|
out of method declaration snippet.
|
|
|
|
|
|
|
|
------------------- SNIP -------------------
|
|
|
|
global !p
|
|
|
|
from UltiSnips import UltiSnips_Manager
|
|
|
|
|
|
|
|
def insert_method_call(name):
|
|
|
|
global new_cursor
|
|
|
|
|
|
|
|
vim.command('normal G')
|
|
|
|
UltiSnips_Manager.expand_anon(name + '($1)\n')
|
|
|
|
new_cursor = 'keep'
|
|
|
|
endglobal
|
|
|
|
|
|
|
|
post_jump "if tabstop == 0: insert_method_call(tabstops[1].current_text)"
|
|
|
|
snippet d "method declaration" b
|
|
|
|
def $1():
|
|
|
|
$2
|
|
|
|
endsnippet
|
|
|
|
------------------- SNAP -------------------
|
|
|
|
|
2013-03-25 04:07:49 -04:00
|
|
|
==============================================================================
|
2014-02-23 05:19:11 -05:00
|
|
|
5. UltiSnips and Other Plugins *UltiSnips-other-plugins*
|
2013-03-25 04:07:49 -04:00
|
|
|
|
2014-03-05 13:02:30 -05:00
|
|
|
5.1 Existing Integrations *UltiSnips-integrations*
|
|
|
|
-------------------------
|
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
UltiSnips has built-in support for some common plugins and there are others
|
2013-03-25 04:07:49 -04:00
|
|
|
that are aware of UltiSnips and use it to improve the user experience. This is
|
2014-03-23 04:30:56 -04:00
|
|
|
an incomplete list - if you want to have your plugin listed here, just send me
|
2013-03-25 04:07:49 -04:00
|
|
|
a pull request.
|
|
|
|
|
2014-02-26 02:23:01 -05:00
|
|
|
*UltiSnips-snipMate*
|
|
|
|
|
2014-03-23 04:30:56 -04:00
|
|
|
snipMate - UltiSnips is a drop-in replacement for snipMate. It has many more
|
2014-02-26 02:23:01 -05:00
|
|
|
features, so porting snippets is still a good idea, but switching has low
|
|
|
|
friction now. UltiSnips is trying hard to truly emulate snipMate, for example
|
|
|
|
recursive tabstops are not supported in snipMate snippets (but of course in
|
|
|
|
UltiSnips snippets).
|
2014-02-23 05:19:11 -05:00
|
|
|
|
2014-02-15 07:16:12 -05:00
|
|
|
YouCompleteMe - comes with out of the box completion support for UltiSnips. It
|
|
|
|
offers a really nice completion dialogue for snippets.
|
|
|
|
|
2014-03-06 01:07:49 -05:00
|
|
|
neocomplete - UltiSnips ships with a source for neocomplete and therefore
|
|
|
|
offers out of the box completion dialogue support for it too.
|
|
|
|
|
2014-04-15 10:20:31 -04:00
|
|
|
unite - UltiSnips has a source for unite. As an example of how you can use
|
2014-04-17 17:13:29 -04:00
|
|
|
it add the following function and mappings to your vimrc: >
|
2014-04-03 00:00:34 -04:00
|
|
|
|
|
|
|
function! UltiSnipsCallUnite()
|
|
|
|
Unite -start-insert -winheight=100 -immediately -no-empty ultisnips
|
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
inoremap <silent> <F12> <C-R>=(pumvisible()? "\<LT>C-E>":"")<CR><C-R>=UltiSnipsCallUnite()<CR>
|
|
|
|
nnoremap <silent> <F12> a<C-R>=(pumvisible()? "\<LT>C-E>":"")<CR><C-R>=UltiSnipsCallUnite()<CR>
|
2014-03-31 21:44:31 -04:00
|
|
|
|
2014-04-15 02:19:23 -04:00
|
|
|
When typing <F12> in either insert or normal mode you will get the unite
|
|
|
|
interface with matching snippets. Pressing enter will expand the corresponding
|
|
|
|
snippet. If only one snippet matches the text in front of the cursor will be
|
2014-04-03 00:00:34 -04:00
|
|
|
expanded when you press the <F12> key.
|
2014-03-31 21:44:31 -04:00
|
|
|
|
2013-04-15 01:19:07 -04:00
|
|
|
Supertab - UltiSnips has built-in support for Supertab. Just use a recent
|
2013-03-25 04:07:49 -04:00
|
|
|
enough version of both plugins and <tab> will either expand a snippet or defer
|
|
|
|
to Supertab for expansion.
|
|
|
|
|
2014-03-05 13:02:30 -05:00
|
|
|
5.2 Extending UltiSnips *UltiSnips-extending*
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
UltiSnips allows other plugins to add new snippets on the fly. Since UltiSnips
|
|
|
|
is written in python, the integration is also on a python basis. A small
|
|
|
|
example can be found in `test.py`, search for AddNewSnippetSource. Please
|
|
|
|
contact me on github if you integrate UltiSnips with your plugin so it can be
|
|
|
|
listed in the docs.
|
2013-03-25 04:07:49 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
=============================================================================
|
2013-03-25 04:07:49 -04:00
|
|
|
6. Helping Out *UltiSnips-helping*
|
2009-07-15 15:06:11 -04:00
|
|
|
|
2013-03-25 04:07:49 -04:00
|
|
|
UltiSnips needs the help of the Vim community to keep improving. Please
|
2012-03-10 15:41:47 -05:00
|
|
|
consider joining this effort by providing new snippets, new features or bug
|
|
|
|
reports.
|
2011-12-30 02:29:36 -05:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
You can contribute snippets or patches in various ways. The methods are listed
|
|
|
|
below in order of convenience for me. Please be as convenient as you
|
|
|
|
can be :)
|
2011-12-30 02:29:36 -05:00
|
|
|
|
|
|
|
* Clone the repository on GitHub (git clone git@github.com:SirVer/ultisnips.git),
|
|
|
|
make your changes and send a pull request on GitHub.
|
2012-03-10 15:41:47 -05:00
|
|
|
* Make a patch, report a bug/feature request (see below) and attach the patch
|
|
|
|
to it.
|
|
|
|
* Send me an Email with a patch (see Contact section below).
|
2011-12-30 02:29:36 -05:00
|
|
|
* Send me an Email with the changed files only.
|
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
You can contribute by fixing or reporting bugs in our issue tracker:
|
2014-02-15 07:16:12 -05:00
|
|
|
https://github.com/sirver/ultisnips/issues
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
If you like this plugin, please vote for it on its Vim script page >
|
|
|
|
http://www.vim.org/scripts/script.php?script_id=2715
|
2013-04-15 01:19:07 -04:00
|
|
|
It is life-changing for me. Maybe it is for you too.
|
2012-03-10 15:41:47 -05:00
|
|
|
|
2009-07-13 06:28:58 -04:00
|
|
|
|
2009-07-13 04:46:14 -04:00
|
|
|
=============================================================================
|
2013-03-25 04:07:49 -04:00
|
|
|
7. Contact *UltiSnips-contact*
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2014-02-15 07:16:12 -05:00
|
|
|
You can reach me at SirVer -AT- gmx -ADOT- de.
|
2009-07-13 04:46:14 -04:00
|
|
|
|
2009-07-15 14:11:47 -04:00
|
|
|
This project aims to be the one-for-all solution for Snippets for Vim. If you
|
2014-02-16 07:54:31 -05:00
|
|
|
miss a feature or find a bug, please contact me or add an issues to our issues
|
|
|
|
tracker.
|
2009-07-15 14:11:47 -04:00
|
|
|
|
2009-08-16 10:07:34 -04:00
|
|
|
=============================================================================
|
2013-03-25 04:07:49 -04:00
|
|
|
8. Contributors *UltiSnips-contributors*
|
2012-03-10 15:41:47 -05:00
|
|
|
|
|
|
|
The primary developer of UltiSnips is SirVer (Holger Rapp). The following
|
2014-03-04 11:54:30 -05:00
|
|
|
individuals have contributed to UltiSnips (in chronological order):
|
2010-07-12 08:52:12 -04:00
|
|
|
|
|
|
|
JCEB - Jan Christoph Ebersbach
|
|
|
|
Michael Henry
|
|
|
|
Chris Chambers
|
2010-08-08 21:15:34 -04:00
|
|
|
Ryan Wooden
|
2010-11-13 05:25:01 -05:00
|
|
|
rupa - Rupa Deadwyler
|
2011-02-17 08:07:27 -05:00
|
|
|
Timo Schmiade
|
2011-03-14 15:19:35 -04:00
|
|
|
blueyed - Daniel Hahler
|
2011-03-28 14:27:54 -04:00
|
|
|
expelledboy - Anthony Jackson
|
2011-05-11 03:12:56 -04:00
|
|
|
allait - Alexey Bezhan
|
2011-06-28 16:22:41 -04:00
|
|
|
peacech - Charles Gunawan
|
2011-06-28 16:24:54 -04:00
|
|
|
guns - Sung Pae
|
2011-06-28 16:50:47 -04:00
|
|
|
shlomif - Shlomi Fish
|
2011-07-17 06:17:23 -04:00
|
|
|
pberndt - Phillip Berndt
|
2011-08-18 09:06:35 -04:00
|
|
|
thanatermesis-elive - Thanatermesis
|
2011-08-29 07:14:14 -04:00
|
|
|
rico-ambiescent - Rico Sta. Cruz
|
2012-02-05 11:20:09 -05:00
|
|
|
Cody Frazer
|
2012-01-14 16:24:57 -05:00
|
|
|
suy - Alejandro Exojo
|
2012-02-06 04:22:15 -05:00
|
|
|
grota - Giuseppe Rota
|
2012-03-11 12:30:05 -04:00
|
|
|
iiijjjii - Jim Karsten
|
2012-05-14 03:56:27 -04:00
|
|
|
fgalassi - Federico Galassi
|
2012-05-22 05:24:38 -04:00
|
|
|
lucapette
|
2013-01-22 01:03:06 -05:00
|
|
|
Psycojoker - Laurent Peuch
|
2012-08-09 09:42:16 -04:00
|
|
|
aschrab - Aaron Schrab
|
2012-09-06 13:38:41 -04:00
|
|
|
stardiviner - NagatoPain
|
|
|
|
skeept - Jorge Rodrigues
|
2012-10-14 05:37:58 -04:00
|
|
|
buztard
|
2012-11-24 04:32:00 -05:00
|
|
|
stephenmckinney - Steve McKinney
|
2012-12-17 05:03:02 -05:00
|
|
|
Pedro Algarvio - s0undt3ch
|
2013-01-22 01:03:06 -05:00
|
|
|
Eric Van Dewoestine - ervandew
|
|
|
|
Matt Patterson - fidothe
|
2013-01-27 11:38:49 -05:00
|
|
|
Mike Morearty - mmorearty
|
2013-02-18 14:41:54 -05:00
|
|
|
Stanislav Golovanov - JazzCore
|
2013-03-21 06:32:17 -04:00
|
|
|
David Briscoe - DavidBriscoe
|
2013-04-12 00:55:37 -04:00
|
|
|
Keith Welch - paralogiki
|
2013-04-21 11:18:14 -04:00
|
|
|
Zhao Cai - zhaocai
|
2013-06-19 02:00:52 -04:00
|
|
|
John Szakmeister - jszakmeister
|
2013-07-16 01:05:42 -04:00
|
|
|
Jonas Diemer - diemer
|
2013-10-23 02:16:59 -04:00
|
|
|
Romain Giot - rgiot
|
2013-12-30 16:37:17 -05:00
|
|
|
Sergey Alexandrov - taketwo
|
2013-12-27 13:21:51 -05:00
|
|
|
Brian Mock - saikobee
|
2014-02-03 12:14:27 -05:00
|
|
|
Gernot Höflechner - LFDM
|
2014-02-05 13:19:16 -05:00
|
|
|
Marcelo D Montu - mMontu
|
2014-03-05 02:14:53 -05:00
|
|
|
Karl Yngve Lervåg - lervag
|
2014-03-08 03:09:21 -05:00
|
|
|
Pedro Ferrari - petobens
|
2014-03-23 04:54:41 -04:00
|
|
|
Ches Martin - ches
|
2014-04-06 10:33:02 -04:00
|
|
|
Christian - Oberon00
|
2014-04-09 10:51:19 -04:00
|
|
|
Andrew Ruder - aeruder
|
2014-05-03 04:42:23 -04:00
|
|
|
Mathias Fußenegger - mfussenegger
|
2014-07-02 01:27:29 -04:00
|
|
|
Kevin Ballard - kballard
|
2014-07-22 03:28:02 -04:00
|
|
|
Ahbong Chang - cwahbong
|
2014-10-08 13:30:40 -04:00
|
|
|
Glenn Griffin - ggriffiniii
|
2014-12-08 01:20:53 -05:00
|
|
|
Michael - Pyrohh
|
2014-12-06 12:53:19 -05:00
|
|
|
Stanislav Seletskiy - seletskiy
|
2015-01-15 02:17:37 -05:00
|
|
|
Pawel Palucki - ppalucki
|
2015-02-14 04:44:48 -05:00
|
|
|
Dettorer - dettorer
|
2015-04-12 10:34:06 -04:00
|
|
|
Zhao Jiarong - kawing-chiu
|
2015-06-01 15:12:19 -04:00
|
|
|
Ye Ding - dyng
|
2015-07-12 01:17:35 -04:00
|
|
|
Greg Hurrell - wincent
|
2014-05-03 04:42:23 -04:00
|
|
|
|
2009-08-16 10:07:34 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
Thank you for your support.
|
2009-08-16 10:07:34 -04:00
|
|
|
|
2012-03-10 15:41:47 -05:00
|
|
|
vim:tw=78:ts=8:ft=help:norl:
|