-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customise pprint function #406
Comments
I think it's fipp now. I found more discussion here: cb124b8 fipp is causing me minor issues, also would be nice to have the option to switch to something more extensible (clojure.pprint). AFAIU the issue is how to abstract over the following lines via configuration: vim-fireplace/autoload/fireplace.vim Lines 1587 to 1591 in f2be859
|
The solution that seems most flexible to me is a callback function (mirrored to tagfunc, etc.) with defaults built-in: function! fireplace#pprint_puget(msg, width, ...)
if fireplace#op_available('info')
let a:msg['nrepl.middleware.print/print'] = 'cider.nrepl.pprint/puget-pprint'
if a:0
let a:msg['nrepl.middleware.print/options'] = a:1
else
let a:msg['nrepl.middleware.print/options'] = {}
endif
if a:width > 0
let a:msg['nrepl.middleware.print/options'].width = a:width
endif
endif
endfunction
function! fireplace#pprint_fipp(msg, width, ...)
if fireplace#op_available('info')
let a:msg['nrepl.middleware.print/print'] = 'cider.nrepl.pprint/fipp-pprint'
if a:0
let a:msg['nrepl.middleware.print/options'] = a:1
else
let a:msg['nrepl.middleware.print/options'] = {}
endif
if a:width > 0
let a:msg['nrepl.middleware.print/options'].width = a:width
endif
endif
endfunction
function! s:add_pprint_opts(msg, width) abort
let a:msg['nrepl.middleware.print/stream?'] = 1
call call(get(g:, 'Fireplace_pprint_func', 'fireplace#pprint_fipp'), [a:msg, a:width])
return a:msg
endfunction This would then support doing:
@tpope is that an interface you'd be happy with? |
Currently it's hardcoded to puget, it would be nice to customise it (e.g. for zprint)
The text was updated successfully, but these errors were encountered: