yi-core-0.19.4: Yi editor core library

License | GPL-2
Maintainer | yi-devel@googlegroups.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Extensions

- Cpp
- ScopedTypeVariables
- DeriveDataTypeable
- DeriveFunctor
- DeriveTraversable
- DeriveFoldable
- FlexibleContexts
- ConstrainedClassMethods
- MultiParamTypeClasses
- ExistentialQuantification
- GeneralizedNewtypeDeriving
- ExplicitForAll
- LambdaCase

Yi.Types

Description

This module is the host of the most prevalent types throughout Yi. It is unfortunately a necessary evil to avoid use of bootfiles.

You're encouraged to import from more idiomatic modules which will re-export these where appropriate.

Synopsis

- data Action
  - = Show a => YiA (YiM a)
  - | Show a => EditorA (EditorM a)
  - | Show a => BufferA (BufferM a)
- emptyAction :: Action
- class (Default a, Binary a, Typeable a) => YiVariable a
- class (Default a, Typeable a) => YiConfigVariable a
- type Interact ev a = I ev Action a
- type KeymapM a = Interact Event a
- type Keymap = KeymapM ()
- type KeymapEndo = Keymap -> Keymap
- type KeymapProcess = P Event Action
- data IsRefreshNeeded
  - = MustRefresh
  - | NoNeedToRefresh
- data Yi = Yi {
  - yiUi :: UI Editor
  - yiInput :: [Event] -> IO ()
  - yiOutput :: IsRefreshNeeded -> [Action] -> IO ()
  - yiConfig :: Config
  - yiVar :: MVar YiVar
  }
- data YiVar = YiVar {
  - yiEditor :: !Editor
  - yiSubprocessIdSupply :: !SubprocessId
  - yiSubprocesses :: !(Map SubprocessId SubprocessInfo)
  }
- newtype YiM a = YiM {
  - runYiM :: ReaderT Yi IO a
  }
- unsafeWithEditor :: Config -> MVar YiVar -> EditorM a -> IO a
- data KeymapSet = KeymapSet {
  - topKeymap :: Keymap
  - insertKeymap :: Keymap
  }
- extractTopKeymap :: KeymapSet -> Keymap
- newtype BufferM a = BufferM {
  - fromBufferM :: ReaderT Window (State FBuffer) a
  }
- data IndentSettings = IndentSettings {
  - expandTabs :: !Bool
  - tabSize :: !Int
  - shiftWidth :: !Int
  }
- data FBuffer = FBuffer {
  - bmode :: !(Mode syntax)
  - rawbuf :: !(BufferImpl syntax)
  - attributes :: !Attributes
  }
- type WinMarks = MarkSet Mark
- data MarkSet a = MarkSet {
  - fromMark :: !a
  - insMark :: !a
  - selMark :: !a
  }
- data Attributes = Attributes {
  - ident :: !BufferId
  - bkey__ :: !BufferRef
  - undos :: !URList
  - bufferDynamic :: !DynamicState
  - preferCol :: !(Maybe Int)
  - preferVisCol :: !(Maybe Int)
  - stickyEol :: !Bool
  - pendingUpdates :: !(Seq UIUpdate)
  - selectionStyle :: !SelectionStyle
  - keymapProcess :: !KeymapProcess
  - winMarks :: !(Map WindowRef WinMarks)
  - lastActiveWindow :: !Window
  - lastSyncTime :: !UTCTime
  - readOnly :: !Bool
  - inserting :: !Bool
  - directoryContent :: !Bool
  - pointFollowsWindow :: !(Set WindowRef)
  - updateTransactionInFlight :: !Bool
  - updateTransactionAccum :: !(Seq Update)
  - fontsizeVariation :: !Int
  - updateStream :: !(Seq Update)
  }
- data BufferId
  - = MemBuffer !Text
  - | FileBuffer !FilePath
- data SelectionStyle = SelectionStyle {
  - highlightSelection :: !Bool
  - rectangleSelection :: !Bool
  }
- data AnyMode = AnyMode (Mode syntax)
- data Mode syntax = Mode {
  - modeName :: Text
  - modeApplies :: FilePath -> YiString -> Bool
  - modeHL :: ExtHL syntax
  - modePrettify :: syntax -> BufferM ()
  - modeKeymap :: KeymapSet -> KeymapSet
  - modeIndent :: syntax -> IndentBehaviour -> BufferM ()
  - modeFollow :: syntax -> Action
  - modeIndentSettings :: IndentSettings
  - modeToggleCommentSelection :: Maybe (BufferM ())
  - modeGetStrokes :: syntax -> Point -> Point -> Point -> [Stroke]
  - modeOnLoad :: BufferM ()
  - modeModeLine :: [Text] -> BufferM Text
  - modeGotoDeclaration :: BufferM ()
  }
- data IndentBehaviour
  - = IncreaseCycle
  - | DecreaseCycle
  - | IncreaseOnly
  - | DecreaseOnly
- type Status = ([Text], StyleName)
- type Statuses = DelayList Status
- data Editor = Editor {
  - bufferStack :: !(NonEmpty BufferRef)
  - buffers :: !(Map BufferRef FBuffer)
  - refSupply :: !Int
  - tabs_ :: !(PointedList Tab)
  - dynamic :: !DynamicState
  - statusLines :: !Statuses
  - maxStatusHeight :: !Int
  - killring :: !Killring
  - currentRegex :: !(Maybe SearchExp)
  - searchDirection :: !Direction
  - pendingEvents :: ![Event]
  - onCloseActions :: !(Map BufferRef (EditorM ()))
  }
- newtype EditorM a = EditorM {
  - fromEditorM :: ReaderT Config (State Editor) a
  }
- class (Monad m, MonadState Editor m) => MonadEditor (m :: Type -> Type) where
  - askCfg :: m Config
  - withEditor :: EditorM a -> m a
  - withEditor_ :: EditorM a -> m ()
- runEditor :: Config -> EditorM a -> Editor -> (Editor, a)
- data UIConfig = UIConfig {
  - configFontName :: Maybe String
  - configFontSize :: Maybe Int
  - configScrollStyle :: Maybe ScrollStyle
  - configScrollWheelAmount :: Int
  - configLeftSideScrollBar :: Bool
  - configAutoHideScrollBar :: Bool
  - configAutoHideTabBar :: Bool
  - configLineWrap :: Bool
  - configCursorStyle :: CursorStyle
  - configWindowFill :: Char
  - configTheme :: Theme
  - configLineNumbers :: Bool
  }
- type UIBoot = Config -> ([Event] -> IO ()) -> ([Action] -> IO ()) -> Editor -> IO (UI Editor)
- data CursorStyle
  - = AlwaysFat
  - | NeverFat
  - | FatWhenFocused
  - | FatWhenFocusedAndInserting
- data Config = Config {
  - startFrontEnd :: UIBoot
  - configUI :: !UIConfig
  - startActions :: ![Action]
  - initialActions :: ![Action]
  - defaultKm :: !KeymapSet
  - configInputPreprocess :: !(P Event Event)
  - modeTable :: ![AnyMode]
  - debugMode :: !Bool
  - configRegionStyle :: !RegionStyle
  - configKillringAccumulate :: !Bool
  - configCheckExternalChangesObsessively :: !Bool
  - bufferUpdateHandler :: !(Seq (Seq Update -> BufferM ()))
  - layoutManagers :: ![AnyLayoutManager]
  - configVars :: !DynamicState
  }
- data RegionStyle
  - = LineWise
  - | Inclusive
  - | Exclusive
  - | Block

# Documentation

data Action Source #

Constructors

Show a => YiA (YiM a) |
Show a => EditorA (EditorM a) |
Show a => BufferA (BufferM a) |

#### Instances

Instances details

Show Action Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> Action -> ShowS Source # show :: Action -> String Source # showList :: [Action] -> ShowS Source #
Eq Action Source # |
Instance details Defined in Yi.Types Methods (==) :: Action -> Action -> Bool Source # (/=) :: Action -> Action -> Bool Source #
YiAction Action () Source # |
Instance details Defined in Yi.Keymap Methods makeAction :: Action -> Action Source #

emptyAction :: Action Source #

class (Default a, Binary a, Typeable a) => YiVariable a Source #

#### Instances

Instances details

YiVariable CabalBuffer Source # |
Instance details Defined in Yi.Command
YiVariable Histories Source # |
Instance details Defined in Yi.History
YiVariable RegionStyle Source # |
Instance details Defined in Yi.Types

