Commit Graph

302 Commits

Author SHA1 Message Date
Holger Rapp
f7c12f9d55 Fixed all remaining TODOs 2011-07-24 19:16:49 +02:00
Holger Rapp
7f12de5cd9 More cleanup 2011-07-24 18:46:35 +02:00
Holger Rapp
9608346e77 TextObjects now accept a single token as initializer 2011-07-24 18:29:31 +02:00
Holger Rapp
ad0059bc2d Some refactoring 2011-07-24 17:30:29 +02:00
Holger Rapp
ac619f0bd2 All tests pass again. Only beautifying still to do 2011-07-24 17:01:03 +02:00
Holger Rapp
c5245ae69a Implemted ShellCode again 2011-07-24 13:19:11 +02:00
Holger Rapp
6c1a82c04d Implemented Transformation parsing 2011-07-24 13:10:57 +02:00
Holger Rapp
ef10362469 Fixed escaped chars handling 2011-07-24 11:42:29 +02:00
Holger Rapp
b91e97fa5d Homing in on a design 2011-07-24 09:31:25 +02:00
Holger Rapp
4307612aa8 New stateful parser. Still flawed design and not flexible enough, but a beginning 2011-07-23 23:40:01 +02:00
Holger Rapp
cdb4558f79 First tryouts.. Nothing working so far and all is horrible ugly 2011-04-01 21:03:25 +02:00
Holger Rapp
2ac5fd419b New conversion script for snipmate snippet files. Work by Phillip Berndt, only whitespace corrections by me 2011-07-17 12:17:23 +02:00
Holger Rapp
b46461bc07 Sort snippets alphabetically before showing them in the list. Patch by Allait 2011-07-17 12:09:29 +02:00
Phillip Berndt
8276ec9b94 Use argparse in the snipmate conversion script, renamed that script to convert_snipmate_snippets, removed the snipmate compatibility code from UltiSnips.vim and placed it into it's own file, fixed a bug where the user's value of g:snips_author was overwritten 2011-07-14 12:24:14 +02:00
Phillip Berndt
d08b58cf39 Some of snipmates snippets also require one to have g:snips_author defined 2011-07-13 14:23:21 +02:00
Phillip Berndt
281781fcee Added snipmate's Filename() helper to UltiSnips.vim 2011-07-13 14:19:17 +02:00
Holger Rapp
83de7a3e66 Fixed the problem that you could not switch windows/tabs while inside a snippet 2011-06-28 22:48:05 +02:00
Holger Rapp
402df7605c Fixed a bug which compared a vim.eval to an integer instead of a string. Patch by Sung Pae 2011-06-28 22:24:54 +02:00
Holger Rapp
c6af0d0c72 Regression fix for listing snippets by Charles Gunawan 2011-06-28 22:22:41 +02:00
rygwdn@gmail.com
4e145d7f79 Added tests and a fix for bug #774923. 2011-05-02 16:20:36 -03:00
rygwdn@gmail.com
cd375f976c Added fix for bug #774917. 2011-05-02 14:56:27 -03:00
rygwdn@gmail.com
5d208cb7be return snippets in original order 2011-05-02 14:28:10 -03:00
rygwdn@gmail.com
a2ee197c1f added proper quoting taken from rope-omni plugin 2011-05-02 14:27:41 -03:00
rygwdn@gmail.com
5facee70f8 applied patch from allait. fixes bug #774911.
only overwrites snippets with the same trigger when overwrite_previous is set.
2011-05-02 13:33:50 -03:00
Holger Rapp
9e712a9a39 Removed UltiSnipsReset. It is no longer needed 2011-04-28 08:27:09 +02:00
Holger Rapp
8c249b79c8 Merged ryans implementation of automatic reloading of changed snippet files. Replaced crc32 through hashlib.sha1 because it is always available since python 2.5, more reliable and has the same runtime up to an order of magnitude 2011-04-28 08:23:01 +02:00
rygwdn@gmail.com
6b86dcae2b added fallback for crc and ability to disable hashing on entry.
also disabled hashing in parsing tests to avoid having the test files
overwritten in the process.
2011-04-27 23:41:30 -03:00
rygwdn@gmail.com
7d5e92743a track manually added snippets differently 2011-04-27 23:13:26 -03:00
rygwdn@gmail.com
db9e0b20a7 implemented idea from bug #720326.
uses an MD5 hash to determine if any .snippets files have been updated
2011-04-27 22:22:34 -03:00
rygwdn@gmail.com
424b817338 look through filetypes in the right order 2011-04-27 16:09:33 -03:00
rygwdn@gmail.com
fe896cffb3 fixed return for method - tests all pass now 2011-04-27 15:58:42 -03:00
rygwdn@gmail.com
b54300a82e added documentation for new search 2011-04-27 15:51:04 -03:00
rygwdn@gmail.com
ce6efdd95c added in-code documentation 2011-04-27 15:37:12 -03:00
rygwdn@gmail.com
ad84c346d0 - extracted and cleaned up searching for snippets files
- cleaned up UltiSnipsEdit by rewriting in python reusing existing code
2011-04-27 15:26:12 -03:00
rygwdn@gmail.com
dbeecdbe24 use consistent spacing in vim file 2011-04-27 12:37:07 -03:00
Holger Rapp
a63c3f9a18 Improvements to UltiSnipsEdit command by jmcantrell which partially fixes bug 748433 2011-04-09 17:58:30 +02:00
Holger Rapp
eeb8dc4831 Disable vims auto-wrapping inside snippets
- Disable autowrapping inside of snippets
- renable it when the snippet has been completely handled
- added snippet option 'f' to avoid disabling text wrapping
- added docs and tests
2011-04-09 17:48:14 +02:00
Holger Rapp
2def1b4ce1 Escaping of \ didn't work 2011-04-01 16:50:49 +02:00
Holger Rapp
8513aa48d8 Added a new variable for snippet directory names. UltiSnips directories can be excluded to not make the shipped plugins available 2011-03-31 07:40:56 +02:00
Holger Rapp
1b782e1218 Compatibility changes for python 2.6, mainly for windows 2011-03-30 08:23:59 +02:00
Holger Rapp
0f50245882 Leave initial indent of line alone, only reindent snippet definition 2011-03-29 07:02:14 +02:00
Holger Rapp
a0a2b54f52 Catch errors and show them in a scratch buffer instead of posting useless lines in the statusbar 2011-03-28 23:02:58 +02:00
rygwdn@gmail.com
6c210e26fe fixes bug #720611 by keeping track of which filetypes have been tried. 2011-02-28 23:31:32 -04:00
Holger Rapp
57cf2790cb Refactored fix for better understandability 2011-02-20 21:16:56 +01:00
Holger Rapp
461e81d6a2 Added stricter test case that show the problem and implement fixes for them 2011-02-20 20:49:32 +01:00
Holger Rapp
be07baf2a8 Handle the case when vim was not compiled with the langmap option 2011-02-16 13:38:51 +01:00
Holger Rapp
a4242d65f7 Fixed a map with select mode unmapping 2011-02-13 19:34:21 +01:00
rygwdn@gmail.com
386e0a6a9b Return true from expand_anon if the snippet was actually expanded. 2011-02-04 20:09:28 -04:00
rygwdn@gmail.com
30738b2176 Use faster, cleaner method for modifying the path. 2011-02-04 20:02:30 -04:00
rygwdn@gmail.com
98b396ff24 Fixes Bug #427676.
- Adds the idea of anonymous snippets with new method on SnippetManager to expand a snippet without adding it.
- Adds two new functions for adding new snippets, and expanding anonymous snippets.
- Adds tests for the above functionality.
2010-12-18 13:07:46 -04:00
rygwdn@gmail.com
b065b5cf30 Fixes Bug #691575.
Deals with the case where there are multiple matches on the line. Tries all
matches until one fits!
2010-12-17 22:38:56 -04:00
rygwdn@gmail.com
fbb339d03e add option to not expand tabs in snippet 2010-11-22 10:14:47 -04:00
rygwdn@gmail.com
eff5ec2c66 use shiftwidth again as per bug comments 2010-11-22 09:59:06 -04:00
rygwdn@gmail.com
9464f0c99c better name for 'tab' attribute, and expand to tabstops, rather inserting 'ts' spaces 2010-11-18 14:00:36 -04:00
rygwdn@gmail.com
23924c3249 use sts instead of sw for initial tabs 2010-11-18 13:30:07 -04:00
rygwdn@gmail.com
c20c76be71 Fixes bug #676998.
- Adds a new module for handling indentation to bring everything together.
- Uses shiftwidth to replace initial tabs in snippets, this is closer to
  what you would get if you were to type the snippet out by hand.
