ribosome-0.3.0.0: lib/Ribosome/Api/Function.hs
module Ribosome.Api.Function where
import qualified Data.Text as Text (intercalate)
import Ribosome.Control.Monad.Ribo (NvimE)
import Ribosome.Nvim.Api.IO (vimCommand)
defineFunction ::
NvimE e m =>
Text ->
[Text] ->
[Text] ->
m ()
defineFunction name params body =
vimCommand $ unlines $ sig : body ++ ["endfunction"]
where
sig =
"function! " <> name <> "(" <> Text.intercalate ", " params <> ")"