Skip to content

Commit 75a3f38

Browse files
committed
Make repeat-vim optional dependency, update demo gifs
1 parent 7099036 commit 75a3f38

4 files changed

Lines changed: 41 additions & 23 deletions

File tree

README.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,40 @@
1818
debugstring aims to automate standard debugging operations (e.g., segfaults).
1919
It does that by facilitating the ubiquitous
2020
[printf()-debugging](https://everything2.com/title/printf%28%29%20debugging)
21-
i.e., scatter
22-
logging statements around the various code snippets that you want to test.
21+
i.e., scatter logging statements around the various code snippets that you want
22+
to test.
2323

24-
![demo_gif](https://github.com/bergercookie/vim-debugstring/blob/master/misc/demo.gif)
2524

26-
The form and syntax of the logging statements target the language at hand
27-
(e.g., use `printf()` in C/C++ but `puts()` in Ruby)
25+
### Demos
2826

29-
Currently the following languages are supported:
27+
#### Standard debugging - C++
28+
29+
![demo_gif](https://github.com/bergercookie/vim-debugstring/blob/master/misc/demo_cpp.gif)
3030

31-
- C/C++
32-
- Fortran
33-
- Haskell
34-
- Java
35-
- Javascript
36-
- PHP
37-
- Python
38-
- Ruby
39-
- Shell
40-
- Vim
31+
#### Debugging for expression/variables - C++
4132

42-
### Features
33+
![demo_gif](https://github.com/bergercookie/vim-debugstring/blob/master/misc/demo_cpp_var.gif)
4334

35+
## Features
36+
37+
- The form and syntax of the logging statements target the language at hand
38+
(e.g., use `printf()` in C/C++ but `puts()` in Ruby)
39+
Currently the following languages are supported:
4440

41+
+ C
42+
+ C++
43+
+ Fortran
44+
+ Haskell
45+
+ Java
46+
+ Javascript
47+
+ PHP
48+
+ Python
49+
+ Ruby
50+
+ Shell
51+
+ Vim
52+
53+
- Support for debugging variable expressions e.g., the values of variables or
54+
arbitrary expressions at certain parts of your code
4555
- Support for [vim-repeat](https://github.com/tpope/vim-repeat). No
4656
need for repeat the same mapping, or rewrite the lengthy expression that you
4757
want to monitor, just use the `.` character
@@ -51,14 +61,15 @@ For a more detailed outline of `debugstring` check
5161

5262
## Usage
5363

54-
Use the mapping of your choice to place unique logging directives during
64+
Use the mappings of your choice to place unique logging directives during
5565
debugging times.
5666

5767
```vim
5868
nnoremap <your-key-combination> <Plug>DumpDebugString
69+
nnoremap <a-second-key-combination> <Plug>DumpDebugStringExpr
5970
```
6071

61-
Default mapping is: `<Leader>ds`
72+
Default mappings are: `<Leader>ds`, `<Leader>dS` respectively.
6273

6374
### Remarks - Debugging
6475

@@ -72,7 +83,7 @@ Default mapping is: `<Leader>ds`
7283

7384
debugstring depends on the following vim plugins:
7485

75-
- vim-repeat
86+
- vim-repeat [OPTIONAL]
7687

7788
### Using a runtimepath/package manager
7889

@@ -125,3 +136,4 @@ vim.org](https://vim.sourceforge.io/scripts/script.php?script_id=5634)
125136
- [ ] Extend vader support for rest of languages
126137
- [ ] Use travis for CI
127138
- [x] Bug with changing the filename of the current file
139+
- [ ] Make vim-repeat dependency optional

misc/demo_cpp.gif

777 KB
Loading

misc/demo_cpp_var.gif

994 KB
Loading

plugin/debugstring.vim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
" (@setting(default_dump_debug_map)) or define your own
2323
"
2424
" nmap <your-key-combination> <Plug>DumpDebugString
25+
" nmap <a-second-key-combination> <Plug>DumpDebugStringExpr
2526

2627
""
2728
" @section Functions
@@ -154,7 +155,10 @@ function! s:debugFunctionWrapper(mode, ...)
154155
endif
155156

156157
AddDebugString
157-
call repeat#set("\<Plug>DumpDebugString")
158+
159+
if &rtp =~ 'vim-repeat'
160+
call repeat#set("\<Plug>DumpDebugString")
161+
endif
158162

159163
elseif a:mode ==# s:modes['var_debug']
160164
if !exists(':AddDebugStringExpr')
@@ -171,8 +175,10 @@ function! s:debugFunctionWrapper(mode, ...)
171175
AddDebugStringExpr(l:expr)
172176

173177
" Make way for repeat.vim
174-
execute 'nnoremap <silent> <Plug>DumpDebugStringSpecExpr :<C-U> :call <SID>debugFunctionWrapper(1, "' . l:expr . '")<CR>'
175-
call repeat#set("\<Plug>DumpDebugStringSpecExpr")
178+
if &rtp =~ 'vim-repeat'
179+
execute 'nnoremap <silent> <Plug>DumpDebugStringSpecExpr :<C-U> :call <SID>debugFunctionWrapper(1, "' . l:expr . '")<CR>'
180+
call repeat#set("\<Plug>DumpDebugStringSpecExpr")
181+
endif
176182
else
177183
echoerr 's:debugFunctionWrapper - Unknown mode: ' a:mode
178184
return 0

0 commit comments

Comments
 (0)