wlangstroth / vim-racket

vim bundle for Racket
MIT License
234 stars 60 forks source link

K mapping does not work #49

Closed beelzebielsk closed 4 years ago

beelzebielsk commented 4 years ago

When I press K on a word, looking it up in raco docs doesn't work. The command seems to run, but nothing comes up in my browser. Nor does it work if I execute it in vim directly. For example:

!raco docs list

I thought that was strange, and thought maybe vim was terminating something too quickly, and that seems to be the case, since this works for me:

!raco docs list && sleep 1

How would I get raco docs to execute correctly in vim? I'd rather not make vim sleep, as that will cause vim to hang when I use the command. This is probably the wrong place to ask, but I'm not sure what the right place to ask is, and I figure you'd be interested to know since it impacts the package. The K mapping is helpful.

Some extra notes: the argument to sleep is in seconds. It works with sleep .5, but not sleep .4 or less. I am pretty sure forcing vim to do something for longer is what makes the command work.

dkvasnicka commented 4 years ago

You can try executing raco asynchronously using https://github.com/kassio/neoterm or any other facility that allows end user acces to the async job features in Vim 8/NeoVim.

wlangstroth commented 4 years ago

Did that solve the problem, @beelzebielsk?

beelzebielsk commented 4 years ago

I haven't taken a look at it since then, but I tried it tonight. Yes, that solved the problem. I'm not sure how neoterm exposes job features, but I was able to use jobstart from neovim.

Final command I used was:

nnoremap <buffer> K :call jobstart('raco docs ' . expand('<cword>'))<cr>

beelzebielsk commented 4 years ago

While this solves the problem for neovim, what would you recommend for a solution that works across the vim and neovim? Can vim packages have dependencies like https://github.com/prabirshrestha/async.vim for job control across vim and neovim?