ndmitchell / ghcid

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

(neovim plugin) add option to disable buffer #174

Open mitchellwrosen opened 6 years ago

mitchellwrosen commented 6 years ago

It'd be nice to have a flag to disable whether or not :Ghcid creates a new buffer for ghcid's output. Personally, I'd be happy with the quickfix menu being populated, and no more. Thanks :)

ndmitchell commented 6 years ago

CC @cloudhead

mitchellwrosen commented 6 years ago

Another oddity that I will report here rather than open a new issue: the plugin seems to cache the first :Ghcid invocation.

For example, running

:Ghcid -c 'cabal new-repl

will fail once ("missing closing '"), but then running

:Ghcid -c 'cabal new-repl'

will continue to fail with a "missing closing '".

cloudhead commented 6 years ago

Nice idea - I pushed a change that allows this by setting g:ghcid_background = 1 in your vimrc. Also fixed the second issue. Let me know if it works as expected. The window will stay open if on-load there is an error, and go in the background from there on.

mitchellwrosen commented 6 years ago

Fantastic! I tried it out - it's almost perfect. If possible, I'd rather not have the buffer appear at all, even on the very first display.

I'm going to dump some thoughts and requests in this comment, I hope you don't mind =)

cloudhead commented 6 years ago

Fantastic! I tried it out - it's almost perfect. If possible, I'd rather not have the buffer appear at all, even on the very first display.

Not sure this is possible - at least not with a bunch of changes to how ghcid is invoked.

When All good, the plugin displays Ghcid: OK. This could be removed to preserve the file-being-written message.

Hmm but then you don't know if things are ok! There's no other indication.

(given g:ghcid_background = 1) When there's an error, the plugin displays Ghcid: 1 message(s). Is it possible to update the cmdline when you hover over the offending line?

You could do this with the CursorMoved event afaict.

(given g:ghcid_background = 1) When looking at errors in the quickfix menu, or by jumping to one, I get precisely 1 line of diagnostic information (controlled by cmdheight, but I do want cmdheight = 1.) Is there a way to manually open the terminal ghcid buffer that I've suppressed with g:ghcid_background = 1), so I can see the full output?

I think just calling :Ghcid should show the panel?

mitchellwrosen commented 6 years ago

Not sure this is possible - at least not with a bunch of changes to how ghcid is invoked.

That's unfortunate :( I may dig around the code and try to solve the issue myself then (but I appreciate the work you've put in so far). I don't know any VimL and am not so eager to learn at the moment with limited time, but the main reason I don't want the ghcid buffer to display at all by default is:

By the way, here are my quickfix settings.

Plug 'romain/vim-qf'
nmap <Space-l> <Plug>(qf_qf_toggle)
nmap <A-j> <Plug>(qf_qf_next)
nmap <A-k> <Plug(qf_qf_prev)
autocmd BufReadPost quickfix nnoremap <silent> <buffer> <CR> <CR>:cclose<CR>

Hmm but then you don't know if things are ok! There's no other indication.

That's true (though signcolumn=auto helps here). I'd just prefer my tooling to only make noises when things are going wrong. I'd appreciate an option to toggle this echoing behavior (and I can make a patch for this if you'd like).

You could do this with the CursorMoved event afaict.

Great, I'll try to figure this one out and report back!

I think just calling :Ghcid should show the panel?

It does indeed, wonderful.

mitchellwrosen commented 6 years ago

Btw, one thought about how to fix the first issue (inelegantly), if hidden is set, I think you could just :quit the ghcid terminal buffer after creating it, rather than moving the cursor back to the previous window.