class (Default a, Typeable a) => YiConfigVariable a Source #

#### Instances

Instances details

YiConfigVariable Evaluator Source # |
Instance details Defined in Yi.Eval

type Interact ev a = I ev Action a Source #

type KeymapM a = Interact Event a Source #

type Keymap = KeymapM () Source #

type KeymapEndo = Keymap -> Keymap Source #

type KeymapProcess = P Event Action Source #

data IsRefreshNeeded Source #

Constructors

MustRefresh |
NoNeedToRefresh |

#### Instances

Instances details

Show IsRefreshNeeded Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> IsRefreshNeeded -> ShowS Source # show :: IsRefreshNeeded -> String Source # showList :: [IsRefreshNeeded] -> ShowS Source #
Eq IsRefreshNeeded Source # |
Instance details Defined in Yi.Types Methods (==) :: IsRefreshNeeded -> IsRefreshNeeded -> Bool Source # (/=) :: IsRefreshNeeded -> IsRefreshNeeded -> Bool Source #

data Yi Source #

Constructors

Yi |

Fields

- yiUi :: UI Editor
- yiInput :: [Event] -> IO ()

  input stream

- yiOutput :: IsRefreshNeeded -> [Action] -> IO ()

  output stream

- yiConfig :: Config
- yiVar :: MVar YiVar

  The only mutable state in the program

#### Instances

Instances details

MonadReader Yi YiM Source # |
Instance details Defined in Yi.Types Methods ask :: YiM Yi Source # local :: (Yi -> Yi) -> YiM a -> YiM a Source # reader :: (Yi -> a) -> YiM a Source #

data YiVar Source #

Constructors

YiVar |

Fields

- yiEditor :: !Editor
- yiSubprocessIdSupply :: !SubprocessId
- yiSubprocesses :: !(Map SubprocessId SubprocessInfo)

newtype YiM a Source #

The type of user-bindable functions TODO: doc how these are actually user-bindable are they?

Constructors

YiM |

Fields

- runYiM :: ReaderT Yi IO a

#### Instances

Instances details

Applicative YiM Source # |
Instance details Defined in Yi.Types Methods pure :: a -> YiM a Source # (<*>) :: YiM (a -> b) -> YiM a -> YiM b Source # liftA2 :: (a -> b -> c) -> YiM a -> YiM b -> YiM c Source # (*>) :: YiM a -> YiM b -> YiM b Source # (<*) :: YiM a -> YiM b -> YiM a Source #
Functor YiM Source # |
Instance details Defined in Yi.Types Methods fmap :: (a -> b) -> YiM a -> YiM b Source # (<$) :: a -> YiM b -> YiM a Source #
Monad YiM Source # |
Instance details Defined in Yi.Types Methods (>>=) :: YiM a -> (a -> YiM b) -> YiM b Source # (>>) :: YiM a -> YiM b -> YiM b Source # return :: a -> YiM a Source #
MonadFail YiM Source # |
Instance details Defined in Yi.Types Methods fail :: String -> YiM a Source #
MonadEditor YiM Source # |
Instance details Defined in Yi.Types Methods askCfg :: YiM Config Source # withEditor :: EditorM a -> YiM a Source # withEditor_ :: EditorM a -> YiM () Source #
MonadReader Yi YiM Source # |
Instance details Defined in Yi.Types Methods ask :: YiM Yi Source # local :: (Yi -> Yi) -> YiM a -> YiM a Source # reader :: (Yi -> a) -> YiM a Source #
MonadState Editor YiM Source # |
Instance details Defined in Yi.Types Methods get :: YiM Editor Source # put :: Editor -> YiM () Source # state :: (Editor -> (a, Editor)) -> YiM a Source #
MonadBase IO YiM Source # |
Instance details Defined in Yi.Types Methods liftBase :: IO α -> YiM α Source #
HookType (YiM a) Source # |
Instance details Defined in Yi.Hooks Methods runHookImpl :: YiConfigVariable var => (var -> YiM a) -> YiM a
YiAction (YiM x) x Source # |
Instance details Defined in Yi.Keymap Methods makeAction :: YiM x -> Action Source #

unsafeWithEditor :: Config -> MVar YiVar -> EditorM a -> IO a Source #

data KeymapSet Source #

