nvim-hs-0.0.2: Haskell plugin backend for neovim

Copyright(c) Sebastian Witte
LicenseApache-2.0
Maintainerwoozletoff@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Neovim.Plugin.Classes

Description

 

Synopsis

Documentation

newtype ExportedFunctionality r st Source

This data type is used in the plugin registration to properly register the functions.

Constructors

EF (FunctionalityDescription, [Object] -> Neovim r st Object) 

getFunction :: ExportedFunctionality r st -> [Object] -> Neovim r st Object Source

Extract the function of an ExportedFunctionality.

data FunctionalityDescription Source

Functionality specific functional description entries.

All fields which are directly specified in these constructors are not optional, but can partialy be generated via the Template Haskell functions. The last field is a data type that contains all relevant options with sensible defaults, hence def can be used as an argument.

Constructors

Function Text Synchronous

Exported function. Callable via call name(arg1,arg2).

  • Name of the function (must start with an uppercase letter)
  • Option to indicate how neovim should behave when calling this function
Command Text CommandOptions

Exported Command. Callable via :Name arg1 arg2.

  • Name of the command (must start with an uppercase letter)
  • Options to configure neovim's behavior for calling the command
Autocmd Text Text AutocmdOptions

Exported autocommand. Will call the given function if the type and filter match.

NB: Since we are registering this on the Haskell side of things, the number of accepted arguments should be 0. TODO Should this be enforced somehow? Possibly via the TH generator.

  • Type of the autocmd (e.g. "BufWritePost")
  • Name for the function to call

class FunctionName a where Source

Conveniennce class to extract a name from some value.

Methods

name :: a -> Text Source

data NeovimPlugin Source

Constructors

forall r st . NeovimPlugin (Plugin r st) 

data Plugin r st Source

This data type contains meta information for the plugin manager.

Constructors

Plugin 

Fields

exports :: [ExportedFunctionality () ()]
 
statefulExports :: [(r, st, [ExportedFunctionality r st])]
 

wrapPlugin :: Monad m => Plugin r st -> m NeovimPlugin Source

Wrap a Plugin in some nice blankets, so that we can put them in a simple list.

data Synchronous Source

This option detemines how neovim should behave when calling some functionality on a remote host.

Constructors

Async

Call the functionality entirely for its side effects and do not wait for it to finish. Calling a functionality with this flag set is completely asynchronous and nothing is really expected to happen. This is why a call like this is called notification on the neovim side of things.

Sync

Call the function and wait for its result. This is only synchronous on the neovim side. For comands it means that the GUI will (probably) not allow any user input until a reult is received. Functions run asynchronously inside neovim (or in one of its plugin providers) can use these functions concurrently.

data CommandOption Source

Options for commands.

Some command can also be described by using the OverloadedString extensions. This means that you can write a literal String inside your source file in place for a CommandOption value. See the documentation for each value on how these strings should look like (Both versions are compile time checked.)

Constructors

CmdSync Synchronous

Should neovim wait for an answer (Sync)?

Stringliteral: "sync" or "async"

CmdRegister

Register passed to the command.

Stringliteral: """

CmdNargs String

Command takes a specific amount of arguments

Automatically set via template haskell functions. You really shouldn't use this option yourself unless you have to.

CmdRange RangeSpecification

Determines how neovim passes the range.

Stringliterals: "%" for WholeFile, "," for line and ",123" for 123 lines.

CmdCount Int

Command handles a count. The argument defines the default count.

Stringliteral: string of numbers (e.g. "132")

CmdBang

Command handles a bang

Stringliteral: "!"

data CommandArguments Source

You can use this type as the first argument for a function which is intended to be exported as a command. It holds information about the special attributes a command can take.

Constructors

CommandArguments 

Fields

bang :: Maybe Bool

Nothing means that the function was not defined to handle a bang, otherwise it means that the bang was passed (Just True) or that it was not passed when called (Just False).

range :: Maybe (Int, Int)

Range passed from neovim. Only set if CmdRange was used in the export declaration of the command.

Examples: * Just (1,12)

count :: Maybe Int

Count passed by neovim. Only set if CmdCount was used in the export declaration of the command.

register :: Maybe String

Register that the command canshouldmust use.

getCommandOptions :: CommandOptions -> [CommandOption] Source

mkCommandOptions :: [CommandOption] -> CommandOptions Source

data AutocmdOptions Source

Constructors

AutocmdOptions 

Fields

acmdSync :: Synchronous

Option to indicate whether vim shuould block until the function has completed. (default: Sync)

acmdPattern :: String

Pattern to match on. (default: "*")

acmdNested :: Bool

Nested autocmd. (default: False)

See :h autocmd-nested