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

Add async versions of GhcModInfoPreview && GhcModInfo #104

Open adam-singer opened 7 years ago

adam-singer commented 7 years ago

Would be nice to have async versions of GhcModInfoPreview and GhcModInfo. I'm looking to wire up

set updatetime=1000
autocmd CursorHold *.hs GhcModInfoPreview
autocmd CursorHoldI *.hs GhcModInfoPreview

but the calls tend to have a higher lag time then expected.

BlackCapCoder commented 7 years ago

I ended up doing this, which is better but not perfect:

let moved = 0
autocmd FileType haskell autocmd CursorMoved *
  \ exec "GhcModTypeClear" |
  \ let moved = 1

autocmd FileType haskell autocmd CursorHold *
  \ if moved == 1 |
  \   exec "GhcModType" |
  \   let moved = 0 |
  \ endif

set updatetime=500