Constructors

KeymapSet |

Fields

- topKeymap :: Keymap

  Content of the top-level loop.

- insertKeymap :: Keymap

  For insertion-only modes

extractTopKeymap :: KeymapSet -> Keymap Source #

newtype BufferM a Source #

The BufferM monad writes the updates performed.

Constructors

BufferM |

Fields

- fromBufferM :: ReaderT Window (State FBuffer) a

#### Instances

Instances details

Applicative BufferM Source # |
Instance details Defined in Yi.Types Methods pure :: a -> BufferM a Source # (<*>) :: BufferM (a -> b) -> BufferM a -> BufferM b Source # liftA2 :: (a -> b -> c) -> BufferM a -> BufferM b -> BufferM c Source # (*>) :: BufferM a -> BufferM b -> BufferM b Source # (<*) :: BufferM a -> BufferM b -> BufferM a Source #
Functor BufferM Source # |
Instance details Defined in Yi.Types Methods fmap :: (a -> b) -> BufferM a -> BufferM b Source # (<$) :: a -> BufferM b -> BufferM a Source #
Monad BufferM Source # |
Instance details Defined in Yi.Types Methods (>>=) :: BufferM a -> (a -> BufferM b) -> BufferM b Source # (>>) :: BufferM a -> BufferM b -> BufferM b Source # return :: a -> BufferM a Source #
MonadFail BufferM Source # |
Instance details Defined in Yi.Types Methods fail :: String -> BufferM a Source #
MonadReader Window BufferM Source # |
Instance details Defined in Yi.Types Methods ask :: BufferM Window Source # local :: (Window -> Window) -> BufferM a -> BufferM a Source # reader :: (Window -> a) -> BufferM a Source #
MonadState FBuffer BufferM Source # |
Instance details Defined in Yi.Types Methods get :: BufferM FBuffer Source # put :: FBuffer -> BufferM () Source # state :: (FBuffer -> (a, FBuffer)) -> BufferM a Source #
YiAction (BufferM x) x Source # |
Instance details Defined in Yi.Keymap Methods makeAction :: BufferM x -> Action Source #

data IndentSettings Source #

Currently duplicates some of Vim's indent settings. Allowing a buffer to specify settings that are more dynamic, perhaps via closures, could be useful.

Constructors

IndentSettings |

Fields

- expandTabs :: !Bool

  Insert spaces instead of tabs as possible

- tabSize :: !Int

  Size of a Tab

- shiftWidth :: !Int

  Indent by so many columns

#### Instances

Instances details

Show IndentSettings Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> IndentSettings -> ShowS Source # show :: IndentSettings -> String Source # showList :: [IndentSettings] -> ShowS Source #
Eq IndentSettings Source # |
Instance details Defined in Yi.Types Methods (==) :: IndentSettings -> IndentSettings -> Bool Source # (/=) :: IndentSettings -> IndentSettings -> Bool Source #

data FBuffer Source #

Constructors

FBuffer |

Fields

- bmode :: !(Mode syntax)
- rawbuf :: !(BufferImpl syntax)
- attributes :: !Attributes

#### Instances

Instances details

Binary FBuffer Source # |
Instance details Defined in Yi.Buffer.Misc Methods put :: FBuffer -> Put Source # get :: Get FBuffer Source # putList :: [FBuffer] -> Put Source #
Show FBuffer Source # |
Instance details Defined in Yi.Buffer.Misc Methods showsPrec :: Int -> FBuffer -> ShowS Source # show :: FBuffer -> String Source # showList :: [FBuffer] -> ShowS Source #
Eq FBuffer Source # |
Instance details Defined in Yi.Types Methods (==) :: FBuffer -> FBuffer -> Bool Source # (/=) :: FBuffer -> FBuffer -> Bool Source #
MonadState FBuffer BufferM Source # |
Instance details Defined in Yi.Types Methods get :: BufferM FBuffer Source # put :: FBuffer -> BufferM () Source # state :: (FBuffer -> (a, FBuffer)) -> BufferM a Source #

type WinMarks = MarkSet Mark Source #

data MarkSet a Source #

Constructors

MarkSet |

Fields

- fromMark :: !a
- insMark :: !a
- selMark :: !a

#### Instances

Instances details

