# HG changeset patch # User Steve Losh # Date 1288197375 14400 # Node ID f2193e4dee39ff3e5d9a166bb19fbaf8d3cd4d6d # Parent 126dedb1845dc50905b3eb456dd3bed55f70ff6f vim: update snipmate diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/README.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/bundle/snipmate/README.markdown Wed Oct 27 12:36:15 2010 -0400 @@ -0,0 +1,5 @@ +Quickly install with: + + git clone git://github.com/msanders/snipmate.vim.git + cd snipmate.vim + cp -R * ~/.vim diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/after/plugin/snipMate.vim --- a/vim/bundle/snipmate/after/plugin/snipMate.vim Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/bundle/snipmate/after/plugin/snipMate.vim Wed Oct 27 12:36:15 2010 -0400 @@ -5,6 +5,11 @@ endif let s:did_snips_mappings = 1 +" This is put here in the 'after' directory in order for snipMate to override +" other plugin mappings (e.g., supertab). +" +" You can safely adjust these mappings to your preferences (as explained in +" :help snipMate-remap). ino =TriggerSnippet() snor i=TriggerSnippet() ino =BackwardsSnippet() diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/autoload/snipMate.vim --- a/vim/bundle/snipmate/autoload/snipMate.vim Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/bundle/snipmate/autoload/snipMate.vim Wed Oct 27 12:36:15 2010 -0400 @@ -76,14 +76,16 @@ fun s:ProcessSnippet(snip) let snippet = a:snip " Evaluate eval (`...`) expressions. + " Backquotes prefixed with a backslash "\" are ignored. " Using a loop here instead of a regex fixes a bug with nested "\=". if stridx(snippet, '`') != -1 - while match(snippet, '`.\{-}`') != -1 - let snippet = substitute(snippet, '`.\{-}`', - \ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')), - \ "\n\\%$", '', ''), '') + while match(snippet, '\(^\|[^\\]\)`.\{-}[^\\]`') != -1 + let snippet = substitute(snippet, '\(^\|[^\\]\)\zs`.\{-}[^\\]`\ze', + \ substitute(eval(matchstr(snippet, '\(^\|[^\\]\)`\zs.\{-}[^\\]\ze`')), + \ "\n\\%$", '', ''), '') endw let snippet = substitute(snippet, "\r", "\n", 'g') + let snippet = substitute(snippet, '\\`', '`', 'g') endif " Place all text after a colon in a tab stop after the tab stop diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/doc/snipMate.txt --- a/vim/bundle/snipmate/doc/snipMate.txt Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/bundle/snipmate/doc/snipMate.txt Wed Oct 27 12:36:15 2010 -0400 @@ -1,7 +1,7 @@ *snipMate.txt* Plugin for using TextMate-style snippets in Vim. snipMate *snippet* *snippets* *snipMate* -Last Change: July 13, 2009 +Last Change: December 27, 2009 |snipMate-description| Description |snipMate-syntax| Snippet syntax @@ -10,6 +10,7 @@ |snipMate-features| Features |snipMate-disadvantages| Disadvantages to TextMate |snipMate-contact| Contact +|snipMate-license| License For Vim version 7.0 or later. This plugin only works if 'compatible' is not set. @@ -198,10 +199,20 @@ multiple matches, it should look like this: 'snippets///.snippet' (see |multi_snip|). - *ResetSnippets()* -The ResetSnippets() function removes all snippets from memory. This is useful -to put at the top of a snippet setup file for if you would like to |:source| -it multiple times. +ResetAllSnippets() *ResetAllSnippets()* +ResetAllSnippets() removes all snippets from memory. This is useful to put at +the top of a snippet setup file for if you would like to |:source| it multiple +times. + +ResetSnippets({filetype}) *ResetSnippets()* +ResetSnippets() removes all snippets from memory for the given filetype. + +ReloadAllSnippets() *ReloadAllSnippets()* +ReloadAllSnippets() reloads all snippets for all filetypes. This is useful for +testing and debugging. + +ReloadSnippets({filetype}) *ReloadSnippets()* +ReloadSnippets() reloads all snippets for the given filetype. *list-snippets* *i_CTRL-R_* If you would like to see what snippets are available, simply type @@ -282,5 +293,30 @@ I greatly appreciate any suggestions or improvements offered for the script. ============================================================================== +LICENSE *snipMate-license* + +snipMate is released under the MIT license: + +Copyright 2009-2010 Michael Sanders. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The software is provided "as is", without warranty of any kind, express or +implied, including but not limited to the warranties of merchantability, +fitness for a particular purpose and noninfringement. In no event shall the +authors or copyright holders be liable for any claim, damages or other +liability, whether in an action of contract, tort or otherwise, arising from, +out of or in connection with the software or the use or other dealings in the +software. + +============================================================================== vim:tw=78:ts=8:ft=help:norl: diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/plugin-info.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/bundle/snipmate/plugin-info.txt Wed Oct 27 12:36:15 2010 -0400 @@ -0,0 +1,8 @@ +{ + "name" : "snipmate", + "version" : "dev", + "author" : "Michael Sanders ", + "repository" : {"type": "git", "url": "git://github.com/msanders/snipmate.vim.git"}, + "dependencies" : {}, + "description" : "snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim." +} diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/plugin/snipMate.vim --- a/vim/bundle/snipmate/plugin/snipMate.vim Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/bundle/snipmate/plugin/snipMate.vim Wed Oct 27 12:36:15 2010 -0400 @@ -1,7 +1,6 @@ " File: snipMate.vim " Author: Michael Sanders -" Last Updated: July 13, 2009 -" Version: 0.83 +" Version: 0.84 " Description: snipMate.vim implements some of TextMate's snippets features in " Vim. A snippet is a piece of often-typed text that you can " insert into your document using a trigger word followed by a "". @@ -92,10 +91,35 @@ endfor endf -fun! ResetSnippets() +" Reset snippets for filetype. +fun! ResetSnippets(ft) + let ft = a:ft == '' ? '_' : a:ft + for dict in [s:snippets, s:multi_snips, g:did_ft] + if has_key(dict, ft) + unlet dict[ft] + endif + endfor +endf + +" Reset snippets for all filetypes. +fun! ResetAllSnippets() let s:snippets = {} | let s:multi_snips = {} | let g:did_ft = {} endf +" Reload snippets for filetype. +fun! ReloadSnippets(ft) + let ft = a:ft == '' ? '_' : a:ft + call ResetSnippets(ft) + call GetSnippets(g:snippets_dir, ft) +endf + +" Reload snippets for all filetypes. +fun! ReloadAllSnippets() + for ft in keys(g:did_ft) + call ReloadSnippets(ft) + endfor +endf + let g:did_ft = {} fun! GetSnippets(dir, filetypes) for ft in split(a:filetypes, '\.') @@ -148,7 +172,7 @@ " the snippet. if snippet != '' let col = col('.') - len(trigger) - sil exe 's/\V'.escape(trigger, '/.').'\%#//' + sil exe 's/\V'.escape(trigger, '/\.').'\%#//' return snipMate#expandSnip(snippet, col) endif endfor diff -r 126dedb1845d -r f2193e4dee39 vim/bundle/snipmate/syntax/snippet.vim --- a/vim/bundle/snipmate/syntax/snippet.vim Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/bundle/snipmate/syntax/snippet.vim Wed Oct 27 12:36:15 2010 -0400 @@ -3,7 +3,7 @@ syn match snipComment '^#.*' syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand syn match tabStop '\$\d\+' -syn match snipCommand '`.\{-}`' +syn match snipCommand '[^\\]`.\{-}`' syn match snippet '^snippet.*' transparent contains=multiSnipText,snipKeyword syn match multiSnipText '\S\+ \zs.*' contained syn match snipKeyword '^snippet'me=s+8 contained diff -r 126dedb1845d -r f2193e4dee39 vim/snippets/django.snippets --- a/vim/snippets/django.snippets Wed Oct 27 12:24:44 2010 -0400 +++ b/vim/snippets/django.snippets Wed Oct 27 12:36:15 2010 -0400 @@ -69,6 +69,12 @@ """${2:docstring}""" ${3} +snippet manager + class $1:{ModelName}Manager(models.Manager): + def get_query_set(self): + return super($1Manager, self).get_query_set() + ${3} + snippet model class ${1:ModelName}(models.Model): """${2:docstring}"""