Stability | experimental |
---|---|
Maintainer | woozletoff@gmail.com |
Safe Haskell | None |
- newUniqueFunctionName :: Neovim r st FunctionName
- data Neovim r st a
- type Neovim' = Neovim () ()
- data NeovimException = ErrorMessage Doc
- type FunctionMap = Map FunctionName FunctionMapEntry
- type FunctionMapEntry = (FunctionalityDescription, FunctionType)
- mkFunctionMap :: [FunctionMapEntry] -> FunctionMap
- runNeovim :: Config r st -> st -> Neovim r st a -> IO (Either Doc (a, st))
- forkNeovim :: ir -> ist -> Neovim ir ist a -> Neovim r st ThreadId
- err :: Doc -> Neovim r st a
- errOnInvalidResult :: NvimObject o => Neovim r st (Either Object Object) -> Neovim r st o
- restart :: Neovim r st ()
- quit :: Neovim r st ()
- ask :: MonadReader r m => m r
- asks :: MonadReader r m => (r -> a) -> m a
- get :: MonadState s m => m s
- gets :: MonadState s m => (s -> a) -> m a
- put :: MonadState s m => s -> m ()
- modify :: MonadState s m => (s -> s) -> m ()
- throwError :: MonadError e m => forall a. e -> m a
Documentation
newUniqueFunctionName :: Neovim r st FunctionNameSource
Create a new unique function name. To prevent possible name clashes, digits are stripped from the given suffix.
This is the environment in which all plugins are initially started.
Stateless functions use '()' for the static configuration and the mutable
state and there is another type alias for that case: Neovim'
.
Functions have to run in this transformer stack to communicate with neovim.
If parts of your own functions dont need to communicate with neovim, it is
good practice to factor them out. This allows you to write tests and spot
errors easier. Essentially, you should treat this similar to IO
in general
haskell programs.
MonadBase IO (Neovim r st) | |
MonadReader r (Neovim r st) | User facing instance declaration for the reader state. |
MonadState st (Neovim r st) | |
Monad (Neovim r st) | |
Functor (Neovim r st) | |
Applicative (Neovim r st) | |
MonadIO (Neovim r st) | |
MonadThrow (Neovim r st) | |
MonadMask (Neovim r st) | |
MonadCatch (Neovim r st) | |
MonadResource (Neovim r st) |
data NeovimException Source
Exceptions specific to nvim-hs.
ErrorMessage Doc | Simply error message that is passed to neovim. It should currently only contain one line of text. |
type FunctionMap = Map FunctionName FunctionMapEntrySource
A function map is a map containing the names of functions as keys and some context dependent value which contains all the necessary information to execute that function in the intended way.
This type is only used internally and handles two distinct cases. One case
is a direct function call, wich is simply a function that accepts a list of
Object
values and returns a result in the Neovim
context. The second
case is calling a function that has a persistent state. This is mediated to
a thread that reads from a TQueue
. (NB: persistent currently means, that
state is stored for as long as the plugin provider is running and not
restarted.)
type FunctionMapEntry = (FunctionalityDescription, FunctionType)Source
Type of the values stored in the function map.
mkFunctionMap :: [FunctionMapEntry] -> FunctionMapSource
Create a new function map from the given list of FunctionMapEntry
values.
runNeovim :: Config r st -> st -> Neovim r st a -> IO (Either Doc (a, st))Source
Initialize a Neovim
context by supplying an InternalEnvironment
.
forkNeovim :: ir -> ist -> Neovim ir ist a -> Neovim r st ThreadIdSource
Fork a neovim thread with the given custom config value and a custom
state. The result of the thread is discarded and only the ThreadId
is
returend immediately.
FIXME This function is pretty much unused and mayhave undesired effects,
namely that you cannot register autocmds in the forked thread.
errOnInvalidResult :: NvimObject o => Neovim r st (Either Object Object) -> Neovim r st oSource
ask :: MonadReader r m => m r
asks :: MonadReader r m => (r -> a) -> m a
get :: MonadState s m => m s
gets :: MonadState s m => (s -> a) -> m a
put :: MonadState s m => s -> m ()
modify :: MonadState s m => (s -> s) -> m ()
throwError :: MonadError e m => forall a. e -> m a