Skip to content

Commit 11dfd96

Browse files
authored
Merge pull request #5 from ltriant/nrepl-options-passthrough
fix refactor-nrepl option passthrough
2 parents 18d3a33 + 3fcc552 commit 11dfd96

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ own. Check the implementation file for `<Plug>` bindings.
4949
```vim
5050
let g:cider_no_maps=1 " Disable built-in mappings
5151
52-
" Set refactor-nrepl options, e.g. tell clean-ns to not use prefix forms
53-
let g:refactor_nrepl_options = '{:prefix-rewriting false}'
52+
" Set refactor-nrepl options
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+
\ }
5457

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

doc/cider.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ g:cider_no_maps Set this option to true to disable built-in maps.
1818

1919
*refactor-nrepl-options*
2020
g:refactor_nrepl_options
21-
Use this option to set settings for refactor-nrepl.
22-
Check https://github.com/clojure-emacs/refactor-nrepl#configure
21+
Use this option to set settings for refactor-nrepl.
22+
Check https://github.com/clojure-emacs/refactor-nrepl#configure
2323
for documentation.
2424

25-
*cider-cf*
26-
cf{motion} Format the code indicated by {motion}.
25+
*cider-=f*
26+
=f{motion} Format the code indicated by {motion}.
2727
Use <Plug>CiderFormat to map this yourself.
2828
Visual mode mapping is not by default enabled but you
2929
can do that yourself:
@@ -33,15 +33,15 @@ cf{motion} Format the code indicated by {motion}.
3333
Just remeber to use mapping which doesn't conflict
3434
with e.g. change command.
3535

36-
*cider-cff*
37-
cff Format the innertmost form at the cursor.
36+
*cider-=ff*
37+
=ff Format the innertmost form at the cursor.
3838
Like |fireplace-c!|
3939
Use <Plug>CiderFormatCount to map this yourself.
4040

41-
*cider-cF*
42-
cF Format the current file.
43-
Use ggcfG to map this yourself (notice to use your own
44-
|cider-cf| mapping.)
41+
*cider-=F*
42+
=F Format the current file.
43+
Use gg=fG to map this yourself (notice to use your own
44+
|cider-=f| mapping.)
4545

4646
*cider-cdd*
4747
cdd Undefine a variable or unalias namespace a alias

plugin/cider.vim

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ nnoremap <silent> <Plug>CiderUndef :<C-U>call <SID>undef()<CR>
111111
" CleanNs
112112
"
113113

114-
function! s:init_refactor_nrepl() abort
115-
if !exists('b:refactor_nrepl_loaded') && exists('g:refactor_nrepl_options')
116-
let b:refactor_nrepl_loaded = 1
117-
call fireplace#message({'op': 'configure', 'opts': g:refactor_nrepl_options})
118-
endif
119-
endfunction
120-
121114
function! s:paste(text) abort
122115
" Does charwise paste to current '[ and '] marks
123116
let @@ = a:text
@@ -128,8 +121,6 @@ function! s:paste(text) abort
128121
endfunction
129122

130123
function! s:clean_ns() abort
131-
call s:init_refactor_nrepl()
132-
133124
" FIXME: Moves cursor
134125

135126
let p = expand('%:p')
@@ -145,7 +136,10 @@ function! s:clean_ns() abort
145136
call setpos("']", [0, line2, col2, 0])
146137

147138
if expand('<cword>') ==? 'ns'
148-
let res = fireplace#message({'op': 'clean-ns', 'path': p})[0]
139+
let opts = { 'op': 'clean-ns', 'path': p }
140+
call extend(opts, get(g:, 'refactor_nrepl_options', {}))
141+
142+
let res = fireplace#message(opts)[0]
149143
let error = get(res, 'error')
150144
if !empty(error)
151145
throw error

0 commit comments

Comments
 (0)