ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.14k stars 114 forks source link

Neovim plugin errors as soon as I try :Ghcid #209

Open kozross opened 6 years ago

kozross commented 6 years ago

I'm on Neovim v0.3.1, with the plugin for GHCid installed as per the instructions on this Github repo. I have the following in my .ghci file:

:set -fwarn-unused-binds -fwarn-unused-imports
:set -isrc

I have a Stack project with a single source file in src/AI titled Foo.hs (which is in the exposed-modules part of my cabal file), consisting currently of a module declaration and nothing more. If I open it from the toplevel directory of my project where my .ghci file resides (that is, I call nvim src/AI/Foo.hs), and then try to do :Ghcid, I get this error:

Error detected while processing function 8:
line    2:
Ghcid: Exited with status 127
Press ENTER or type command to continue

If I try again, I get the same error, only with the function number changing.

Am I missing something here, or have I hit a bug?

kozross commented 6 years ago

Upon further investigation, it appears this happens because I have a project-local build of GHCid (using stack build) rather than a global one (using stack install). I know this because manually removing .ghci and running stack exec ghcid works just fine. Is there something I can set in my config file to allow it to still work if I have a project-local ghcid executable?

cloudhead commented 5 years ago

You can try adding let g:ghcid_command = "stack exec ghcid" to your vimrc before the plugin is loaded. That might do it.

EDIT: You might need to do let g:ghcid_command = "stack exec ghcid --" to ensure that any args are passed to ghcid and not stack.