Copyright | (c) Sebastian Witte |
---|---|
License | Apache-2.0 |
Maintainer | woozletoff@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- generateAPI :: Map String (Q Type) -> Q [Dec]
- function :: String -> Name -> Q Exp
- function' :: Name -> Q Exp
- command :: String -> Name -> Q Exp
- command' :: Name -> Q Exp
- autocmd :: Name -> Q Exp
- defaultAPITypeToHaskellTypeMap :: Map String (Q Type)
- module UnliftIO.Exception
- module Neovim.Classes
- module Data.Data
- module Data.MessagePack
Documentation
generateAPI :: Map String (Q Type) -> Q [Dec] Source #
Generate the API types and functions provided by nvim --api-info
.
The provided map allows the use of different Haskell types for the types
defined in the API. The types must be an instance of NvimObject
and they
must form an isomorphism with the sent messages types. Currently, it
provides a Convenient way to replace the String type with Text
,
ByteString
or String
.
function :: String -> Name -> Q Exp Source #
Define an exported function by providing a custom name and referencing the function you want to export.
Note that the name must start with an upper case letter.
Example: $(function "MyExportedFunction" 'myDefinedFunction)
Sync
function' :: Name -> Q Exp Source #
Define an exported function. This function works exactly like function
,
but it generates the exported name automatically by converting the first
letter to upper case.
command :: String -> Name -> Q Exp Source #
Similarly to function
, this function is used to export a command with a
custom name.
Note that commands must start with an upper case letter.
Due to limitations on the side of (neo)vim, commands can only have one of the
following five signatures, where you can replace String
with ByteString
or Text
if you wish:
CommandArguments
->Neovim
r st ()CommandArguments
->Maybe
String
->Neovim
r st ()CommandArguments
->String
->Neovim
r st ()CommandArguments
-> [String
] ->Neovim
r st ()CommandArguments
->String
-> [String
] ->Neovim
r st ()
Example: $(command "RememberThePrime" 'someFunction) [
CmdBang
]
Note that the list of command options (i.e. the last argument) removes duplicate options by means of some internally convenient sorting. You should simply not define the same option twice.
command' :: Name -> Q Exp Source #
Define an exported command. This function works exactly like command
, but
it generates the command name by converting the first letter to upper case.
defaultAPITypeToHaskellTypeMap :: Map String (Q Type) Source #
Default type mappings for the requested API.
module UnliftIO.Exception
module Neovim.Classes
module Data.Data
module Data.MessagePack