yi-0.8.2: The Haskell-Scriptable Editor

Safe HaskellNone
LanguageHaskell2010

Yi.Keymap

Synopsis

Documentation

data Action Source

Constructors

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

type Interact ev a = I ev Action a Source

data KeymapSet Source

Constructors

KeymapSet 

Fields

topKeymap :: Keymap

Content of the top-level loop.

startInsertKeymap :: Keymap

Startup when entering insert mode

insertKeymap :: Keymap

For insertion-only modes

startTopKeymap :: Keymap

Startup bit, to execute only once at the beginning.

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
 

withUI :: (UI -> IO a) -> YiM a Source

readEditor :: MonadEditor m => (Editor -> a) -> m a Source

catchDynE :: Exception exception => YiM a -> (exception -> YiM a) -> YiM a Source

catchJustE Source

Arguments

:: Exception e 
=> (e -> Maybe b)

Predicate to select exceptions

-> YiM a

Computation to run

-> (b -> YiM a)

Handler

-> YiM a 

handleJustE :: Exception e => (e -> Maybe b) -> (b -> YiM a) -> YiM a -> YiM a Source

shutdown :: YiM () Source

Shut down all of our threads. Should free buffers etc.

class YiAction a x | a -> x where Source

Methods

makeAction :: Show x => a -> Action Source

Instances

YiAction Action () 
YiAction (IO x) x 
YiAction (BufferM x) x 
YiAction (EditorM x) x 
YiAction (YiM x) x 
(YiAction a x, Promptable r) => YiAction (r -> a) x 

data Yi Source

Constructors

Yi 

Fields

yiUi :: UI
 
input :: Event -> IO ()

input stream

output :: [Action] -> IO ()

output stream

yiConfig :: Config
 
yiVar :: MVar YiVar

The only mutable state in the program

Instances

write :: (MonadInteract m Action ev, YiAction a x, Show x) => a -> m () Source

write a returns a keymap that just outputs the action a.

withModeY :: (forall syntax. Mode syntax -> YiM ()) -> YiM () Source

withModeY f runs f on the current buffer's mode. As this runs in the YiM monad, we're able to do more than with just withModeB such as prompt the user for something before running the action.