module Neovim.Plugin.ConfigHelper
where
import Config.Dyre (Params)
import Config.Dyre.Paths (getPaths)
import Neovim.API.TH
import Neovim.Config
import Neovim.Plugin.Classes
import Neovim.Plugin.ConfigHelper.Internal
import Data.Text (pack)
plugin :: Params NeovimConfig -> IO NeovimPlugin
plugin params = do
(_, _, cfgFile, _, libsDir) <- getPaths params
wrapPlugin Plugin
{ exports =
[ $(function' 'pingNvimhs) Sync
, $(command' 'restartNvimhs) def { cmdSync = Async }
]
, statefulExports =
[ (params, [],
[ $(autocmd 'recompileNvimhs) "BufWritePost" def
{ acmdSync = Async
, acmdPattern = pack cfgFile
}
, $(autocmd 'recompileNvimhs) "BufWritePost" def
{ acmdSync = Async
, acmdPattern = pack (libsDir++"/.*")
}
])
]
}