Skip to content

Commit cee1f21

Browse files
committed
Correct mapping for call to debugFunctionWrapper to run instantly
1 parent aa46952 commit cee1f21

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ In case you like the plugin, you might as well [star it on
136136
Github](https://github.com/bergercookie/vim-debugstring) or [rate it on
137137
vim.org](https://vim.sourceforge.io/scripts/script.php?script_id=5634)
138138

139+
140+
## Notes on Development
141+
142+
This mostly comprises a list of stuff I want to keep track of when developing
143+
this or other vim plugins
144+
145+
* Use [vimdoc](https://github.com/google/vimdoc) to generate documentation from
146+
the `vim` docstring (instead of manually updating the .txt file). See the
147+
misc/build_doc for more on how this is done.
148+
* Use [vader](https://github.com/junegunn/vader.vim) for unittesting.
149+
150+
139151
## TODO
140152

141153
- [ ] Method to delete all the debugging strings in all "touched" buffers

doc/debugstring.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ The form and syntax of the logging statements target the language at hand
3333
CONFIGURATION *debugstring-config*
3434

3535
To add a logging statement either use the default normal mode mapping
36-
(|g:default_dump_debug_map|) or define your own
36+
(|g:default_dump_debug_map|) or define your own:
3737

38-
nmap <your-key-combination> <Plug>DumpDebugString
38+
* nmap <your-key-combination> <Plug>DumpDebugString
39+
40+
* nmap <a-second-key-combination> <Plug>DumpDebugStringExpr
3941

4042
*g:debugstringAlwaysIncludeHeader*
4143
Set this to false if you want to print just the logging statement without any

plugin/debugstring.vim

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
""
2121
" @section Configuration, config
2222
" To add a logging statement either use the default normal mode mapping
23-
" (@setting(default_dump_debug_map)) or define your own
23+
" (@setting(default_dump_debug_map)) or define your own:
2424
"
25-
" nmap <your-key-combination> <Plug>DumpDebugString
26-
" nmap <a-second-key-combination> <Plug>DumpDebugStringExpr
25+
" * nmap <your-key-combination> <Plug>DumpDebugString
26+
"
27+
" * nmap <a-second-key-combination> <Plug>DumpDebugStringExpr
2728

2829
""
2930
" @section Functions
@@ -81,6 +82,7 @@ let s:modes = {
8182
let g:debugStringCounter = 0
8283
let g:debugStringCounterStep = 1
8384

85+
""
8486
" By default debugging lines should be of the form
8587
" <directive_to_print> <prefix_string><debug_number>
8688
function! g:DebugstringPrefixStr()
@@ -103,6 +105,8 @@ function! s:resetDebugCounter()
103105
let g:debugStringCounter = 0
104106
endfunc
105107

108+
" }}}
109+
106110
""
107111
" Reset the debugging counter
108112
"
@@ -119,11 +123,12 @@ endfunc
119123
if !hasmapto('<Plug>DumpDebugString')
120124
""@setting default_dump_debug_map
121125
"
122-
nmap <unique> <Leader>ds <Plug>DumpDebugString
126+
nmap <nowait> <unique> <Leader>ds <Plug>DumpDebugString<CR>
123127
""@setting default_dump_debug_map
124128
"
125-
nmap <unique> <Leader>dS <Plug>DumpDebugStringExpr
129+
nmap <nowait> <unique> <Leader>dS <Plug>DumpDebugStringExpr
126130
endif
131+
127132
""
128133
" Set this to false if you want to print just the logging statement without any
129134
" additional directive like '#include <stsdio.h'
@@ -132,6 +137,7 @@ endif
132137
"
133138
let g:debugstringAlwaysIncludeHeader = 0 " Include Header in place?
134139

140+
""
135141
" Wrapper around the low-level debug* methods.
136142
" It also takes care of incrementing the g:debugCounter
137143
"
@@ -204,6 +210,10 @@ function! s:debugFunctionWrapper(mode, ...)
204210
call setpos('.', l:new_pos)
205211
endfunc
206212

213+
""
214+
" For debugging, execute a <Plug> command using execute:
215+
" :execute "normal \<Plug>DumpDebugString"
216+
"
207217
nnoremap <silent> <Plug>DumpDebugString :<C-U> :call <SID>debugFunctionWrapper(0)<CR>
208218
nnoremap <silent> <Plug>DumpDebugStringExpr :<C-U> :call <SID>debugFunctionWrapper(1)<CR>
209219

0 commit comments

Comments
 (0)