Slippery Snippets
Tuesday, July 25, 2006
  Bug fix: TextMate mode now works in Linux The new TextMate mode was not working properly under linux due to some strange behaviour with expand('<cword>'). The new version (uploaded) uses a different search mechanism so all should be better. Bug reports to the usual address.

Could anyone under *nix environments try a little test for me? Open Vim, go to insert and type: AWORD<c-r>=expand('<cword>')<cr>. That is: type AWORD, hit ctrl-r, '=' and 'expand('<cword>')'. Under Windows this will insert AWORD after the first AWORD. Under Linux it does not. Post what you get along with your vim version and environment in the comments. Cheers. 
Fantastic work! I'm enjoying every new version of you script.

I'm having some problems with the TextMate compatibility mode. Basically, it does not expand the snippet keyword when I hit tab; it simply inserts a tab.

I'm using VIM 7 on Ubuntu 6.06, and I've set the start and end tags to '@'.

Any suggestions?

Thanks and keep up the awesome work!
BTW, I tried what you asked with AWORD. I do NOT get the copy of AWORD after the original.
That's kind of annoying as that's the Linux set up I'm testing with. Can you double check that only 0.5.4 is present in your plugin directory. Also make sure that g:snip_set_textmate_cp is set to 1: stick 'let g:snip_set_textmate_cp = 1' in your .vimrc. You'll need to set this and restart Vim.

Simple stuff I know but if you're still having trouble then drop me an email.
That describes you.

That describes me.

I mistakenly put the 'let g:snip_set_textmate_cp = 1' in the cpp_snippets.vim file instead of the .vimrc file. :)

Once I corrected this, everything seems to be working just fine!

Thanks for your help, Felix!

I think this highlights the need for some better documentation really. It's in the pipeline.
I've defined my snippets in after/ftplugin/cpp_snippets.vim. This is the only snippets file I have. And, I've defined textmate compatibility mode in my .vimrc file. This works great when I'm working on C/C++ files. However, I've run into a couple of issues.

1) When I edit a regular, non-C/C++ text file, and I hit tab, I get an error message:
Error detected while processing function < SNR >14_Jumper:
line 65:
E121: Undefined variable: s:search_str

2) I've tried putting the "let g:snip_set_textmate_cp=1" in an autocommand to set it only when working with a C/C++ file. But, that doesn't work like I expect it. While it doesn't set textmate compatibilty mode for non-C/C++ files, it seems to revert back to the spacebar expanding my snippets in C/C++ files.

Can you help?

I've seen this problem a couple of times. It basically comes from installing the plugin but not having any definitions defined. When you hit tab then the search string won't have been defined (it gets defined when snippets are set) and so you get an error.

I'll look into fixing this in the next version. For now you can define a snippet that you'll never use in your .vimrc (some line noise or similar). This should work as a quick fix.
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]