From e951bb849fd05f203bd82606ef8ac19d1eed397a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Wed, 1 Jan 2020 12:18:30 +0530 Subject: [PATCH] nvim: init.vim: Setup ghcid/hoogle based on environment We may be running in a nix environment or without stack supported project. Check this and setup the environment variable for ghcid and hoogle plugin accordingly. Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/init.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 80fea19..cd0558e 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -513,8 +513,17 @@ let g:haskell_indent_in = 1 let g:haskell_indent_guard = 2 let g:haskell_indent_case_alternative = 1 let g:cabal_indent_section = 2 -let g:ghcid_command = 'stack exec -- ghcid' -let g:hoogle_search_bin = 'stack exec -- hoogle' +" Either check empty($IN_NIX_SHELL) for nix specific or executable('ghcid') +if executable('ghcid') + let g:ghcid_command = 'ghcid' +else + let g:ghcid_command = 'stack exec -- ghcid' +endif +if executable('hoogle') + let g:hoogle_search_bin = 'hoogle' +else + let g:hoogle_search_bin = 'stack exec -- hoogle' +endif let g:hoogle_search_count = 30 " Use deoplete