- Replaces code in SnippetUtil with common class.
- Replaces the code in launch() with the common class to properly, and
  consistently indent the lines.
- Changes the tests to use shiftwidth instead of tabstop as per the bug.
- Fixes the indentation in python snippets to use tabs instead of spaces.
2010-11-18 12:58:15 -04:00
rygwdn@gmail.com
d74c3f697b fixes bug with trailing whitespace 2010-11-16 15:32:28 -04:00
Holger Rapp
b9c48763c5 Removed unneeded import statement 2010-09-23 10:50:51 +02:00
Holger Rapp
13331a8aba Fixed a bug if a snippet contains folding markers. Call normal zv (show current line) after each insertion 2010-09-23 10:49:39 +02:00
Holger Rapp
c095147fa1 Added commands UltiSnipsReset and UltiSnipsEdit by JCEB 2010-09-22 13:01:04 +02:00
Holger Rapp
05c09d746a Merged my fixes for the bug Ryan brought up 2010-08-21 13:10:47 +02:00
Holger Rapp
09939c2921 Fixed the bug again 2010-08-21 13:07:54 +02:00
Holger Rapp
5aac3f5836 Implemented a fix for select mode mappings along the lines of the suggestions by Ryan. Added tests. Documentation is still missing 2010-08-20 09:32:12 +02:00
Holger Rapp
b5fe29bc0f Fixed a TODO and removed some which do not seem to be reasonable at this point in time 2010-08-19 14:02:03 +02:00
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
Holger Rapp
43e60ebd57 Added support for extends keyword. With this it is simple to make inheritance trees of snippets for file types 2009-08-02 11:57:43 +02:00
Holger Rapp
1236d0ab86 Refactored parsing of Snippets files a bit to make it easier to extend the syntax 2009-08-02 11:29:42 +02:00
Holger Rapp
5eaed114db Fixed 407144. Also added test cases for it 2009-08-02 10:35:23 +02:00
Holger Rapp
ac163993a9 Fixed expandtabs. Was broken at the beginning of the line. Now it is broken in the middle of the line 2009-07-30 08:08:36 +02:00
Holger Rapp
8fb1412791 - fixed a bug related to indentexpr. vim just has too many options
- expandtab and ts options are now taken into consideration when expanding tabs
2009-07-29 09:49:44 +02:00
Holger Rapp
274ef83833 Fixed bug #405502. Also added a test case for it 2009-07-28 08:04:53 +02:00
Holger Rapp
cb458a0ce7 Attemp to work around SuperTabs <tab> claiming when installed in the home vim folder 2009-07-27 09:51:09 +02:00
Holger Rapp
e5058084c3 Fixed a missing self; a bug that slipped the tests 2009-07-26 23:03:59 +02:00
Holger Rapp
2f28d0ebb5 Fixed bug #404822 with a patch by jceb. 2009-07-26 17:42:40 +02:00
Holger Rapp
5ee8b842eb Fixed some bugs related to char escaping in snippet definitions. fixes #401687 2009-07-22 12:08:21 +02:00
Holger Rapp
d0a50ae9d2 Made trigger keys configurable. Added support for setting forward jump and expand to the same key 2009-07-21 10:21:05 +02:00
Holger Rapp
c3dff61ef1 Fixed a small bug with string escaping in transformations. Went over the c snippets from TextMate, reworked them to work without any shell code (for compatibility sake) 2009-07-19 17:12:57 +02:00
Holger Rapp
47a7948526 Conditional replaces can now be nested 2009-07-19 16:44:29 +02:00
Holger Rapp
5a42d16499 Added snippets for snippets. Fixed a subtle bug with overwriting snippets 2009-07-19 12:56:10 +02:00
Holger Rapp
0943961479 Added support for b option. Some snippets can be defined to only be valid at the beginning of the line 2009-07-18 00:51:19 +02:00
Holger Rapp
c1494c6d83 A small refactoring 2009-07-18 00:14:20 +02:00
Holger Rapp
5d2a39a0c5 Fixed a inconsequent handling of indent: indent was different for recursive snippets then for the othermost snippet 2009-07-17 23:42:33 +02:00
Holger Rapp
93b3cc7126 Added support for overwriting of previous snippet definitions 2009-07-17 23:33:48 +02:00
Holger Rapp
e3ae328d8c Added support for dotted ft syntax 2009-07-17 23:00:59 +02:00
Holger Rapp
e9c1dd597a All done. Ready for intial release I guess 2009-07-16 18:08:32 +02:00
Holger Rapp
3e25a15469 Fixed the annoying bug 2009-07-16 17:49:35 +02:00
Holger Rapp
3f760eaebf Only one critical known bug remaining in recursive expansion 2009-07-16 17:34:36 +02:00
Holger Rapp
118045a24a Added more test cases for recursive tabstops, fixed some bugs that occured 2009-07-16 17:00:25 +02:00
Holger Rapp
94ee96cb31 Added vim module into imported python modules for python interpolation. box and bbox are now in the all.snippets and use the comment leader extracted from the commentstring option 2009-07-16 15:51:15 +02:00
Holger Rapp
8e46b5ba11 Beginning of recursive snippet expansion. This still has more bugs than a dog has fleas 2009-07-16 14:10:59 +02:00
Holger Rapp
318b2726ae Fixed bug 400105 and 400114 2009-07-16 10:16:30 +02:00
Holger Rapp
717ae7586c Fixed a stupid bug where == and bzr commit -m "Fixed a stupid bug where == and boxes -d shell= were used. Instead it should have been is and is not"= were used. Instead it should have been is and is not 2009-07-15 17:40:24 +02:00
Holger Rapp
001bb70975 Added support for vimscript interpolation 2009-07-15 16:28:33 +02:00
Holger Rapp
8b2c8274ec Removed an unneeded debug output 2009-07-13 12:29:55 +02:00
Holger Rapp
79d342ddb4 Added support for interpolated python code 2009-07-13 11:36:13 +02:00
Holger Rapp
53f464e3a0 Fixed a bug with indenting in snippets. Autoindent is now supported 2009-07-12 17:23:39 +02:00
Holger Rapp
ba6e0662b5 Added the possibility to backspace over newlines in tabstops 2009-07-10 18:34:46 +02:00
Holger Rapp
86e7b3a1b5 The project now has a name: UltiSnips 2009-07-10 12:47:54 +02:00
Holger Rapp
5db7148f77 children -> childs everywhere 2009-07-10 12:29:40 +02:00
Holger Rapp
3bcbdac872 - Fixed a bug in parsing of definition files
- implemented shell code interpolation
- implemented multiline tabstop selection (needed for shell code interpolation)
2009-07-10 12:06:58 +02:00
Holger Rapp
8d9c04c675 Fixed a corner case in jumping: When a TS was selected and the next one was jumped too and was a TS with zero lenght, the cursor moved one too far 2009-07-10 09:35:21 +02:00