Functor MarkSet Source # |
Instance details Defined in Yi.Types Methods fmap :: (a -> b) -> MarkSet a -> MarkSet b Source # (<$) :: a -> MarkSet b -> MarkSet a Source #
Foldable MarkSet Source # |

Instance details

Defined in Yi.Types

Methods

fold :: Monoid m => MarkSet m -> m Source #

foldMap :: Monoid m => (a -> m) -> MarkSet a -> m Source #

foldMap' :: Monoid m => (a -> m) -> MarkSet a -> m Source #

foldr :: (a -> b -> b) -> b -> MarkSet a -> b Source #

foldr' :: (a -> b -> b) -> b -> MarkSet a -> b Source #

foldl :: (b -> a -> b) -> b -> MarkSet a -> b Source #

foldl' :: (b -> a -> b) -> b -> MarkSet a -> b Source #

foldr1 :: (a -> a -> a) -> MarkSet a -> a Source #

foldl1 :: (a -> a -> a) -> MarkSet a -> a Source #

toList :: MarkSet a -> [a] Source #

null :: MarkSet a -> Bool Source #

length :: MarkSet a -> Int Source #

elem :: Eq a => a -> MarkSet a -> Bool Source #

maximum :: Ord a => MarkSet a -> a Source #

minimum :: Ord a => MarkSet a -> a Source #

sum :: Num a => MarkSet a -> a Source #

product :: Num a => MarkSet a -> a Source #

Traversable MarkSet Source # |
Instance details Defined in Yi.Types Methods traverse :: Applicative f => (a -> f b) -> MarkSet a -> f (MarkSet b) Source # sequenceA :: Applicative f => MarkSet (f a) -> f (MarkSet a) Source # mapM :: Monad m => (a -> m b) -> MarkSet a -> m (MarkSet b) Source # sequence :: Monad m => MarkSet (m a) -> m (MarkSet a) Source #
Binary a => Binary (MarkSet a) Source # |
Instance details Defined in Yi.Types Methods put :: MarkSet a -> Put Source # get :: Get (MarkSet a) Source # putList :: [MarkSet a] -> Put Source #
Show a => Show (MarkSet a) Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> MarkSet a -> ShowS Source # show :: MarkSet a -> String Source # showList :: [MarkSet a] -> ShowS Source #

data Attributes Source #

Constructors

Attributes |

Fields

- ident :: !BufferId
- bkey__ :: !BufferRef

  immutable unique key

- undos :: !URList

  undo/redo list

- bufferDynamic :: !DynamicState

  dynamic components

- preferCol :: !(Maybe Int)

  preferred column to arrive at when we do a lineDown / lineUp

- preferVisCol :: !(Maybe Int)

  preferred column to arrive at visually (ie, respecting wrap)

- stickyEol :: !Bool

  stick to the end of line (used by vim bindings mostly)

- pendingUpdates :: !(Seq UIUpdate)

  updates that haven't been synched in the UI yet

- selectionStyle :: !SelectionStyle
- keymapProcess :: !KeymapProcess
- winMarks :: !(Map WindowRef WinMarks)
- lastActiveWindow :: !Window
- lastSyncTime :: !UTCTime

  time of the last synchronization with disk

- readOnly :: !Bool

  read-only flag

- inserting :: !Bool

  the keymap is ready for insertion into this buffer

- directoryContent :: !Bool

  does buffer contain directory contents

- pointFollowsWindow :: !(Set WindowRef)
- updateTransactionInFlight :: !Bool
- updateTransactionAccum :: !(Seq Update)
- fontsizeVariation :: !Int

  How many points (frontend-specific) to change the font by in this buffer

- updateStream :: !(Seq Update)

  Updates that we've seen in this buffer, basically "write-only". Work-around for broken WriterT.

#### Instances

Instances details

Binary Attributes Source # |
Instance details Defined in Yi.Types Methods put :: Attributes -> Put Source # get :: Get Attributes Source # putList :: [Attributes] -> Put Source #

data BufferId Source #

Constructors

MemBuffer !Text |
FileBuffer !FilePath |

#### Instances

Instances details

