Use this page to discuss script 2540 snipMate: TextMate-style snippets
- Add constructive comments, bug reports, or discuss improvements (see the guideline).
- Do not document the script here (the author should do that on vim.org).
- This page may be out of date: check the script's vim.org page above, and its release notes.
Forks[]
There have been some changes and improvements with forks of this plugin. Works with supertab, better handling of multiline snippets, many snippets added, and a bunch of other stuff.
The main fork seems to be: SnipMate Fork
And snippets now are separate: Snippets Repo
Comments[]
I've just installed snipmate and am trying to add a snippets file for Oberon/Modula. I created the snippets file from the Perl one, and added a pro tag like this:
# Function snippet pro PROCEDURE ${1:function_name} { ${2:#body ...} END ${1};
I added the .Mod to the Modula 2 filetypes file.
I'm getting the following error:
"test.Mod" [New File] Error detected while processing BufNewFile Auto commands for "*.Mod": E20: Mark not set
Can you help me with this? Fitz
I have this in my vimrc to quickly access the files (modify based on your paths). Usage:
:Snippets
will open all associated file types.
com! Snippets call Snipple() function! Snipple() for myfiletype in split(&ft, "\\.") exec "split ~/.vim/nicessnippets/" .myfiletype. ".snippets" endfor endfunc
On my machine (Debian 5, Vim 7.1, snipMate 0.83) I have the following problem:
when I'm inside a snippet and use ctrl-N tab-completion then it seems that the whole list of possible source files is scanned for a possible completion before I get any suggestion, which can take quite a long time. This happens even if the text to bo completed can actually be found in the current buffer.
Outside of snippets, this does not happen, i.e. the completion list is built rapidly and I get possible completions from the current buffer instantly.
Any idea why this could be happening? This is in Perl code BTW.
Frank
In case you want to get the function name you are in from a snippet, you can patch this function and call it in .vim/plugin/snipMate.vim
fun! ShowFuncName() let func_def=getline(search("^[^ \t#/]\\{2}.*[^:]\s*$", 'bW')) let no_args=substitute( func_def, "\s*(.*$", "", "g") let no_ret_val=substitute( no_args, ".* [^a-zA-Z]*", "", "g") return no_ret_val endfun
This is tested for C code only. Im sure it can be done way nicer, but im not a regex guru :) special thanks to do1 for providing the original
--DirectSunlight 20:07, October 19, 2011 (UTC)