Commit Graph

138 Commits

Author SHA1 Message Date
Holger Rapp
e557c8751e All tests pass 2010-08-19 13:52:12 +02:00
Holger Rapp
686bacb7a2 All TrailingNewline tests pass now. Others broke though 2010-08-19 13:35:06 +02:00
Holger Rapp
d2190f95ff First test passes, have not broken anything yet 2010-08-19 12:32:45 +02:00
Holger Rapp
9011515686 Merged my fix for bug 501727 2010-08-18 12:54:23 +02:00
Holger Rapp
e3d9896cf2 Encapsulated the translation of the langmap including caching of results into a own object 2010-08-18 12:52:56 +02:00
Holger Rapp
1637cbef8a The only working solution is to manually reverse the langmap if possible. 2010-08-18 11:54:56 +02:00
Holger Rapp
131e5fdc04 all calls to feedkeys are now routed through one function 2010-08-18 10:24:34 +02:00
rygwdn@gmail.com
4b85266929 Added documentation for globals, and fixed docs for locals.
Fixed error messages to match tests.
Changed endsnippet -> endglobal for global snippets.
2010-08-17 00:12:30 -03:00
rygwdn@gmail.com
e025da5cf2 Changed local variables in python code blocks to persist across blocks in a snippet.
Removed "snips.locals".
Also added ability to use file-wide "global" snippets.
Added tests for both.
2010-08-16 21:59:41 -03:00
Holger Rapp
5803910060 Merged ryans regular expression trigger branch 2010-08-10 10:35:54 +02:00
Holger Rapp
4e966e1a05 Fixed some whitespaces 2010-08-10 10:25:37 +02:00
rygwdn@gmail.com
deecdc8c49 added some in-code documentation to clarify the changes. 2010-08-09 09:34:09 -03:00
rygwdn@gmail.com
4a3b2310ab give match object to python blocks. 2010-08-08 21:49:03 -03:00
rygwdn@gmail.com
4851a8277e Added support for multi-word snippets. 2010-08-08 21:32:36 -03:00
rygwdn@gmail.com
1167fd6729 added basic regular expression matching. 2010-08-08 19:29:46 -03:00
rygwdn@gmail.com
b5c8a32762 added new "matched" property on snippet. contains the last string that matched the snippet. 2010-08-08 16:16:24 -03:00
rygwdn@gmail.com
fb54432ff0 more work on the refactor. most duplicated code is gone now. 2010-08-08 08:23:24 -03:00
rygwdn@gmail.com
4e0102b3fa started refactor of _try_expand and list_snippets. 2010-08-08 07:57:28 -03:00
Holger Rapp
76b5ce1eb0 Whitespace fixes and python 2.5 compatibility 2010-08-02 15:22:18 +02:00
rygwdn@gmail.com
462b9cdf77 updated deprecation messages, and updated (and documented) the way
"snip.rv" works.
2010-07-30 21:54:51 -03:00
rygwdn@gmail.com
e6759cd03f added fn, basename and ft properties to SnippetUtil. 2010-07-30 21:21:05 -03:00
rygwdn@gmail.com
d6c174e9df merged with upstream 2010-07-29 23:11:46 -03:00
rygwdn@gmail.com
6a98c5439d typo fixes! 2010-07-29 22:42:38 -03:00
rygwdn@gmail.com
64500f6188 - removed some hacks from testing.
- removed "first" variable hack.
- made some variables more consistent.
- cleaned up indentation code.
- added "opt".
- hand the right things into SnippetUtil.
2010-07-29 22:35:53 -03:00
rygwdn@gmail.com
d7ccf9f711 improved mkline, added syntatic sugar, rv, c, and locals.
rv contains the return value, c contains the current contents.
mkline can now append directly to rv.
locals is a dict which replaces the dictionary style access to snippetutil.
added syntatic sugar for:
- appending lines to the snippet with the default indentation (snip += "blah").
- shifting (>>) and unshifting (<<) by an amount
2010-07-27 22:18:22 -03:00
Holger Rapp
b437f30fc7 Applied patch from Chris Chambers 2010-07-12 14:52:12 +02:00
rygwdn@gmail.com
67d1b65aa7 removed another extra print, and fixed some comments 2010-05-16 21:38:55 -03:00
Ryan Wooden
c72307c19d removed a print statement which was causing unit tests to fail 2010-05-16 20:23:02 -03:00
rygwdn@gmail.com
513a635c51 use a helper object, rather than replacing 'res', also provide 'snippet-local' variables 2010-05-16 19:34:44 -03:00
rygwdn@gmail.com
e8125051d3 Added PythonResult class to handle indentation, etc automatically. Modified my python snippets to use it. 2010-05-16 15:22:16 -03:00
rygwdn@gmail.com
52be5df6ef Shortened the variable name, and added documentation. 2010-05-16 02:19:55 -03:00
rygwdn@gmail.com
741686603a Added initial_indent to python context 2010-05-16 02:03:36 -03:00
Holger Rapp
5d116bac33 Merged with clearsnippets branch from Michael Henry. Only very minor changes on my part 2009-10-13 09:56:12 +02:00
Holger Rapp
31cd328236 Cleaned python 2.6 workaround up a bit 2009-09-17 14:26:57 +02:00
Holger Rapp
e12f7f3b9c Fixes for python 2.6 2009-09-17 14:11:43 +02:00
Michael Henry
9e6b3737f8 Added <silent> to mappings to remove the distraction in the status line. 2009-09-17 05:53:25 -04:00
Michael Henry
ca560acd86 Removed spurious debug "print" statement. 2009-09-09 06:39:18 -04:00
Michael Henry
99e8842ca5 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
Holger Rapp
4948c5f7f7 Applied Michael Henrys patch for w option 2009-08-30 20:39:27 +02:00
Holger Rapp
441d0d21cf Applied patch by Michael Henry to fix a bug that ultisnips doesn't exit at ts zero 2009-08-30 20:15:06 +02:00
Michael Henry
66ba0686d9 Snippet mode is now exited after final tabstop zero is encountered. 2009-08-25 19:18:06 -04:00
Michael Henry
9a19e9c573 Fixed problem with tab being ignored on failed snippet expansion. 2009-08-24 06:28:54 -04:00
Michael Henry
66d35419a4 Added support for snippet option "w" for word-boundary triggers. 2009-08-23 18:44:19 -04:00
Holger Rapp
40a0b46435 Fixed a bug with escaping of twopoints in conditional replaces 2009-08-17 17:20:19 +02:00
Holger Rapp
3cf98270de Implemented listing of current snippets following the suggestion of jceb. This patch took another route than his suggestion, but should be functional equivalent 2009-08-16 20:55:08 +02:00
Holger Rapp
de9e35b8f7 Fixed stupid bug introduced in last revision 2009-08-16 18:50:14 +02:00
Holger Rapp
a96a6a31c9 Made trigger description include trigger by default. Patch suggested by jceb 2009-08-16 16:44:50 +02:00
Holger Rapp
c1462f3a02 _SnippetDictionary is no longer derived from dict since it makes no longer sense with the i option 2009-08-16 16:42:32 +02:00
Holger Rapp
cd0b859b62 Implemented i option (inword snippet expansion) along the line of the patch by jceb, also added his test cases 2009-08-16 16:34:54 +02:00
Holger Rapp
f4515daeee Fixed bug 411010 2009-08-09 15:00:20 +02:00