yi-core-0.19.4: Yi editor core library
LicenseGPL-2
Maintaineryi-devel@googlegroups.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • TemplateHaskell
  • TemplateHaskellQuotes
  • OverloadedStrings
  • LambdaCase

Yi.Editor

Description

The top level editor state, and operations on it. This is inside an internal module for easy re-export with Yi.Types bits.

Synopsis

Documentation

data Editor Source #

The Editor state

Constructors

Editor 

Fields

Instances

Instances details
Binary Editor Source # 
Instance details

Defined in Yi.Editor

Methods

put :: Editor -> Put #

get :: Get Editor #

putList :: [Editor] -> Put #

MonadState Editor EditorM Source # 
Instance details

Defined in Yi.Types

Methods

get :: EditorM Editor #

put :: Editor -> EditorM () #

state :: (Editor -> (a, Editor)) -> EditorM a #

MonadState Editor YiM Source # 
Instance details

Defined in Yi.Types

Methods

get :: YiM Editor #

put :: Editor -> YiM () #

state :: (Editor -> (a, Editor)) -> YiM a #

data EditorM a Source #

Instances

Instances details
MonadFail EditorM Source # 
Instance details

Defined in Yi.Types

Methods

fail :: String -> EditorM a #

Applicative EditorM Source # 
Instance details

Defined in Yi.Types

Methods

pure :: a -> EditorM a #

(<*>) :: EditorM (a -> b) -> EditorM a -> EditorM b #

liftA2 :: (a -> b -> c) -> EditorM a -> EditorM b -> EditorM c #

(*>) :: EditorM a -> EditorM b -> EditorM b #

(<*) :: EditorM a -> EditorM b -> EditorM a #

Functor EditorM Source # 
Instance details

Defined in Yi.Types

Methods

fmap :: (a -> b) -> EditorM a -> EditorM b #

(<$) :: a -> EditorM b -> EditorM a #

Monad EditorM Source # 
Instance details

Defined in Yi.Types

Methods

(>>=) :: EditorM a -> (a -> EditorM b) -> EditorM b #

(>>) :: EditorM a -> EditorM b -> EditorM b #

return :: a -> EditorM a #

MonadEditor EditorM Source # 
Instance details

Defined in Yi.Types

MonadReader Config EditorM Source # 
Instance details

Defined in Yi.Types

Methods

ask :: EditorM Config #

local :: (Config -> Config) -> EditorM a -> EditorM a #

reader :: (Config -> a) -> EditorM a #

MonadState Editor EditorM Source # 
Instance details

Defined in Yi.Types

Methods

get :: EditorM Editor #

put :: Editor -> EditorM () #

state :: (Editor -> (a, Editor)) -> EditorM a #

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

class (Monad m, MonadState Editor m) => MonadEditor m 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

MonadEditor YiM Source # 
Instance details

Defined in Yi.Types

acceptedInputsOtherWindow :: EditorM () Source #

Shows the current key bindings in a new window

bufferSet :: Editor -> [FBuffer] Source #

Return the buffers we have, in no particular order

closeBufferAndWindowE :: EditorM () Source #

Close current buffer and window, unless it's the last one.

closeBufferE :: Text -> EditorM () Source #

Close a buffer. Note: close the current buffer if the empty string is given

closeOtherE :: EditorM () Source #

Make the current window the only window on the screen

clrStatus :: EditorM () Source #

Clear the status line

commonNamePrefix :: Editor -> [FilePath] Source #

Return a prefix that can be removed from all buffer paths while keeping them unique.

currentBuffer :: Editor -> BufferRef Source #

Return the current buffer

deleteBuffer :: MonadEditor m => BufferRef -> m () Source #

Delete a buffer (and release resources associated with it).

deleteTabE :: EditorM () Source #

Deletes the current tab. If there is only one tab open then error out. When the last tab is focused, move focus to the left, otherwise move focus to the right.

emptyEditor :: Editor Source #

The initial state

findBufferWith :: BufferRef -> Editor -> FBuffer Source #

Find buffer with this key

findBufferWithName :: Text -> Editor -> [BufferRef] Source #

Find buffers with this name

focusWindowE :: WindowRef -> EditorM () Source #

bring the editor focus the window with the given key.

Fails if no window with the given key is found.

getBufferWithName :: MonadEditor m => Text -> m BufferRef Source #

Find buffer with given name. Fail if not found.

getEditorDyn :: (MonadEditor m, YiVariable a, Default a, Functor m) => m a Source #

Dynamically-extensible state components.

These hooks are used by keymaps to store values that result from Actions (i.e. that result from IO), as opposed to the pure values they generate themselves, and can be stored internally.

The dynamic field is a type-indexed map.

