This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-22
Channels
- # beginners (240)
- # boot (23)
- # bristol-clojurians (3)
- # cider (101)
- # cljs-dev (52)
- # cljsrn (17)
- # clojure (212)
- # clojure-dusseldorf (2)
- # clojure-greece (2)
- # clojure-italy (9)
- # clojure-russia (1)
- # clojure-spec (91)
- # clojure-uk (33)
- # clojurescript (164)
- # community-development (23)
- # core-async (24)
- # core-logic (9)
- # cursive (18)
- # datavis (1)
- # datomic (119)
- # emacs (13)
- # events (1)
- # figwheel (2)
- # fulcro (86)
- # graphql (1)
- # immutant (5)
- # jobs-discuss (6)
- # leiningen (19)
- # lumo (46)
- # nyc (7)
- # off-topic (23)
- # parinfer (15)
- # pedestal (3)
- # planck (32)
- # re-frame (48)
- # reagent (75)
- # ring-swagger (13)
- # rum (32)
- # shadow-cljs (402)
- # spacemacs (5)
- # specter (3)
- # tools-deps (11)
- # unrepl (20)
- # vim (135)
- # yada (3)
Hi...is there a plugin that provides function signature as you type, so you can know the parameters something expects?
Async clj omni, with deoplete, and with preview in completeopt on (default, I think). @mfiano
@dominicm Yes I am using that, however as soon as I type a space after the operator it goes away and I am forced to remember all the arguments
@mfiano that's not the default behaviour of preview. Generally, you have to do something special to make that happen. PClose I think is the aucmd.
I come from emacs where the signature stays on the bottom of the screen, even for multiple arity functions
I'm not sure what you mean
@mfiano just to be clear, which bits of what I described are you doing? I'm on mobile so can't type what I mean.
Oh I forgot, I'm not using deoplete, but nvim-completion-manager. I was confusing it with denite
I type defn and I see this: https://files.lispcoder.net/images/screenshots/img-20180322033502.png
Then i type space and it all goes away
NCM doesn't support preview normally because reasons. If you go into :help
there's an option for ncm which you can set to modify the completeopt.
I do have preview in completeopts
I searched ncm help for 'preview' and didn't find anything
Ok I set g:cm_completeopt
to have preview too, and it resizes my existing windows to make a large preview window...and it never goes away
That is horrible 🙂
You could bind pclose to something I guess. I don't know of anything like eldoc for vim, but it may exist.
https://www.reddit.com/r/vim/comments/31b999/function_arguments_in_echo_area/ shougo/echodoc?
@dominicm It does not
At least not with NCM
Not an editor command
Yeah...it's installed but I don't have that command
Ok it's enabled but I see nothing
Or it only works with his specific completion plugin
(deoplete)
Interestingly, it doesn't even work with deoplete
Yeah, I tried both
I think this is your only path. I'm gonna try this out later I think. Seems pretty cool.
@mfiano trying it from the train station, I'm getting "No pattern found", same for you?
No I don't get that
I don't get any output
@dominicm Do you use fireplace?
How do I remap that hard to type goto definition binding of [-C-d
--- after/ftplugin/clojure.vim
nmap <buffer> gs <Plug>FireplaceDjump
nmap <buffer> gvs <Plug>FireplaceDsplit
---
^^ in the named fileIs there a command to jump back or do i have to use C-o?
Nevermind...got it
My vim config is pretty huge. I'm gonna end up spending all day configuring Clojure
I'm sick of Emacs...been using it for years, but not as long as Vim which isn't slow on some of my older hardware
@dominicm Is your vim/clojure config online by any chance?
I just found it 🙂
You seem to have some Spacemacs-like layer setup. Interesting
@dominicm Nice config. You still using ncm?
I have one problem with it I'm not sure how to solve
sec let me remember
I guess it relates to using tab as my candidate selection key. doing so prevents me from being able to tab to indent
FWIW, it's not to everyone's taste but I hook into the CompleteDone
autocmd and drop the last completion in my status line. https://i.imgur.com/Tz6ttHW.gif
@markwoodhall Very cool. How did you do that?
I capture the last completion info
:
autocmd BufEnter * if !exists('b:last_completion_sig') | let b:last_completion_sig = '' | endif
autocmd CompleteDone * let b:last_completion_sig = join(split(has_key(v:completed_item, 'info') ? v: : b:last_completion_sig, '\n')[0:1], ' ')
Then I expose that variable in my lightline config.Hmm I didn't know you could add custom info in lightline
That is what I do.
@markwoodhall That works thanks, however vim emits an error when CtrlP is invoked
Error detected while processing function LightlineCompletion:
E121: Undefined variable: b:last_completion_sig
It only seems to have problems with CtrlP...works for file buffersAh, weird, I'm using fzf rather than ctrlp.
I guess you can just check if that variable exists in LightlineCompletion
.
Yeah that works
Great thanks. Now I just have to solve my tab key problems with ncm
Is that just that you need to do something like inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
?
I actually have that
If you remove that then you can tab as desired with the pum visible, I think, but you will need to use <C-n> to cycle through completions?
Oh i see. The issue was that I was invoking ncm manually with tab. i disabled the auto popup
Thanks all. This is good enough as a CIDER replacement now.
If you prefer not to use the status line for the completion info then you can always just change the CompleteDone
autocmd to echo rather than capturing a variable. I like the status line approach but for multi-arity functions with lots of arguments, it can sometimes truncate.
Oh yeah, fair point
The location list approach to stacktraces is kind of confusing...I never really used the location list before
echoing is not very persistent though. it disappears as soon as i jump out of a s-expression etc
I probably meant echom
.
Same difference.
If I type def
, select defn
completion candidate and then continue so I have (defn foo ...)
, the echom disappears as soon as I press f
in foo
.
That does't happen for me with cmdheight=2.
I'll try that
Same thing huh
I think you can make it better by using autocmd CompleteDone * if has_key(v:completed_item, 'info') | echo join(split(v:
but can see that it's still not perfect.
The problem is the other line
bufenter
I think echodoc only works if you press <Ctrl-y>, it doesn't for CompleteDone
also, it probably should tbh
https://github.com/Shougo/echodoc.vim/blob/3193cae7c13194bed8d96921e7d2b1c401eb530e/autoload/echodoc.vim#L26-L30 pass, no idea why not
I have echodoc working I think, but it's flashing because I have something else causing an error odd enough.
That doesn't work for me, and reading the issues, it seems to be a regex mess
I'd rather just extract it out of the pum
But for some reason, the above snippet from mark blocks...wants me to press enter to continue
Best I can get with echoing, rather than in my status line is using this:
autocmd BufEnter * if !exists('b:last_completion_sig') | let b:last_completion_sig = '' | endif
autocmd CompleteDone * if has_key(v:completed_item, 'info') && v: != '' | let b:last_completion_sig = join(split(v:, '\n')[0:1]) | endif
autocmd CompleteDone * echo b:last_completion_sig
Again with cmdheight=2
Or set noshowmode
but that isn't as clean.
I think splitting or just using v:
is just preference, since the menu
includes kind
and CLJ/CLJS.
Yeah I can't get it to not block input without faking the variable
I accomplished similar
The above works well enough for me.
I'm terrible with vimscript though. 🙈
Did you already rule out completeopt+=preview
because it's a bit hideous?
function! CompletionEcho()
if !exists('b:last_completion_sig')
let b:last_completion_sig = ''
else
if has_key(v:completed_item, 'info') && v: != ''
let b:last_completion_sig = join(split(v:, '\n')[0:1])
endif
echo b:last_completion_sig
endif
endfunction
augroup completion_echo
au!
au completedone * call CompletionEcho()
augroup end
My vimscript is horrible too, but that's what I got
Yeah, preview is hideous...the window keeps growing everytime a docstring is longer to account for it...and if i close it, it annoys me when it pushes my buffers around when it opens
Hmh. Is there a way to "mirror" a repl connection? So that it's not just the same repl, but also shows the same input and output
I suppose I could do tricks with screen or tmux, but I was wondering if lein repl or nrepl itself could do some tricks. Or the clojure socket repl
I'd like a way to send forms from nvim to the repl and see them on the other screen, without having the multiwindow support landed in nvim
Something like opening a clj file would open a hidden :terminal buffer with screen -S project_name lein repl, unless screen with that name already exists, and then just connect to it (still hidden)
I suppose I'd better make a short shell script that handles the screen start/attach, and google a bit for how to do the nvim side. autocmd something something, I suppose
That will not work when it's time to do some cljs again, but I'll cross that hurdle when I get there
autocmd FileType clojure nested split term://~/bin/start-or-attach-to-repl.sh | :hide seems to do it, where my script recurses to parent dirs until it finds where project.lein is, then uses the name of the leaf dir to attach a screen, and if that fails, create a new one
Anyone using fireplace that can make sense of the location list stack trace?
It doesn't even give me an exception message
How do people even go about debugging on vim? With CIDER I had exceptions being raised
Anything that doesn't leave me guessing why something doesn't compile