1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2026-02-17 05:55:45 +01:00

Completely replaced command-based snippets with a new, easier to read/maintain syntax. Also added a python script to make it easier to migrate.

This commit is contained in:
Michael Sanders
2009-03-22 22:35:03 -04:00
parent 1c12d12862
commit 8764924dfe
33 changed files with 1793 additions and 840 deletions

View File

@@ -1,8 +0,0 @@
if !exists('g:loaded_snips') || exists('s:did_snips')
fini
en
let s:did_snips = 1
" (c) holds no legal value ;)
exe 'GlobalSnip c) '.(&enc[:2] == 'utf' ? '©' : '(c)').' Copyright `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}'
exe 'GlobalSnip date `strftime("%Y-%m-%d")`'

View File

@@ -12,8 +12,6 @@ snor ' b<bs>'
snor <right> <esc>a
snor <left> <esc>bi
au FileType objc,cpp,cs let &ft = expand('<amatch>').'.c'
" By default load snippets in ~/.vim/snippets/<filetype>
if !exists('snippets_dir')
let snippets_dir = $HOME.'/'.finddir('snippets', &rtp).'/'
@@ -23,12 +21,22 @@ if empty(snippets_dir) | finish | endif
if isdirectory(snippets_dir.'_')
call ExtractSnips(snippets_dir.'_', '_')
endif
if filereadable(snippets_dir.'_.snippets')
call ExtractSnipsFile(snippets_dir.'_.snippets')
endif
au FileType * call GetSnippets(g:snippets_dir)
fun GetSnippets(dir)
for ft in split(&ft, '\.')
if !exists('g:did_ft_'.ft) && isdirectory(a:dir.ft)
call ExtractSnips(a:dir.ft, ft)
if !exists('g:did_ft_'.ft)
if isdirectory(a:dir.ft)
call ExtractSnips(a:dir.ft, ft)
endif
if filereadable(a:dir.ft.'.snippets')
call ExtractSnipsFile(a:dir.ft.'.snippets')
endif
endif
let g:did_ft_{ft} = 1
endfor
endf
" vim:noet:sw=4:ts=4:ft=vim