Created
December 10, 2010 17:27
-
-
Save sid137/736492 to your computer and use it in GitHub Desktop.
SnipMate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""""""""""""""""""""""""""""""""""""""""""""" | |
""Snipmate Mod | |
""""""""""""""""""""""""""""""""""""""""""""" | |
" Reload snippets and close snippet buffer on snippet save | |
autocmd BufWritePost *.snippet :call ReloadAllSnippets() | :Bclose | |
"shortcuts to quickly create new snippet | |
map <Leader>ca :call MakeSnippet()<CR> | |
imap <Leader>ca <ESC> :call MakeSnippet()<CR> | |
function! MakeSnippet() | |
if exists("g:snippet_file_type") | |
unlet g:snippet_file_type | |
endif | |
if empty(&ft) | |
echo "No filetype defined for snippet" | |
else | |
let name = input('Enter the snippet abbreviation: ') | |
let g:snippet_file_type = &ft | |
let snippet_path = g:snippets_dir . g:snippet_file_type . '/' . name . '.snippet' | |
exec "edit" snippet_path | |
let &filetype=g:snippet_file_type | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment