mirror of
https://github.com/gryf/snipmate.vim.git
synced 2025-12-25 16:02:30 +01:00
added a default "guard" snippet for checking if a snippet has been loaded more than once, and put cpp snippets in their own file"
This commit is contained in:
16
after/ftplugin/cpp_snips.vim
Normal file
16
after/ftplugin/cpp_snips.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if !exists('g:loaded_snips') || exists('s:did_cpp_snips')
|
||||
finish
|
||||
endif
|
||||
let s:did_cpp_snips = 1
|
||||
|
||||
" Read File Into Vector
|
||||
exe "Snipp readfile std::vector<char> v;\nif (FILE *${2:fp} = fopen(${1:\"filename\"}, \"r\")) {\n\tchar buf[1024];\n\twhile (size_t len = "
|
||||
\ ."fread(buf, 1, sizeof(buf), $2))\n\t\tv.insert(v.end(), buf, buf + len);\n\tfclose($2);\n}${3}"
|
||||
" std::map
|
||||
exe "Snipp map std::map<${1:key}, ${2:value}> map${3};"
|
||||
" std::vector
|
||||
exe "Snipp vector std::vector<${1:char}> v${2};"
|
||||
" Namespace
|
||||
exe "Snipp ns namespace ${1:`Filename('', 'my')`} {\n\t${2}\n} /* $1 */"
|
||||
" Class
|
||||
exe "Snipp cl class ${1:`Filename('$1_t', 'name')`} {\npublic:\n\t$1 (${2:arguments});\n\tvirtual ~$1 ();\n\nprivate:\n\t${3:/* data */}\n};"
|
||||
Reference in New Issue
Block a user