Fork me on GitHub
#conjure
<
2020-07-01
>
jose15:07:35

was the log toggle option removed? I think in previous versions there was a toggle log mapping

Olical15:07:18

Ah, that’s just not implemented since it’s more of a regular window now. The current best approach is ,lv to open and ,lq to close. A toggle could be added but it might not make much sense in the context of multiple log windows and the HUD open. Old Conjure only had a concept of one window, the new conjure is designed around “open the windows you want, I’ll pop something up if there’s something you’re going to miss”

Olical15:07:36

So toggle may make less sense unless you only ever open a single log window at a time :thinking_face:

jose15:07:47

I see, usually I open only one log window, I think it make some sense, but don't worry, I'm fine using <leader>lq . Out of curiosity, do you think it would be easy to create a custom map on my nvim config for it?

Olical20:07:20

:thinking_face: I suppose you could list tab windows and then if there was one, you invoke the close mapping.

Olical20:07:52

Also, which way would it open... vertical or horizontal :thinking_face:

dave20:07:38

@jlle here are some hacks i have in my dotfiles, allows me to toggle the conjure log (i prefer the <localleader>lt one, which opens the log in a tab instead of a split) on/off by pressing <localleader>cc

function! ToggleConjureLog() abort
  if expand('%:t') =~ ".*conjure-log-.*"
    execute 'Bclose'
  else
    " Ideally I could call some function provided by Conjure directly to do
    " this, but I wasn't able to figure out how to do that. This mapping will
    " need to be adjusted if I ever configure Conjure to use a different mapping
    " to open the log in a tab, or if Conjure ever changes the default mapping.
    " I think those two things are both pretty unlikely to happen, so meh.
    "
    " Another thing worth noting: normal apparently doesn't work with <leader>
    " and <localleader>, so you have to do some hackery like what's going on
    " here () or just give up and type
    " your actual (local)leader key in the mapping. I'm doing the second one.
    normal \lt
  endif
endfunction

augroup additional_conjure_bindings
  autocmd!

  autocmd FileType clojure,fennel
        \ nnoremap <buffer>
        \ <localleader>cc :call ToggleConjureLog()<CR>

  " press q to close the log buffer
  autocmd BufEnter conjure-log-* nnoremap <buffer> q :Bclose<CR>
augroup END

dave20:07:19

i also like to be able to press q to close certain types of buffers. sort of controversial, but anyway, i set up a mapping for that too

Olical20:07:46

I love seeing this sort of thing! And it helps me spot areas where I can help if you're having to jump through hoops to to something essential

🙂 3
dave20:07:57

also worth noting that my localleader is \. you'll want to change that to , or whatever your local leader is

dave20:07:38

oh, one more thing. i have a Bclose function defined, and the code above relies on it

" Don't close window when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt() abort
   let l:currentBufNum = bufnr("%")
   let l:alternateBufNum = bufnr("#")

   if buflisted(l:alternateBufNum)
     buffer #
   else
     bnext
   endif

   if bufnr("%") == l:currentBufNum
     new
   endif

   if buflisted(l:currentBufNum)
     execute("bdelete! ".l:currentBufNum)
   endif
endfunction

dave20:07:05

basically it closes the buffer. feel free to replace that part with whatever you want. believe it or not, there are vim plugins solely devoted to closing buffers! 😅

dave20:07:24

:bd! would probably work fine here

markx23:07:19

Just a random question: how feasible is it to add a general nrepl client to Conjure? If this works, maybe conjure can work with more languages with nrepl server implementation?

Olical08:07:28

By design 😄 I'm planning on extracting the TCP client code into it's own thing then building a generic nREPL client on top of that. This is the same as the STDIO client I want to implement.

Olical08:07:02

So it might take a little bit of config to hook it up, but you can then set up any file type to use one of Conjure's super generic implementations until there's a more specific implementation.

Olical08:07:30

I'd love to have every scheme working over STDIO (even in a limited slightly excavated way)

Olical08:07:52

And things like Racket that have nREPL implementations of some sort working to some degree.

Olical08:07:36

I'll mention in the channel when I have generic implementations and write up a wiki page or help text on how to hook them up to things. Hopefully it'll bring so much more support! Then for the most used and loved they can eventually be replaced by a custom client that adds deeper integration with the target.

markx15:07:49

That’s awesome! Thanks for your great work.