eagletmt / ghcmod-vim

Happy Haskell programming on Vim, powered by ghc-mod
http://www.vim.org/scripts/script.php?script_id=4473
433 stars 59 forks source link

ghcmod.vim should not show an error message if ghc-mod is not installed #67

Closed cdepillabout closed 9 years ago

cdepillabout commented 9 years ago

When starting vim with ghcmod-vim enabled, it throws up an error message "ghcmod: ghc-mod is not executable!". This is annoying.

I am using NixOS, so I don't have ghc-mod installed globally, just in the environments for my haskell projects. Sometimes I use vim to open up a Haskell file without first entering an environment, and I get this warning. I then have to press Enter.

I could work around it by checking in my .vimrc file whether or not ghc-mod exists on the path, but I think not printing an error from ghcmod-vim is a better solution.

I can see how getting errors printed to the screen could be helpful for someone trying to debug problems, but it's just annoying when I know what's going on don't have ghc-mod on my path on purpose.

ches commented 9 years ago

They have a load guard variable which is the typical solution offered for dealing with situations like this for Vim plugins:

autocmd FileType haskell
      \ if !executable('ghc-mod')
      \   let b:did_ftplugin_ghcmod = 1
      \ endif

should work.

eagletmt commented 9 years ago

I support @ches 's idea. Set b:did_ftplugin_ghcmod at your favorite timing.

pjan commented 6 years ago

@cdepillabout long time ago, but did you ever find a solution for this? whatever I try, I am unable to get the timing of this right.

cdepillabout commented 6 years ago

@pjan I'm sorry, I don't remember how I solved this. I'm pretty sure I checked to see if ghcmod is on my PATH before loading ghcmod-vim.

Here is my .vimrc if you want to look through it for ghcmod stuff:

https://github.com/cdepillabout/docs/blob/master/dot_files/dot_vimrc