@@ -77,6 +77,7 @@ set cpoptions&vim
7777let s: modes = {
7878 \ ' std_debug' : 0 ,
7979 \ ' var_debug' : 1 ,
80+ \ ' var_debug_cexpr' : 2 ,
8081 \}
8182
8283
@@ -131,6 +132,11 @@ if !hasmapto('<Plug>DumpDebugStringExpr')
131132 "
132133 nmap <unique> <Leader> dS <Plug> DumpDebugStringExpr
133134endif
135+ if ! hasmapto (' <Plug>DumpDebugStringCexpr' )
136+ " "@setting default_dump_debug_map
137+ "
138+ nmap <unique> <Leader> DS <Plug> DumpDebugStringCexpr
139+ endif
134140
135141" "
136142" Set this to false if you want to print just the logging statement without any
@@ -171,20 +177,23 @@ function! s:debugFunctionWrapper(mode, ...)
171177 call repeat#set (" \<Plug> DumpDebugStringVar<CR>" )
172178 endif
173179
174- elseif a: mode == # s: modes [' var_debug' ]
180+ elseif a: mode == # s: modes [' var_debug' ] || a: mode == # s: modes [ ' var_debug_cexpr ' ]
175181 if ! exists (' :AddDebugStringExpr' )
176182 echoerr " Command AddDebugStringExpr isn't implemented for filetype \" " . &filetype . " \" "
177183 return 0
178184 endif
179- let l: expr = ' '
180- if len (a: 000 ) == # 0
181- let l: expr = input (' Input Expression: ' )
185+ if a: mode == # s: modes [' var_debug_cexpr' ]
186+ let l: expr = expand (" <cexpr>" )
182187 else
183- let l: expr = a: 1
184- endif
185-
186- if empty (l: expr )
187- return
188+ let l: expr = ' '
189+ if len (a: 000 ) == # 0
190+ let l: expr = input (' Input Expression: ' )
191+ else
192+ let l: expr = a: 1
193+ endif
194+ if empty (l: expr )
195+ return
196+ endif
188197 endif
189198
190199 AddDebugStringExpr (l: expr )
@@ -223,6 +232,7 @@ endfunc
223232"
224233nnoremap <silent> <Plug> DumpDebugStringVar :<C-U> call <SID> debugFunctionWrapper(0)<CR>
225234nnoremap <silent> <Plug> DumpDebugStringExpr :<C-U> call <SID> debugFunctionWrapper(1)<CR>
235+ nnoremap <silent> <Plug> DumpDebugStringCexpr :<C-U> call <SID> debugFunctionWrapper(2)<CR>
226236
227237let &cpoptions = s: save_cpo
228238unlet s: save_cpo
0 commit comments