Skip to content

Commit dcdf176

Browse files
committed
Add rust println!, update README
1 parent f160513 commit dcdf176

File tree

2 files changed

+43
-32
lines changed

2 files changed

+43
-32
lines changed

README.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
1-
# vim-infer-debugger
2-
A VIM plugin to insert a breakpoint debugger based on your current file extension
1+
vim-infer-debugger
2+
==================
3+
4+
A VIM plugin to insert a breakpoint debugger based on your current file
5+
extension
36

47
`vim-infer-debugger` works by taking a set of defined file extensions and their
5-
corresponding debuggers, and then selecting the correct debugger based on the file
6-
you're in. It comes with a set of defaults (currently centered around Ruby/Rails and Elixir/Phoenix development):
8+
corresponding debuggers, and then selecting the correct debugger based on the
9+
file you're in. It comes with a set of defaults:
710

8-
```
9-
let g:debugger_array = [['\.rb', 'require "pry"; binding.pry'],
10-
\['\.ex$', 'require IEx; IEx.pry'],
11-
\['\.exs', 'require IEx; IEx.pry'],
12-
\['\.erb', '<% require "pry"; binding.pry %>'],
13-
\['\.eex', '<%= require IEx; IEx.pry %>'],
14-
\['\.coffee$', 'debugger'],
11+
```VIM
12+
let g:debugger_array = [['\.rb', 'require "pry"; binding.pry'],
13+
\['\.ex$', 'require IEx; IEx.pry'],
14+
\['\.exs', 'require IEx; IEx.pry'],
15+
\['\.erb', '<% require "pry"; binding.pry %>'],
16+
\['\.eex', '<%= require IEx; IEx.pry %>'],
17+
\['\.coffee$', 'debugger'],
1518
\['\.json\.jbuilder', 'require "pry"; binding.pry'],
16-
\['\.js$', 'debugger;'],
17-
\['\.jsx$', 'debugger;']]
19+
\['\.js$', 'debugger;'],
20+
\['\.jsx$', 'debugger;']
21+
\['\.rs$', 'println!("{:?}", )']]
1822
```
19-
In order to define your own debuggers, just overwrite `g:debugger_array` in your `.vimrc`
20-
Please note that when defining the regex for the file extension, it is best to wrap it
21-
in single quotes. Also note that by setting `g:debugger_array` in your `.vimrc`, you overwrite
22-
the entire array. So if you want to only change one of the default entries, you will have to supply
23-
the rest of them as well.
23+
In order to define your own debuggers, just overwrite `g:debugger_array` in
24+
your `.vimrc` Please note that when defining the regex for the file extension,
25+
it is best to wrap it in single quotes. Also note that by setting
26+
`g:debugger_array` in your `.vimrc`, you overwrite the entire array. So if you
27+
want to only change one of the default entries, you will have to supply the
28+
rest of them as well.
2429

2530
`vim-infer-debugger` defines two key bindings by default:
2631

27-
```
32+
```VIM
2833
nmap <Leader>P :call Debugging("O")<cr>
2934
nmap <Leader>p :call Debugging("o")<cr>
3035
```
3136

32-
Following VIM convention that capital letters insert above your cursor, and lowercase
33-
insert below, the debugging statement will be pasted above or below your cursor accordingly.
37+
Following VIM convention that capital letters insert above your cursor, and
38+
lowercase insert below, the debugging statement will be pasted above or below
39+
your cursor accordingly.
40+
41+
I recommend using [vim-plug](https://github.com/junegunn/vim-plug) to install,
42+
just add `Plug 'mcasper/vim-infer-debugger'` to your `.vimrc`, run `PlugInstall`,
43+
and you're on your way.
3444

35-
If you have any debugging statements that you think should be the default for a certain file extension,
36-
feel free to open a pull request or issue!
45+
If you have any debugging statements that you think should be the default for a
46+
certain file extension, feel free to open a pull request or issue!

plugin/debugger.vim

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
if !exists("g:debugger_array")
2-
let g:debugger_array = [['\.rb', 'require "pry"; binding.pry'],
3-
\['\.ex$', 'require IEx; IEx.pry'],
4-
\['\.exs', 'require IEx; IEx.pry'],
5-
\['\.erb', '<% require "pry"; binding.pry %>'],
6-
\['\.eex', '<%= require IEx; IEx.pry %>'],
7-
\['\.coffee$', 'debugger'],
8-
\['\.json\.jbuilder', 'require "pry"; binding.pry'],
9-
\['\.js$', 'debugger;'],
10-
\['\.jsx$', 'debugger;']]
2+
l let g:debugger_array = [['\.rb', 'require "pry"; binding.pry'],
3+
\['\.ex$', 'require IEx; IEx.pry'],
4+
\['\.exs', 'require IEx; IEx.pry'],
5+
\['\.erb', '<% require "pry"; binding.pry %>'],
6+
\['\.eex', '<%= require IEx; IEx.pry %>'],
7+
\['\.coffee$', 'debugger'],
8+
\['\.json\.jbuilder', 'require "pry"; binding.pry'],
9+
\['\.js$', 'debugger;'],
10+
\['\.jsx$', 'debugger;']
11+
\['\.rs$', 'println!("{:?}", );']]
1112
endif
1213

1314
function! Debugging(direction)

0 commit comments

Comments
 (0)