Binary BufferId Source # |
Instance details Defined in Yi.Types Methods put :: BufferId -> Put Source # get :: Get BufferId Source # putList :: [BufferId] -> Put Source #
Show BufferId Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> BufferId -> ShowS Source # show :: BufferId -> String Source # showList :: [BufferId] -> ShowS Source #
Eq BufferId Source # |
Instance details Defined in Yi.Types Methods (==) :: BufferId -> BufferId -> Bool Source # (/=) :: BufferId -> BufferId -> Bool Source #
Ord BufferId Source # |
Instance details Defined in Yi.Types Methods compare :: BufferId -> BufferId -> Ordering Source # (<) :: BufferId -> BufferId -> Bool Source # (<=) :: BufferId -> BufferId -> Bool Source # (>) :: BufferId -> BufferId -> Bool Source # (>=) :: BufferId -> BufferId -> Bool Source # max :: BufferId -> BufferId -> BufferId Source # min :: BufferId -> BufferId -> BufferId Source #

data SelectionStyle Source #

Constructors

SelectionStyle |

Fields

- highlightSelection :: !Bool
- rectangleSelection :: !Bool

#### Instances

Instances details

Binary SelectionStyle Source # |
Instance details Defined in Yi.Types Methods put :: SelectionStyle -> Put Source # get :: Get SelectionStyle Source # putList :: [SelectionStyle] -> Put Source #
Show SelectionStyle Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> SelectionStyle -> ShowS Source # show :: SelectionStyle -> String Source # showList :: [SelectionStyle] -> ShowS Source #

data AnyMode Source #

Constructors

AnyMode (Mode syntax) |

data Mode syntax Source #

A Mode customizes the Yi interface for editing a particular data format. It specifies when the mode should be used and controls file-specific syntax highlighting and command input, among other things.

Constructors

Mode |

Fields

- modeName :: Text

  so this can be serialized, debugged.

- modeApplies :: FilePath -> YiString -> Bool

  What type of files does this mode apply to?

- modeHL :: ExtHL syntax

  Syntax highlighter

- modePrettify :: syntax -> BufferM ()

  Prettify current "paragraph"

- modeKeymap :: KeymapSet -> KeymapSet

  Buffer-local keymap modification

- modeIndent :: syntax -> IndentBehaviour -> BufferM ()

  emacs-style auto-indent line

- modeFollow :: syntax -> Action

  Follow a "link" in the file. (eg. go to location of error message)

- modeIndentSettings :: IndentSettings
- modeToggleCommentSelection :: Maybe (BufferM ())
- modeGetStrokes :: syntax -> Point -> Point -> Point -> [Stroke]

  Strokes that should be applied when displaying a syntax element should this be an Action instead?

- modeOnLoad :: BufferM ()

  An action that is to be executed when this mode is set

- modeModeLine :: [Text] -> BufferM Text

  buffer-local modeline formatting method

- modeGotoDeclaration :: BufferM ()

  go to the point where the variable is declared

#### Instances

Instances details

Binary (Mode syntax) Source # | Just stores the mode name.
Instance details Defined in Yi.Buffer.Misc Methods put :: Mode syntax -> Put Source # get :: Get (Mode syntax) Source # putList :: [Mode syntax] -> Put Source #

data IndentBehaviour Source #

Used to specify the behaviour of the automatic indent command.

Constructors

IncreaseCycle | Increase the indentation to the next higher indentation hint. If we are currently at the highest level of indentation then cycle back to the lowest.
DecreaseCycle | Decrease the indentation to the next smaller indentation hint. If we are currently at the smallest level then cycle back to the largest
IncreaseOnly | Increase the indentation to the next higher hint if no such hint exists do nothing.
DecreaseOnly | Decrease the indentation to the next smaller indentation hint, if no such hint exists do nothing.

#### Instances

Instances details

Show IndentBehaviour Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> IndentBehaviour -> ShowS Source # show :: IndentBehaviour -> String Source # showList :: [IndentBehaviour] -> ShowS Source #
Eq IndentBehaviour Source # |
Instance details Defined in Yi.Types Methods (==) :: IndentBehaviour -> IndentBehaviour -> Bool Source # (/=) :: IndentBehaviour -> IndentBehaviour -> Bool Source #

type Status = ([Text], StyleName) Source #

type Statuses = DelayList Status Source #

data Editor Source #

The Editor state

Constructors

Editor |

Fields

- bufferStack :: !(NonEmpty BufferRef)

  Stack of all the buffers. Invariant: first buffer is the current one.

