Skip to content

Commit 1c5fcb4

Browse files
committed
Merge pull request #12 from adimit/master
Add a way to make ghc-mod's execution directory customizable
2 parents 0c07e56 + a213a85 commit 1c5fcb4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

autoload/ghcmod.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,11 @@ function! s:system(...)"{{{
403403
endfunction"}}}
404404

405405
function! s:plineopen2(...)"{{{
406-
lcd `=expand('%:p:h')`
406+
if empty(g:ghcmod_use_basedir)
407+
lcd `=expand('%:p:h')`
408+
else
409+
lcd `=g:ghcmod_use_basedir`
410+
endif
407411
let l:ret = call('vimproc#plineopen2', a:000)
408412
lcd -
409413
return l:ret

doc/ghcmod.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ g:ghcmod_type_highlight *g:ghcmod_type_highlight*
102102
let ghcmodType ctermbg=yellow
103103
let g:ghcmod_type_highlight = 'ghcmodType'
104104
<
105+
g:ghcmod_use_basedir *g:ghcmod_use_basedir*
106+
The directory to execute ghc-mod from. This can have an effect
107+
particularly on template Haskell splices that expect to find certain
108+
files in certain places. A good practice in these cases is to make
109+
them work from the projects base directory, and open Vim from there.
110+
>
111+
let g:ghcmod_use_basedir = getcwd()
112+
<
113+
If you do not set it, ghcmod will be executed from the folder the file
114+
current Haskell file is contained in.
105115

106116
==============================================================================
107117
CUSTOMIZE *ghcmod-customize*

0 commit comments

Comments
 (0)