Skip to content

Instantly share code, notes, and snippets.

@sid137
Created December 10, 2010 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sid137/736492 to your computer and use it in GitHub Desktop.
Save sid137/736492 to your computer and use it in GitHub Desktop.
SnipMate
"""""""""""""""""""""""""""""""""""""""""""""
""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