nvim-hs-0.2.5: Haskell plugin backend for neovim

Copyright(c) Sebastian Witte
Safe HaskellNone






newUniqueFunctionName :: Neovim r st FunctionName Source #

Create a new unique function name. To prevent possible name clashes, digits are stripped from the given suffix.

data Neovim r st a Source #

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) Source # 


liftBase :: IO α -> Neovim r st α #

MonadState st (Neovim r st) Source # 


get :: Neovim r st st #

put :: st -> Neovim r st () #

state :: (st -> (a, st)) -> Neovim r st a #

MonadReader r (Neovim r st) Source #

User facing instance declaration for the reader state.


ask :: Neovim r st r #

local :: (r -> r) -> Neovim r st a -> Neovim r st a #

reader :: (r -> a) -> Neovim r st a #

Monad (Neovim r st) Source # 


(>>=) :: Neovim r st a -> (a -> Neovim r st b) -> Neovim r st b #

(>>) :: Neovim r st a -> Neovim r st b -> Neovim r st b #

return :: a -> Neovim r st a #

fail :: String -> Neovim r st a #

Functor (Neovim r st) Source # 


fmap :: (a -> b) -> Neovim r st a -> Neovim r st b #

(<$) :: a -> Neovim r st b -> Neovim r st a #

Applicative (Neovim r st) Source # 


pure :: a -> Neovim r st a #

(<*>) :: Neovim r st (a -> b) -> Neovim r st a -> Neovim r st b #

liftA2 :: (a -> b -> c) -> Neovim r st a -> Neovim r st b -> Neovim r st c #

(*>) :: Neovim r st a -> Neovim r st b -> Neovim r st b #

(<*) :: Neovim r st a -> Neovim r st b -> Neovim r st a #

MonadIO (Neovim r st) Source # 


liftIO :: IO a -> Neovim r st a #

MonadThrow (Neovim r st) Source # 


throwM :: Exception e => e -> Neovim r st a #

MonadCatch (Neovim r st) Source # 


catch :: Exception e => Neovim r st a -> (e -> Neovim r st a) -> Neovim r st a #

MonadMask (Neovim r st) Source # 


mask :: ((forall a. Neovim r st a -> Neovim r st a) -> Neovim r st b) -> Neovim r st b #

uninterruptibleMask :: ((forall a. Neovim r st a -> Neovim r st a) -> Neovim r st b) -> Neovim r st b #

MonadResource (Neovim r st) Source # 


liftResourceT :: ResourceT IO a -> Neovim r st a #

type Neovim' = Neovim () () Source #

Convenience alias for Neovim () ().

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.

ErrorResult Object

Error that can be returned by a remote API call. A call of fromObject on this value could be converted to a value of NeovimExceptionGen.

type FunctionMap = Map FunctionName FunctionMapEntry Source #

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] -> FunctionMap Source #

Create a new function map from the given list of FunctionMapEntry values.

runNeovim :: NFData a => Config r st -> st -> Neovim r st a -> IO (Either Doc (a, st)) Source #

Initialize a Neovim context by supplying an InternalEnvironment.

forkNeovim :: NFData a => ir -> ist -> Neovim ir ist a -> Neovim r st ThreadId Source #

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.

err :: Pretty err => err -> Neovim r st a Source #

throw specialized to a Pretty value.

restart :: Neovim r st () Source #

Initiate a restart of the plugin provider.

quit :: Neovim r st () Source #

Initiate the termination of the plugin provider.

ask :: MonadReader r m => m r #

Retrieves the monad environment.

asks #


:: MonadReader r m 
=> (r -> a)

The selector function to apply to the environment.

-> m a 

Retrieves a function of the current environment.

get :: MonadState s m => m s #

Return the state from the internals of the monad.

gets :: MonadState s m => (s -> a) -> m a #

Gets specific component of the state, using a projection function supplied.

put :: MonadState s m => s -> m () #

Replace the state inside the monad.

modify :: MonadState s m => (s -> s) -> m () #

Monadic state transformer.

Maps an old state to a new state inside a state monad. The old state is thrown away.

     Main> :t modify ((+1) :: Int -> Int)
     modify (...) :: (MonadState Int a) => a ()

This says that modify (+1) acts over any Monad that is a member of the MonadState class, with an Int state.

throwError :: MonadError e m => forall a. e -> m a #

Is used within a monadic computation to begin exception processing.