Skip to content

Commit e4b4464

Browse files
committed
Add :GhcModInfo {identifier}
1 parent 6d94615 commit e4b4464

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

after/ftplugin/haskell/ghcmod.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else
3131
endif
3232

3333
command! -buffer -nargs=0 GhcModType echo ghcmod#type()[1]
34-
command! -buffer -nargs=0 GhcModInfo echo ghcmod#info()
34+
command! -buffer -nargs=? GhcModInfo call s:info(<q-args>)
3535
command! -buffer -nargs=0 GhcModTypeClear call ghcmod#type_clear()
3636
command! -buffer -nargs=0 GhcModCheck call s:make('check')
3737
command! -buffer -nargs=0 GhcModLint call s:make('lint')
@@ -68,3 +68,11 @@ function! s:check_and_lint_async()
6868
call ghcmod#async_make('lint', 'a')
6969
endif
7070
endfunction
71+
72+
function! s:info(fexp)
73+
let l:fexp = a:fexp
74+
if empty(l:fexp)
75+
let l:fexp = ghcmod#getHaskellIdentifier()
76+
end
77+
echo ghcmod#info(l:fexp)
78+
endfunction

autoload/ghcmod.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,17 @@ function! ghcmod#getHaskellIdentifier()"{{{
6060
return ll1.ll2
6161
endfunction"}}}
6262

63-
function! ghcmod#info()"{{{
63+
function! ghcmod#info(fexp)"{{{
6464
if &l:modified
6565
call ghcmod#print_warning('ghcmod#info: the buffer has been modified but not written')
6666
endif
67-
let l:fexp = ghcmod#getHaskellIdentifier()
6867
let l:file = expand('%:p')
6968
if l:file ==# ''
7069
call ghcmod#print_warning("current version of ghcmod.vim doesn't support running on an unnamed buffer.")
7170
return ''
7271
endif
7372
let l:mod = ghcmod#detect_module()
74-
let l:cmd = ghcmod#build_command(['info', l:file, l:mod, l:fexp])
73+
let l:cmd = ghcmod#build_command(['info', l:file, l:mod, a:fexp])
7574
let l:output = s:system(l:cmd)
7675

7776
return l:output

doc/ghcmod.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ If you'd like to give GHC options, set |g:ghcmod_ghc_options|.
5151
:GhcModInfo *:GhcModInfo*
5252
Information about the identifier under the cursor is echoed.
5353

54+
:GhcModInfo {identifier}
55+
Information about {identifier} is echoed.
56+
5457
:GhcModTypeClear *:GhcModTypeClear*
5558
Clear the highlight created by |:GhcModType|.
5659

0 commit comments

Comments
 (0)