- buffers :: !(Map BufferRef FBuffer)
- refSupply :: !Int

  Supply for buffer, window and tab ids.

- tabs_ :: !(PointedList Tab)

  current tab contains the visible windows pointed list.

- dynamic :: !DynamicState

  dynamic components

- statusLines :: !Statuses
- maxStatusHeight :: !Int
- killring :: !Killring
- currentRegex :: !(Maybe SearchExp)

  currently highlighted regex (also most recent regex for use in vim bindings)

- searchDirection :: !Direction
- pendingEvents :: ![Event]

  Processed events that didn't yield any action yet.

- onCloseActions :: !(Map BufferRef (EditorM ()))

  Actions to be run when the buffer is closed; should be scrapped.

#### Instances

Instances details

Binary Editor Source # |
Instance details Defined in Yi.Editor Methods put :: Editor -> Put Source # get :: Get Editor Source # putList :: [Editor] -> Put Source #
MonadState Editor EditorM Source # |
Instance details Defined in Yi.Types Methods get :: EditorM Editor Source # put :: Editor -> EditorM () Source # state :: (Editor -> (a, Editor)) -> EditorM a Source #
MonadState Editor YiM Source # |
Instance details Defined in Yi.Types Methods get :: YiM Editor Source # put :: Editor -> YiM () Source # state :: (Editor -> (a, Editor)) -> YiM a Source #

newtype EditorM a Source #

Constructors

EditorM |

Fields

- fromEditorM :: ReaderT Config (State Editor) a

#### Instances

Instances details

Applicative EditorM Source # |
Instance details Defined in Yi.Types Methods pure :: a -> EditorM a Source # (<*>) :: EditorM (a -> b) -> EditorM a -> EditorM b Source # liftA2 :: (a -> b -> c) -> EditorM a -> EditorM b -> EditorM c Source # (*>) :: EditorM a -> EditorM b -> EditorM b Source # (<*) :: EditorM a -> EditorM b -> EditorM a Source #
Functor EditorM Source # |
Instance details Defined in Yi.Types Methods fmap :: (a -> b) -> EditorM a -> EditorM b Source # (<$) :: a -> EditorM b -> EditorM a Source #
Monad EditorM Source # |
Instance details Defined in Yi.Types Methods (>>=) :: EditorM a -> (a -> EditorM b) -> EditorM b Source # (>>) :: EditorM a -> EditorM b -> EditorM b Source # return :: a -> EditorM a Source #
MonadFail EditorM Source # |
Instance details Defined in Yi.Types Methods fail :: String -> EditorM a Source #
MonadEditor EditorM Source # |
Instance details Defined in Yi.Types Methods askCfg :: EditorM Config Source # withEditor :: EditorM a -> EditorM a Source # withEditor_ :: EditorM a -> EditorM () Source #
MonadReader Config EditorM Source # |
Instance details Defined in Yi.Types Methods ask :: EditorM Config Source # local :: (Config -> Config) -> EditorM a -> EditorM a Source # reader :: (Config -> a) -> EditorM a Source #
MonadState Editor EditorM Source # |
Instance details Defined in Yi.Types Methods get :: EditorM Editor Source # put :: Editor -> EditorM () Source # state :: (Editor -> (a, Editor)) -> EditorM a Source #
HookType (EditorM a) Source # |
Instance details Defined in Yi.Hooks Methods runHookImpl :: YiConfigVariable var => (var -> EditorM a) -> EditorM a
YiAction (EditorM x) x Source # |
Instance details Defined in Yi.Keymap Methods makeAction :: EditorM x -> Action Source #

class (Monad m, MonadState Editor m) => MonadEditor (m :: Type -> Type) where Source #

Minimal complete definition

askCfg

Methods

askCfg :: m Config Source #

withEditor :: EditorM a -> m a Source #

withEditor_ :: EditorM a -> m () Source #

#### Instances

Instances details

MonadEditor EditorM Source # |
Instance details Defined in Yi.Types Methods askCfg :: EditorM Config Source # withEditor :: EditorM a -> EditorM a Source # withEditor_ :: EditorM a -> EditorM () Source #
MonadEditor YiM Source # |
Instance details Defined in Yi.Types Methods askCfg :: YiM Config Source # withEditor :: EditorM a -> YiM a Source # withEditor_ :: EditorM a -> YiM () Source #

