Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51d82e4

Browse files
committed
Use ghc-mod root command to find base directory
Fixes #75 .
1 parent 7e5f610 commit 51d82e4

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

autoload/ghcmod.vim

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,8 @@ endfunction "}}}
292292
function! s:find_basedir() "{{{
293293
" search Cabal file
294294
if !exists('b:ghcmod_basedir')
295-
let l:ghcmod_basedir = expand('%:p:h')
296-
let l:dir = l:ghcmod_basedir
297-
for _ in range(6)
298-
if !empty(glob(l:dir . '/*.cabal', 0))
299-
let l:ghcmod_basedir = l:dir
300-
break
301-
endif
302-
let l:dir = fnamemodify(l:dir, ':h')
303-
endfor
304-
let b:ghcmod_basedir = l:ghcmod_basedir
295+
" `ghc-mod root` is available since v4.0.0.
296+
let b:ghcmod_basedir = substitute(vimproc#system(['ghc-mod', 'root']), '\n*$', '', '')
305297
endif
306298
return b:ghcmod_basedir
307299
endfunction "}}}

0 commit comments

Comments
 (0)