Skip to content

Commit e23fe79

Browse files
committed
cider: configure refactor-nrepl options as a dictionary
Rather than having a global per option, have a single global dictionary for refactor-nrepl options. This is more versatile and resilient to any future additions or removals to these options from the refactor-nrepl project.
1 parent b23a8cc commit e23fe79

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ own. Check the implementation file for `<Plug>` bindings.
5050
let g:cider_no_maps=1 " Disable built-in mappings
5151
5252
" Set refactor-nrepl options
53-
let g:refactor_nrepl_prefix_rewriting = 0 " tell clean-ns to not use prefix forms
54-
let g:refactor_nrepl_prune_ns_form = 0 " ... and don't remove unused symbols
53+
let g:refactor_nrepl_options = {
54+
\ 'prefix-rewriting': 'false', " tell clean-ns to not use prefix forms
55+
\ 'prune-ns-form': 'false', " ... and don't remove unused symbols
56+
\ }
5557

5658
" Setup visualmode bindings yourself, to some keys which don't interact
5759
" with e.g. change command

doc/cider.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,10 @@ DOCUMENTATION *cider-documentation*
1616
*cider-no-maps*
1717
g:cider_no_maps Set this option to true to disable built-in maps.
1818

19-
*refactor-nrepl-prune-ns-form*
20-
g:refactor_nrepl_prune_ns_form
21-
Use this option to set the prune-ns-form option for
22-
refactor-nrepl. Check
23-
https://github.com/clojure-emacs/refactor-nrepl#configure
24-
for documentation.
25-
26-
*refactor-nrepl-prefix-rewriting*
27-
g:refactor_nrepl_prefix_rewriting
28-
Use this option to set the prefix-rewriting option for
29-
refactor-nrepl. Check
30-
https://github.com/clojure-emacs/refactor-nrepl#configure
19+
*refactor-nrepl-options*
20+
g:refactor_nrepl_options
21+
Use this option to set settings for refactor-nrepl.
22+
Check https://github.com/clojure-emacs/refactor-nrepl#configure
3123
for documentation.
3224

3325
*cider-=f*

plugin/cider.vim

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,10 @@ function! s:clean_ns() abort
138138
if expand('<cword>') ==? 'ns'
139139
let opts = { 'op': 'clean-ns', 'path': p }
140140

141-
if exists('g:refactor_nrepl_prune_ns_form')
142-
let opts['prune-ns-form'] = g:refactor_nrepl_prune_ns_form ? 'true' : 'false'
143-
endif
144-
145-
if exists('g:refactor_nrepl_prefix_rewriting')
146-
let opts['prefix-rewriting'] = g:refactor_nrepl_prefix_rewriting ? 'true' : 'false'
141+
if exists('g:refactor_nrepl_options')
142+
for [opt_k, opt_v] in items(g:refactor_nrepl_options)
143+
let opts[opt_k] = opt_v
144+
endfor
147145
endif
148146

149147
let res = fireplace#message(opts)[0]

0 commit comments

Comments
 (0)