Slippery Snippets
Monday, August 14, 2006
  0.5.5. Released. 0.5.5 is out. All the bugs mentioned in the last post have been fixed (fingers crossed).

The whole plugin is now a lot more buffer specific and should handle a lot better.

If there are any more bugs (new or old) then post them here (or email me).
Unfortunately I get this error when starting vim:

Fehler beim Ausführen von "/usr/share/vim/vim64/plugin/snippetEmu0.5.5.vim":
Zeile 298:
E193: :endfunction außerhalb einer Funktion
Zeile 342:
E580: :endif ohne :if: endif
Zeile 343:
E581: :else ohne :if: else
Zeile 353:
E580: :endif ohne :if: endif
Zeile 354:
E581: :else ohne :if: else
Zeile 372:
E492: Kein Editor-Befehl: for i in range(strlen(snip_start_tag))
Zeile 377:
E580: :endif ohne :if: endif
Zeile 378:
E193: :endfunction außerhalb einer Funktion
Hi Fladd. Sorry to say that this version of snippetsEmu requires Vim 7.0. I think I've had a similar error when running it on an older version. I'll try and get a VM image up with an older version so I confirm that.
As this is the bug thread for 0.5.5 I'll post my current list here:

TODO Escape strings for matching in replacements
Special characters in commands or tag names can cause problems when replacing. Infinite loops are very likely.

TODO Default value function doesn't work for named tags
Having a named tag will fill @z which in turn will cause the default function to fail. One possible fix will be to remove the possibility for tag names to act as default values. This may annoy, whoever.
first of all, thanks for that wonderful plugin! A real timesaver :)

I don't know if this is really a bug, but it just took me 20 minutes to figure out that "Textmate mode" only works if the line
:let g:snip_set_textmate_cp=1
appears in ~/.vimrc *before* loading the snippetEmu script itself.
(Tested with commandline version of Vim 7.0 on linux, snippetEmu0.5.5)

Perhaps you should add this to the documentation.
After playing around a little bit more, I think I found a bug:
It seems like you can't define Iabbrs starting with the letter 's' when in texmate-mode???

I've already moved my ~/.vimrc and ~/.vim directory out of the way to make sure nothing in there interferes with the snippet script, to no avail.

I tried this (and several variations):
:Iabbr afoo test(<>)
:Iabbr sfoo test(<>)

In "normal" mode, both snippets work without any problem, in "textmate" mode, hitting tab after 'sfoo' just inserts tabs.

Interestingly, if the abbreviation contains *only* 's' characters, like this:
:Iabbr sss test(<>)
when pressing Tab multiple times, the fist Tab will insert a Tab, and the next ones will trigger the mapping, but not jump to the markers, resulting in this:
sss test(test(test()))
Ok, found it :)
The problem is in line 219 and 225 of snippetEmu0.5.5.vim (I'd post a patch if the comment system would let me instead of complaining about invalid HTML).

There are 2 calls to the substitute() function to strip leading and/or trailing spaces. The problem is the double quotes around the search pattern. If enclosed in double quotes, '\s' will match 's' instead of spaces.

You can try it out with

:echo substitute("sfoo", "\s*foo", "bar", "")

prints: 'bar'
expected: 'sbar'

To make it work, one must either use single quotes:

:echo substitute("sfoo", '\s*foo', "bar", "")

or double backslashes:

:echo substitute("sfoo", "\\s*foo", "bar", "")

The Vim documentation in ':help pattern' does not make this clear at all, IMHO, but ':help literal-string' gives an example.
Hi nfowar. Thanks for the bug report and thanks for tracking the bug down. I'll make sure that it's fixed in the next release.

Sorry for the slow response; emails will next you a speedier reply if you have any more troubles.

Fingers crossed there aren't any more though :-)
Post a Comment

Subscribe to Post Comments [Atom]

<< Home

July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / March 2007 / April 2007 / May 2007 / July 2007 / September 2007 / February 2008 / June 2009 / December 2010 /

Powered by Blogger

Subscribe to
Posts [Atom]