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

- ScopedTypeVariables
- OverloadedStrings
- RecursiveDo
- RankNTypes
- ExplicitForAll
- LambdaCase

Yi.Core

Contents

- Construction and destruction
- User interaction
- Global editor actions
- Interacting with external commands
- Misc

Description

The core actions of Yi. This module is the link between the editor and the UI. Key bindings, and libraries should manipulate Yi through the interface defined here.

Synopsis

- startEditor :: Config -> Maybe Editor -> IO ()
- quitEditor :: YiM ()
- quitEditorWithExitCode :: ExitCode -> YiM ()
- refreshEditor :: YiM ()
- suspendEditor :: YiM ()
- userForceRefresh :: YiM ()
- errorEditor :: Text -> YiM ()
- closeWindow :: YiM ()
- closeWindowEmacs :: YiM ()
- runProcessWithInput :: String -> String -> YiM String
- startSubprocess :: FilePath -> [String] -> (Either SomeException ExitCode -> YiM x) -> YiM BufferRef
- sendToProcess :: BufferRef -> String -> YiM ()
- runAction :: Action -> YiM ()
- withSyntax :: (Show x, YiAction a x) => (forall syntax. Mode syntax -> syntax -> a) -> YiM ()
- focusAllSyntax :: Editor -> Editor
- onYiVar :: (Yi -> YiVar -> IO (YiVar, a)) -> YiM a

# Construction and destruction

startEditor :: Config -> Maybe Editor -> IO () Source #

Start up the editor, setting any state with the user preferences and file names passed in, and turning on the UI

quitEditor :: YiM () Source #

Quit.

quitEditorWithExitCode :: ExitCode -> YiM () Source #

Quit with an exit code. (This is used to implement vim's :cq command)

# User interaction

refreshEditor :: YiM () Source #

Redraw

suspendEditor :: YiM () Source #

Suspend the program

userForceRefresh :: YiM () Source #

# Global editor actions

errorEditor :: Text -> YiM () Source #

Show an error on the status line and log it.

closeWindow :: YiM () Source #

Close the current window. If this is the last window open, quit the program.

CONSIDER: call quitEditor when there are no other window in the `interactive` function. (Not possible since the windowset type disallows it -- should it be relaxed?)

closeWindowEmacs :: YiM () Source #

This is a like `closeWindow` but with emacs behaviour of C-x 0: if we're trying to close the minibuffer or last buffer in the editor, then just print a message warning the user about it rather closing mini or quitting editor.

# Interacting with external commands

runProcessWithInput :: String -> String -> YiM String Source #

Pipe a string through an external command, returning the stdout chomp any trailing newline (is this desirable?)

Todo: variants with marks?

startSubprocess :: FilePath -> [String] -> (Either SomeException ExitCode -> YiM x) -> YiM BufferRef Source #

Start a subprocess with the given command and arguments.

sendToProcess :: BufferRef -> String -> YiM () Source #

# Misc

runAction :: Action -> YiM () Source #

withSyntax :: (Show x, YiAction a x) => (forall syntax. Mode syntax -> syntax -> a) -> YiM () Source #

focusAllSyntax :: Editor -> Editor Source #

onYiVar :: (Yi -> YiVar -> IO (YiVar, a)) -> YiM a Source #