-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcpp.vim
More file actions
22 lines (18 loc) · 664 Bytes
/
cpp.vim
File metadata and controls
22 lines (18 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let g:debugstring_loaded_cpp_vim = 1
function! s:DebugStringFunBase(desc, var)
" Escape quotes in description
let l:desc = a:desc
if stridx('"', l:desc)
let l:desc = substitute(l:desc, '"', '\\"', "g")
endif
let l:debug_str = 'std::cout << "' . l:desc
\ . '" << '
\ . a:var
\ . ' << '
\ . 'std::endl;'
return l:debug_str
endfunc
command! -buffer -nargs=0 AddDebugString
\ put=s:DebugStringFunBase(g:DebugstringPrefixStr(), g:debugStringCounter)
command! -buffer -nargs=1 AddDebugStringExpr
\ put=s:DebugStringFunBase(<args> . ': ', <args>)