runEditor :: Config -> EditorM a -> Editor -> (Editor, a) Source #

data UIConfig Source #

Constructors

UIConfig |

Fields

- configFontName :: Maybe String

  Font name, for the UI that support it.

- configFontSize :: Maybe Int

  Font size, for the UI that support it.

- configScrollStyle :: Maybe ScrollStyle

  Style of scroll

- configScrollWheelAmount :: Int

  Amount to move the buffer when using the scroll wheel

- configLeftSideScrollBar :: Bool

  Should the scrollbar be shown on the left side?

- configAutoHideScrollBar :: Bool

  Hide scrollbar automatically if text fits on one page.

- configAutoHideTabBar :: Bool

  Hide the tabbar automatically if only one tab is present

- configLineWrap :: Bool

  Wrap lines at the edge of the window if too long to display.

- configCursorStyle :: CursorStyle
- configWindowFill :: Char

  The char with which to fill empty window space. Usually `~` for vi-like editors, ' ' for everything else.

- configTheme :: Theme

  UI colours

- configLineNumbers :: Bool

  Should we show line numbers by default?

type UIBoot = Config -> ([Event] -> IO ()) -> ([Action] -> IO ()) -> Editor -> IO (UI Editor) Source #

data CursorStyle Source #

When should we use a "fat" cursor (i.e. 2 pixels wide, rather than 1)? Fat cursors have only been implemented for the Pango frontend.

Constructors

AlwaysFat |
NeverFat |
FatWhenFocused |
FatWhenFocusedAndInserting |

data Config Source #

Configuration record. All Yi hooks can be set here.

Constructors

Config |

Fields

- startFrontEnd :: UIBoot

  UI to use.

- configUI :: !UIConfig

  UI-specific configuration.

- startActions :: ![Action]

  Actions to run when the editor is started.

- initialActions :: ![Action]

  Actions to run after startup (after startActions) or reload.

- defaultKm :: !KeymapSet

  Default keymap to use.

- configInputPreprocess :: !(P Event Event)
- modeTable :: ![AnyMode]

  List modes by order of preference.

- debugMode :: !Bool

  Produce a .yi.dbg file with a lot of debug information.

- configRegionStyle :: !RegionStyle

  Set to `Exclusive` for an emacs-like behaviour.

- configKillringAccumulate :: !Bool

  Set to `True` for an emacs-like behaviour, where all deleted text is accumulated in a killring.

- configCheckExternalChangesObsessively :: !Bool
- bufferUpdateHandler :: !(Seq (Seq Update -> BufferM ()))
- layoutManagers :: ![AnyLayoutManager]

  List of layout managers for `cycleLayoutManagersNext`

- configVars :: !DynamicState

  Custom configuration, containing the `YiConfigVariable`s. Configure with `configVariableA`.

#### Instances

Instances details

MonadReader Config EditorM Source # |
Instance details Defined in Yi.Types Methods ask :: EditorM Config Source # local :: (Config -> Config) -> EditorM a -> EditorM a Source # reader :: (Config -> a) -> EditorM a Source #
MonadState Config ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods get :: ConfigM Config Source # put :: Config -> ConfigM () Source # state :: (Config -> (a, Config)) -> ConfigM a Source #

data RegionStyle Source #

Constructors

LineWise |
Inclusive |
Exclusive |
Block |

#### Instances

Instances details

Binary RegionStyle Source # |
Instance details Defined in Yi.Types Methods put :: RegionStyle -> Put Source # get :: Get RegionStyle Source # putList :: [RegionStyle] -> Put Source #
Default RegionStyle Source # |
Instance details Defined in Yi.Types Methods def :: RegionStyle Source #
Show RegionStyle Source # |
Instance details Defined in Yi.Types Methods showsPrec :: Int -> RegionStyle -> ShowS Source # show :: RegionStyle -> String Source # showList :: [RegionStyle] -> ShowS Source #
Eq RegionStyle Source # |
Instance details Defined in Yi.Types Methods (==) :: RegionStyle -> RegionStyle -> Bool Source # (/=) :: RegionStyle -> RegionStyle -> Bool Source #
YiVariable RegionStyle Source # |
Instance details Defined in Yi.Types