Retrieve a value from the extensible state

getRegE :: EditorM YiString Source #

Return the contents of the yank register

layoutManagerNextVariantE :: EditorM () Source #

Next variant of the current layout manager, as given by nextVariant

layoutManagerPreviousVariantE :: EditorM () Source #

Previous variant of the current layout manager, as given by previousVariant

layoutManagersNextE :: EditorM () Source #

Cycle to the next layout manager, or the first one if the current one is nonstandard.

layoutManagersPreviousE :: EditorM () Source #

Cycle to the previous layout manager, or the first one if the current one is nonstandard.

layoutManagersPrintMsgE :: EditorM () Source #

Prints the description of the current layout manager in the status bar

moveTabE :: Maybe Int -> EditorM () Source #

Moves the focused tab to the given index, or to the end if the index is not specified.

moveWinNextE :: EditorM () Source #

Swap focused window with the next one

moveWinPrevE :: EditorM () Source #

Swap focused window with the previous one

newBufferE Source #

Arguments

:: BufferId

buffer name

-> YiString

buffer contents

-> EditorM BufferRef 

Like fnewE, create a new buffer filled with the String s, Switch the current window to this buffer. Doesn't associate any file with the buffer (unlike fnewE) and so is good for popup internal buffers (like scratch)

newEmptyBufferE :: BufferId -> EditorM BufferRef Source #

Like newBufferE but defaults to empty contents.

newTabE :: EditorM () Source #

Creates a new tab containing a window that views the current buffer.

newTempBufferE :: EditorM BufferRef Source #

Creates an in-memory buffer with a unique name.

newWindowE :: Bool -> BufferRef -> EditorM Window Source #

Create a new window onto the given buffer.

nextTabE :: EditorM () Source #

Moves to the next tab in the round robin set of tabs

nextWinE :: EditorM () Source #

Rotate focus to the next window

prevWinE :: EditorM () Source #

Rotate focus to the previous window

previousTabE :: EditorM () Source #

Moves to the previous tab in the round robin set of tabs

printMsg :: MonadEditor m => Text -> m () Source #

Prints a message with defaultStyle.

printMsgs :: MonadEditor m => [Text] -> m () Source #

Prints a all given messages with defaultStyle.

pushWinToFirstE :: EditorM () Source #

Moves the focused window to the first window, and moves all other windows down the stack.

putEditorDyn :: (MonadEditor m, YiVariable a, Functor m) => a -> m () Source #

Insert a value into the extensible state, keyed by its type

setDividerPosE :: DividerRef -> DividerPosition -> EditorM () Source #

Sets the given divider position on the current tab

setRegE :: YiString -> EditorM () Source #

Put string into yank register

setStatus :: MonadEditor m => Status -> m () Source #

Set the "background" status line

shiftOtherWindow :: MonadEditor m => m () Source #

Switch focus to some other window. If none is available, create one.

splitE :: EditorM () Source #

Split the current window, opening a second window onto current buffer. TODO: unfold newWindowE here?

stringToNewBuffer Source #

Arguments

:: MonadEditor m 
=> BufferId

The buffer indentifier

-> YiString

The contents with which to populate the buffer

-> m BufferRef 

Create and fill a new buffer, using contents of string. | Does not focus the window, or make it the current window. | Call newWindowE or switchToBufferE to take care of that.

swapWinWithFirstE :: EditorM () Source #

Swaps the focused window with the first window. Useful for layouts such as HPairOneStack, for which the first window is the largest.

switchToBufferE :: BufferRef -> EditorM () Source #

Attach the specified buffer to the current window

switchToBufferWithNameE :: Text -> EditorM () Source #

Switch to the buffer specified as parameter. If the buffer name is empty, switch to the next buffer.

tryCloseE :: EditorM () Source #

Close the current window. If there is only one tab open and the tab contains only one window then do nothing.

windowsOnBufferE :: BufferRef -> EditorM [Window] Source #

Return the windows that are currently open on the buffer whose key is given

withCurrentBuffer :: MonadEditor m => BufferM a -> m a Source #

Perform action with current window's buffer

withGivenBuffer :: MonadEditor m => BufferRef -> BufferM a -> m a Source #

Perform action with any given buffer, using the last window that was used for that buffer.

withGivenBufferAndWindow :: MonadEditor m => Window -> BufferRef -> BufferM a -> m a Source #

Perform action with any given buffer

withOtherWindow :: MonadEditor m => m a -> m a Source #

Execute the argument in the context of an other window. Create one if necessary. The current window is re-focused after the argument has completed.

Orphan instances

Binary Editor Source # 
Instance details

Methods

put :: Editor -> Put #

get :: Get Editor #

putList :: [Editor] -> Put #