yi-core-0.14.0: Yi editor core library

LicenseGPL-2
Maintaineryi-devel@googlegroups.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • TemplateHaskell
  • TemplateHaskellQuotes
  • GeneralizedNewtypeDeriving
  • RankNTypes
  • ExplicitForAll

Yi.Option

Contents

Description

Command-line options

Synopsis

Types

type YiOption = Config -> Either OptionError Config #

An option is a function that attempts to change the configuration of the editor at runtime.

data YiOptions #

Custom options that should be accepted. Provided in user configuration.

The general flow is that the user adds options to his configuration. Options are essentially functions describing how to modify the configuration at runtime. When an option is called, it gets the current config and may modify it (to encode its value)

Core

yiCustomOptions :: Lens' Config [YiOptionDescr] #

Lens for accessing the list of custom options.

You can pretty much create whatever types of options you want with this. But most cases are taken care of by one of the helper functions in this module.

consYiOption :: YiOptionDescr -> Config -> Config #

Includes an extra option in the configuration. Small wrapper around yiCustomOptions

consYiOptions :: [YiOptionDescr] -> Config -> Config #

Like consYiOption but supports multiple options. Convenient for keymaps which might want to install lots of options.

Argument-less options

yiBoolOption :: Lens' Config Bool -> ArgDescr YiOption #

An argument which sets some configuration value to True.

yiFlagOption :: Lens' Config a -> (a -> a) -> ArgDescr YiOption #

An argument which applies a function transforming some inner value of the configuration.

yiActionFlagOption :: Action -> ArgDescr YiOption #

Flag that appends an action to the startup actions.

Argument-taking options

yiStringOption :: IsString a => Lens' Config a -> String -> ArgDescr YiOption #

Sets the value of an option which is any string type (hopefully text...)

This is not meant to be fully applied. By only passing in the lens you will obtain a value suitable for use in OptDescr.

yiStringOption' :: IsString a => Lens' Config (Maybe a) -> String -> ArgDescr YiOption #

Just like yiStringOption, except it applies a Just. Useful for setting string-like values whose default is None.

yiActionOption :: IsString a => (a -> Action) -> String -> ArgDescr YiOption #

Option that appends a parameterized action to the startup actions.