Fork me on GitHub
#vim
<
2019-05-30
>
dave01:05:15

@olical i gave conjure a try tonight and it's fantastic! excellent work. i'm excited to see how it develops in the future my custom conjure config, in case anyone is curious:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => conjure
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:conjure_log_direction = "horizontal"
let g:conjure_log_size_large = 100

augroup additional_conjure_bindings
  autocmd!
  autocmd FileType clojure
        \ nnoremap <buffer> <localleader>ca
        \ :ConjureAdd {:tag :dev, :port 5555}<left>
  " press q to close the log buffer
  autocmd BufEnter /tmp/conjure.cljc nnoremap <buffer> q :ConjureCloseLog<CR>
augroup END
i found that the lower 25% of the screen is the perfect place for the output buffer, and i like being able to full-screen it (via <localleader>cl / :ConjureOpenLog) when i need to take a closer look i also like having a quick binding for :ConjureAdd with the usual arguments. i almost always just have a single prepl running on port 5555 for whatever project i'm working on, and if i ever need more, i have my keybinding set up to put the cursor right after the port, so i can backspace and make it 5556, etc. i also tend to add q bindings to most vim plugin-specific buffers, so i added one for conjure

Olical08:05:02

Oh sweet! Thank you for giving it a go and the kind words! I still stick to my buffer on the right but I think that's out of habit at this point, I might start moving it to the bottom soon. That feature was contributed fairly recently so I haven't had a chance to play with it. Maybe I should make the zprint formatting width configurable too so you can keep more things on one line in horizontal mode :thinking_face: Interesting use of ConjureAdd too! I usually add local mappings to do the same with localvimrc. So I have ,ccX where X is a key of the prepl I want to connect to, ,cca for my API for example. Hopefully https://github.com/Olical/conjure/issues/15 will replace most of this need but I guess I'll need a way to do it at runtime as well.

Olical08:05:19

I probably wouldn't add q as a default binding although I like the idea. I might want macros in there 😄 I use the log buffer as a scratch / REPL buffer essentially.

dave01:05:18

i also hacked together a quick boot prepl task in my profile.boot, which is very handy for starting a prepl in the context of whatever boot project i'm working on. i'm linking it here in case anyone finds it useful: https://github.com/daveyarwood/dotfiles/commit/74ee8cc6bc5550df871620cf121e6283490c2c08

Olical08:05:13

Oh this is neat, maybe comment it on https://oli.me.uk/2019-03-22-clojure-socket-prepl-cookbook/ ? Could be a useful link from there.

dave13:05:12

good idea! i'll leave a comment

dave01:05:56

the next thing on my wishlist for conjure would be inline evaluation results in virtualtext, but i think even the way it is now, it's quite nice

Olical08:05:34

That's near enough next up 😄 I experimented with virtual text for inline doc output, now I know how to use it. I'll probably only do it for single line output with no stdin/out though. If it doesn't look like it'll fit in that one line I'll open the log buffer for you. Edit: Basically the UX for the log buffer is shifting slightly to: Open it if the value doesn't fit nicely in one line without syntax highlighting. If there's more than one output or it spans multiple lines it'll open the log buffer. For the most basic repetitive interactions (evaluating a def or checking the order of args to a function) it shouldn't require a log buffer.

dave10:05:41

That sounds reasonable to me

lxsli08:05:23

Just added this to my ~/.lein/profiles.clj:

:injections [(defmacro def+
                       "binding => binding-form
                       internalizes binding-forms as if by def."
                       {:added "1.9", :special-form true, :forms '[(def+ [bindings*])]}
                       [& bindings]
                       (let [bings (partition 2 (destructure bindings))]
                         (sequence cat
                                   ['(do)
                                    (map (fn [[var value]] `(def ~var ~value)) bings)
                                    [(mapv (fn [[var _]] (str var)) bings)]])))]}}
allowing me to use this mapping: nmap <LocalLeader>d v<M-e><M-e>"zy:let @z=substitute(@z, '\v(\n\|\s)+', ' ', 'g')<CR>cqc(user/def+ <C-R>z)<ESC><CR> to define bindings out of a let

lxsli08:05:50

Might be useful for someone; happy to hear better ways to get it done!

dominicm08:05:31

I use this to give me a subrepl in a context: https://github.com/gfredericks/debug-repl

lxsli08:05:21

So if I'm in vim and eval a form containing (debug-repl), how do I return to vim with fireplace connected to that repl before it exits?

dominicm08:05:50

so, the evaluation context in fireplace changes. Then you can run (break!) to reutrn

dominicm08:05:58

(I linked the wrong one at first, so I changed the link)

lxsli08:05:20

Ah that link makes more sense, thanks 🙂

dharrigan13:05:09

Does anyone know how to make the preview window bigger on vim, so that when doing deoplete and tabbing through the suggestions, it shows more than just the signature of the function and a snippet of the docstring, i.e.,

dharrigan13:05:21

would really like to see more of that docstring 🙂

dominicm13:05:29

It didn't used to do that, I think it must be a deoplete option

dharrigan13:05:53

I'm checking sources 😉

dominicm13:05:55

If you figure it out, let me know :)

dharrigan13:05:57

It's hardcoded in vim (and neovim)

dharrigan13:05:17

if you set previewheight=2, then you get two lines

dharrigan13:05:24

but nothing above 3

dominicm13:05:57

Hmm, very odd. I could have sworn it used to be longer...

dominicm13:05:20

I remember it being quite annoying when something had a massive docstring

dominicm13:05:55

https://github.com/ncm2/float-preview.nvim this doesn't seem to have the same problem (linked in deoplete)

Olical13:05:16

Is floating window actually out yet? (I think it's in 0.4.0 actually...?)

dave13:05:33

oh man, that looks great

Olical13:05:17

I've wanted to use floating windows for a while but didn't think it was in any released Neovim version. (log buffer is crying out for it)

dharrigan13:05:48

Yeah, floating stuff isn't available yet, I have 0.3.7 of Neovim and no floaties for me!

dharrigan13:05:05

Still, having a hard coded max of 3 lines for preview seems a bit archaic.

dominicm13:05:38

It's small so that it minimizes offset of the screen while typing (the thing that roxma is trying to fix with floats)

dave13:05:18

i'm using nvim 0.4.0-dev, and i don't see floating windows

dave13:05:29

granted, i'm not 100% sure when they are supposed to appear

dominicm13:05:46

when a plugin uses them :)

dharrigan15:05:19

that float window looks great

dharrigan15:05:33

I look forward to it

Chase21:05:05

I built nvim from source and am on 0.4.0 and definitely get floating windows and they live up to the hype. coc.nvim was one of the first adopters I think and it works pretty darn well with things like rls in Rust when you are looking at documentation of methods and such.

👍 8