-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Yi editor core library
--
-- Yi editor core library
@package yi-core
@version 0.19.2
module Parser.Incremental
type Process token result = Zip token (result :< ())
-- | Parse the same thing as the argument, but will be used only as backup.
-- ie, it will be used only if disjuncted with a failing parser.
recoverWith :: Parser s a -> Parser s a
symbol :: forall s. (s -> Bool) -> Parser s s
eof :: forall s. Parser s ()
lookNext :: Parser s (Maybe s)
testNext :: (Maybe s -> Bool) -> Parser s ()
-- | Run a process (in case you do not need the incremental interface)
run :: Process s a -> [s] -> (a, [String])
-- | Make a parser into a process.
mkProcess :: forall s a. Parser s a -> Process s a
profile :: Steps s r -> Profile
-- | Push some symbols.
pushSyms :: forall s r. [s] -> Zip s r -> Zip s r
-- | Push eof
pushEof :: forall s r. Zip s r -> Zip s r
evalL :: forall s output. Zip s output -> Zip s output
evalR :: Zip token (a :< rest) -> (a, [String])
feedZ :: Maybe [s] -> Zip s r -> Zip s r
-- | Parser specification
data Parser s a
[Look] :: Parser s a -> (s -> Parser s a) -> Parser s a
[Yuck] :: Parser s a -> Parser s a
[Enter] :: String -> Parser s a -> Parser s a
countWidth :: Zip s r -> Int
fullLog :: Zip s output -> ([String], Tree LogEntry)
data LogEntry
LLog :: String -> LogEntry
LEmpty :: LogEntry
LDislike :: LogEntry
LShift :: LogEntry
LDone :: LogEntry
LFail :: LogEntry
LSusp :: LogEntry
LS :: String -> LogEntry
evalL' :: Zip s output -> Zip s output
instance GHC.Base.Functor Parser.Incremental.ProfileF
instance GHC.Show.Show a => GHC.Show.Show (Parser.Incremental.ProfileF a)
instance GHC.Show.Show Parser.Incremental.LogEntry
instance GHC.Show.Show (Parser.Incremental.Zip s output)
instance GHC.Show.Show (Parser.Incremental.RPolish i o)
instance GHC.Show.Show (Parser.Incremental.Steps s r)
instance GHC.Base.Functor (Parser.Incremental.Parser s)
instance GHC.Base.Applicative (Parser.Incremental.Parser s)
instance GHC.Base.Alternative (Parser.Incremental.Parser s)
instance GHC.Base.Monad (Parser.Incremental.Parser s)
instance Control.Monad.Fail.MonadFail (Parser.Incremental.Parser s)
module Paths_yi_core
version :: Version
getBinDir :: IO FilePath
getLibDir :: IO FilePath
getDynLibDir :: IO FilePath
getDataDir :: IO FilePath
getLibexecDir :: IO FilePath
getDataFileName :: FilePath -> IO FilePath
getSysconfDir :: IO FilePath
module System.FriendlyPath
-- | Canonicalize a user-friendly path
userToCanonPath :: FilePath -> IO String
-- | Turn a user-friendly path into a computer-friendly path by expanding
-- the leading tilda.
expandTilda :: String -> IO FilePath
-- | Is a user-friendly path absolute?
isAbsolute' :: String -> Bool
-- | An implementation of restricted, linear undo, as described in:
--
--
-- T. Berlage, "A selective undo mechanism for graphical user interfaces
-- based on command objects", ACM Transactions on Computer-Human
-- Interaction 1(3), pp. 269-294, 1994.
--
--
-- Implementation based on a proposal by sjw.
--
-- From Berlage:
--
--
-- All buffer-mutating commands are stored (in abstract form) in an
-- Undo list. The most recent item in this list is the action that
-- will be undone next. When it is undone, it is removed from the Undo
-- list, and its inverse is added to the Redo list. The last command
-- put into the Redo list can be redone, and again prepended to the
-- Undo list. New commands are added to the Undo list without
-- affecting the Redo list.
--
--
-- Now, the above assumes that commands can be _redone_ in a state other
-- than that in which it was orginally done. This is not the case in our
-- text editor: a user may delete, for example, between an undo and a
-- redo. Berlage addresses this in S2.3. A Yi example:
--
--
-- Delete some characters
-- Undo partialy
-- Move prior in the file, and delete another _chunk_
-- Redo some things == corruption.
--
--
-- Berlage describes the stable execution property:
--
--
-- A command is always redone in the same state that it was originally
-- executed in, and is always undone in the state that was reached
-- after the original execution.
--
--
--
-- The only case where the linear undo model violates the stable
-- execution property is when _a new command is submitted while the
-- redo list is not empty_. The _restricted linear undo model_ ...
-- clears the redo list in this case.
--
--
-- Also some discussion of this in: The Text Editor Sam, Rob Pike,
-- pg 19.
module Yi.Buffer.Undo
-- | A new empty URList. Notice we must have a saved file point as
-- this is when we assume we are opening the file so it is currently the
-- same as the one on disk
emptyU :: URList
-- | Add an action to the undo list. According to the restricted, linear
-- undo model, if we add a command whilst the redo list is not empty, we
-- will lose our redoable changes.
addChangeU :: Change -> URList -> URList
deleteInteractivePointsU :: URList -> URList
-- | Add a saved file point so that we can tell that the buffer has not
-- been modified since the previous saved file point. Notice that we must
-- be sure to remove the previous saved file points since they are now
-- worthless.
setSavedFilePointU :: URList -> URList
-- | undoIsAtSavedFilePoint. True if the undo list is at a
-- SavedFilePoint indicating that the buffer has not been modified since
-- we last saved the file. Note: that an empty undo list does NOT mean
-- that the buffer is not modified since the last save. Because we may
-- have saved the file and then undone actions done before the save.
isAtSavedFilePointU :: URList -> Bool
-- | This undoes one interaction step.
undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
-- | This redoes one iteraction step.
redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
-- | A URList consists of an undo and a redo list.
data URList
data Change
InteractivePoint :: Change
AtomicChange :: !Update -> Change
instance GHC.Generics.Generic Yi.Buffer.Undo.Change
instance GHC.Show.Show Yi.Buffer.Undo.Change
instance GHC.Generics.Generic Yi.Buffer.Undo.URList
instance GHC.Show.Show Yi.Buffer.Undo.URList
instance Data.Binary.Class.Binary Yi.Buffer.Undo.URList
instance Data.Binary.Class.Binary Yi.Buffer.Undo.Change
-- | Little helper for completion interfaces.
--
-- Intended to be imported qualified:
--
--
-- import qualified Yi.CompletionTree as CT
--
module Yi.CompletionTree
-- | A CompletionTree is a map of partial completions.
--
-- Example:
--
-- fromList ["put","putStr","putStrLn","print","abc"]
--
-- Gives the following tree:
--
-- / "p" "abc" / "ut" "rint" / Str "" / Ln ""
--
-- (The empty strings are needed to denote the end of a word) (A
-- CompletionTree is not limited to a binary tree)
newtype CompletionTree a
CompletionTree :: Map a (CompletionTree a) -> CompletionTree a
-- | This function converts a list of completable elements to a
-- CompletionTree It finds elements that share a common prefix and groups
-- them.
--
--
-- fromList . toList = id
--
fromList :: (Ord a, ListLike a i, Eq i) => [a] -> CompletionTree a
-- | Converts a CompletionTree to a list of completions.
--
--
-- toList . fromList = sort . nub
--
--
-- Examples:
--
--
-- >>> toList mempty
-- []
--
--
--
-- >>> toList (fromList ["a"])
-- ["a"]
--
--
--
-- >>> toList (fromList ["a","a","a"])
-- ["a"]
--
--
--
-- >>> toList (fromList ["z","x","y"])
-- ["x","y","z"]
--
toList :: (Ord a, ListLike a i) => CompletionTree a -> [a]
-- | Complete as much as possible without guessing.
--
-- Examples:
--
--
-- >>> complete $ fromList ["put","putStrLn","putStr"]
-- ("put", fromList ["","Str","StrLn"])
--
--
--
-- >>> complete $ fromList ["put","putStr","putStrLn","abc"]
-- ("", fromList ["put","putStr","putStrLn","abc"])
--
complete :: (Eq i, Ord a, ListLike a i) => CompletionTree a -> (a, CompletionTree a)
-- | Update the CompletionTree with new information. An empty list means
-- that there is no completion left. A [mempty] means that the end of a
-- word is reached.
--
-- Examples:
--
--
-- >>> update (fromList ["put","putStr"]) "p"
-- fromList ["ut","utStr"]
--
--
--
-- >>> update (fromList ["put","putStr"]) "put"
-- fromList ["","Str"]
--
--
--
-- >>> update (fromList ["put","putStr"]) "putS"
-- fromList ["tr"]
--
--
--
-- >>> update (fromList ["put"]) "find"
-- fromList []
--
--
--
-- >>> update (fromList ["put"]) "put"
-- fromList [""]
--
update :: (Ord a, ListLike a i, Eq i) => CompletionTree a -> a -> CompletionTree a
-- | For debugging purposes.
--
-- Example:
--
--
-- >>> putStrLn $ pretty $ fromList ["put", "putStr", "putStrLn"]
-- ["put"[""|"Str"[""|"Ln"]]]
--
pretty :: Show a => CompletionTree a -> String
unCompletionTree :: Lens' (CompletionTree a) (Map a (CompletionTree a))
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Yi.CompletionTree.CompletionTree a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Yi.CompletionTree.CompletionTree a)
instance GHC.Classes.Ord a => GHC.Base.Monoid (Yi.CompletionTree.CompletionTree a)
instance GHC.Classes.Ord a => GHC.Base.Semigroup (Yi.CompletionTree.CompletionTree a)
instance (GHC.Classes.Ord a, GHC.Show.Show a, Data.ListLike.Base.ListLike a i) => GHC.Show.Show (Yi.CompletionTree.CompletionTree a)
module Yi.Config.Misc
data ScrollStyle
SnapToCenter :: ScrollStyle
SingleLine :: ScrollStyle
-- | Debug utilities used throughout Yi.
module Yi.Debug
-- | Set the file to which debugging output should be written. Though this
-- is called initDebug. Debugging output is not created by default
-- (i.e., if this function is never called.) The target file can not be
-- changed, nor debugging disabled.
initDebug :: FilePath -> IO ()
-- | Outputs the given string before returning the second argument.
trace :: Text -> a -> a
-- | Traces x and returns y.
traceM :: Monad m => Text -> a -> m a
-- | Like traceM, but returns ().
traceM_ :: Monad m => Text -> m ()
logPutStrLn :: MonadBase IO m => Text -> m ()
logError :: MonadBase IO m => Text -> m ()
logStream :: Show a => Text -> Chan a -> IO ()
error :: Text -> a
module Yi.Event
data Event
Event :: Key -> [Modifier] -> Event
prettyEvent :: Event -> String
data Key
KEsc :: Key
KFun :: Int -> Key
KPrtScr :: Key
KPause :: Key
KASCII :: Char -> Key
KBS :: Key
KIns :: Key
KHome :: Key
KPageUp :: Key
KDel :: Key
KEnd :: Key
KPageDown :: Key
KNP5 :: Key
KUp :: Key
KMenu :: Key
KLeft :: Key
KDown :: Key
KRight :: Key
KEnter :: Key
KTab :: Key
data Modifier
MShift :: Modifier
MCtrl :: Modifier
MMeta :: Modifier
MSuper :: Modifier
MHyper :: Modifier
-- | Map an Event to a Char. This is used in the emacs keymap for Ctrl-Q
-- and vim keymap insertSpecialChar
eventToChar :: Event -> Char
instance GHC.Classes.Ord Yi.Event.Modifier
instance GHC.Classes.Eq Yi.Event.Modifier
instance GHC.Show.Show Yi.Event.Modifier
instance GHC.Classes.Ord Yi.Event.Key
instance GHC.Show.Show Yi.Event.Key
instance GHC.Classes.Eq Yi.Event.Key
instance GHC.Classes.Eq Yi.Event.Event
instance GHC.Classes.Ord Yi.Event.Event
instance GHC.Show.Show Yi.Event.Event
module Yi.IncrementalParse
-- | Parse the same thing as the argument, but will be used only as backup.
-- ie, it will be used only if disjuncted with a failing parser.
recoverWith :: Parser s a -> Parser s a
symbol :: forall s. (s -> Bool) -> Parser s s
eof :: forall s. Parser s ()
lookNext :: Parser s (Maybe s)
testNext :: (Maybe s -> Bool) -> Parser s ()
type State st token result = (st, Process token result)
type P s a = Parser s a
-- | Parser specification
data Parser s a
[Look] :: Parser s a -> (s -> Parser s a) -> Parser s a
[Yuck] :: Parser s a -> Parser s a
[Enter] :: String -> Parser s a -> Parser s a
-- | Lexer state
data AlexState lexerState
AlexState :: lexerState -> !Point -> !Posn -> AlexState lexerState
[stLexer] :: AlexState lexerState -> lexerState
[lookedOffset] :: AlexState lexerState -> !Point
[stPosn] :: AlexState lexerState -> !Posn
scanner :: forall st token result. Parser token result -> Scanner st token -> Scanner (State st token result) result
-- | This is a library of interactive processes combinators, usable to
-- define extensible keymaps.
--
-- (Inspired by the Parsec library, written by Koen Claessen)
--
-- The processes are:
--
--
-- - composable: in parallel using <|>, in sequence using
-- monadic bind.
-- - extensible: it is always possible to override a behaviour by
-- combination of adjustPriority and <|>. (See also
-- <|| for a convenient combination of the two.)
-- - monadic: sequencing is done via monadic bind. (leveraging the
-- whole battery of monadic tools that Haskell provides)
--
--
-- The processes can parse input, and write output that depends on it.
--
-- The semantics are quite obvious; only disjunction deserve a bit more
-- explanation:
--
-- in p = (a <|> b), what happens if a and
-- b recognize the same input (prefix), but produce conflicting
-- output?
--
--
-- - if the output is the same (as by the Eq class), then the processes
-- (prefixes) are "merged"
-- - if a Write is more prioritized than the other, the one with low
-- priority will be discarded
-- - otherwise, the output will be delayed until one of the branches
-- can be discarded.
-- - if there is no way to disambiguate, then no output will be
-- generated anymore. This situation can be detected by using
-- possibleActions however.
--
module Yi.Interact
-- | Interactive process description
data I ev w a
-- | Operational representation of a process
data P event w
End :: P event w
Chain :: P event mid -> P mid w -> P event w
-- | Abstraction of the automaton state.
data InteractState event w
Ambiguous :: [(Int, w, P event w)] -> InteractState event w
Waiting :: InteractState event w
Dead :: InteractState event w
Running :: w -> P event w -> InteractState event w
-- | Abstraction of monadic interactive processes
class (Eq w, Monad m, Alternative m, Applicative m, MonadPlus m) => MonadInteract m w e | m -> w e
-- | Outputs a result.
write :: MonadInteract m w e => w -> m ()
-- | Consumes and returns the next character. Fails if there is no input
-- left, or outside the given bounds.
eventBounds :: (MonadInteract m w e, Ord e) => Maybe e -> Maybe e -> m e
adjustPriority :: MonadInteract m w e => Int -> m ()
deprioritize :: MonadInteract f w e => f ()
-- | Just like (<||) but in prefix form. It deprioritizes
-- the second argument.
important :: MonadInteract f w e => f a -> f a -> f a
(<||) :: MonadInteract f w e => f a -> f a -> f a
infixl 3 <||
(||>) :: MonadInteract f w e => f a -> f a -> f a
-- | option x p will either parse p or return x
-- without consuming any input.
option :: MonadInteract m w e => a -> m a -> m a
oneOf :: (Ord event, MonadInteract m w event, MonadFail m) => [event] -> m event
processOneEvent :: Eq w => P event w -> event -> ([w], P event w)
computeState :: Eq w => P event w -> InteractState event w
-- | Parses and returns the specified character.
event :: (Ord event, MonadInteract m w event) => event -> m event
-- | Parses and returns the specified list of events (lazily).
events :: (Ord event, MonadInteract m w event) => [event] -> m [event]
-- | Combines all parsers in the specified list.
choice :: (MonadInteract m w e, MonadFail m) => [m a] -> m a
mkAutomaton :: Eq w => I ev w a -> P ev w
idAutomaton :: (Ord a, Eq a) => P a a
runWrite :: Eq w => P event w -> [event] -> [w]
anyEvent :: (Ord event, MonadInteract m w event) => m event
eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e
accepted :: Show ev => Int -> P ev w -> [[Text]]
instance GHC.Base.Semigroup (Yi.Interact.InteractState event w)
instance GHC.Base.Monoid (Yi.Interact.InteractState event w)
instance (GHC.Show.Show w, GHC.Show.Show ev) => GHC.Show.Show (Yi.Interact.P ev w)
instance GHC.Base.Functor (Yi.Interact.I event w)
instance GHC.Base.Applicative (Yi.Interact.I ev w)
instance GHC.Base.Alternative (Yi.Interact.I ev w)
instance GHC.Base.Monad (Yi.Interact.I event w)
instance Control.Monad.Fail.MonadFail (Yi.Interact.I event w)
instance GHC.Classes.Eq w => GHC.Base.MonadPlus (Yi.Interact.I event w)
instance GHC.Classes.Eq w => Yi.Interact.MonadInteract (Yi.Interact.I event w) w event
instance Yi.Interact.MonadInteract m w e => Yi.Interact.MonadInteract (Control.Monad.Trans.State.Lazy.StateT s m) w e
module Yi.JumpList
type JumpList = Maybe (PointedList Jump)
data Jump
Jump :: Mark -> BufferRef -> Jump
[jumpMark] :: Jump -> Mark
[jumpBufferRef] :: Jump -> BufferRef
addJump :: Jump -> JumpList -> JumpList
jumpBack :: JumpList -> JumpList
jumpForward :: JumpList -> JumpList
instance GHC.Generics.Generic Yi.JumpList.Jump
instance Data.Binary.Class.Binary Yi.JumpList.Jump
instance GHC.Show.Show Yi.JumpList.Jump
-- | Killring operations.
module Yi.KillRing
data Killring
_krKilled :: Killring -> Bool
_krContents :: Killring -> NonEmpty YiString
krKilled :: Lens' Killring Bool
krContents :: Lens' Killring (NonEmpty YiString)
-- | Finish an atomic command, for the purpose of killring accumulation.
krEndCmd :: Killring -> Killring
-- | Put some text in the killring. It's accumulated if the last command
-- was a kill too
krPut :: Direction -> YiString -> Killring -> Killring
-- | Set the top of the killring. Never accumulate the previous content.
krSet :: YiString -> Killring -> Killring
-- | Get the top of the killring.
krGet :: Killring -> YiString
krEmpty :: Killring
krLastYank :: Lens' Killring Bool
instance GHC.Classes.Eq Yi.KillRing.Killring
instance GHC.Show.Show Yi.KillRing.Killring
instance Data.Binary.Class.Binary Yi.KillRing.Killring
-- | This module defines the layout manager interface (see
-- LayoutManager). To desgin a new layout manager, just make an
-- instance of this class.
module Yi.Layout
-- | UI-agnostic layout schema. The basic constructs are
-- (horizontal/vertical) stacks with fixed ratios between window sizes;
-- and (horizontal/vertical) pairs with a slider in between (if
-- available).
data Layout a
SingleWindow :: a -> Layout a
Stack :: !Orientation -> [(Layout a, RelativeSize)] -> Layout a
-- | Orientation
[orientation] :: Layout a -> !Orientation
-- | The layout stack, with the given weights TODO: fix strictness for
-- stack (it's still lazy)
[wins] :: Layout a -> [(Layout a, RelativeSize)]
Pair :: !Orientation -> !DividerPosition -> !DividerRef -> !Layout a -> !Layout a -> Layout a
-- | Orientation
[orientation] :: Layout a -> !Orientation
-- | Initial position of the divider
[divPos] :: Layout a -> !DividerPosition
-- | Index of the divider (for updating the divider position)
[divRef] :: Layout a -> !DividerRef
-- | Upper of of the pair
[pairFst] :: Layout a -> !Layout a
-- | Lower of the pair
[pairSnd] :: Layout a -> !Layout a
-- | Orientations for Stack and Pair
data Orientation
Horizontal :: Orientation
Vertical :: Orientation
-- | Divider position, in the range (0,1)
type DividerPosition = Double
-- | Divider reference
type DividerRef = Int
-- | Relative sizes, for Stack
type RelativeSize = Double
-- | Accessor for the DividerPosition with given reference
dividerPositionA :: DividerRef -> Lens' (Layout a) DividerPosition
-- | Find the divider nearest to a given window, or just the first one in
-- case the argument is Nothing
findDivider :: Eq a => Maybe a -> Layout a -> Maybe DividerRef
-- | The type of layout managers. See the layout managers tall,
-- hPairNStack and slidyTall for some example
-- implementations.
class (Typeable m, Eq m) => LayoutManager m
-- | Given the old layout and the new list of windows, construct a layout
-- for the new list of windows.
--
-- If the layout manager uses sliding dividers, then a user will expect
-- that most of these dividers don't move when adding a new window. It is
-- the layout manager's responsibility to ensure that this is the case,
-- and this is the purpose of the Layout a argument.
--
-- The old layout may come from a different layout manager, in which case
-- the layout manager is free to ignore it.
pureLayout :: LayoutManager m => m -> Layout a -> [a] -> Layout a
-- | Describe the layout in a form suitable for the user.
describeLayout :: LayoutManager m => m -> String
-- | Cycles to the next variant, if there is one (the default is id)
nextVariant :: LayoutManager m => m -> m
-- | Cycles to the previous variant, if there is one (the default is
-- id
previousVariant :: LayoutManager m => m -> m
-- | Existential wrapper for Layout
data AnyLayoutManager
AnyLayoutManager :: !m -> AnyLayoutManager
-- | True if the internal layout managers have the same type (but are not
-- necessarily equal).
layoutManagerSameType :: AnyLayoutManager -> AnyLayoutManager -> Bool
-- | Windows placed on top of one another, equally spaced
wide :: AnyLayoutManager
-- | Windows placed side-by-side, equally spaced.
tall :: AnyLayoutManager
-- | Tall windows, arranged in a balanced binary tree with sliders in
-- between them.
slidyTall :: AnyLayoutManager
-- | Transposed version of slidyTall
slidyWide :: AnyLayoutManager
-- | n windows on the left; stack of windows on the right.
hPairNStack :: Int -> AnyLayoutManager
-- | Transposed version of hPairNStack.
vPairNStack :: Int -> AnyLayoutManager
-- | A general bounding box
data Rectangle
Rectangle :: !Double -> Rectangle
[rectX, rectY, rectWidth, rectHeight] :: Rectangle -> !Double
-- | Used by the vty frontend to draw vertical separators
type HasNeighborWest = Bool
layoutToRectangles :: HasNeighborWest -> Rectangle -> Layout a -> [(a, Rectangle, HasNeighborWest)]
-- | Things with orientations which can be flipped
class Transposable r
transpose :: Transposable r => r -> r
-- | Same as lm, but with all Orientations
-- transposed. See slidyWide for an example of its use.
newtype Transposed lm
Transposed :: lm -> Transposed lm
-- | A 'Layout a' wrapped in a state monad for tracking DividerRefs.
-- This type is not itself a monad, but should rather be thought
-- of as a DividerRef-free version of the Layout type.
data LayoutM a
pair :: Orientation -> DividerPosition -> LayoutM a -> LayoutM a -> LayoutM a
singleWindow :: a -> LayoutM a
stack :: Orientation -> [(LayoutM a, RelativeSize)] -> LayoutM a
-- | Special case of stack with all RelativeSizes equal.
evenStack :: Orientation -> [LayoutM a] -> LayoutM a
runLayoutM :: LayoutM a -> Layout a
instance GHC.Show.Show Yi.Layout.Orientation
instance GHC.Classes.Eq Yi.Layout.Orientation
instance GHC.Base.Functor Yi.Layout.Layout
instance GHC.Classes.Eq a => GHC.Classes.Eq (Yi.Layout.Layout a)
instance GHC.Classes.Eq Yi.Layout.Tall
instance GHC.Classes.Eq Yi.Layout.Wide
instance GHC.Classes.Eq Yi.Layout.SlidyTall
instance GHC.Classes.Eq Yi.Layout.HPairNStack
instance GHC.Show.Show Yi.Layout.Rectangle
instance GHC.Classes.Eq Yi.Layout.Rectangle
instance GHC.Classes.Eq lm => GHC.Classes.Eq (Yi.Layout.Transposed lm)
instance GHC.Classes.Eq Yi.Layout.VPairNStack
instance GHC.Classes.Eq Yi.Layout.SlidyWide
instance Yi.Layout.LayoutManager Yi.Layout.SlidyWide
instance Yi.Layout.LayoutManager Yi.Layout.VPairNStack
instance Yi.Layout.LayoutManager lm => Yi.Layout.LayoutManager (Yi.Layout.Transposed lm)
instance Yi.Layout.Transposable Yi.Layout.Orientation
instance Yi.Layout.Transposable (Yi.Layout.Layout a)
instance Yi.Layout.LayoutManager Yi.Layout.HPairNStack
instance Yi.Layout.LayoutManager Yi.Layout.SlidyTall
instance Yi.Layout.LayoutManager Yi.Layout.Wide
instance Yi.Layout.LayoutManager Yi.Layout.Tall
instance GHC.Classes.Eq Yi.Layout.AnyLayoutManager
instance Yi.Layout.LayoutManager Yi.Layout.AnyLayoutManager
instance Data.Default.Class.Default Yi.Layout.AnyLayoutManager
instance GHC.Show.Show a => GHC.Show.Show (Yi.Layout.Layout a)
instance Data.Default.Class.Default a => Data.Default.Class.Default (Yi.Layout.Layout a)
module Yi.Monad
assign :: MonadState s m => ASetter s s a b -> b -> m ()
-- | Gets specific component of the state, using a projection function
-- supplied.
gets :: MonadState s m => (s -> a) -> m a
-- | Combination of the Control.Monad.State modify and gets
getsAndModify :: MonadState s m => (s -> (s, a)) -> m a
maybeM :: Monad m => (x -> m ()) -> Maybe x -> m ()
-- | Rerun the monad until the boolean result is false, collecting list of
-- results.
repeatUntilM :: Monad m => m (Bool, a) -> m [a]
uses :: MonadState s m => Getting a s a -> (a -> b) -> m b
whenM :: Monad m => m Bool -> m () -> m ()
with :: (MonadReader r m, MonadBase b m) => (r -> a) -> (a -> b c) -> m c
module Yi.Paths
-- | Get path to environment file that defines namespace used by Yi command
-- evaluator.
getEvaluatorContextFilename :: MonadBase IO m => m FilePath
-- | Get Yi master configuration script.
getConfigFilename :: MonadBase IO m => m FilePath
getConfigModules :: MonadBase IO m => m FilePath
-- | Get path to Yi history that stores state between runs.
getPersistentStateFilename :: MonadBase IO m => m FilePath
getConfigDir :: MonadBase IO m => m FilePath
-- | Given a path relative to application configuration directory, this
-- function finds a path to a given configuration file.
getConfigPath :: MonadBase IO m => FilePath -> m FilePath
-- | Given an action that retrieves config path, and a path relative to it,
-- this function joins the two together to create a config file path.
getCustomConfigPath :: MonadBase IO m => m FilePath -> FilePath -> m FilePath
-- | Given a path relative to application data directory, this function
-- finds a path to a given data file.
getDataPath :: MonadBase IO m => FilePath -> m FilePath
module Yi.Process
runProgCommand :: ListLikeProcessIO a c => String -> [String] -> IO (ExitCode, a, a)
runShellCommand :: ListLikeProcessIO a c => String -> IO (ExitCode, a, a)
-- | Run a command using the system shell, returning stdout, stderr and
-- exit code
shellFileName :: IO String
createSubprocess :: FilePath -> [String] -> BufferRef -> IO SubprocessInfo
readAvailable :: Handle -> IO String
data SubprocessInfo
SubprocessInfo :: FilePath -> [String] -> ProcessHandle -> Handle -> Handle -> Handle -> BufferRef -> Bool -> SubprocessInfo
[procCmd] :: SubprocessInfo -> FilePath
[procArgs] :: SubprocessInfo -> [String]
[procHandle] :: SubprocessInfo -> ProcessHandle
[hIn] :: SubprocessInfo -> Handle
[hOut] :: SubprocessInfo -> Handle
[hErr] :: SubprocessInfo -> Handle
[bufRef] :: SubprocessInfo -> BufferRef
[separateStdErr] :: SubprocessInfo -> Bool
type SubprocessId = Integer
-- | String manipulation utilities
module Yi.String
isBlank :: YiString -> Bool
-- | Remove any trailing strings matching irs (input record
-- separator) from input string. Like perl's chomp(1).
chomp :: String -> String -> String
capitalize :: String -> String
capitalizeFirst :: YiString -> YiString
-- | Trim spaces at beginning and end
dropSpace :: String -> String
-- | Fills lines up to the given length, splitting the text up if
-- necessary.
fillText :: Int -> YiString -> [YiString]
onLines :: ([YiString] -> [YiString]) -> YiString -> YiString
-- | A helper function for creating functions suitable for
-- modifySelectionB and modifyRegionB. To be used when
-- the desired function should map across the lines of a region.
mapLines :: (YiString -> YiString) -> YiString -> YiString
-- | Split a Text in lines. Unlike lines, this does not remove any
-- empty line at the end.
lines' :: Text -> [Text]
-- | Inverse of lines'. In contrast to unlines, this does not
-- add an empty line at the end.
unlines' :: [Text] -> Text
padLeft :: Int -> String -> String
padRight :: Int -> String -> String
-- | Works by resupplying the found prefix back into the list, eventually
-- either finding the prefix or not matching.
commonTPrefix :: [Text] -> Maybe Text
-- | Like commonTPrefix but returns empty text on failure.
commonTPrefix' :: [Text] -> Text
-- | This is kind of like the default Show instance for lists except over
-- Text. It does not leave the elements in extra quotes and should
-- not be attempted to be shown and read back.
listify :: [YiString] -> YiString
-- | Helper that shows then packs the Text, for all those cases
-- where we use show.
showT :: Show a => a -> Text
-- | overInit f runs f over the init of the input if
-- possible, preserving the last element as-is. If given a string
-- with length ≤ 1, it effectively does nothing.
--
-- Also see overTail.
overInit :: (YiString -> YiString) -> YiString -> YiString
-- | overInit f runs f over the tail of the input if
-- possible, preserving the head element as-is. If given a string
-- with length ≤ 1, it effectively does nothing.
--
-- Also see overInit.
overTail :: (YiString -> YiString) -> YiString -> YiString
module Yi.Syntax.Layout
-- | Transform a scanner into a scanner that also adds opening, closing and
-- "next" tokens to indicate layout.
layoutHandler :: forall t lexState. (Show t, Eq t) => (t -> Bool) -> [(t, t)] -> (Tok t -> Bool) -> (t, t, t) -> (Tok t -> Bool) -> Scanner (AlexState lexState) (Tok t) -> Scanner (State t lexState) (Tok t)
type State t lexState = (IState t, AlexState lexState)
instance GHC.Show.Show t => GHC.Show.Show (Yi.Syntax.Layout.BlockOpen t)
instance GHC.Show.Show t => GHC.Show.Show (Yi.Syntax.Layout.IState t)
module Yi.Syntax.Tree
class Foldable tree => IsTree tree
-- | Direct subtrees of a tree
subtrees :: IsTree tree => tree t -> [tree t]
uniplate :: IsTree tree => tree t -> ([tree t], [tree t] -> tree t)
emptyNode :: IsTree tree => tree t
toksAfter :: Foldable t1 => t -> t1 a -> [a]
allToks :: Foldable t => t a -> [a]
tokAtOrBefore :: Foldable t => Point -> t (Tok t1) -> Maybe (Tok t1)
toksInRegion :: Foldable t1 => Region -> t1 (Tok t) -> [Tok t]
sepBy :: Alternative f => f a -> f v -> f [a]
sepBy1 :: Alternative f => f a -> f v -> f [a]
getLastOffset :: Foldable t => t (Tok t1) -> Point
getFirstOffset :: Foldable t => t (Tok t1) -> Point
-- | Return the 1st token of a subtree.
getFirstElement :: Foldable t => t a -> Maybe a
-- | Return the last token of a subtree.
getLastElement :: Foldable t => t a -> Maybe a
-- | Search the given list, and return the last tree before the given
-- point; with path to the root. (Root is at the start of the path)
getLastPath :: IsTree tree => [tree (Tok t)] -> Point -> Maybe [tree (Tok t)]
-- | Return all subtrees in a tree, in preorder.
getAllSubTrees :: IsTree tree => tree t -> [tree t]
tokenBasedAnnots :: Foldable t1 => (a1 -> Maybe a) -> t1 a1 -> t -> [a]
tokenBasedStrokes :: Foldable t3 => (a -> b) -> t3 a -> t -> t2 -> t1 -> [b]
subtreeRegion :: Foldable t => t (Tok t1) -> Region
-- | Search the tree in pre-order starting at a given node, until finding a
-- leaf which is at or after the given point. An effort is also made to
-- return a leaf as close as possible to p.
--
-- TODO: rename to fromLeafToLeafAt
fromLeafToLeafAfter :: IsTree tree => Point -> Node (tree (Tok a)) -> Node (tree (Tok a))
-- | Given an approximate path to a leaf at the end of the region, return:
-- (path to leaf at the end of the region,path from focused node to the
-- leaf, small node encompassing the region)
fromNodeToFinal :: IsTree tree => Region -> Node (tree (Tok a)) -> Node (tree (Tok a))
-- | Module defining the Tree used as part of many Modes.
module Yi.Syntax.OnlineTree
data Tree a
Bin :: Tree a -> Tree a -> Tree a
Leaf :: a -> Tree a
Tip :: Tree a
manyToks :: P (Tok t) (Tree (Tok t))
tokAtOrBefore :: Foldable t => Point -> t (Tok t1) -> Maybe (Tok t1)
instance Data.Traversable.Traversable Yi.Syntax.OnlineTree.Tree
instance Data.Foldable.Foldable Yi.Syntax.OnlineTree.Tree
instance GHC.Base.Functor Yi.Syntax.OnlineTree.Tree
instance GHC.Show.Show a => GHC.Show.Show (Yi.Syntax.OnlineTree.Tree a)
instance Yi.Syntax.Tree.IsTree Yi.Syntax.OnlineTree.Tree
-- | This module defines implementations of syntax-awareness drivers.
module Yi.Syntax.Driver
type Path = [Int]
data Cache state tree tt
Cache :: Map WindowRef Path -> [state] -> tree (Tok tt) -> !Map WindowRef (tree (Tok tt)) -> Cache state tree tt
[path] :: Cache state tree tt -> Map WindowRef Path
[cachedStates] :: Cache state tree tt -> [state]
[root] :: Cache state tree tt -> tree (Tok tt)
[focused] :: Cache state tree tt -> !Map WindowRef (tree (Tok tt))
mkHighlighter :: forall state tree tt. (IsTree tree, Show state) => (Scanner Point Char -> Scanner state (tree (Tok tt))) -> Highlighter (Cache state tree tt) (tree (Tok tt))
unzipFM :: Ord k => [(k, (u, v))] -> (Map k u, Map k v)
zipWithFM :: Ord k => (u -> v -> w) -> v -> Map k u -> Map k v -> [(k, w)]
module Yi.UI.Common
-- | Record presenting a frontend's interface.
--
-- The functions layout and refresh are both run by the
-- editor's main loop, in response to user actions and so on. Their
-- relation is a little subtle, and is discussed here:
--
--
-- - to see some code, look at the function refreshEditor in
-- Yi.Core. This is the only place where layout and
-- refresh are used.
-- - the function layout is responsible for updating the
-- Editor with the width and height of the windows. Some
-- frontends, such as Pango, need to modify their internal state to do
-- this, and will consequently change their display. This is
-- expected.
-- - the function refresh should cause the UI to update its
-- display with the information given in the Editor.
-- - the functionalities of layout and refresh overlap to
-- some extent, in the sense that both may cause the frontend to update
-- its display. The Yi core provides the following guarantees which the
-- frontend may take advantage of:
- in the main editor loop (i.e.
-- in the refreshEditor function), layout will be run
-- (possibly multiple times) and then refresh will be run. This
-- guarantee will hold even in the case of threading (the function
-- refreshEditor will always be run atomically, using
-- MVars).
- between the last run of layout and the
-- run of refresh, some changes may be made to the
-- Editor. However, the text, text attributes, and (displayed)
-- window region of all windows will remain the same. However, the cursor
-- location may change.
This guarantee allows frontends which
-- calculate rendering of the text during the layout stage to
-- avoid recalculating the render again during refresh. Pango is
-- an example of such a frontend.
--
--
-- The Yi core provides no guarantee about the OS thread from which the
-- functions layout and refresh are called from. In
-- particular, subprocesses (e.g. compilation, ghci) will run
-- layout and refresh from new OS threads (see
-- startSubprocessWatchers in Yi.Core). The frontend must
-- be preparaed for this: for instance, Gtk-based frontends should wrap
-- GUI updates in postGUIAsync.
data UI e
UI :: IO () -> (Maybe ExitCode -> IO ()) -> IO () -> (e -> IO ()) -> IO () -> (e -> IO e) -> (FilePath -> IO ()) -> UI e
-- | Main loop
[main] :: UI e -> IO ()
-- | Clean up, and also terminate if given an exit code.
[end] :: UI e -> Maybe ExitCode -> IO ()
-- | Suspend (or minimize) the program
[suspend] :: UI e -> IO ()
-- | Refresh the UI with the given state
[refresh] :: UI e -> e -> IO ()
-- | User force-refresh (in case the screen has been messed up from
-- outside)
[userForceRefresh] :: UI e -> IO ()
-- | Set window width and height
[layout] :: UI e -> e -> IO e
-- | Reload cabal project views
[reloadProject] :: UI e -> FilePath -> IO ()
dummyUI :: UI e
-- | Operations on Windows, in the emacs sense of the word.
module Yi.Window
-- | A window onto a buffer.
data Window
Window :: !Bool -> !BufferRef -> ![BufferRef] -> !Int -> !Int -> !Region -> !WindowRef -> !Int -> !JumpList -> Window
-- | regular or mini window?
[isMini] :: Window -> !Bool
-- | the buffer this window opens to
[bufkey] :: Window -> !BufferRef
-- | list of last accessed buffers (former bufKeys). Last accessed one is
-- first element
[bufAccessList] :: Window -> ![BufferRef]
-- | height of the window (in number of screen lines displayed)
[height] :: Window -> !Int
-- | width of the window (in number of chars)
[width] :: Window -> !Int
-- | view area. note that the top point is also available as a buffer mark.
[winRegion] :: Window -> !Region
-- | identifier for the window (for UI sync) This is required for accurate
-- scrolling. Scrolling depends on the actual number of buffer lines
-- displayed. Line wrapping changes that number relative to the height so
-- we can't use height for that purpose.
[wkey] :: Window -> !WindowRef
-- | The actual number of buffer lines displayed. Taking into account line
-- wrapping
[actualLines] :: Window -> !Int
[jumpList] :: Window -> !JumpList
wkeyA :: Lens' Window WindowRef
winRegionA :: Lens' Window Region
widthA :: Lens' Window Int
jumpListA :: Lens' Window JumpList
isMiniA :: Lens' Window Bool
heightA :: Lens' Window Int
bufkeyA :: Lens' Window BufferRef
bufAccessListA :: Lens' Window [BufferRef]
actualLinesA :: Lens' Window Int
-- | Get the identification of a window.
winkey :: Window -> (Bool, BufferRef)
-- | Return a "fake" window onto a buffer.
dummyWindow :: BufferRef -> Window
instance Data.Binary.Class.Binary Yi.Window.Window
instance GHC.Show.Show Yi.Window.Window
instance GHC.Classes.Eq Yi.Window.Window
module Yi.Tab
-- | A tab, containing a collection of windows.
data Tab
type TabRef = Int
-- | Accessor for the windows. If the windows (but not the focus) have
-- changed when setting, then a relayout will be triggered to preserve
-- the internal invariant.
tabWindowsA :: Functor f => (PointedList Window -> f (PointedList Window)) -> Tab -> f Tab
-- | Accessor for the layout manager. When setting, will trigger a relayout
-- if the layout manager has changed.
tabLayoutManagerA :: Functor f => (AnyLayoutManager -> f AnyLayoutManager) -> Tab -> f Tab
-- | Gets / sets the position of the divider with the given reference. The
-- caller must ensure that the DividerRef is valid, otherwise an error
-- will (might!) occur.
tabDividerPositionA :: DividerRef -> Lens' Tab DividerPosition
-- | For UI sync; fixes #304
tkey :: Tab -> TabRef
-- | Returns a list of all mini windows associated with the given tab
tabMiniWindows :: Tab -> [Window]
tabFocus :: Tab -> Window
-- | Forces all windows in the tab
forceTab :: Tab -> Tab
-- | A specialised version of "fmap".
mapWindows :: (Window -> Window) -> Tab -> Tab
-- | Current layout. Invariant: must be the layout generated by
-- tabLayoutManager, up to changing the divPoss.
tabLayout :: Tab -> Layout WindowRef
-- | Folds over the windows in the tab
tabFoldl :: (a -> Window -> a) -> a -> Tab -> a
-- | Make a tab from multiple windows
makeTab :: TabRef -> PointedList Window -> Tab
-- | Make a tab from one window
makeTab1 :: TabRef -> Window -> Tab
instance Data.Binary.Class.Binary Yi.Tab.Tab
instance GHC.Classes.Eq Yi.Tab.Tab
instance GHC.Show.Show Yi.Tab.Tab
-- | 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.
module Yi.Types
data Action
YiA :: YiM a -> Action
EditorA :: EditorM a -> Action
BufferA :: BufferM a -> Action
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 :: IsRefreshNeeded
NoNeedToRefresh :: IsRefreshNeeded
data Yi
Yi :: UI Editor -> ([Event] -> IO ()) -> (IsRefreshNeeded -> [Action] -> IO ()) -> Config -> MVar YiVar -> Yi
[yiUi] :: Yi -> UI Editor
-- | input stream
[yiInput] :: Yi -> [Event] -> IO ()
-- | output stream
[yiOutput] :: Yi -> IsRefreshNeeded -> [Action] -> IO ()
[yiConfig] :: Yi -> Config
-- | The only mutable state in the program
[yiVar] :: Yi -> MVar YiVar
data YiVar
YiVar :: !Editor -> !SubprocessId -> !Map SubprocessId SubprocessInfo -> YiVar
[yiEditor] :: YiVar -> !Editor
[yiSubprocessIdSupply] :: YiVar -> !SubprocessId
[yiSubprocesses] :: YiVar -> !Map SubprocessId SubprocessInfo
-- | The type of user-bindable functions TODO: doc how these are actually
-- user-bindable are they?
newtype YiM a
YiM :: ReaderT Yi IO a -> YiM a
[runYiM] :: YiM a -> ReaderT Yi IO a
unsafeWithEditor :: Config -> MVar YiVar -> EditorM a -> IO a
data KeymapSet
KeymapSet :: Keymap -> Keymap -> KeymapSet
-- | Content of the top-level loop.
[topKeymap] :: KeymapSet -> Keymap
-- | For insertion-only modes
[insertKeymap] :: KeymapSet -> Keymap
extractTopKeymap :: KeymapSet -> Keymap
-- | The BufferM monad writes the updates performed.
newtype BufferM a
BufferM :: ReaderT Window (State FBuffer) a -> BufferM a
[fromBufferM] :: BufferM a -> ReaderT Window (State FBuffer) a
-- | Currently duplicates some of Vim's indent settings. Allowing a buffer
-- to specify settings that are more dynamic, perhaps via closures, could
-- be useful.
data IndentSettings
IndentSettings :: !Bool -> !Int -> !Int -> IndentSettings
-- | Insert spaces instead of tabs as possible
[expandTabs] :: IndentSettings -> !Bool
-- | Size of a Tab
[tabSize] :: IndentSettings -> !Int
-- | Indent by so many columns
[shiftWidth] :: IndentSettings -> !Int
data FBuffer
FBuffer :: !Mode syntax -> !BufferImpl syntax -> !Attributes -> FBuffer
[bmode] :: FBuffer -> !Mode syntax
[rawbuf] :: FBuffer -> !BufferImpl syntax
[attributes] :: FBuffer -> !Attributes
type WinMarks = MarkSet Mark
data MarkSet a
MarkSet :: !a -> MarkSet a
[fromMark, insMark, selMark] :: MarkSet a -> !a
data Attributes
Attributes :: !BufferId -> !BufferRef -> !URList -> !DynamicState -> !Maybe Int -> !Maybe Int -> !Bool -> !Seq UIUpdate -> !SelectionStyle -> !KeymapProcess -> !Map WindowRef WinMarks -> !Window -> !UTCTime -> !Bool -> !Bool -> !Bool -> !Set WindowRef -> !Bool -> !Seq Update -> !Int -> !Seq Update -> Attributes
[ident] :: Attributes -> !BufferId
-- | immutable unique key
[bkey__] :: Attributes -> !BufferRef
-- | undo/redo list
[undos] :: Attributes -> !URList
-- | dynamic components
[bufferDynamic] :: Attributes -> !DynamicState
-- | prefered column to arrive at when we do a lineDown / lineUp
[preferCol] :: Attributes -> !Maybe Int
-- | prefered column to arrive at visually (ie, respecting wrap)
[preferVisCol] :: Attributes -> !Maybe Int
-- | stick to the end of line (used by vim bindings mostly)
[stickyEol] :: Attributes -> !Bool
-- | updates that haven't been synched in the UI yet
[pendingUpdates] :: Attributes -> !Seq UIUpdate
[selectionStyle] :: Attributes -> !SelectionStyle
[keymapProcess] :: Attributes -> !KeymapProcess
[winMarks] :: Attributes -> !Map WindowRef WinMarks
[lastActiveWindow] :: Attributes -> !Window
-- | time of the last synchronization with disk
[lastSyncTime] :: Attributes -> !UTCTime
-- | read-only flag
[readOnly] :: Attributes -> !Bool
-- | the keymap is ready for insertion into this buffer
[inserting] :: Attributes -> !Bool
-- | does buffer contain directory contents
[directoryContent] :: Attributes -> !Bool
[pointFollowsWindow] :: Attributes -> !Set WindowRef
[updateTransactionInFlight] :: Attributes -> !Bool
[updateTransactionAccum] :: Attributes -> !Seq Update
-- | How many points (frontend-specific) to change the font by in this
-- buffer
[fontsizeVariation] :: Attributes -> !Int
-- | Updates that we've seen in this buffer, basically "write-only".
-- Work-around for broken WriterT.
[updateStream] :: Attributes -> !Seq Update
data BufferId
MemBuffer :: !Text -> BufferId
FileBuffer :: !FilePath -> BufferId
data SelectionStyle
SelectionStyle :: !Bool -> !Bool -> SelectionStyle
[highlightSelection] :: SelectionStyle -> !Bool
[rectangleSelection] :: SelectionStyle -> !Bool
data AnyMode
AnyMode :: Mode syntax -> AnyMode
-- | 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.
data Mode syntax
Mode :: Text -> (FilePath -> YiString -> Bool) -> ExtHL syntax -> (syntax -> BufferM ()) -> (KeymapSet -> KeymapSet) -> (syntax -> IndentBehaviour -> BufferM ()) -> (syntax -> Action) -> IndentSettings -> Maybe (BufferM ()) -> (syntax -> Point -> Point -> Point -> [Stroke]) -> BufferM () -> ([Text] -> BufferM Text) -> BufferM () -> Mode syntax
-- | so this can be serialized, debugged.
[modeName] :: Mode syntax -> Text
-- | What type of files does this mode apply to?
[modeApplies] :: Mode syntax -> FilePath -> YiString -> Bool
-- | Syntax highlighter
[modeHL] :: Mode syntax -> ExtHL syntax
-- | Prettify current "paragraph"
[modePrettify] :: Mode syntax -> syntax -> BufferM ()
-- | Buffer-local keymap modification
[modeKeymap] :: Mode syntax -> KeymapSet -> KeymapSet
-- | emacs-style auto-indent line
[modeIndent] :: Mode syntax -> syntax -> IndentBehaviour -> BufferM ()
-- | Follow a "link" in the file. (eg. go to location of error message)
[modeFollow] :: Mode syntax -> syntax -> Action
[modeIndentSettings] :: Mode syntax -> IndentSettings
[modeToggleCommentSelection] :: Mode syntax -> Maybe (BufferM ())
-- | Strokes that should be applied when displaying a syntax element should
-- this be an Action instead?
[modeGetStrokes] :: Mode syntax -> syntax -> Point -> Point -> Point -> [Stroke]
-- | An action that is to be executed when this mode is set
[modeOnLoad] :: Mode syntax -> BufferM ()
-- | buffer-local modeline formatting method
[modeModeLine] :: Mode syntax -> [Text] -> BufferM Text
-- | go to the point where the variable is declared
[modeGotoDeclaration] :: Mode syntax -> BufferM ()
-- | Used to specify the behaviour of the automatic indent command.
data IndentBehaviour
-- | 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.
IncreaseCycle :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint. If we
-- are currently at the smallest level then cycle back to the largest
DecreaseCycle :: IndentBehaviour
-- | Increase the indentation to the next higher hint if no such hint
-- exists do nothing.
IncreaseOnly :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint, if no
-- such hint exists do nothing.
DecreaseOnly :: IndentBehaviour
type Status = ([Text], StyleName)
type Statuses = DelayList Status
-- | The Editor state
data Editor
Editor :: !NonEmpty BufferRef -> !Map BufferRef FBuffer -> !Int -> !PointedList Tab -> !DynamicState -> !Statuses -> !Int -> !Killring -> !Maybe SearchExp -> !Direction -> ![Event] -> !Map BufferRef (EditorM ()) -> Editor
-- | Stack of all the buffers. Invariant: first buffer is the current one.
[bufferStack] :: Editor -> !NonEmpty BufferRef
[buffers] :: Editor -> !Map BufferRef FBuffer
-- | Supply for buffer, window and tab ids.
[refSupply] :: Editor -> !Int
-- | current tab contains the visible windows pointed list.
[tabs_] :: Editor -> !PointedList Tab
-- | dynamic components
[dynamic] :: Editor -> !DynamicState
[statusLines] :: Editor -> !Statuses
[maxStatusHeight] :: Editor -> !Int
[killring] :: Editor -> !Killring
-- | currently highlighted regex (also most recent regex for use in vim
-- bindings)
[currentRegex] :: Editor -> !Maybe SearchExp
[searchDirection] :: Editor -> !Direction
-- | Processed events that didn't yield any action yet.
[pendingEvents] :: Editor -> ![Event]
-- | Actions to be run when the buffer is closed; should be scrapped.
[onCloseActions] :: Editor -> !Map BufferRef (EditorM ())
newtype EditorM a
EditorM :: ReaderT Config (State Editor) a -> EditorM a
[fromEditorM] :: EditorM a -> ReaderT Config (State Editor) a
class (Monad m, MonadState Editor m) => MonadEditor m
askCfg :: MonadEditor m => m Config
withEditor :: MonadEditor m => EditorM a -> m a
withEditor_ :: MonadEditor m => EditorM a -> m ()
runEditor :: Config -> EditorM a -> Editor -> (Editor, a)
data UIConfig
UIConfig :: Maybe String -> Maybe Int -> Maybe ScrollStyle -> Int -> Bool -> Bool -> Bool -> Bool -> CursorStyle -> Char -> Theme -> Bool -> UIConfig
-- | Font name, for the UI that support it.
[configFontName] :: UIConfig -> Maybe String
-- | Font size, for the UI that support it.
[configFontSize] :: UIConfig -> Maybe Int
-- | Style of scroll
[configScrollStyle] :: UIConfig -> Maybe ScrollStyle
-- | Amount to move the buffer when using the scroll wheel
[configScrollWheelAmount] :: UIConfig -> Int
-- | Should the scrollbar be shown on the left side?
[configLeftSideScrollBar] :: UIConfig -> Bool
-- | Hide scrollbar automatically if text fits on one page.
[configAutoHideScrollBar] :: UIConfig -> Bool
-- | Hide the tabbar automatically if only one tab is present
[configAutoHideTabBar] :: UIConfig -> Bool
-- | Wrap lines at the edge of the window if too long to display.
[configLineWrap] :: UIConfig -> Bool
[configCursorStyle] :: UIConfig -> CursorStyle
-- | The char with which to fill empty window space. Usually '~' for
-- vi-like editors, ' ' for everything else.
[configWindowFill] :: UIConfig -> Char
-- | UI colours
[configTheme] :: UIConfig -> Theme
-- | Should we show line numbers by default?
[configLineNumbers] :: UIConfig -> Bool
type UIBoot = Config -> ([Event] -> IO ()) -> ([Action] -> IO ()) -> Editor -> IO (UI Editor)
-- | 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.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
-- | Configuration record. All Yi hooks can be set here.
data Config
Config :: UIBoot -> !UIConfig -> ![Action] -> ![Action] -> !KeymapSet -> !P Event Event -> ![AnyMode] -> !Bool -> !RegionStyle -> !Bool -> !Bool -> !Seq (Seq Update -> BufferM ()) -> ![AnyLayoutManager] -> !DynamicState -> Config
-- | UI to use.
[startFrontEnd] :: Config -> UIBoot
-- | UI-specific configuration.
[configUI] :: Config -> !UIConfig
-- | Actions to run when the editor is started.
[startActions] :: Config -> ![Action]
-- | Actions to run after startup (after startActions) or reload.
[initialActions] :: Config -> ![Action]
-- | Default keymap to use.
[defaultKm] :: Config -> !KeymapSet
[configInputPreprocess] :: Config -> !P Event Event
-- | List modes by order of preference.
[modeTable] :: Config -> ![AnyMode]
-- | Produce a .yi.dbg file with a lot of debug information.
[debugMode] :: Config -> !Bool
-- | Set to Exclusive for an emacs-like behaviour.
[configRegionStyle] :: Config -> !RegionStyle
-- | Set to True for an emacs-like behaviour, where all deleted text
-- is accumulated in a killring.
[configKillringAccumulate] :: Config -> !Bool
[configCheckExternalChangesObsessively] :: Config -> !Bool
[bufferUpdateHandler] :: Config -> !Seq (Seq Update -> BufferM ())
-- | List of layout managers for cycleLayoutManagersNext
[layoutManagers] :: Config -> ![AnyLayoutManager]
-- | Custom configuration, containing the YiConfigVariables.
-- Configure with configVariableA.
[configVars] :: Config -> !DynamicState
data RegionStyle
LineWise :: RegionStyle
Inclusive :: RegionStyle
Exclusive :: RegionStyle
Block :: RegionStyle
instance GHC.Classes.Eq Yi.Types.IsRefreshNeeded
instance GHC.Show.Show Yi.Types.IsRefreshNeeded
instance GHC.Show.Show Yi.Types.IndentSettings
instance GHC.Classes.Eq Yi.Types.IndentSettings
instance GHC.Show.Show a => GHC.Show.Show (Yi.Types.MarkSet a)
instance GHC.Base.Functor Yi.Types.MarkSet
instance Data.Foldable.Foldable Yi.Types.MarkSet
instance Data.Traversable.Traversable Yi.Types.MarkSet
instance GHC.Classes.Ord Yi.Types.BufferId
instance GHC.Classes.Eq Yi.Types.BufferId
instance GHC.Show.Show Yi.Types.BufferId
instance GHC.Show.Show Yi.Types.SelectionStyle
instance GHC.Show.Show Yi.Types.IndentBehaviour
instance GHC.Classes.Eq Yi.Types.IndentBehaviour
instance GHC.Show.Show Yi.Types.RegionStyle
instance GHC.Classes.Eq Yi.Types.RegionStyle
instance Control.Monad.Fail.MonadFail Yi.Types.YiM
instance GHC.Base.Functor Yi.Types.YiM
instance Control.Monad.Base.MonadBase GHC.Types.IO Yi.Types.YiM
instance Control.Monad.Reader.Class.MonadReader Yi.Types.Yi Yi.Types.YiM
instance GHC.Base.Applicative Yi.Types.YiM
instance GHC.Base.Monad Yi.Types.YiM
instance Control.Monad.Reader.Class.MonadReader Yi.Window.Window Yi.Types.BufferM
instance Control.Monad.State.Class.MonadState Yi.Types.FBuffer Yi.Types.BufferM
instance GHC.Base.Functor Yi.Types.BufferM
instance GHC.Base.Monad Yi.Types.BufferM
instance GHC.Base.Functor Yi.Types.EditorM
instance Control.Monad.Reader.Class.MonadReader Yi.Types.Config Yi.Types.EditorM
instance Control.Monad.State.Class.MonadState Yi.Types.Editor Yi.Types.EditorM
instance GHC.Base.Applicative Yi.Types.EditorM
instance GHC.Base.Monad Yi.Types.EditorM
instance Yi.Types.MonadEditor Yi.Types.YiM
instance Yi.Types.MonadEditor Yi.Types.EditorM
instance GHC.Classes.Eq Yi.Types.Action
instance GHC.Show.Show Yi.Types.Action
instance Control.Monad.State.Class.MonadState Yi.Types.Editor Yi.Types.YiM
instance Control.Monad.Fail.MonadFail Yi.Types.BufferM
instance GHC.Base.Applicative Yi.Types.BufferM
instance GHC.Classes.Eq Yi.Types.FBuffer
instance Data.Binary.Class.Binary Yi.Types.Attributes
instance Control.Monad.Fail.MonadFail Yi.Types.EditorM
instance Data.Binary.Class.Binary Yi.Types.RegionStyle
instance Data.Default.Class.Default Yi.Types.RegionStyle
instance Yi.Types.YiVariable Yi.Types.RegionStyle
instance Data.Binary.Class.Binary Yi.Types.SelectionStyle
instance Data.Binary.Class.Binary Yi.Types.BufferId
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Yi.Types.MarkSet a)
-- | Lenses for types exported in Yi.Config. This module serves as a
-- convenience module, for easy re-exporting.
module Yi.Config.Lens
startFrontEndA :: Lens' Config UIBoot
startActionsA :: Lens' Config [Action]
modeTableA :: Lens' Config [AnyMode]
layoutManagersA :: Lens' Config [AnyLayoutManager]
initialActionsA :: Lens' Config [Action]
defaultKmA :: Lens' Config KeymapSet
debugModeA :: Lens' Config Bool
configVarsA :: Lens' Config DynamicState
configUIA :: Lens' Config UIConfig
configRegionStyleA :: Lens' Config RegionStyle
configKillringAccumulateA :: Lens' Config Bool
configInputPreprocessA :: Lens' Config (P Event Event)
configCheckExternalChangesObsessivelyA :: Lens' Config Bool
bufferUpdateHandlerA :: Lens' Config (Seq (Seq Update -> BufferM ()))
configWindowFillA :: Lens' UIConfig Char
configThemeA :: Lens' UIConfig Theme
configScrollWheelAmountA :: Lens' UIConfig Int
configScrollStyleA :: Lens' UIConfig (Maybe ScrollStyle)
configLineWrapA :: Lens' UIConfig Bool
configLineNumbersA :: Lens' UIConfig Bool
configLeftSideScrollBarA :: Lens' UIConfig Bool
configFontSizeA :: Lens' UIConfig (Maybe Int)
configFontNameA :: Lens' UIConfig (Maybe String)
configCursorStyleA :: Lens' UIConfig CursorStyle
configAutoHideTabBarA :: Lens' UIConfig Bool
configAutoHideScrollBarA :: Lens' UIConfig Bool
configVariable :: YiConfigVariable a => Lens Config Config a a
-- | Module exposing common user settings. Users most likely want to be
-- starting with Yi.Config.Default.
module Yi.Config
-- | Configuration record. All Yi hooks can be set here.
data Config
Config :: UIBoot -> !UIConfig -> ![Action] -> ![Action] -> !KeymapSet -> !P Event Event -> ![AnyMode] -> !Bool -> !RegionStyle -> !Bool -> !Bool -> !Seq (Seq Update -> BufferM ()) -> ![AnyLayoutManager] -> !DynamicState -> Config
-- | UI to use.
[startFrontEnd] :: Config -> UIBoot
-- | UI-specific configuration.
[configUI] :: Config -> !UIConfig
-- | Actions to run when the editor is started.
[startActions] :: Config -> ![Action]
-- | Actions to run after startup (after startActions) or reload.
[initialActions] :: Config -> ![Action]
-- | Default keymap to use.
[defaultKm] :: Config -> !KeymapSet
[configInputPreprocess] :: Config -> !P Event Event
-- | List modes by order of preference.
[modeTable] :: Config -> ![AnyMode]
-- | Produce a .yi.dbg file with a lot of debug information.
[debugMode] :: Config -> !Bool
-- | Set to Exclusive for an emacs-like behaviour.
[configRegionStyle] :: Config -> !RegionStyle
-- | Set to True for an emacs-like behaviour, where all deleted text
-- is accumulated in a killring.
[configKillringAccumulate] :: Config -> !Bool
[configCheckExternalChangesObsessively] :: Config -> !Bool
[bufferUpdateHandler] :: Config -> !Seq (Seq Update -> BufferM ())
-- | List of layout managers for cycleLayoutManagersNext
[layoutManagers] :: Config -> ![AnyLayoutManager]
-- | Custom configuration, containing the YiConfigVariables.
-- Configure with configVariableA.
[configVars] :: Config -> !DynamicState
data UIConfig
UIConfig :: Maybe String -> Maybe Int -> Maybe ScrollStyle -> Int -> Bool -> Bool -> Bool -> Bool -> CursorStyle -> Char -> Theme -> Bool -> UIConfig
-- | Font name, for the UI that support it.
[configFontName] :: UIConfig -> Maybe String
-- | Font size, for the UI that support it.
[configFontSize] :: UIConfig -> Maybe Int
-- | Style of scroll
[configScrollStyle] :: UIConfig -> Maybe ScrollStyle
-- | Amount to move the buffer when using the scroll wheel
[configScrollWheelAmount] :: UIConfig -> Int
-- | Should the scrollbar be shown on the left side?
[configLeftSideScrollBar] :: UIConfig -> Bool
-- | Hide scrollbar automatically if text fits on one page.
[configAutoHideScrollBar] :: UIConfig -> Bool
-- | Hide the tabbar automatically if only one tab is present
[configAutoHideTabBar] :: UIConfig -> Bool
-- | Wrap lines at the edge of the window if too long to display.
[configLineWrap] :: UIConfig -> Bool
[configCursorStyle] :: UIConfig -> CursorStyle
-- | The char with which to fill empty window space. Usually '~' for
-- vi-like editors, ' ' for everything else.
[configWindowFill] :: UIConfig -> Char
-- | UI colours
[configTheme] :: UIConfig -> Theme
-- | Should we show line numbers by default?
[configLineNumbers] :: UIConfig -> Bool
type UIBoot = Config -> ([Event] -> IO ()) -> ([Action] -> IO ()) -> Editor -> IO (UI Editor)
-- | 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.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
configStyle :: UIConfig -> UIStyle
configFundamentalMode :: Config -> AnyMode
configTopLevelKeymap :: Config -> Keymap
-- | exports from Yi.Config.Simple which are useful to "core yi"
-- rather than just config files.
module Yi.Config.Simple.Types
-- | The configuration monad. Run it with configMain.
newtype ConfigM a
ConfigM :: StateT Config IO a -> ConfigM a
[runConfigM] :: ConfigM a -> StateT Config IO a
-- | Fields that can be modified with all lens machinery.
type Field a = Lens' Config a
-- | Accessor for any YiConfigVariable, to be used by modules
-- defining YiConfigVariables. Such modules should provide a
-- custom-named field. For instance, take the following hypothetical
-- YiConfigVariable:
--
-- @newtype UserName = UserName { unUserName :: String }
-- deriving(Typeable, Binary, Default) instance YiConfigVariable UserName
--
-- $(nameDeriveAccessors ''UserName (n -> Just (n ++ "A")))
--
-- userName :: Field String userName = unUserNameA .
-- customVariable@
--
-- Here, the hypothetical library would provide the field
-- userName to be used in preference to customVariable.
customVariable :: YiConfigVariable a => Field a
instance Control.Monad.Base.MonadBase GHC.Types.IO Yi.Config.Simple.Types.ConfigM
instance Control.Monad.State.Class.MonadState Yi.Types.Config Yi.Config.Simple.Types.ConfigM
instance GHC.Base.Applicative Yi.Config.Simple.Types.ConfigM
instance GHC.Base.Functor Yi.Config.Simple.Types.ConfigM
instance GHC.Base.Monad Yi.Config.Simple.Types.ConfigM
-- | The Buffer module defines monadic editing operations over
-- one-dimensional buffers, maintaining a current point.
module Yi.Buffer.Misc
data FBuffer
FBuffer :: !Mode syntax -> !BufferImpl syntax -> !Attributes -> FBuffer
-- | The BufferM monad writes the updates performed.
newtype BufferM a
BufferM :: ReaderT Window (State FBuffer) a -> BufferM a
[fromBufferM] :: BufferM a -> ReaderT Window (State FBuffer) a
type WinMarks = MarkSet Mark
data MarkSet a
MarkSet :: !a -> MarkSet a
[fromMark, insMark, selMark] :: MarkSet a -> !a
bkey :: FBuffer -> BufferRef
getMarks :: Window -> BufferM (Maybe WinMarks)
-- | Execute a BufferM value on a given buffer and window. The new
-- state of the buffer is returned alongside the result of the
-- computation.
runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer)
runBufferFull :: Window -> FBuffer -> BufferM a -> (a, Seq Update, FBuffer)
-- | Execute a BufferM value on a given buffer, using a dummy
-- window. The new state of the buffer is discarded.
runBufferDummyWindow :: FBuffer -> BufferM a -> a
-- | Top line of the screen
screenTopLn :: BufferM Int
-- | Middle line of the screen
screenMidLn :: BufferM Int
-- | Bottom line of the screen
screenBotLn :: BufferM Int
-- | Return the current line number
curLn :: BufferM Int
-- | Current column. Note that this is different from offset or number of
-- chars from sol. (This takes into account tabs, unicode chars, etc.)
curCol :: BufferM Int
colOf :: Point -> BufferM Int
lineOf :: Point -> BufferM Int
lineCountB :: BufferM Int
-- | Point of eof
sizeB :: BufferM Point
-- | Extract the current point
pointB :: BufferM Point
pointOfLineColB :: Int -> Int -> BufferM Point
-- | Returns start of line point for a given point p
solPointB :: Point -> BufferM Point
-- | Returns end of line for given point.
eolPointB :: Point -> BufferM Point
-- | Return line numbers of marks
markLines :: BufferM (MarkSet Int)
-- | Move point in buffer to the given index
moveTo :: Point -> BufferM ()
moveToColB :: Int -> BufferM ()
moveToLineColB :: Int -> Int -> BufferM ()
-- | Move point down by n lines. n can be negative.
-- Returns the actual difference in lines which we moved which may be
-- negative if the requested line difference is negative.
lineMoveRel :: Int -> BufferM Int
-- | Move point up one line
lineUp :: BufferM ()
-- | Move point down one line
lineDown :: BufferM ()
-- | Create buffer named nm with contents s
newB :: BufferRef -> BufferId -> YiString -> FBuffer
data MarkValue
MarkValue :: !Point -> !Direction -> MarkValue
[markPoint] :: MarkValue -> !Point
[markGravity] :: MarkValue -> !Direction
data Overlay
-- | Create an "overlay" for the style sty between points
-- s and e
mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay
-- | Go to line number n. n is indexed from 1. Returns
-- the actual line we went to (which may be not be the requested line, if
-- it was out of range)
gotoLn :: Int -> BufferM Int
-- | Go to line indexed from current point Returns the actual moved
-- difference which of course may be negative if the requested difference
-- was negative.
gotoLnFrom :: Int -> BufferM Int
-- | Move point -1
leftB :: BufferM ()
-- | Move cursor +1
rightB :: BufferM ()
-- | Move point by the given number of characters. A negative offset moves
-- backwards a positive one forward.
moveN :: Int -> BufferM ()
-- | Move cursor -n
leftN :: Int -> BufferM ()
-- | Move cursor +n
rightN :: Int -> BufferM ()
-- | Insert the YiString at current point, extending size of buffer
insertN :: YiString -> BufferM ()
-- | Insert given YiString at specified point, extending size of the
-- buffer.
insertNAt :: YiString -> Point -> BufferM ()
-- | Insert the char at current point, extending size of buffer
--
-- Implementation note: This just insertBs a singleton.
-- This seems sub-optimal because we should be able to do much better
-- without spewing chunks of size 1 everywhere. This approach is
-- necessary however so an Update can be recorded. A possible
-- improvement for space would be to have ‘yi-rope’ package optimise for
-- appends with length 1.
insertB :: Char -> BufferM ()
-- | Delete n characters forward from the current point
deleteN :: Int -> BufferM ()
nelemsB :: Int -> Point -> BufferM YiString
-- | Write an element into the buffer at the current point.
writeB :: Char -> BufferM ()
-- | Write the list into the buffer at current point.
writeN :: YiString -> BufferM ()
-- | Insert newline at current point.
newlineB :: BufferM ()
-- | deleteNAt n p deletes n characters forwards from
-- position p
deleteNAt :: Direction -> Int -> Point -> BufferM ()
-- | Read the character at the current point
readB :: BufferM Char
-- | Return the contents of the buffer.
elemsB :: BufferM YiString
undosA :: HasAttributes c_aU7d => Lens' c_aU7d URList
undoB :: BufferM ()
redoB :: BufferM ()
getMarkB :: Maybe String -> BufferM Mark
setMarkHereB :: BufferM Mark
setNamedMarkHereB :: String -> BufferM ()
mayGetMarkB :: String -> BufferM (Maybe Mark)
getMarkValueB :: Mark -> BufferM MarkValue
markPointA :: Mark -> Lens' FBuffer Point
modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM ()
newMarkB :: MarkValue -> BufferM Mark
deleteMarkB :: Mark -> BufferM ()
-- | Whether the selection is highlighted
getVisibleSelection :: BufferM Bool
-- | Highlight the selection
setVisibleSelection :: Bool -> BufferM ()
isUnchangedBuffer :: FBuffer -> Bool
-- | Set the mode
setAnyMode :: AnyMode -> BufferM ()
setMode :: Mode syntax -> BufferM ()
setMode0 :: forall syntax. Mode syntax -> FBuffer -> FBuffer
-- | Modify the mode
modifyMode :: (forall syntax. Mode syntax -> Mode syntax) -> BufferM ()
-- | Return indices of strings in buffer matched by regex in the given
-- region.
regexRegionB :: SearchExp -> Region -> BufferM [Region]
-- | Return indices of next string in buffer matched by regex in the given
-- direction
regexB :: Direction -> SearchExp -> BufferM [Region]
-- | Read the character at the given index This is an unsafe operation:
-- character NUL is returned when out of bounds
readAtB :: Point -> BufferM Char
-- | Given a buffer, and some information update the modeline
--
-- N.B. the contents of modelines should be specified by user, and not
-- hardcoded.
getModeLine :: [Text] -> BufferM Text
-- | Given a point, and the file size, gives us a percent string
getPercent :: Point -> Point -> Text
setInserting :: Bool -> BufferM ()
savingPrefCol :: BufferM a -> BufferM a
forgetPreferCol :: BufferM ()
movingToPrefCol :: BufferM a -> BufferM a
-- | Moves to a visual column within the current line as shown on the
-- editor (ie, moving within the current width of a single visual line)
movingToPrefVisCol :: BufferM a -> BufferM a
preferColA :: HasAttributes c_aU7d => Lens' c_aU7d (Maybe Int)
-- | Mark the current point in the undo list as a saved state.
markSavedB :: UTCTime -> BufferM ()
-- | Undo all updates that happened since last save, perform a given action
-- and redo all updates again. Given action must not modify undo history.
retroactivelyAtSavePointB :: BufferM a -> BufferM a
-- | Adds an "overlay" to the buffer
addOverlayB :: Overlay -> BufferM ()
-- | Remove an existing "overlay"
delOverlayB :: Overlay -> BufferM ()
delOverlaysOfOwnerB :: YiString -> BufferM ()
getOverlaysOfOwnerB :: YiString -> BufferM (Set Overlay)
isPointInsideOverlay :: Point -> Overlay -> Bool
-- | perform a BufferM a, and return to the current point. (by
-- using a mark)
savingExcursionB :: BufferM a -> BufferM a
-- | Perform an BufferM a, and return to the current point.
savingPointB :: BufferM a -> BufferM a
-- | Perform an BufferM a, and return to the current line and
-- column number. The difference between this and savingPointB is
-- that here we attempt to return to the specific line and column number,
-- rather than a specific number of characters from the beginning of the
-- buffer.
--
-- In case the column is further away than EOL, the point is left at EOL:
-- moveToLineColB is used internally.
savingPositionB :: BufferM a -> BufferM a
pendingUpdatesA :: HasAttributes c_aU7d => Lens' c_aU7d (Seq UIUpdate)
highlightSelectionA :: Lens' FBuffer Bool
rectangleSelectionA :: Lens' FBuffer Bool
readOnlyA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
insertingA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
pointFollowsWindowA :: HasAttributes c_aU7d => Lens' c_aU7d (Set WindowRef)
-- | Revert all the pending updates; don't touch the point.
revertPendingUpdatesB :: BufferM ()
askWindow :: (Window -> a) -> BufferM a
-- | update the syntax information (clear the dirty "flag")
clearSyntax :: FBuffer -> FBuffer
focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer
-- | 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.
data Mode syntax
Mode :: Text -> (FilePath -> YiString -> Bool) -> ExtHL syntax -> (syntax -> BufferM ()) -> (KeymapSet -> KeymapSet) -> (syntax -> IndentBehaviour -> BufferM ()) -> (syntax -> Action) -> IndentSettings -> Maybe (BufferM ()) -> (syntax -> Point -> Point -> Point -> [Stroke]) -> BufferM () -> ([Text] -> BufferM Text) -> BufferM () -> Mode syntax
-- | so this can be serialized, debugged.
[modeName] :: Mode syntax -> Text
-- | What type of files does this mode apply to?
[modeApplies] :: Mode syntax -> FilePath -> YiString -> Bool
-- | Syntax highlighter
[modeHL] :: Mode syntax -> ExtHL syntax
-- | Prettify current "paragraph"
[modePrettify] :: Mode syntax -> syntax -> BufferM ()
-- | Buffer-local keymap modification
[modeKeymap] :: Mode syntax -> KeymapSet -> KeymapSet
-- | emacs-style auto-indent line
[modeIndent] :: Mode syntax -> syntax -> IndentBehaviour -> BufferM ()
-- | Follow a "link" in the file. (eg. go to location of error message)
[modeFollow] :: Mode syntax -> syntax -> Action
[modeIndentSettings] :: Mode syntax -> IndentSettings
[modeToggleCommentSelection] :: Mode syntax -> Maybe (BufferM ())
-- | Strokes that should be applied when displaying a syntax element should
-- this be an Action instead?
[modeGetStrokes] :: Mode syntax -> syntax -> Point -> Point -> Point -> [Stroke]
-- | An action that is to be executed when this mode is set
[modeOnLoad] :: Mode syntax -> BufferM ()
-- | buffer-local modeline formatting method
[modeModeLine] :: Mode syntax -> [Text] -> BufferM Text
-- | go to the point where the variable is declared
[modeGotoDeclaration] :: Mode syntax -> BufferM ()
modeNameA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) Text
modeAppliesA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (FilePath -> YiString -> Bool)
modeHLA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (ExtHL syntax_aIGp)
modePrettifyA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> BufferM ())
modeKeymapA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (KeymapSet -> KeymapSet)
modeIndentA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> IndentBehaviour -> BufferM ())
modeFollowA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> Action)
modeIndentSettingsA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) IndentSettings
modeToggleCommentSelectionA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (Maybe (BufferM ()))
modeGetStrokesA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> Point -> Point -> Point -> [Stroke])
modeOnLoadA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (BufferM ())
modeGotoDeclarationA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (BufferM ())
modeModeLineA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) ([Text] -> BufferM Text)
data AnyMode
AnyMode :: Mode syntax -> AnyMode
-- | Used to specify the behaviour of the automatic indent command.
data IndentBehaviour
-- | 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.
IncreaseCycle :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint. If we
-- are currently at the smallest level then cycle back to the largest
DecreaseCycle :: IndentBehaviour
-- | Increase the indentation to the next higher hint if no such hint
-- exists do nothing.
IncreaseOnly :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint, if no
-- such hint exists do nothing.
DecreaseOnly :: IndentBehaviour
-- | Currently duplicates some of Vim's indent settings. Allowing a buffer
-- to specify settings that are more dynamic, perhaps via closures, could
-- be useful.
data IndentSettings
IndentSettings :: !Bool -> !Int -> !Int -> IndentSettings
-- | Insert spaces instead of tabs as possible
[expandTabs] :: IndentSettings -> !Bool
-- | Size of a Tab
[tabSize] :: IndentSettings -> !Int
-- | Indent by so many columns
[shiftWidth] :: IndentSettings -> !Int
expandTabsA :: Lens' IndentSettings Bool
tabSizeA :: Lens' IndentSettings Int
shiftWidthA :: Lens' IndentSettings Int
-- | Mode applies function that always returns True.
modeAlwaysApplies :: a -> b -> Bool
-- | Mode applies function that always returns False.
modeNeverApplies :: a -> b -> Bool
emptyMode :: Mode syntax
withModeB :: (forall syntax. Mode syntax -> BufferM a) -> BufferM a
withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a
onMode :: (forall syntax. Mode syntax -> Mode syntax) -> AnyMode -> AnyMode
withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a
withSyntaxB' :: (forall syntax. Mode syntax -> syntax -> BufferM a) -> BufferM a
keymapProcessA :: HasAttributes c_aU7d => Lens' c_aU7d KeymapProcess
strokesRangesB :: Maybe SearchExp -> Region -> BufferM [[Stroke]]
streamB :: Direction -> Point -> BufferM YiString
indexedStreamB :: Direction -> Point -> BufferM [(Point, Char)]
askMarks :: BufferM WinMarks
pointAt :: BufferM a -> BufferM Point
data SearchExp
lastActiveWindowA :: HasAttributes c_aU7d => Lens' c_aU7d Window
-- | Access to a value into the extensible state, keyed by its type. This
-- allows you to save inside a BufferM monad, ie:
--
--
-- putBufferDyn updatedvalue
--
putBufferDyn :: (YiVariable a, MonadState FBuffer m, Functor m) => a -> m ()
-- | Access to a value into the extensible state, keyed by its type. This
-- allows you to retrieve inside a BufferM monad, ie:
--
--
-- value <- getBufferDyn
--
getBufferDyn :: forall m a. (Default a, YiVariable a, MonadState FBuffer m, Functor m) => m a
-- | Gets a short identifier of a buffer. If we're given a MemBuffer
-- then just wraps the buffer name like so: *name*. If we're
-- given a FileBuffer, it drops the number of path components.
--
--
-- >>> let memBuf = newB (BufferRef 0) (MemBuffer "foo/bar/hello") ""
--
-- >>> shortIdentString 2 memBuf
-- "*foo/bar/hello*"
--
-- >>> let fileBuf = newB (BufferRef 0) (FileBuffer "foo/bar/hello") ""
--
-- >>> shortIdentString 2 fileBuf
-- "hello"
--
shortIdentString :: Int -> FBuffer -> Text
-- | Gets the buffer's identifier string, emphasising the MemBuffer:
--
--
-- >>> let memBuf = newB (BufferRef 0) (MemBuffer "foo/bar/hello") ""
--
-- >>> identString memBuf
-- "*foo/bar/hello*"
--
-- >>> let fileBuf = newB (BufferRef 0) (FileBuffer "foo/bar/hello") ""
--
-- >>> identString fileBuf
-- "foo/bar/hello"
--
identString :: FBuffer -> Text
miniIdentString :: FBuffer -> Text
identA :: HasAttributes c_aU7d => Lens' c_aU7d BufferId
directoryContentA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
data BufferId
MemBuffer :: !Text -> BufferId
FileBuffer :: !FilePath -> BufferId
file :: FBuffer -> Maybe FilePath
lastSyncTimeA :: HasAttributes c_aU7d => Lens' c_aU7d UTCTime
replaceCharB :: Char -> BufferM ()
replaceCharWithBelowB :: BufferM ()
replaceCharWithAboveB :: BufferM ()
insertCharWithBelowB :: BufferM ()
insertCharWithAboveB :: BufferM ()
pointAfterCursorB :: Point -> BufferM Point
-- | What would be the point after doing the given action? The argument
-- must not modify the buffer.
destinationOfMoveB :: BufferM a -> BufferM Point
withEveryLineB :: BufferM () -> BufferM ()
startUpdateTransactionB :: BufferM ()
commitUpdateTransactionB :: BufferM ()
applyUpdate :: Update -> BufferM ()
-- | Returns the contents of the buffer between the two points.
--
-- If the startPoint >= endPoint, empty string is returned.
-- If the points are out of bounds, as much of the content as possible is
-- taken: you're not guaranteed to get endPoint - startPoint
-- characters.
betweenB :: Point -> Point -> BufferM YiString
-- | Decreases the font size in the buffer by specified number. What this
-- number actually means depends on the front-end.
decreaseFontSize :: Int -> BufferM ()
-- | Increases the font size in the buffer by specified number. What this
-- number actually means depends on the front-end.
increaseFontSize :: Int -> BufferM ()
-- | Gives the IndentSettings for the current buffer.
indentSettingsB :: BufferM IndentSettings
fontsizeVariationA :: HasAttributes c_aU7d => Lens' c_aU7d Int
stickyEolA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x
instance Yi.Buffer.Misc.HasAttributes Yi.Types.Attributes
instance Yi.Buffer.Misc.HasAttributes Yi.Types.FBuffer
instance GHC.Show.Show Yi.Types.FBuffer
instance Data.Binary.Class.Binary Yi.Types.FBuffer
instance Data.Binary.Class.Binary (Yi.Types.Mode syntax)
-- | This module defines buffer operation on regions
module Yi.Buffer.Region
-- | Swap the content of two Regions
swapRegionsB :: Region -> Region -> BufferM ()
-- | Delete an arbitrary part of the buffer
deleteRegionB :: Region -> BufferM ()
-- | Replace a region with a given rope.
replaceRegionB :: Region -> YiString -> BufferM ()
readRegionB :: Region -> BufferM YiString
-- | Map the given function over the characters in the region.
mapRegionB :: Region -> (Char -> Char) -> BufferM ()
-- | Modifies the given region according to the given string transformation
-- function
modifyRegionB :: (YiString -> YiString) -> Region -> BufferM ()
winRegionB :: BufferM Region
-- | Extend the right bound of a region to include it.
inclusiveRegionB :: Region -> BufferM Region
-- | See a region as a block/rectangular region, since regions are
-- represented by two point, this returns a list of small regions form
-- this block region.
blockifyRegion :: Region -> BufferM [Region]
-- | Joins lines in the region with a single space, skipping any empty
-- lines.
joinLinesB :: Region -> BufferM ()
-- | Concatenates lines in the region preserving the trailing newline if
-- any.
concatLinesB :: Region -> BufferM ()
-- | Gets the lines of a region (as a region), preserving newlines. Thus
-- the resulting list of regions is a partition of the original region.
--
-- The direction of the region is preserved and all smaller regions will
-- retain that direction.
--
-- Note that regions should never be empty, so it would be odd for this
-- to return an empty list...
linesOfRegionB :: Region -> BufferM [Region]
-- | Working with blocks (units) of text.
module Yi.Buffer.TextUnit
-- | Designate a given "unit" of text.
data TextUnit
-- | a single character
Character :: TextUnit
-- | a line of text (between newlines)
Line :: TextUnit
-- | a "vertical" line of text (area of text between two characters at the
-- same column number)
VLine :: TextUnit
-- | the whole document
Document :: TextUnit
GenUnit :: TextUnit -> (Direction -> BufferM Bool) -> TextUnit
[genEnclosingUnit] :: TextUnit -> TextUnit
[genUnitBoundary] :: TextUnit -> Direction -> BufferM Bool
-- | Turns a unit into its "negative" by inverting the boundaries. For
-- example, outsideUnit unitViWord will be the unit of spaces
-- between words. For units without boundaries (Character,
-- Document, ...), this is the identity function.
outsideUnit :: TextUnit -> TextUnit
-- | Unit that have its left and right boundaries at the left boundary of
-- the argument unit.
leftBoundaryUnit :: TextUnit -> TextUnit
-- | a word as in use in Emacs (fundamental mode)
unitWord :: TextUnit
unitViWord :: TextUnit
unitViWORD :: TextUnit
unitViWordAnyBnd :: TextUnit
unitViWORDAnyBnd :: TextUnit
unitViWordOnLine :: TextUnit
unitViWORDOnLine :: TextUnit
-- | delimited on the left and right by given characters, boolean argument
-- tells if whether those are included.
unitDelimited :: Char -> Char -> Bool -> TextUnit
unitSentence :: TextUnit
-- | Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitEmacsParagraph :: TextUnit
-- | Paragraph that begins and ends in the paragraph, not the empty lines
-- surrounding it.
unitParagraph :: TextUnit
-- | Separator characters (space, tab, unicode separators). Most of the
-- units above attempt to identify "words" with various punctuation and
-- symbols included or excluded. This set of units is a simple inverse:
-- it is true for "whitespace" or "separators" and false for anything
-- that is not (letters, numbers, symbols, punctuation, whatever).
isAnySep :: Char -> Bool
-- | unitSep is true for any kind of whitespace/separator
unitSep :: TextUnit
-- | unitSepThisLine is true for any kind of whitespace/separator on this
-- line only
unitSepThisLine :: TextUnit
isWordChar :: Char -> Bool
-- | Move to the next unit boundary
moveB :: TextUnit -> Direction -> BufferM ()
-- | As moveB, unless the point is at a unit boundary
maybeMoveB :: TextUnit -> Direction -> BufferM ()
-- | Transforms the region given by TextUnit in the Direction
-- with user-supplied function.
transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
transposeB :: TextUnit -> Direction -> BufferM ()
-- | Region of the whole textunit where the current point is.
regionOfB :: TextUnit -> BufferM Region
-- | Non empty region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region
-- | Region between the point and the next boundary. The region is empty if
-- the point is at the boundary.
regionOfPartB :: TextUnit -> Direction -> BufferM Region
regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region
-- | Non empty region between the point and the next boundary, In fact the
-- region can be empty if we are at the end of file.
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
-- | Non empty region at given point and the next boundary,
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
readPrevUnitB :: TextUnit -> BufferM YiString
readUnitB :: TextUnit -> BufferM YiString
-- | Repeat an action until the condition is fulfilled or the cursor stops
-- moving. The Action may be performed zero times.
untilB :: BufferM Bool -> BufferM a -> BufferM [a]
doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
whileB :: BufferM Bool -> BufferM a -> BufferM [a]
-- | Do an action if the current buffer character passes the predicate
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
atBoundaryB :: TextUnit -> Direction -> BufferM Bool
numberOfB :: TextUnit -> TextUnit -> BufferM Int
-- | Delete between point and next unit boundary, return the deleted
-- region.
deleteB :: TextUnit -> Direction -> BufferM ()
-- | Generic maybe move operation. As genMoveB, but don't move if we are at
-- boundary already.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | Generic move operation Warning: moving To the (OutsideBound, Backward)
-- bound of Document is impossible (offset -1!) genMoveB u b d:
-- move in direction d until encountering boundary b or unit u. See
-- genAtBoundaryB for boundary explanation.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | Boundary side
data BoundarySide
InsideBound :: BoundarySide
OutsideBound :: BoundarySide
-- | genAtBoundaryB u d s returns whether the point is at a given
-- boundary (d,s) . Boundary (d,s) , taking Word as
-- example, means: Word ^^ ^^ 12 34 1: (Backward,OutsideBound) 2:
-- (Backward,InsideBound) 3: (Forward,InsideBound) 4:
-- (Forward,OutsideBound)
--
-- rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward
-- genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
halfUnit :: Direction -> TextUnit -> TextUnit
deleteUnitB :: TextUnit -> Direction -> BufferM ()
instance GHC.Classes.Eq Yi.Buffer.TextUnit.BoundarySide
-- | A normalized API to many buffer operations.
module Yi.Buffer.Normal
-- | Designate a given "unit" of text.
data TextUnit
-- | a single character
Character :: TextUnit
-- | a line of text (between newlines)
Line :: TextUnit
-- | a "vertical" line of text (area of text between two characters at the
-- same column number)
VLine :: TextUnit
-- | the whole document
Document :: TextUnit
GenUnit :: TextUnit -> (Direction -> BufferM Bool) -> TextUnit
-- | Separator characters (space, tab, unicode separators). Most of the
-- units above attempt to identify "words" with various punctuation and
-- symbols included or excluded. This set of units is a simple inverse:
-- it is true for "whitespace" or "separators" and false for anything
-- that is not (letters, numbers, symbols, punctuation, whatever).
isAnySep :: Char -> Bool
isWordChar :: Char -> Bool
-- | Unit that have its left and right boundaries at the left boundary of
-- the argument unit.
leftBoundaryUnit :: TextUnit -> TextUnit
-- | Turns a unit into its "negative" by inverting the boundaries. For
-- example, outsideUnit unitViWord will be the unit of spaces
-- between words. For units without boundaries (Character,
-- Document, ...), this is the identity function.
outsideUnit :: TextUnit -> TextUnit
-- | delimited on the left and right by given characters, boolean argument
-- tells if whether those are included.
unitDelimited :: Char -> Char -> Bool -> TextUnit
-- | Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitEmacsParagraph :: TextUnit
-- | Paragraph that begins and ends in the paragraph, not the empty lines
-- surrounding it.
unitParagraph :: TextUnit
unitSentence :: TextUnit
-- | unitSep is true for any kind of whitespace/separator
unitSep :: TextUnit
-- | unitSepThisLine is true for any kind of whitespace/separator on this
-- line only
unitSepThisLine :: TextUnit
unitViWORD :: TextUnit
unitViWORDAnyBnd :: TextUnit
unitViWORDOnLine :: TextUnit
unitViWord :: TextUnit
unitViWordAnyBnd :: TextUnit
unitViWordOnLine :: TextUnit
-- | a word as in use in Emacs (fundamental mode)
unitWord :: TextUnit
atBoundaryB :: TextUnit -> Direction -> BufferM Bool
-- | Delete between point and next unit boundary, return the deleted
-- region.
deleteB :: TextUnit -> Direction -> BufferM ()
-- | Do an action if the current buffer character passes the predicate
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
-- | Generic maybe move operation. As genMoveB, but don't move if we are at
-- boundary already.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | Generic move operation Warning: moving To the (OutsideBound, Backward)
-- bound of Document is impossible (offset -1!) genMoveB u b d:
-- move in direction d until encountering boundary b or unit u. See
-- genAtBoundaryB for boundary explanation.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | As moveB, unless the point is at a unit boundary
maybeMoveB :: TextUnit -> Direction -> BufferM ()
-- | Move to the next unit boundary
moveB :: TextUnit -> Direction -> BufferM ()
numberOfB :: TextUnit -> TextUnit -> BufferM Int
readPrevUnitB :: TextUnit -> BufferM YiString
readUnitB :: TextUnit -> BufferM YiString
-- | Region of the whole textunit where the current point is.
regionOfB :: TextUnit -> BufferM Region
-- | Non empty region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region
-- | Region between the point and the next boundary. The region is empty if
-- the point is at the boundary.
regionOfPartB :: TextUnit -> Direction -> BufferM Region
-- | Non empty region at given point and the next boundary,
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
-- | Non empty region between the point and the next boundary, In fact the
-- region can be empty if we are at the end of file.
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
-- | Transforms the region given by TextUnit in the Direction
-- with user-supplied function.
transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
transposeB :: TextUnit -> Direction -> BufferM ()
-- | Repeat an action until the condition is fulfilled or the cursor stops
-- moving. The Action may be performed zero times.
untilB :: BufferM Bool -> BufferM a -> BufferM [a]
untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
whileB :: BufferM Bool -> BufferM a -> BufferM [a]
-- | Boundary side
data BoundarySide
InsideBound :: BoundarySide
OutsideBound :: BoundarySide
checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
-- | genAtBoundaryB u d s returns whether the point is at a given
-- boundary (d,s) . Boundary (d,s) , taking Word as
-- example, means: Word ^^ ^^ 12 34 1: (Backward,OutsideBound) 2:
-- (Backward,InsideBound) 3: (Forward,InsideBound) 4:
-- (Forward,OutsideBound)
--
-- rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward
-- genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
genEnclosingUnit :: TextUnit -> TextUnit
genUnitBoundary :: TextUnit -> Direction -> BufferM Bool
data RegionStyle
LineWise :: RegionStyle
Inclusive :: RegionStyle
Exclusive :: RegionStyle
Block :: RegionStyle
convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
-- | Extend the given region to boundaries of the text unit. For instance
-- one can extend the selection to complete lines, or paragraphs.
extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
getRegionStyle :: BufferM RegionStyle
mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
putRegionStyle :: RegionStyle -> BufferM ()
unitWiseRegion :: TextUnit -> Region -> BufferM Region
-- | High level operations on buffers.
module Yi.Buffer.HighLevel
-- | True if point at end of file
atEof :: BufferM Bool
-- | Return true if the current point is the end of a line
atEol :: BufferM Bool
-- | True if point at the last line
atLastLine :: BufferM Bool
-- | Return true if the current point is the start of a line
atSol :: BufferM Bool
-- | True if point at start of file
atSof :: BufferM Bool
-- | Delete one character backward
bdeleteB :: BufferM ()
-- | Delete backward to the sof or the new line character
bdeleteLineB :: BufferM ()
-- | Delete backward whitespace or non-whitespace depending on the
-- character before point.
bkillWordB :: BufferM ()
-- | Move cursor to end of buffer
botB :: BufferM ()
-- | File info, size in chars, line no, col num, char num, percent
bufInfoB :: BufferM BufferFileInfo
data BufferFileInfo
BufferFileInfo :: FilePath -> Int -> Int -> Int -> Point -> Text -> Bool -> BufferFileInfo
[bufInfoFileName] :: BufferFileInfo -> FilePath
[bufInfoSize] :: BufferFileInfo -> Int
[bufInfoLineNo] :: BufferFileInfo -> Int
[bufInfoColNo] :: BufferFileInfo -> Int
[bufInfoCharNo] :: BufferFileInfo -> Point
[bufInfoPercent] :: BufferFileInfo -> Text
[bufInfoModified] :: BufferFileInfo -> Bool
-- | capitalise the first letter of this word
capitaliseWordB :: BufferM ()
deleteBlankLinesB :: BufferM ()
-- | emacs' delete-horizontal-space with the optional argument.
deleteHorizontalSpaceB :: Maybe Int -> BufferM ()
deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point)
-- | Delete to the end of line, excluding it.
deleteToEol :: BufferM ()
-- | Delete trailing whitespace from all lines. Uses savingPositionB
-- to get back to where it was.
deleteTrailingSpaceB :: BufferM ()
-- | Move to n lines down from top of screen
downFromTosB :: Int -> BufferM ()
-- | Scroll down 1 screen
downScreenB :: BufferM ()
downScreensB :: Int -> BufferM ()
-- | Exchange point & mark.
exchangePointAndMarkB :: BufferM ()
fillParagraph :: BufferM ()
findMatchingPairB :: BufferM ()
-- | Move to first non-space character in this line
firstNonSpaceB :: BufferM ()
flipRectangleB :: Point -> Point -> BufferM (Point, Point)
getBookmarkB :: String -> BufferM Mark
-- | Get the current line and column number
getLineAndCol :: BufferM (Int, Int)
getLineAndColOfPoint :: Point -> BufferM (Int, Int)
-- | The same as getMaybeNextLineB but avoids the use of the
-- Maybe type in the return by returning the empty string if there
-- is no next line.
getNextLineB :: Direction -> BufferM YiString
-- | Returns the closest line to the current line which is non-blank, in
-- the given direction. Returns the empty string if there is no such line
-- (for example if we are on the top line already).
getNextNonBlankLineB :: Direction -> BufferM YiString
-- | Return the region between point and mark
getRawestSelectRegionB :: BufferM Region
-- | Get the current buffer selection mark
getSelectionMarkPointB :: BufferM Point
-- | Get the current region boundaries. Extended to the current selection
-- unit.
getSelectRegionB :: BufferM Region
gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()
hasWhiteSpaceBefore :: BufferM Bool
-- | Increase (or decrease if negative) next number on line by n.
incrementNextNumberByB :: Int -> BufferM ()
insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM ()
-- | Note: Returns False if line doesn't have any characters besides a
-- newline
isCurrentLineAllWhiteSpaceB :: BufferM Bool
-- | True if current line consists of just a newline (no whitespace)
isCurrentLineEmptyB :: BufferM Bool
-- | Is character under cursor a number.
isNumberB :: BufferM Bool
-- | Delete forward whitespace or non-whitespace depending on the character
-- under point.
killWordB :: BufferM ()
-- | Move to the last non-space character in this line
lastNonSpaceB :: BufferM ()
leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
-- | Move left if on eol, but not on blank line
leftOnEol :: BufferM ()
-- | Move point down by n lines If line extends past width of
-- window, count moving a single line as moving width points to the
-- right.
lineMoveVisRel :: Int -> BufferM ()
-- | Prefix each line in the selection using the given string.
linePrefixSelectionB :: YiString -> BufferM ()
-- | Get a (lazy) stream of lines in the buffer, starting at the
-- next line in the given direction.
lineStreamB :: Direction -> BufferM [YiString]
-- | lowerise word under the cursor
lowercaseWordB :: BufferM ()
-- | Move to middle line in screen
middleB :: BufferM ()
modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM ()
-- | Go to the first non space character in the line; if already there,
-- then go to the beginning of the line.
moveNonspaceOrSol :: BufferM ()
movePercentageFileB :: Int -> BufferM ()
-- | Move point between the middle, top and bottom of the screen If the
-- point stays at the middle, it'll be gone to the top else if the point
-- stays at the top, it'll be gone to the bottom else it'll be gone to
-- the middle
moveToMTB :: BufferM ()
-- | Move point to end of line
moveToEol :: BufferM ()
-- | Move point to start of line
moveToSol :: BufferM ()
-- | Move x chars forward, or to the eol, whichever is less
moveXorEol :: Int -> BufferM ()
-- | Move x chars back, or to the sol, whichever is less
moveXorSol :: Int -> BufferM ()
-- | Move to the character before the next occurence of c
nextCExc :: Char -> BufferM ()
-- | Move to the next occurence of c
nextCInc :: Char -> BufferM ()
nextCInLineExc :: Char -> BufferM ()
nextCInLineInc :: Char -> BufferM ()
-- | Move down next n paragraphs
nextNParagraphs :: Int -> BufferM ()
-- | Move to first char of next word forwards
nextWordB :: BufferM ()
-- | Move to the character after the previous occurence of c
prevCExc :: Char -> BufferM ()
-- | Move to the previous occurence of c
prevCInc :: Char -> BufferM ()
prevCInLineExc :: Char -> BufferM ()
prevCInLineInc :: Char -> BufferM ()
-- | Move up prev n paragraphs
prevNParagraphs :: Int -> BufferM ()
-- | Move to first char of next word backwards
prevWordB :: BufferM ()
-- | Reads in word at point.
readCurrentWordB :: BufferM YiString
-- | Read the line the point is on
readLnB :: BufferM YiString
-- | Reads in word before point.
readPrevWordB :: BufferM YiString
readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString
-- | Replace the contents of the buffer with some string
replaceBufferContent :: YiString -> BufferM ()
-- | Helper function: revert the buffer contents to its on-disk version
revertB :: YiString -> UTCTime -> BufferM ()
rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
-- | Scroll by n lines.
scrollB :: Int -> BufferM ()
-- | Move cursor to the bottom of the screen
scrollCursorToBottomB :: BufferM ()
-- | Move cursor to the top of the screen
scrollCursorToTopB :: BufferM ()
-- | Scroll by n screens (negative for up)
scrollScreensB :: Int -> BufferM ()
-- | Move to middle line in screen
scrollToCursorB :: BufferM ()
scrollToLineAboveWindowB :: BufferM ()
scrollToLineBelowWindowB :: BufferM ()
-- | Select next n paragraphs
selectNParagraphs :: Int -> BufferM ()
-- | Marks
--
-- Set the current buffer selection mark
setSelectionMarkPointB :: Point -> BufferM ()
-- | Select the given region: set the selection mark at the
-- regionStart and the current point at the regionEnd.
setSelectRegionB :: Region -> BufferM ()
shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
-- | Sort the lines of the region.
sortLines :: BufferM ()
sortLinesWithRegion :: Region -> BufferM ()
-- | Move the point to inside the viewable region
snapInsB :: BufferM ()
-- | Move the visible region to include the point
snapScreenB :: Maybe ScrollStyle -> BufferM Bool
splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
-- | Transpose two characters, (the Emacs C-t action)
swapB :: BufferM ()
switchCaseChar :: Char -> Char
-- | Used by isNumber to test if current character under cursor is a
-- number.
test3CharB :: BufferM Bool
-- | Characters [a..f] are part of a hex number only if
-- preceded by 0x. Test if the current occurence of
-- [a..f] is part of a hex number.
testHexB :: BufferM Bool
-- | Just like toggleCommentSelectionB but automatically inserts a
-- whitespace suffix to the inserted comment string. In fact:
toggleCommentB :: YiString -> BufferM ()
-- | Move cursor to origin
topB :: BufferM ()
-- | Uncomments the selection using the given line comment starting string.
-- This only works for the comments which begin at the start of the line.
unLineCommentSelectionB :: YiString -> YiString -> BufferM ()
-- | Move to n lines up from the bottom of the screen
upFromBosB :: Int -> BufferM ()
-- | capitalise the word under the cursor
uppercaseWordB :: BufferM ()
-- | Scroll up 1 screen
upScreenB :: BufferM ()
upScreensB :: Int -> BufferM ()
-- | Same as scrollB, but also moves the cursor
vimScrollB :: Int -> BufferM ()
-- | Same as scrollByB, but also moves the cursor
vimScrollByB :: (Int -> Int) -> Int -> BufferM ()
-- | Implements the same logic that emacs' `mark-word` does. Checks the
-- mark point and moves it forth (or backward) for one word.
markWord :: BufferM ()
instance GHC.Show.Show Yi.Buffer.HighLevel.RelPosition
-- | Handles indentation in the keymaps. Includes:
--
--
-- - (TODO) Auto-indentation to the previous lines indentation
-- - Tab-expansion
-- - Shifting of the indentation for a region of text
--
module Yi.Buffer.Indent
-- | A specialisation of autoIndentHelperB. This is the most basic
-- and the user is encouraged to specialise autoIndentHelperB on
-- their own.
autoIndentB :: IndentBehaviour -> BufferM ()
-- | Cycles through the indentation hints. It does this without requiring
-- to set/get any state. We just look at the current indentation of the
-- current line and moving to the largest indent that is
cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM ()
-- | Indent as much as the next line
indentAsNextB :: BufferM ()
-- | Indent as much as the previous line
indentAsPreviousB :: BufferM ()
indentAsTheMostIndentedNeighborLineB :: BufferM ()
-- | Returns the indentation of a given string. Note that this depends on
-- the current indentation settings.
indentOfB :: YiString -> BufferM Int
-- | Return the number of spaces at the beginning of the line, up to the
-- point.
indentOfCurrentPosB :: BufferM Int
-- | Gives the IndentSettings for the current buffer.
indentSettingsB :: BufferM IndentSettings
-- | Indents the current line to the given indentation level. In addition
-- moves the point according to where it was on the line originally. If
-- we were somewhere within the indentation (ie at the start of the line
-- or on an empty line) then we want to just go to the end of the (new)
-- indentation. However if we are currently pointing somewhere within the
-- text of the line then we wish to remain pointing to the same
-- character.
indentToB :: Int -> BufferM ()
-- | Modifies current line indent measured in visible spaces. Respects
-- indent settings. Calling this with value (+ 4) will turn "t" into "tt"
-- if shiftwidth is 4 and into "t " if shiftwidth is 8 If current line is
-- empty nothing happens.
modifyIndentB :: (Int -> Int) -> BufferM ()
-- | Insert a newline at point and indent the new line as the previous one.
newlineAndIndentB :: BufferM ()
-- | Increases the indentation on the region by the given amount of
-- shiftWidth
shiftIndentOfRegionB :: Int -> Region -> BufferM ()
-- | Return either a t or the number of spaces specified by tabSize in the
-- IndentSettings. Note that if you actually want to insert a tab
-- character (for example when editing makefiles) then you should use:
-- insertB 't'.
tabB :: BufferM String
-- | The Buffer module defines monadic editing operations over
-- one-dimensional buffers, maintaining a current point.
--
-- This module acts as a facade for the Buffer.* modules.
module Yi.Buffer
data UIUpdate
TextUpdate :: !Update -> UIUpdate
StyleUpdate :: !Point -> !Size -> UIUpdate
-- | Mutation actions (also used the undo or redo list)
--
-- For the undoredo, we use the partial checkpoint/ (Berlage,
-- pg16) strategy to store just the components of the state that change.
--
-- Note that the update direction is only a hint for moving the cursor
-- (mainly for undo purposes); the insertions and deletions are always
-- applied Forward.
--
-- Note that keeping the text does not cost much: we keep the updates in
-- the undo list; if it's a Delete it means we have just inserted
-- the text in the buffer, so the update shares the data with the buffer.
-- If it's an Insert we have to keep the data any way.
data Update
Insert :: !Point -> !Direction -> !YiString -> Update
[updatePoint] :: Update -> !Point
[updateDirection] :: Update -> !Direction
[_insertUpdateString] :: Update -> !YiString
Delete :: !Point -> !Direction -> !YiString -> Update
[updatePoint] :: Update -> !Point
[updateDirection] :: Update -> !Direction
[_deleteUpdateString] :: Update -> !YiString
updateIsDelete :: Update -> Bool
markGravityAA :: Lens' MarkValue Direction
markPointAA :: Lens' MarkValue Point
-- | Utilities shared by various UIs
module Yi.UI.Utils
applyHeights :: Traversable t => [Int] -> t Window -> t Window
spliceAnnots :: [(Point, Char)] -> [Span String] -> [(Point, Char)]
-- | Turn a sequence of (from,style,to) strokes into a sequence of picture
-- points (from,style), taking special care to ensure that the points are
-- strictly increasing and introducing padding segments where neccessary.
-- Precondition: Strokes are ordered and not overlapping.
strokePicture :: [Span (Endo a)] -> [(Point, a -> a)]
-- | Paint the given stroke-picture on top of an existing picture
paintStrokes :: (a -> a) -> a -> [(Point, a -> a)] -> [(Point, a)] -> [(Point, a)]
paintPicture :: a -> [[Span (Endo a)]] -> [(Point, a)]
attributesPictureB :: UIStyle -> Maybe SearchExp -> Region -> [[Span StyleName]] -> BufferM [(Point, Attributes)]
attributesPictureAndSelB :: UIStyle -> Maybe SearchExp -> Region -> BufferM [(Point, Attributes)]
-- | Arrange a list of items in columns over maximum
-- maxNumberOfLines lines
arrangeItems :: [Text] -> Int -> Int -> [Text]
-- | Arrange a list of items in columns over numberOfLines lines.
--
-- TODO: proper Text/YiString implementation
arrangeItems' :: [Text] -> Int -> Int -> (Int, [Text])
-- | Line numbers.
module Yi.UI.LineNumbers
-- | Get the buffer-local line number setting.
getDisplayLineNumbersLocal :: BufferM (Maybe Bool)
-- | Set the buffer-local line number setting. Nothing: use global setting
-- Just True: display line numbers only in this buffer Just False: hide
-- line numbers only in this buffer
setDisplayLineNumbersLocal :: Maybe Bool -> BufferM ()
instance GHC.Generics.Generic Yi.UI.LineNumbers.DisplayLineNumbersLocal
instance Data.Default.Class.Default Yi.UI.LineNumbers.DisplayLineNumbersLocal
instance Data.Binary.Class.Binary Yi.UI.LineNumbers.DisplayLineNumbersLocal
instance Yi.Types.YiVariable Yi.UI.LineNumbers.DisplayLineNumbersLocal
-- | The top level editor state, and operations on it. This is inside an
-- internal module for easy re-export with Yi.Types bits.
module Yi.Editor
-- | The Editor state
data Editor
Editor :: !NonEmpty BufferRef -> !Map BufferRef FBuffer -> !Int -> !PointedList Tab -> !DynamicState -> !Statuses -> !Int -> !Killring -> !Maybe SearchExp -> !Direction -> ![Event] -> !Map BufferRef (EditorM ()) -> Editor
-- | Stack of all the buffers. Invariant: first buffer is the current one.
[bufferStack] :: Editor -> !NonEmpty BufferRef
[buffers] :: Editor -> !Map BufferRef FBuffer
-- | Supply for buffer, window and tab ids.
[refSupply] :: Editor -> !Int
-- | current tab contains the visible windows pointed list.
[tabs_] :: Editor -> !PointedList Tab
-- | dynamic components
[dynamic] :: Editor -> !DynamicState
[statusLines] :: Editor -> !Statuses
[maxStatusHeight] :: Editor -> !Int
[killring] :: Editor -> !Killring
-- | currently highlighted regex (also most recent regex for use in vim
-- bindings)
[currentRegex] :: Editor -> !Maybe SearchExp
[searchDirection] :: Editor -> !Direction
-- | Processed events that didn't yield any action yet.
[pendingEvents] :: Editor -> ![Event]
-- | Actions to be run when the buffer is closed; should be scrapped.
[onCloseActions] :: Editor -> !Map BufferRef (EditorM ())
data EditorM a
class (Monad m, MonadState Editor m) => MonadEditor m
askCfg :: MonadEditor m => m Config
withEditor :: MonadEditor m => EditorM a -> m a
withEditor_ :: MonadEditor m => EditorM a -> m ()
runEditor :: Config -> EditorM a -> Editor -> (Editor, a)
-- | Shows the current key bindings in a new window
acceptedInputsOtherWindow :: EditorM ()
addJumpAtE :: Point -> EditorM ()
addJumpHereE :: EditorM ()
alternateBufferE :: Int -> EditorM ()
askConfigVariableA :: (YiConfigVariable b, MonadEditor m) => m b
-- | Return the buffers we have, in no particular order
bufferSet :: Editor -> [FBuffer]
buffersA :: Lens' Editor (Map BufferRef FBuffer)
-- | Close current buffer and window, unless it's the last one.
closeBufferAndWindowE :: EditorM ()
-- | Close a buffer. Note: close the current buffer if the empty string is
-- given
closeBufferE :: Text -> EditorM ()
-- | Make the current window the only window on the screen
closeOtherE :: EditorM ()
-- | Clear the status line
clrStatus :: EditorM ()
-- | Return a prefix that can be removed from all buffer paths while
-- keeping them unique.
commonNamePrefix :: Editor -> [FilePath]
-- | Return the current buffer
currentBuffer :: Editor -> BufferRef
currentRegexA :: Lens' Editor (Maybe SearchExp)
currentWindowA :: Lens' Editor Window
-- | Delete a buffer (and release resources associated with it).
deleteBuffer :: MonadEditor m => BufferRef -> m ()
-- | 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.
deleteTabE :: EditorM ()
doesBufferNameExist :: Text -> Editor -> Bool
-- | The initial state
emptyEditor :: Editor
findBuffer :: MonadEditor m => BufferRef -> m (Maybe FBuffer)
-- | Find buffer with this key
findBufferWith :: BufferRef -> Editor -> FBuffer
-- | Find buffers with this name
findBufferWithName :: Text -> Editor -> [BufferRef]
findWindowWith :: WindowRef -> Editor -> Window
-- | bring the editor focus the window with the given key.
--
-- Fails if no window with the given key is found.
focusWindowE :: WindowRef -> EditorM ()
getBufferStack :: MonadEditor m => m (NonEmpty FBuffer)
-- | Find buffer with given name. Fail if not found.
getBufferWithName :: MonadEditor m => Text -> m BufferRef
getBufferWithNameOrCurrent :: MonadEditor m => Text -> m BufferRef
-- | Dynamically-extensible state components.
--
-- These hooks are used by keymaps to store values that result from
-- Actions (i.e. that restult 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
getEditorDyn :: (MonadEditor m, YiVariable a, Default a, Functor m) => m a
-- | Return the contents of the yank register
getRegE :: EditorM YiString
jumpBackE :: EditorM ()
jumpForwardE :: EditorM ()
killringA :: Lens' Editor Killring
-- | Next variant of the current layout manager, as given by
-- nextVariant
layoutManagerNextVariantE :: EditorM ()
-- | Previous variant of the current layout manager, as given by
-- previousVariant
layoutManagerPreviousVariantE :: EditorM ()
-- | Cycle to the next layout manager, or the first one if the current one
-- is nonstandard.
layoutManagersNextE :: EditorM ()
-- | Cycle to the previous layout manager, or the first one if the current
-- one is nonstandard.
layoutManagersPreviousE :: EditorM ()
-- | Prints the description of the current layout manager in the status bar
layoutManagersPrintMsgE :: EditorM ()
maxStatusHeightA :: Lens' Editor Int
-- | Moves the focused tab to the given index, or to the end if the index
-- is not specified.
moveTabE :: Maybe Int -> EditorM ()
-- | Swap focused window with the next one
moveWinNextE :: EditorM ()
-- | Swap focused window with the previous one
moveWinPrevE :: EditorM ()
-- | 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)
newBufferE :: BufferId -> YiString -> EditorM BufferRef
-- | Like newBufferE but defaults to empty contents.
newEmptyBufferE :: BufferId -> EditorM BufferRef
-- | Creates a new tab containing a window that views the current buffer.
newTabE :: EditorM ()
-- | Creates an in-memory buffer with a unique name.
newTempBufferE :: EditorM BufferRef
-- | Create a new window onto the given buffer.
newWindowE :: Bool -> BufferRef -> EditorM Window
-- | Moves to the next tab in the round robin set of tabs
nextTabE :: EditorM ()
-- | Rotate focus to the next window
nextWinE :: EditorM ()
onCloseActionsA :: Lens' Editor (Map BufferRef (EditorM ()))
pendingEventsA :: Lens' Editor [Event]
-- | Rotate focus to the previous window
prevWinE :: EditorM ()
-- | Moves to the previous tab in the round robin set of tabs
previousTabE :: EditorM ()
-- | Prints a message with defaultStyle.
printMsg :: MonadEditor m => Text -> m ()
-- | Prints a all given messages with defaultStyle.
printMsgs :: MonadEditor m => [Text] -> m ()
printStatus :: MonadEditor m => Status -> m ()
-- | Moves the focused window to the first window, and moves all other
-- windows down the stack.
pushWinToFirstE :: EditorM ()
-- | Insert a value into the extensible state, keyed by its type
putEditorDyn :: (MonadEditor m, YiVariable a, Functor m) => a -> m ()
searchDirectionA :: Lens' Editor Direction
-- | Sets the given divider position on the current tab
setDividerPosE :: DividerRef -> DividerPosition -> EditorM ()
-- | Put string into yank register
setRegE :: YiString -> EditorM ()
-- | Set the "background" status line
setStatus :: MonadEditor m => Status -> m ()
-- | Switch focus to some other window. If none is available, create one.
shiftOtherWindow :: MonadEditor m => m ()
-- | Split the current window, opening a second window onto current buffer.
-- TODO: unfold newWindowE here?
splitE :: EditorM ()
statusLine :: Editor -> [Text]
statusLineInfo :: Editor -> Status
statusLinesA :: Lens' Editor Statuses
-- | 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.
stringToNewBuffer :: MonadEditor m => BufferId -> YiString -> m BufferRef
-- | Swaps the focused window with the first window. Useful for layouts
-- such as HPairOneStack, for which the first window is the
-- largest.
swapWinWithFirstE :: EditorM ()
-- | Attach the specified buffer to the current window
switchToBufferE :: BufferRef -> EditorM ()
-- | Switch to the buffer specified as parameter. If the buffer name is
-- empty, switch to the next buffer.
switchToBufferWithNameE :: Text -> EditorM ()
tabsA :: Lens' Editor (PointedList Tab)
-- | Close the current window. If there is only one tab open and the tab
-- contains only one window then do nothing.
tryCloseE :: EditorM ()
windows :: Editor -> PointedList Window
windowsA :: Lens' Editor (PointedList Window)
-- | Return the windows that are currently open on the buffer whose key is
-- given
windowsOnBufferE :: BufferRef -> EditorM [Window]
-- | Perform action with current window's buffer
withCurrentBuffer :: MonadEditor m => BufferM a -> m a
withEveryBuffer :: MonadEditor m => BufferM a -> m [a]
-- | Perform action with any given buffer, using the last window that was
-- used for that buffer.
withGivenBuffer :: MonadEditor m => BufferRef -> BufferM a -> m a
-- | Perform action with any given buffer
withGivenBufferAndWindow :: MonadEditor m => Window -> BufferRef -> BufferM a -> m a
-- | 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.
withOtherWindow :: MonadEditor m => m a -> m a
withWindowE :: Window -> BufferM a -> EditorM a
instance Data.Binary.Class.Binary Yi.Types.Editor
-- | Tabs.
module Yi.UI.TabBar
-- | A TabDescr describes the properties of a UI tab independent of the
-- particular GUI in use.
data TabDescr
TabDescr :: Text -> Bool -> TabDescr
[tabText] :: TabDescr -> Text
[tabInFocus] :: TabDescr -> Bool
type TabBarDescr = PointedList TabDescr
tabBarDescr :: Editor -> TabBarDescr
tabAbbrevTitle :: Text -> Text
instance GHC.Classes.Eq Yi.UI.TabBar.TabDescr
instance GHC.Show.Show Yi.UI.TabBar.TabDescr
module Yi.UI.SimpleLayout
data Rect
Rect :: !Int -> !Int -> !Int -> !Int -> Rect
[offsetX] :: Rect -> !Int
[offsetY] :: Rect -> !Int
[sizeX] :: Rect -> !Int
[sizeY] :: Rect -> !Int
data Layout
Layout :: !Rect -> !Map WindowRef (Rect, HasNeighborWest) -> !Rect -> Layout
[tabbarRect] :: Layout -> !Rect
[windowRects] :: Layout -> !Map WindowRef (Rect, HasNeighborWest)
[promptRect] :: Layout -> !Rect
data Point2D
Point2D :: !Int -> !Int -> Point2D
[pointCol] :: Point2D -> !Int
[pointRow] :: Point2D -> !Int
data Size2D
Size2D :: !Int -> !Int -> Size2D
[sizeWidth] :: Size2D -> !Int
[sizeHeight] :: Size2D -> !Int
coordsOfCharacterB :: Size2D -> Point -> Point -> BufferM (Maybe Point2D)
layout :: Int -> Int -> Editor -> (Editor, Layout)
verticalOffsetsForWindows :: Int -> PointedList Window -> PointedList Int
-- | A module for CTags integration. Note that this reads the ‘tags’ file
-- produced by hasktags, not the ‘TAGS’ file which uses a
-- different format (etags).
module Yi.Tag
-- | Find the location of a tag using the tag table. Returns a full path
-- and line number
lookupTag :: Tag -> TagTable -> [(FilePath, Int)]
-- | Read in a tag file from the system
importTagTable :: FilePath -> IO TagTable
-- | Gives all the possible expanded tags that could match a given
-- prefix
hintTags :: TagTable -> Text -> [Text]
-- | Extends the string to the longest certain length
completeTag :: TagTable -> Text -> Text
newtype Tag
Tag :: Text -> Tag
[_unTag] :: Tag -> Text
unTag' :: Tag -> Text
data TagTable
TagTable :: FilePath -> FilePath -> Map Tag [(FilePath, Int)] -> CompletionTree Text -> TagTable
-- | local name of the tag file TODO: reload if this file is changed
[tagFileName] :: TagTable -> FilePath
-- | path to the tag file directory tags are relative to this path
[tagBaseDir] :: TagTable -> FilePath
-- | map from tags to files
[tagFileMap] :: TagTable -> Map Tag [(FilePath, Int)]
-- | trie to speed up tag hinting
[tagCompletionTree] :: TagTable -> CompletionTree Text
-- | Get the currently registered tag table
getTags :: EditorM (Maybe TagTable)
-- | Set a new TagTable
setTags :: TagTable -> EditorM ()
-- | Reset the TagTable
resetTags :: EditorM ()
tagsFileList :: Field [FilePath]
-- | Super simple parsing CTag format 1 parsing algorithm TODO: support
-- search patterns in addition to lineno
readCTags :: Text -> Map Tag [(FilePath, Int)]
instance Data.Binary.Class.Binary Yi.Tag.Tag
instance GHC.Classes.Ord Yi.Tag.Tag
instance GHC.Classes.Eq Yi.Tag.Tag
instance GHC.Show.Show Yi.Tag.Tag
instance GHC.Generics.Generic Yi.Tag.TagTable
instance Data.Binary.Class.Binary Yi.Tag.Tags
instance Data.Default.Class.Default Yi.Tag.Tags
instance Yi.Types.YiVariable Yi.Tag.Tags
instance Data.Binary.Class.Binary Yi.Tag.TagTable
instance Data.Default.Class.Default Yi.Tag.TagsFileList
instance Yi.Types.YiConfigVariable Yi.Tag.TagsFileList
-- | Internal use for Yi.Search.
module Yi.Search.Internal
-- | Put regex into regex register
setRegexE :: SearchExp -> EditorM ()
-- | Clear the regex register
resetRegexE :: EditorM ()
-- | Return contents of regex register
getRegexE :: EditorM (Maybe SearchExp)
-- | emacs-style rectangle manipulation functions.
module Yi.Rectangle
-- | Get the selected region as a rectangle. Returns the region extended to
-- lines, plus the start and end columns of the rectangle.
getRectangle :: BufferM (Region, Int, Int)
-- | Split text at the boundaries given
multiSplit :: [Int] -> YiString -> [YiString]
onRectangle :: (Int -> Int -> YiString -> YiString) -> BufferM ()
openRectangle :: BufferM ()
stringRectangle :: YiString -> BufferM ()
killRectangle :: EditorM ()
yankRectangle :: EditorM ()
-- | Keymap, YiM and Actions.
module Yi.Keymap
data Action
YiA :: YiM a -> Action
EditorA :: EditorM a -> Action
BufferA :: BufferM a -> Action
emptyAction :: Action
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 KeymapSet
KeymapSet :: Keymap -> Keymap -> KeymapSet
-- | Content of the top-level loop.
[topKeymap] :: KeymapSet -> Keymap
-- | For insertion-only modes
[insertKeymap] :: KeymapSet -> Keymap
topKeymapA :: Lens' KeymapSet Keymap
insertKeymapA :: Lens' KeymapSet Keymap
extractTopKeymap :: KeymapSet -> Keymap
modelessKeymapSet :: Keymap -> KeymapSet
-- | The type of user-bindable functions TODO: doc how these are actually
-- user-bindable are they?
newtype YiM a
YiM :: ReaderT Yi IO a -> YiM a
[runYiM] :: YiM a -> ReaderT Yi IO a
withUI :: (UI Editor -> IO a) -> YiM a
unsafeWithEditor :: Config -> MVar YiVar -> EditorM a -> IO a
readEditor :: MonadEditor m => (Editor -> a) -> m a
catchDynE :: Exception exception => YiM a -> (exception -> YiM a) -> YiM a
catchJustE :: Exception e => (e -> Maybe b) -> YiM a -> (b -> YiM a) -> YiM a
handleJustE :: Exception e => (e -> Maybe b) -> (b -> YiM a) -> YiM a -> YiM a
class YiAction a x | a -> x
makeAction :: (YiAction a x, Show x) => a -> Action
data Yi
Yi :: UI Editor -> ([Event] -> IO ()) -> (IsRefreshNeeded -> [Action] -> IO ()) -> Config -> MVar YiVar -> Yi
[yiUi] :: Yi -> UI Editor
-- | input stream
[yiInput] :: Yi -> [Event] -> IO ()
-- | output stream
[yiOutput] :: Yi -> IsRefreshNeeded -> [Action] -> IO ()
[yiConfig] :: Yi -> Config
-- | The only mutable state in the program
[yiVar] :: Yi -> MVar YiVar
data IsRefreshNeeded
MustRefresh :: IsRefreshNeeded
NoNeedToRefresh :: IsRefreshNeeded
data YiVar
YiVar :: !Editor -> !SubprocessId -> !Map SubprocessId SubprocessInfo -> YiVar
[yiEditor] :: YiVar -> !Editor
[yiSubprocessIdSupply] :: YiVar -> !SubprocessId
[yiSubprocesses] :: YiVar -> !Map SubprocessId SubprocessInfo
-- | write a returns a keymap that just outputs the action
-- a.
write :: (MonadInteract m Action ev, YiAction a x, Show x) => a -> m ()
-- | 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.
withModeY :: (forall syntax. Mode syntax -> YiM ()) -> YiM ()
yiSubprocessesA :: Lens' YiVar (Map SubprocessId SubprocessInfo)
yiEditorA :: Lens' YiVar Editor
yiSubprocessIdSupplyA :: Lens' YiVar SubprocessId
yiConfigA :: Lens' Yi Config
yiInputA :: Lens' Yi ([Event] -> IO ())
yiOutputA :: Lens' Yi (IsRefreshNeeded -> [Action] -> IO ())
yiUiA :: Lens' Yi (UI Editor)
yiVarA :: Lens' Yi (MVar YiVar)
instance Yi.Keymap.YiAction (GHC.Types.IO x) x
instance Yi.Keymap.YiAction (Yi.Types.YiM x) x
instance Yi.Keymap.YiAction (Yi.Types.EditorM x) x
instance Yi.Keymap.YiAction (Yi.Types.BufferM x) x
instance Yi.Keymap.YiAction Yi.Types.Action ()
-- | Combinators for building keymaps.
module Yi.Keymap.Keys
data Event
Event :: Key -> [Modifier] -> Event
data Key
KEsc :: Key
KFun :: Int -> Key
KPrtScr :: Key
KPause :: Key
KASCII :: Char -> Key
KBS :: Key
KIns :: Key
KHome :: Key
KPageUp :: Key
KDel :: Key
KEnd :: Key
KPageDown :: Key
KNP5 :: Key
KUp :: Key
KMenu :: Key
KLeft :: Key
KDown :: Key
KRight :: Key
KEnter :: Key
KTab :: Key
data Modifier
MShift :: Modifier
MCtrl :: Modifier
MMeta :: Modifier
MSuper :: Modifier
MHyper :: Modifier
prettyEvent :: Event -> String
-- | Map an Event to a Char. This is used in the emacs keymap for Ctrl-Q
-- and vim keymap insertSpecialChar
eventToChar :: Event -> Char
-- | Abstraction of the automaton state.
data InteractState event w
Ambiguous :: [(Int, w, P event w)] -> InteractState event w
Waiting :: InteractState event w
Dead :: InteractState event w
Running :: w -> P event w -> InteractState event w
-- | Operational representation of a process
data P event w
End :: P event w
Chain :: P event mid -> P mid w -> P event w
-- | Interactive process description
data I ev w a
-- | Abstraction of monadic interactive processes
class (Eq w, Monad m, Alternative m, Applicative m, MonadPlus m) => MonadInteract m w e | m -> w e
-- | Consumes and returns the next character. Fails if there is no input
-- left, or outside the given bounds.
eventBounds :: (MonadInteract m w e, Ord e) => Maybe e -> Maybe e -> m e
adjustPriority :: MonadInteract m w e => Int -> m ()
deprioritize :: MonadInteract f w e => f ()
(<||) :: MonadInteract f w e => f a -> f a -> f a
infixl 3 <||
(||>) :: MonadInteract f w e => f a -> f a -> f a
-- | Just like (<||) but in prefix form. It deprioritizes
-- the second argument.
important :: MonadInteract f w e => f a -> f a -> f a
accepted :: Show ev => Int -> P ev w -> [[Text]]
runWrite :: Eq w => P event w -> [event] -> [w]
processOneEvent :: Eq w => P event w -> event -> ([w], P event w)
computeState :: Eq w => P event w -> InteractState event w
oneOf :: (Ord event, MonadInteract m w event, MonadFail m) => [event] -> m event
anyEvent :: (Ord event, MonadInteract m w event) => m event
eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e
-- | Parses and returns the specified character.
event :: (Ord event, MonadInteract m w event) => event -> m event
-- | Parses and returns the specified list of events (lazily).
events :: (Ord event, MonadInteract m w event) => [event] -> m [event]
-- | Combines all parsers in the specified list.
choice :: (MonadInteract m w e, MonadFail m) => [m a] -> m a
-- | option x p will either parse p or return x
-- without consuming any input.
option :: MonadInteract m w e => a -> m a -> m a
mkAutomaton :: Eq w => I ev w a -> P ev w
idAutomaton :: (Ord a, Eq a) => P a a
printableChar :: (MonadFail m, MonadInteract m w Event) => m Char
-- | Parse any character that can be inserted in the text.
textChar :: KeymapM Char
charOf :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Char -> Char -> m Char
shift :: Event -> Event
meta :: Event -> Event
ctrl :: Event -> Event
super :: Event -> Event
hyper :: Event -> Event
-- | Convert a special key into an event
spec :: Key -> Event
char :: Char -> Event
-- |
-- p >>! act = p >> 'write' act
--
(>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> a -> m ()
infixl 1 >>!
-- |
-- p >>=! act = p >>= 'write' . act
--
(>>=!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> (b -> a) -> m ()
infixl 1 >>=!
-- |
-- ev ?>> proc = event ev >> proc
--
(?>>) :: MonadInteract m action Event => Event -> m a -> m a
infixr 0 ?>>
-- |
-- ev ?>>! act = event ev >> write act
--
(?>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => Event -> a -> m ()
infixr 0 ?>>!
-- |
-- ev ?*>> proc = events ev >> proc
--
(?*>>) :: MonadInteract m action Event => [Event] -> m a -> m a
infixr 0 ?*>>
-- |
-- ev ?*>>! act = events ev >> write act
--
(?*>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => [Event] -> a -> m ()
infixr 0 ?*>>!
ctrlCh :: Char -> Event
metaCh :: Char -> Event
hyperCh :: Char -> Event
-- | optMod f ev produces a MonadInteract that consumes
-- ev or f ev
optMod :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Event -> m Event
pString :: MonadInteract m w Event => String -> m [Event]
-- | This module provides assistance in implementing "hooks" in Yi. This
-- module provides no major new functionality -- only assistance in using
-- YiConfigVariables more easily to implement hooks.
--
-- We consider a simple example. Suppose we have a function
--
--
-- promptForFile :: Maybe FilePath -> YiM FilePath
--
--
-- which prompts the user to select a file from their file system,
-- starting with the provided directory (if actually provided). Since
-- this is a frequent task in Yi, it is important for it to be as
-- user-friendly as possible. If opinions vary on the meaning of
-- "user-friendly", then we would really like to provide multiple
-- implementations of promptForFile, and allow users to select
-- which implementation to use in their config files.
--
-- A way to achieve this is using hooks, as follows:
--
--
-- -- create a new type
-- newtype FilePrompter = FilePrompter
-- { runFilePrompter :: Maybe FilePath -> YiM FilePath }
-- deriving (Typeable)
-- $(nameDeriveAccessors ''FilePrompter (n -> Just (n ++ "A")))
--
-- -- give some implementations
-- filePrompter1, filePrompter2, filePrompter3 :: FilePrompter
-- ...
--
-- -- declare FilePrompter as a YiConfigVariable (so it can go in the Config)
-- instance YiConfigVariable FilePrompter
--
-- -- specify the default FilePrompter
-- instance Default FilePrompter where
-- def = filePrompter1
--
-- -- replace the old promptForFile function with a shim
-- promptForFile :: Maybe FilePath -> YiM FilePath
-- promptForFile = runHook runFilePrompter
--
-- -- provide a custom-named Field for Yi.Config.Simple (not
-- -- strictly necessary, but user-friendly)
-- filePrompter :: Field FilePrompter
-- filePrompter = customVariable
--
--
-- The user can write
--
--
-- ...
-- filePrompter %= filePrompter2
-- ...
--
--
-- in their config file, and calls to promptForFile will now use
-- the different prompter. Library code which called
-- promptForFile does not need to be changed, but it gets the
-- new filePrompter2 behaviour automatically.
--
-- See Yi.Eval for a real example of hooks.
module Yi.Hooks
-- | Looks up the configured value for the hook, and runs it. The argument
-- to runHook will typically be a record accessor. See
-- HookType for the valid hook types.
runHook :: (HookType ty, YiConfigVariable var) => (var -> ty) -> ty
-- | The class of "valid hooks". This class is exported abstractly, but the
-- instances can be phrased quite simply: the functions (of arbitrarily
-- many arguments, including zero) which run in either the EditorM
-- or YiM monads.
--
-- A typical example would be something like
--
-- Int -> String -> EditorM String.
class HookType ty
-- | Accessor for any YiConfigVariable, to be used by modules
-- defining YiConfigVariables. Such modules should provide a
-- custom-named field. For instance, take the following hypothetical
-- YiConfigVariable:
--
-- @newtype UserName = UserName { unUserName :: String }
-- deriving(Typeable, Binary, Default) instance YiConfigVariable UserName
--
-- $(nameDeriveAccessors ''UserName (n -> Just (n ++ "A")))
--
-- userName :: Field String userName = unUserNameA .
-- customVariable@
--
-- Here, the hypothetical library would provide the field
-- userName to be used in preference to customVariable.
customVariable :: YiConfigVariable a => Field a
-- | Fields that can be modified with all lens machinery.
type Field a = Lens' Config a
instance Yi.Hooks.HookType (Yi.Types.EditorM a)
instance Yi.Hooks.HookType (Yi.Types.YiM a)
instance Yi.Hooks.HookType b => Yi.Hooks.HookType (a -> b)
-- | Provides functions for calling Hoogle on the commandline, and
-- processing results into a form useful for completion or insertion.
module Yi.Hoogle
-- | Remove anything starting with uppercase letter. These denote either
-- module names or types.
caseSensitize :: [YiString] -> [YiString]
-- | Hoogle's output includes a sort of type keyword, telling whether a hit
-- is a package name, syntax, a module name, etc. But we care primarily
-- about the function names, so we filter out anything containing the
-- keywords.
gv :: [YiString] -> [YiString]
-- | Query Hoogle, with given search and options. This errors out on no
-- results or if the hoogle command is not on path.
hoogleRaw :: YiString -> YiString -> IO [YiString]
-- | Filter the output of hoogleRaw to leave just functions.
hoogleFunctions :: YiString -> IO [YiString]
-- | Return module-function pairs.
hoogleFunModule :: YiString -> IO [(YiString, YiString)]
-- | Call out to hoogleFunModule, and overwrite the word at point
-- with the first returned function.
hoogle :: YiM YiString
-- | Call out to hoogleRaw, and print inside the Minibuffer the
-- results of searching Hoogle with the word at point.
hoogleSearch :: YiM ()
-- | ‘Command history’ implementation.
module Yi.History
newtype Histories
Histories :: Map Text History -> Histories
data History
History :: Int -> [Text] -> Text -> History
[_historyCurrent] :: History -> Int
[_historyContents] :: History -> [Text]
[_historyPrefix] :: History -> Text
dynKeyA :: (Default v, Ord k) => k -> Lens' (Map k v) v
miniBuffer :: Text
historyUp :: EditorM ()
historyDown :: EditorM ()
historyStart :: EditorM ()
-- | Start an input session with History
historyStartGen :: Text -> EditorM ()
historyFinish :: EditorM ()
-- | Finish the current input session with history.
historyFinishGen :: Text -> EditorM Text -> EditorM ()
historyFind :: [Text] -> Int -> Int -> Int -> Text -> Int
historyMove :: Text -> Int -> EditorM ()
historyMoveGen :: Text -> Int -> EditorM Text -> EditorM Text
historyPrefixSet :: Text -> EditorM ()
historyPrefixSet' :: Text -> Text -> EditorM ()
-- | Helper that sets the given history at ident and putEditorDyns
-- the result.
setHistory :: (MonadEditor m, Functor m) => Text -> History -> Map Text History -> m ()
instance GHC.Classes.Eq Yi.History.History
instance GHC.Show.Show Yi.History.History
instance GHC.Classes.Eq Yi.History.Histories
instance GHC.Show.Show Yi.History.Histories
instance Data.Binary.Class.Binary Yi.History.Histories
instance Data.Default.Class.Default Yi.History.Histories
instance Yi.Types.YiVariable Yi.History.Histories
instance Data.Default.Class.Default Yi.History.History
instance Data.Binary.Class.Binary Yi.History.History
-- | Search/Replace functions
module Yi.Search
-- | Put regex into regex register
setRegexE :: SearchExp -> EditorM ()
-- | Clear the regex register
resetRegexE :: EditorM ()
-- | Return contents of regex register
getRegexE :: EditorM (Maybe SearchExp)
-- | Global searching. Search for regex and move point to that position.
-- Nothing means reuse the last regular expression. Just
-- s means use s as the new regular expression. Direction
-- of search can be specified as either Backward or
-- Forward (forwards in the buffer). Arguments to modify the
-- compiled regular expression can be supplied as well.
type SearchMatch = Region
data SearchResult
PatternFound :: SearchResult
PatternNotFound :: SearchResult
SearchWrapped :: SearchResult
data SearchOption
-- | Compile for matching that ignores char case
IgnoreCase :: SearchOption
-- | Compile for newline-insensitive matching
NoNewLine :: SearchOption
-- | Treat the input not as a regex but as a literal string to search for.
QuoteRegex :: SearchOption
doSearch :: Maybe String -> [SearchOption] -> Direction -> EditorM SearchResult
-- | Set up a search.
searchInit :: String -> Direction -> [SearchOption] -> EditorM (SearchExp, Direction)
-- | Do a search, placing cursor at first char of pattern, if found.
-- Keymaps may implement their own regex language. How do we provide for
-- this? Also, what's happening with ^ not matching sol?
continueSearch :: (SearchExp, Direction) -> BufferM SearchResult
-- | Create a SearchExp that matches exactly its argument
makeSimpleSearch :: YiString -> SearchExp
-- | Search and Replace all within the current region. Note the region is
-- the final argument since we might perform the same search and replace
-- over multiple regions however we are unlikely to perform several
-- search and replaces over the same region since the first such may
-- change the bounds of the region.
searchReplaceRegionB :: YiString -> YiString -> Region -> BufferM Int
-- | Peform a search and replace on the selection
searchReplaceSelectionB :: YiString -> YiString -> BufferM Int
-- | Replace a string by another everywhere in the document
replaceString :: YiString -> YiString -> BufferM Int
searchAndRepRegion :: YiString -> YiString -> Bool -> Region -> EditorM Bool
-- | Search and replace in the given region.
--
-- If the input boolean is True, then the replace is done globally,
-- otherwise only the first match is replaced. Returns the number of
-- replacements done.
searchAndRepRegion0 :: SearchExp -> YiString -> Bool -> Region -> BufferM Int
-- | Search and replace in the region defined by the given unit. The rest
-- is as in searchAndRepRegion.
searchAndRepUnit :: YiString -> YiString -> Bool -> TextUnit -> EditorM Bool
isearchInitE :: Direction -> EditorM ()
isearchIsEmpty :: EditorM Bool
isearchAddE :: Text -> EditorM ()
isearchPrevE :: EditorM ()
isearchNextE :: EditorM ()
isearchWordE :: EditorM ()
isearchHistory :: Int -> EditorM ()
isearchDelE :: EditorM ()
-- | Cancel a search. Also see isearchCancelWithE.
isearchCancelE :: EditorM ()
-- | Succesfully finish a search. Also see isearchFinishWithE.
isearchFinishE :: EditorM ()
-- | Wrapper over isearchEndWith that passes through the action and
-- marks the search as unsuccessful (i.e. when the user wants to jump
-- back to where the search started).
isearchCancelWithE :: EditorM a -> EditorM ()
-- | Wrapper over isearchEndWith that passes through the action and
-- accepts the search as successful (i.e. when the user wants to stay at
-- the result).
isearchFinishWithE :: EditorM a -> EditorM ()
-- | Find the next match and select it. Point is end, mark is beginning.
qrNext :: Window -> BufferRef -> SearchExp -> EditorM ()
-- | Replace all the remaining occurrences.
qrReplaceAll :: Window -> BufferRef -> SearchExp -> YiString -> EditorM ()
-- | We replace the currently selected match and then move to the next
-- match.
qrReplaceOne :: Window -> BufferRef -> SearchExp -> YiString -> EditorM ()
-- | Exit from query/replace.
qrFinish :: EditorM ()
instance GHC.Classes.Eq Yi.Search.SearchResult
instance GHC.Show.Show Yi.Search.Isearch
instance Data.Binary.Class.Binary Yi.Search.Isearch
instance Data.Default.Class.Default Yi.Search.Isearch
instance Yi.Types.YiVariable Yi.Search.Isearch
-- | This module implements persistence across different Yi runs. It
-- includes minibuffer command history, marks etc. Warning: Current
-- version will _not_ check whether two or more instances of Yi are run
-- at the same time.
module Yi.PersistentState
-- | Loads a persistent state, and sets Yi state variables accordingly.
loadPersistentState :: YiM ()
-- | Here is a persistent history saving part. We assume each command is a
-- single line. To add new components, one has to:
--
--
-- - add new field in PersistentState structure,
-- - add write and read parts in
-- loadPersistentState/savePersistentState,
-- - add a trimming code in savePersistentState to prevent
-- blowing up of save file.
--
savePersistentState :: YiM ()
maxHistoryEntries :: Field Int
persistentSearch :: Field Bool
instance Data.Binary.Class.Binary Yi.PersistentState.PersistentSearch
instance Data.Default.Class.Default Yi.PersistentState.PersistentSearch
instance Yi.Types.YiConfigVariable Yi.PersistentState.PersistentSearch
instance GHC.Generics.Generic Yi.PersistentState.PersistentState
instance Data.Binary.Class.Binary Yi.PersistentState.MaxHistoryEntries
instance Data.Default.Class.Default Yi.PersistentState.MaxHistoryEntries
instance Yi.Types.YiConfigVariable Yi.PersistentState.MaxHistoryEntries
instance Data.Binary.Class.Binary Yi.PersistentState.PersistentState
-- | Collection of functions for completion and matching.
module Yi.Completion
-- | Complete a string given a user input string, a matching function and a
-- list of possibilites. Matching function should return the part of the
-- string that matches the user string.
completeInList :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
completeInList' :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
-- | Same as completeInList, but maps showFunction on
-- possible matches when printing
completeInListCustomShow :: (Text -> Text) -> Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
-- | Return the longest common prefix of a set of lists.
--
--
-- P(xs) === all (isPrefixOf (commonPrefix xs)) xs
-- length s > length (commonPrefix xs) --> not (all (isPrefixOf s) xs)
--
commonPrefix :: Eq a => [[a]] -> [a]
-- | Prefix matching function, for use with completeInList
prefixMatch :: Text -> Text -> Maybe Text
-- | Text from the match up to the end, for use with completeInList
infixUptoEndMatch :: Text -> Text -> Maybe Text
-- | A simple fuzzy match algorithm. Example: "abc" matches "a1b2c"
subsequenceMatch :: String -> String -> Bool
-- | A simple fuzzy match algorithm. Example: "abc" matches "a1b2c"
subsequenceTextMatch :: Text -> Text -> Bool
-- | TODO: this is a terrible function, isn't this just case-insensitive
-- infix? – Fūzetsu
containsMatch' :: Bool -> Text -> Text -> Maybe Text
containsMatch :: Text -> Text -> Maybe Text
containsMatchCaseInsensitive :: Text -> Text -> Maybe Text
-- | Like usual isPrefixOf but user can specify case sensitivity.
-- See toCaseFold for exotic unicode gotchas.
isCasePrefixOf :: Bool -> Text -> Text -> Bool
-- | Module providing text completion functions.
module Yi.TextCompletion
wordComplete :: YiM ()
wordComplete' :: Bool -> YiM ()
wordCompleteString :: YiM Text
wordCompleteString' :: Bool -> YiM Text
-- | Try to complete the current word with occurences found elsewhere in
-- the editor. Further calls try other options.
mkWordComplete :: YiM Text -> (Text -> YiM [Text]) -> ([Text] -> YiM ()) -> (Text -> Text -> Bool) -> YiM Text
-- | Switch out of completion mode.
resetComplete :: EditorM ()
completeWordB :: CompletionScope -> EditorM ()
data CompletionScope
FromCurrentBuffer :: CompletionScope
FromAllBuffers :: CompletionScope
instance GHC.Classes.Eq Yi.TextCompletion.Completion
instance GHC.Show.Show Yi.TextCompletion.Completion
instance GHC.Show.Show Yi.TextCompletion.CompletionScope
instance GHC.Classes.Eq Yi.TextCompletion.CompletionScope
instance Data.Binary.Class.Binary Yi.TextCompletion.Completion
instance Data.Default.Class.Default Yi.TextCompletion.Completion
instance Yi.Types.YiVariable Yi.TextCompletion.Completion
-- | 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.
module Yi.Core
-- | Start up the editor, setting any state with the user preferences and
-- file names passed in, and turning on the UI
startEditor :: Config -> Maybe Editor -> IO ()
-- | Quit.
quitEditor :: YiM ()
-- | Quit with an exit code. (This is used to implement vim's :cq command)
quitEditorWithExitCode :: ExitCode -> YiM ()
-- | Redraw
refreshEditor :: YiM ()
-- | Suspend the program
suspendEditor :: YiM ()
userForceRefresh :: YiM ()
-- | Show an error on the status line and log it.
errorEditor :: Text -> YiM ()
-- | 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?)
closeWindow :: YiM ()
-- | 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.
closeWindowEmacs :: YiM ()
-- | Pipe a string through an external command, returning the stdout chomp
-- any trailing newline (is this desirable?)
--
-- Todo: varients with marks?
runProcessWithInput :: String -> String -> YiM String
-- | Start a subprocess with the given command and arguments.
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
-- | Functions working with the minibuffer.
module Yi.MiniBuffer
-- | Open a minibuffer window with the given prompt and keymap The third
-- argument is an action to perform after the minibuffer is opened such
-- as move to the first occurence of a searched for string. If you don't
-- need this just supply return ()
spawnMinibufferE :: Text -> KeymapEndo -> EditorM BufferRef
-- | withMinibufferFree prompt act: Simple version of
-- withMinibufferGen
withMinibufferFree :: Text -> (Text -> YiM ()) -> YiM ()
-- | withMinibuffer prompt completer act: open a minibuffer with
-- prompt. Once a string s is obtained, run act
-- s. completer can be used to complete functions: it
-- returns a list of possible matches.
withMinibuffer :: Text -> (Text -> YiM [Text]) -> (Text -> YiM ()) -> YiM ()
-- | withMinibufferGen proposal getHint prompt completer onTyping
-- act: open a minibuffer with prompt, and initial content
-- proposal. Once a string s is obtained, run act
-- s. completer can be used to complete inputs by returning
-- an incrementally better match, and getHint can give an immediate
-- feedback to the user on the current input.
--
-- on Typing is an extra action which will fire with every user
-- key-press and receives minibuffer contents. Use something like
-- const $ return () if you don't need this.
withMinibufferGen :: Text -> (Text -> YiM [Text]) -> Text -> (Text -> YiM Text) -> (Text -> YiM ()) -> (Text -> YiM ()) -> YiM ()
-- | Open a minibuffer, given a finite number of suggestions.
withMinibufferFin :: Text -> [Text] -> (Text -> YiM ()) -> YiM ()
-- | Hint function that does nothing, for use with
-- withMinibufferGen
noHint :: a -> YiM [a]
noPossibilities :: String -> YiM [String]
-- | Makes a completion function.
mkCompleteFn :: (Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text) -> (Text -> Text -> Maybe Text) -> (Text -> YiM [Text]) -> Text -> YiM Text
simpleComplete :: (Text -> YiM [Text]) -> Text -> YiM Text
infixComplete :: (Text -> YiM [Text]) -> Text -> YiM Text
infixComplete' :: Bool -> (Text -> YiM [Text]) -> Text -> YiM Text
anyModeByName :: Text -> YiM AnyMode
getAllModeNames :: YiM [Text]
-- | Returns all the buffer names
matchingBufferNames :: YiM [Text]
anyModeByNameM :: Text -> YiM (Maybe AnyMode)
anyModeName :: AnyMode -> Text
-- | Tag a type with a documentation
newtype (:::) t doc
Doc :: t -> (:::) t doc
[fromDoc] :: (:::) t doc -> t
data LineNumber
data RegexTag
data FilePatternTag
data ToKill
newtype CommandArguments
CommandArguments :: [Text] -> CommandArguments
-- | Prompts the user for comment syntax to use for the current mode.
commentRegion :: YiM ()
-- | Prompts for a buffer name, turns it into a BufferRef and passes
-- it on to the handler function. Uses all known buffers for hinting.
promptingForBuffer :: Text -> (BufferRef -> YiM ()) -> ([BufferRef] -> [BufferRef] -> [BufferRef]) -> YiM ()
instance Data.String.IsString t => Data.String.IsString (t Yi.MiniBuffer.::: doc)
instance GHC.Num.Num t => GHC.Num.Num (t Yi.MiniBuffer.::: doc)
instance GHC.Classes.Eq t => GHC.Classes.Eq (t Yi.MiniBuffer.::: doc)
instance GHC.Classes.Eq Yi.MiniBuffer.CommandArguments
instance GHC.Show.Show Yi.MiniBuffer.CommandArguments
instance Yi.MiniBuffer.Promptable Yi.MiniBuffer.CommandArguments
instance Yi.MiniBuffer.DocType Yi.MiniBuffer.FilePatternTag
instance Yi.MiniBuffer.DocType Yi.MiniBuffer.RegexTag
instance Yi.MiniBuffer.DocType Yi.MiniBuffer.ToKill
instance Yi.MiniBuffer.DocType Yi.MiniBuffer.LineNumber
instance (Yi.MiniBuffer.DocType doc, Yi.MiniBuffer.Promptable t) => Yi.MiniBuffer.Promptable (t Yi.MiniBuffer.::: doc)
instance GHC.Show.Show x => GHC.Show.Show (x Yi.MiniBuffer.::: t)
instance Yi.MiniBuffer.Promptable GHC.Base.String
instance Yi.MiniBuffer.Promptable GHC.Types.Char
instance Yi.MiniBuffer.Promptable GHC.Types.Int
instance Yi.MiniBuffer.Promptable Data.Text.Internal.Text
instance Yi.MiniBuffer.Promptable Yi.Rope.YiString
instance Yi.MiniBuffer.Promptable Yi.Buffer.Basic.Direction
instance Yi.MiniBuffer.Promptable Yi.Buffer.TextUnit.TextUnit
instance Yi.MiniBuffer.Promptable Yi.Buffer.Basic.Point
instance Yi.MiniBuffer.Promptable Yi.Types.AnyMode
instance Yi.MiniBuffer.Promptable Yi.Buffer.Basic.BufferRef
instance (Yi.Keymap.YiAction a x, Yi.MiniBuffer.Promptable r) => Yi.Keymap.YiAction (r -> a) x
-- | Common functions used by modes.
module Yi.Mode.Common
type TokenBasedMode tok = Mode (Tree (Tok tok))
-- | The only built in mode of yi
fundamentalMode :: Mode syntax
-- | When applied to an extensions list, creates a modeApplies
-- function.
anyExtension :: [String] -> FilePath -> a -> Bool
-- | When applied to an extensions list and regular expression pattern,
-- creates a modeApplies function.
extensionOrContentsMatch :: [String] -> Parser () -> FilePath -> YiString -> Bool
-- | Specialised version of linearSyntaxMode' for the common case,
-- wrapping up into a Lexer with commonLexer.
linearSyntaxMode :: Show s => s -> TokenLexer AlexState s (Tok t) AlexInput -> (t -> StyleName) -> TokenBasedMode t
-- | Adds a hook to all matching hooks in a list
hookModes :: (AnyMode -> Bool) -> BufferM () -> [AnyMode] -> [AnyMode]
-- | Apply a list of mode hooks to a list of AnyModes
applyModeHooks :: [(AnyMode -> Bool, BufferM ())] -> [AnyMode] -> [AnyMode]
-- | Check whether a mode of the same name is already in modeTable and
-- returns the original mode, if it isn't the case.
lookupMode :: AnyMode -> YiM AnyMode
styleMode :: Show (l s) => StyleLexer l s t i -> TokenBasedMode t
-- | Determines if the file's extension is one of the extensions in the
-- list.
extensionMatches :: [String] -> FilePath -> Bool
-- | Generate a parser for shebang patterns the generated parser will match
-- only if the shebang is at the start of a line
--
-- Examples
--
--
-- shebangParser "runhaskell"
--
--
-- generates a parser that matches "#!/usr/bin/env runhaskell\n" (but
-- also "djsjfaj\n\n\n\r\n#! /usr/bin/env runhaskell
-- \ndkasfkda\n\r\nkasfaj")
--
-- Note: You can get ("runhaskell" :: Parser String) by
-- using the OverloadedStrings extension
--
--
-- shebangParser "python"
--
--
-- generates a parser that matches "#!/usr/bin/env python\n"
--
-- Note: it doesn't match "#!/usr/bin/env python2\n" (that's why
-- the newline is required)
--
-- It is also possible to use more complex parsers:
--
--
-- shebangParser ("python" *> ("2" <|> "3" <|> ""))
--
--
-- generates a parser that matches any of:
--
--
-- - "#!/usr/bin/env python\n"
-- - "#!/usr/bin/env python2\n"
-- - "#!/usr/bin/env python3\n"
--
shebangParser :: Parser a -> Parser ()
-- | Various high-level functions to further classify.
module Yi.Misc
-- | Given a possible starting path (which if not given defaults to the
-- current directory) and a fragment of a path we find all files within
-- the given (or current) directory which can complete the given path
-- fragment. We return a pair of both directory plus the filenames on
-- their own that is without their directories. The reason for this is
-- that if we return all of the filenames then we get a hint
-- which is way too long to be particularly useful.
getAppropriateFiles :: Maybe Text -> Text -> YiM (Text, [Text])
-- | Given a path, trim the file name bit if it exists. If no path given,
-- return current directory.
getFolder :: Maybe String -> IO String
-- | Like M-x cd, it changes the current working directory. Mighty
-- useful when we don't start Yi from the project directory or want to
-- switch projects, as many tools only use the current working directory.
cd :: YiM ()
-- | Shows current working directory. Also see cd.
pwd :: YiM ()
-- | Given a possible path and a prefix, return matching file names.
matchingFileNames :: Maybe Text -> Text -> YiM [Text]
rot13Char :: Char -> Char
-- | Place mark at current point. If there's an existing mark at point
-- already, deactivate mark.
placeMark :: BufferM ()
-- | Select the contents of the whole buffer
selectAll :: BufferM ()
-- | A simple wrapper to adjust the current indentation using the mode
-- specific indentation function but according to the given indent
-- behaviour.
adjIndent :: IndentBehaviour -> BufferM ()
-- | Generic emacs style prompt file action. Takes a prompt and a
-- continuation act and prompts the user with file hints.
promptFile :: Text -> (Text -> YiM ()) -> YiM ()
-- | As promptFile but additionally allows the caller to transform
-- the list of hints arbitrarily, such as only showing directories.
promptFileChangingHints :: Text -> (Text -> [Text] -> YiM [Text]) -> (Text -> YiM ()) -> YiM ()
matchFile :: Text -> Text -> Maybe Text
completeFile :: Text -> Text -> YiM Text
printFileInfoE :: EditorM ()
-- | Prints out the rope of the current buffer as-is to stdout.
--
-- The only way to stop it is to close the buffer in question which
-- should free up the BufferRef.
debugBufferContent :: YiM ()
-- | A simple dired implementation for Yi.
--
-- TODO
--
--
-- - add more comments
-- - Support symlinks
-- - Mark operations
--
--
--
-- - Improve the colouring to show
- loaded buffers
- .hs
-- files
- marked files
-- - Fix old mod dates (> 6months) to show year
-- - Fix the 'number of links' field to show actual values not just
-- 1...
-- - Automatic support for browsing .zip, .gz files etc...
--
module Yi.Dired
dired :: YiM ()
diredDir :: FilePath -> YiM ()
diredDirBuffer :: FilePath -> YiM BufferRef
-- | If file exists, read contents of file into a new buffer, otherwise
-- creating a new empty buffer. Replace the current window with a new
-- window onto the new buffer.
--
-- If the file is already open, just switch to the corresponding buffer.
--
-- Need to clean up semantics for when buffers exist, and how to attach
-- windows to buffers.
--
-- Yi.File module re-exports this, you probably want to import
-- that instead.
--
-- In case of a decoding failure, failure message is returned instead of
-- the BufferRef.
editFile :: FilePath -> YiM (Either Text BufferRef)
instance Data.Binary.Class.Binary Yi.Dired.DiredState
instance Data.Default.Class.Default Yi.Dired.DiredState
instance Yi.Types.YiVariable Yi.Dired.DiredState
instance Data.Binary.Class.Binary Yi.Dired.DiredEntry
instance Data.Binary.Class.Binary Yi.Dired.DiredFileInfo
instance GHC.Generics.Generic Yi.Dired.DiredFileInfo
instance GHC.Classes.Eq Yi.Dired.DiredFileInfo
instance GHC.Show.Show Yi.Dired.DiredFileInfo
instance GHC.Generics.Generic Yi.Dired.DiredEntry
instance GHC.Classes.Eq Yi.Dired.DiredEntry
instance GHC.Show.Show Yi.Dired.DiredEntry
instance GHC.Generics.Generic Yi.Dired.DiredState
instance GHC.Classes.Eq Yi.Dired.DiredState
instance GHC.Show.Show Yi.Dired.DiredState
instance GHC.Generics.Generic Yi.Dired.DiredOpState
instance GHC.Classes.Eq Yi.Dired.DiredOpState
instance GHC.Show.Show Yi.Dired.DiredOpState
instance Data.Default.Class.Default Yi.Dired.DiredOpState
instance Data.Binary.Class.Binary Yi.Dired.DiredOpState
instance Yi.Types.YiVariable Yi.Dired.DiredOpState
module Yi.File
-- | If file exists, read contents of file into a new buffer, otherwise
-- creating a new empty buffer. Replace the current window with a new
-- window onto the new buffer.
--
-- If the file is already open, just switch to the corresponding buffer.
--
-- Need to clean up semantics for when buffers exist, and how to attach
-- windows to buffers.
--
-- Yi.File module re-exports this, you probably want to import
-- that instead.
--
-- In case of a decoding failure, failure message is returned instead of
-- the BufferRef.
editFile :: FilePath -> YiM (Either Text BufferRef)
-- | Tries to open a new buffer with editFile and runs the given
-- action on the buffer handle if it succeeds.
--
-- If the editFile fails, just the failure message is printed.
openingNewFile :: FilePath -> BufferM a -> YiM ()
-- | Same as openingNewFile with no action to run after.
openNewFile :: FilePath -> YiM ()
-- | Try to write a file in the manner of vi/vim Need to catch any
-- exception to avoid losing bindings
viWrite :: YiM ()
-- | Try to write to a named file in the manner of vi/vim
viWriteTo :: Text -> YiM ()
-- | Try to write to a named file if it doesn't exist. Error out if it
-- does.
viSafeWriteTo :: Text -> YiM ()
-- | Write current buffer to disk, if this buffer is associated with a file
fwriteE :: YiM Bool
-- | Write a given buffer to disk if it is associated with a file.
fwriteBufferE :: BufferRef -> YiM Bool
-- | Write all open buffers
fwriteAllY :: YiM Bool
-- | Write current buffer to disk as f. The file is also set to
-- f.
fwriteToE :: Text -> YiM Bool
-- | Make a backup copy of file
backupE :: FilePath -> YiM ()
-- | Revert to the contents of the file on disk
revertE :: YiM ()
-- | Associate buffer with file; canonicalize the given path name.
setFileName :: BufferRef -> FilePath -> YiM ()
-- | Checks if the given buffer deserves a save: whether it's a file buffer
-- and whether it's pointing at a file rather than a directory.
deservesSave :: FBuffer -> YiM Bool
preSaveHooks :: Field [Action]
instance Data.Default.Class.Default Yi.File.PreSaveHooks
instance Yi.Types.YiConfigVariable Yi.File.PreSaveHooks
-- | A Mode for working with buffers showing the results of
-- compilations.
module Yi.Mode.Compilation
mode :: TokenBasedMode Token
-- | Collection of Modes for working with Haskell.
module Yi.Mode.Interactive
mode :: Mode (Tree (Tok Token))
interactId :: Text
-- | TODO: we're just converting back and forth here, historyMoveGen
-- and friends need to migrate to YiString it seems.
interactHistoryMove :: Int -> EditorM ()
interactHistoryFinish :: EditorM ()
interactHistoryStart :: EditorM ()
getInputRegion :: BufferM Region
getInput :: BufferM YiString
setInput :: YiString -> BufferM ()
-- | Open a new buffer for interaction with a process.
spawnProcess :: String -> [String] -> YiM BufferRef
-- | open a new buffer for interaction with a process, using any
-- interactive-derived mode
spawnProcessMode :: Mode syntax -> FilePath -> [String] -> YiM BufferRef
-- | Send the type command to the process
feedCommand :: YiM ()
-- | Send command, recieve reply
queryReply :: BufferRef -> String -> YiM YiString
-- | Evaluator for actions (Action, YiAction). Uses a
-- GHCi session under the hood.
module Yi.Eval
-- | Runs the action, as written by the user.
--
-- The behaviour of this function can be customised by modifying the
-- Evaluator variable.
execEditorAction :: String -> YiM ()
-- | Lists the action names in scope, for use by execEditorAction,
-- and help index.
--
-- The behaviour of this function can be customised by modifying the
-- Evaluator variable.
getAllNamesInScope :: YiM [String]
-- | Describes the named action in scope, for use by help.
--
-- The behaviour of this function can be customised by modifying the
-- Evaluator variable.
describeNamedAction :: String -> YiM String
-- | Config variable for customising the behaviour of
-- execEditorAction and getAllNamesInScope.
--
-- Set this variable using evaluator. See ghciEvaluator
-- and finiteListEvaluator for two implementation.
data Evaluator
Evaluator :: (String -> YiM ()) -> YiM [String] -> (String -> YiM String) -> Evaluator
-- | implementation of execEditorAction
[execEditorActionImpl] :: Evaluator -> String -> YiM ()
-- | implementation of getAllNamesInScope
[getAllNamesInScopeImpl] :: Evaluator -> YiM [String]
-- | describe named action (or at least its type.), simplest implementation
-- is at least return.
[describeNamedActionImpl] :: Evaluator -> String -> YiM String
-- | The evaluator to use for execEditorAction and
-- getAllNamesInScope.
evaluator :: Field Evaluator
-- | Evaluator based on a fixed list of published actions. Has a few
-- differences from ghciEvaluator:
--
--
-- - expressions can't be evaluated
-- - all suggested actions are actually valued
-- - (related to the above) doesn't contain junk actions from
-- Prelude
-- - doesn't require GHCi backend, so uses less memory
--
publishedActionsEvaluator :: Evaluator
-- | Accessor for the published actions. Consider using
-- publishAction.
publishedActions :: Field (HashMap String Action)
-- | Publish the given action, by the given name. This will overwrite any
-- existing actions by the same name.
publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
-- | Tries to jump to error at the current line. See
-- parseErrorMessageB.
jumpToErrorE :: YiM ()
-- | Jumps to specified position in a given file.
jumpToE :: FilePath -> Int -> Int -> YiM ()
consoleKeymap :: Keymap
instance Yi.Types.YiConfigVariable Yi.Eval.PublishedActions
instance Data.Default.Class.Default Yi.Eval.Evaluator
instance Yi.Types.YiConfigVariable Yi.Eval.Evaluator
instance Data.Binary.Class.Binary Yi.Eval.NamesCache
instance Data.Binary.Class.Binary Yi.Eval.HelpCache
instance GHC.Base.Monoid Yi.Eval.PublishedActions
instance GHC.Base.Semigroup Yi.Eval.PublishedActions
instance Data.Default.Class.Default Yi.Eval.PublishedActions
instance Data.Default.Class.Default Yi.Eval.HelpCache
instance Yi.Types.YiVariable Yi.Eval.HelpCache
instance Data.Default.Class.Default Yi.Eval.NamesCache
instance Yi.Types.YiVariable Yi.Eval.NamesCache
-- | Help command support This module uses Yi.Eval.describeNamedAction to
-- show whatever information about particular action is available from
-- current evaluator (ghciEvaluator currently presents only type.) TODO:
-- Would be nice to show excerpt from Haddock documentation in the
-- future.
--
-- If given no arguments, the help index is shown (using
-- getAllNamesInScope).
--
-- Please do not try to show descriptions for the whole index, as our
-- interface to GHCi is too slow.
module Yi.Command.Help
-- | Displays help for a given name, or help index, if no name is given
displayHelpFor :: Text -> YiM ()
instance Data.Binary.Class.Binary Yi.Command.Help.HelpBuffer
instance Data.Default.Class.Default Yi.Command.Help.HelpBuffer
instance Yi.Types.YiVariable Yi.Command.Help.HelpBuffer
-- | Various high-level functions to further classify.
module Yi.Command
-- | Changing the buffer name quite useful if you have several the same.
-- This also breaks the relation with the file.
changeBufferNameE :: YiM ()
-- | shell-command with argument prompt
shellCommandE :: YiM ()
-- | shell-command with a known argument
shellCommandV :: Text -> YiM ()
newtype CabalBuffer
CabalBuffer :: Maybe BufferRef -> CabalBuffer
[cabalBuffer] :: CabalBuffer -> Maybe BufferRef
-- | cabal-configure
cabalConfigureE :: CommandArguments -> YiM ()
configureExit :: Either SomeException ExitCode -> YiM ()
reloadProjectE :: String -> YiM ()
-- | Run the given commands with args and pipe the ouput into the build
-- buffer, which is shown in an other window.
buildRun :: Text -> [Text] -> (Either SomeException ExitCode -> YiM x) -> YiM ()
-- | Run the given command with args in interactive mode.
interactiveRun :: Text -> [Text] -> (Either SomeException ExitCode -> YiM x) -> YiM ()
-- | Select buildRun or interactiveRun based on stack or
-- cabal command name
selectRunner :: Text -> Text -> [Text] -> (Either SomeException ExitCode -> YiM x) -> YiM ()
makeBuild :: CommandArguments -> YiM ()
cabalRun :: Text -> (Either SomeException ExitCode -> YiM x) -> CommandArguments -> YiM ()
makeRun :: (Either SomeException ExitCode -> YiM x) -> CommandArguments -> YiM ()
-- | cabal-build
cabalBuildE :: CommandArguments -> YiM ()
makeBuildE :: CommandArguments -> YiM ()
shell :: YiM BufferRef
-- | Search the source files in the project.
searchSources :: (String ::: RegexTag) -> YiM ()
-- | Perform a find+grep operation
grepFind :: (String ::: FilePatternTag) -> (String ::: RegexTag) -> YiM ()
-- | stack-build
stackCommandE :: Text -> CommandArguments -> YiM ()
stackRun :: Text -> (Either SomeException ExitCode -> YiM x) -> CommandArguments -> YiM ()
instance Data.Binary.Class.Binary Yi.Command.CabalBuffer
instance Data.Default.Class.Default Yi.Command.CabalBuffer
instance Yi.Types.YiVariable Yi.Command.CabalBuffer
module Yi.Config.Default
defaultConfig :: Config
-- | A simplified configuration interface for Yi.
--
-- This module provides a simple configuration API, allowing users to
-- start with an initial configuration and imperatively (monadically)
-- modify it. Some common actions (keybindings, selecting modes, choosing
-- the frontend) have been given special commands (globalBindKeys,
-- setFrontendPreferences, addMode, and so on).
--
-- A simple configuration might look like the following:
--
--
-- import Yi.Config.Simple
-- import Yi.Boot
-- import qualified Yi.Mode.Haskell as Haskell
-- -- note: don't import Yi, or else there will be name clashes
--
-- main = configMain defaultEmacsConfig $ do
-- fontSize %= Just 10
-- modeBindKeys Haskell.cleverMode (metaCh 'q' ?>>! reload)
-- globalBindKeys (metaCh 'r' ?>>! reload)
--
--
-- A lot of the fields here are specified with the Field type. To
-- write a field, use (%=). To read, use get. For
-- modification, use (modify). For example, the functions
-- foo and bar are equivalent:
--
--
-- foo = modify layoutManagers reverse
-- bar = do
-- lms <- get layoutManagers
-- layoutManagers %= reverse lms
--
module Yi.Config.Simple
-- | The configuration monad. Run it with configMain.
data ConfigM a
-- | Fields that can be modified with all lens machinery.
type Field a = Lens' Config a
-- | Adds the given key bindings to the `global keymap'. The bindings will
-- override existing bindings in the case of a clash.
globalBindKeys :: Keymap -> ConfigM ()
-- | modeBindKeys mode keys adds the keybindings in keys
-- to all modes with the same name as mode.
--
-- As with modifyMode, a mode by the given name must already be
-- registered, or the function will have no effect, and issue a
-- command-line warning.
modeBindKeys :: Mode syntax -> Keymap -> ConfigM ()
-- | modeBindKeysByName name keys adds the keybindings in
-- keys to all modes with name name (if it is
-- registered). Consider using modeBindKeys instead.
modeBindKeysByName :: Text -> Keymap -> ConfigM ()
-- | Register the given mode. It will be preferred over any modes already
-- defined.
addMode :: Mode syntax -> ConfigM ()
-- | modifyMode mode f modifies all modes with the same name as
-- mode, using the function f.
--
-- Note that the mode argument is only used by its
-- modeName. In particular, a mode by the given name must already
-- be registered, or this function will have no effect, and issue a
-- command-line warning.
--
--
-- modifyMode mode f = modifyModeByName (modeName mode) f
--
modifyMode :: Mode syntax -> (forall syntax'. Mode syntax' -> Mode syntax') -> ConfigM ()
-- | modifyModeByName name f modifies the mode with name
-- name using the function f. Consider using
-- modifyMode instead.
modifyModeByName :: Text -> (forall syntax. Mode syntax -> Mode syntax) -> ConfigM ()
-- | The evaluator to use for execEditorAction and
-- getAllNamesInScope.
evaluator :: Field Evaluator
-- | Evaluator based on a fixed list of published actions. Has a few
-- differences from ghciEvaluator:
--
--
-- - expressions can't be evaluated
-- - all suggested actions are actually valued
-- - (related to the above) doesn't contain junk actions from
-- Prelude
-- - doesn't require GHCi backend, so uses less memory
--
publishedActionsEvaluator :: Evaluator
-- | Publish the given action, by the given name. This will overwrite any
-- existing actions by the same name.
publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
-- | Accessor for the published actions. Consider using
-- publishAction.
publishedActions :: Field (HashMap String Action)
-- | Just the font name, or Nothing for default.
fontName :: Field (Maybe String)
-- | Just the font size, or Nothing for default.
fontSize :: Field (Maybe Int)
-- | Amount to move the buffer when using the scroll wheel.
scrollWheelAmount :: Field Int
-- | Just the scroll style, or Nothing for default.
scrollStyle :: Field (Maybe ScrollStyle)
data ScrollStyle
SnapToCenter :: ScrollStyle
SingleLine :: ScrollStyle
-- | See CursorStyle for documentation.
cursorStyle :: Field CursorStyle
-- | 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.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
data Side
LeftSide :: Side
RightSide :: Side
-- | Which side to display the scroll bar on.
scrollBarSide :: Field Side
-- | Should the scroll bar autohide?
autoHideScrollBar :: Field Bool
-- | Should the tab bar autohide?
autoHideTabBar :: Field Bool
-- | Should lines be wrapped?
lineWrap :: Field Bool
-- | The character with which to fill empty window space. Usually '~' for
-- vi-like editors, ' ' for everything else.
windowFill :: Field Char
-- | UI colour theme.
theme :: Field Theme
-- | Line numbers.
lineNumbers :: Field Bool
-- | List of registered layout managers. When cycling through layouts, this
-- list will be consulted.
layoutManagers :: Field [AnyLayoutManager]
-- | Produce a .yi.dbg file with debugging information?
debug :: Field Bool
-- | Run when the editor is started (this is run after all actions which
-- have already been registered)
runOnStartup :: Action -> ConfigM ()
-- | Run after the startup actions have completed, or on reload (this is
-- run after all actions which have already been registered)
runAfterStartup :: Action -> ConfigM ()
-- | Actions to run when the editor is started. Consider using
-- runOnStartup or runManyOnStartup instead.
startActions :: Field [Action]
-- | Actions to run after startup or reload. Consider using
-- runAfterStartup or runManyAfterStartup instead.
initialActions :: Field [Action]
-- | Default keymap to use.
defaultKm :: Field KeymapSet
-- | ?
inputPreprocess :: Field (P Event Event)
-- | List of modes by order of preference. Consider using addMode,
-- modeBindKeys, or modifyMode instead.
modes :: Field [AnyMode]
-- | Set to Exclusive for an emacs-like behaviour. Consider starting
-- with defaultEmacsConfig, defaultVimConfig, or
-- defaultCuaConfig to instead.
regionStyle :: Field RegionStyle
-- | Set to True for an emacs-like behaviour, where all deleted text
-- is accumulated in a killring. Consider starting with
-- defaultEmacsConfig, defaultVimConfig, or
-- defaultCuaConfig instead.
killringAccumulate :: Field Bool
-- | ?
bufferUpdateHandler :: Field (Seq (Seq Update -> BufferM ()))
data SearchExp
regionsOverlap :: Bool -> Region -> Region -> Bool
regionIsEmpty :: Region -> Bool
-- | Returns if a region (1st arg) is included in another (2nd arg)
includedRegion :: Region -> Region -> Bool
-- | True if the given point is inside the given region or at the end of
-- it.
nearRegion :: Point -> Region -> Bool
-- | True if the given point is inside the given region.
inRegion :: Point -> Region -> Bool
-- | The empty region
emptyRegion :: Region
mkSizeRegion :: Point -> Size -> Region
mkRegion' :: Direction -> Point -> Point -> Region
-- | Construct a region from its bounds, emacs style: the right bound is
-- excluded
mkRegion :: Point -> Point -> Region
-- | Take the union of two regions (including what is between them)
unionRegion :: Region -> Region -> Region
-- | Take the intersection of two regions
intersectRegion :: Region -> Region -> Region
regionSize :: Region -> Size
fmapRegion :: (Point -> Point) -> Region -> Region
regionLast :: Region -> Point
regionFirst :: Region -> Point
-- | The region data type. The region is semi open: it includes the start
-- but not the end bound. This allows simpler region-manipulation
-- algorithms. Invariant : regionStart r <= regionEnd r
data Region
-- | direction is in the same style of maybe or
-- either functions, It takes one argument per direction
-- (backward, then forward) and a direction to select the output.
directionElim :: Direction -> a -> a -> a
-- | reverse if Backward
mayReverse :: Direction -> [a] -> [a]
reverseDir :: Direction -> Direction
-- | Direction of movement inside a buffer
data Direction
Backward :: Direction
Forward :: Direction
-- | A mark in a buffer
newtype Mark
Mark :: Int -> Mark
[markId] :: Mark -> Int
-- | Reference to a buffer.
newtype BufferRef
BufferRef :: Int -> BufferRef
-- | A point in a buffer
newtype Point
Point :: Int -> Point
[fromPoint] :: Point -> Int
-- | Size of a buffer region
newtype Size
Size :: Int -> Size
[fromSize] :: Size -> Int
-- | Window references
newtype WindowRef
WindowRef :: Int -> WindowRef
[unWindowRef] :: WindowRef -> Int
data MarkValue
MarkValue :: !Point -> !Direction -> MarkValue
[markPoint] :: MarkValue -> !Point
[markGravity] :: MarkValue -> !Direction
data UIUpdate
TextUpdate :: !Update -> UIUpdate
StyleUpdate :: !Point -> !Size -> UIUpdate
-- | Mutation actions (also used the undo or redo list)
--
-- For the undoredo, we use the partial checkpoint/ (Berlage,
-- pg16) strategy to store just the components of the state that change.
--
-- Note that the update direction is only a hint for moving the cursor
-- (mainly for undo purposes); the insertions and deletions are always
-- applied Forward.
--
-- Note that keeping the text does not cost much: we keep the updates in
-- the undo list; if it's a Delete it means we have just inserted
-- the text in the buffer, so the update shares the data with the buffer.
-- If it's an Insert we have to keep the data any way.
data Update
Insert :: !Point -> !Direction -> !YiString -> Update
[updatePoint] :: Update -> !Point
[updateDirection] :: Update -> !Direction
[_insertUpdateString] :: Update -> !YiString
Delete :: !Point -> !Direction -> !YiString -> Update
[updatePoint] :: Update -> !Point
[updateDirection] :: Update -> !Direction
[_deleteUpdateString] :: Update -> !YiString
data Overlay
markGravityAA :: Lens' MarkValue Direction
markPointAA :: Lens' MarkValue Point
updateIsDelete :: Update -> Bool
-- | Create an "overlay" for the style sty between points
-- s and e
mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay
-- | A URList consists of an undo and a redo list.
data URList
data Change
InteractivePoint :: Change
AtomicChange :: !Update -> Change
-- | A new empty URList. Notice we must have a saved file point as
-- this is when we assume we are opening the file so it is currently the
-- same as the one on disk
emptyU :: URList
-- | Add an action to the undo list. According to the restricted, linear
-- undo model, if we add a command whilst the redo list is not empty, we
-- will lose our redoable changes.
addChangeU :: Change -> URList -> URList
deleteInteractivePointsU :: URList -> URList
-- | Add a saved file point so that we can tell that the buffer has not
-- been modified since the previous saved file point. Notice that we must
-- be sure to remove the previous saved file points since they are now
-- worthless.
setSavedFilePointU :: URList -> URList
-- | This undoes one interaction step.
undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
-- | This redoes one iteraction step.
redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
-- | undoIsAtSavedFilePoint. True if the undo list is at a
-- SavedFilePoint indicating that the buffer has not been modified since
-- we last saved the file. Note: that an empty undo list does NOT mean
-- that the buffer is not modified since the last save. Because we may
-- have saved the file and then undone actions done before the save.
isAtSavedFilePointU :: URList -> Bool
data RegionStyle
LineWise :: RegionStyle
Inclusive :: RegionStyle
Exclusive :: RegionStyle
Block :: RegionStyle
-- | Used to specify the behaviour of the automatic indent command.
data IndentBehaviour
-- | 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.
IncreaseCycle :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint. If we
-- are currently at the smallest level then cycle back to the largest
DecreaseCycle :: IndentBehaviour
-- | Increase the indentation to the next higher hint if no such hint
-- exists do nothing.
IncreaseOnly :: IndentBehaviour
-- | Decrease the indentation to the next smaller indentation hint, if no
-- such hint exists do nothing.
DecreaseOnly :: IndentBehaviour
-- | 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.
data Mode syntax
Mode :: Text -> (FilePath -> YiString -> Bool) -> ExtHL syntax -> (syntax -> BufferM ()) -> (KeymapSet -> KeymapSet) -> (syntax -> IndentBehaviour -> BufferM ()) -> (syntax -> Action) -> IndentSettings -> Maybe (BufferM ()) -> (syntax -> Point -> Point -> Point -> [Stroke]) -> BufferM () -> ([Text] -> BufferM Text) -> BufferM () -> Mode syntax
-- | so this can be serialized, debugged.
[modeName] :: Mode syntax -> Text
-- | What type of files does this mode apply to?
[modeApplies] :: Mode syntax -> FilePath -> YiString -> Bool
-- | Syntax highlighter
[modeHL] :: Mode syntax -> ExtHL syntax
-- | Prettify current "paragraph"
[modePrettify] :: Mode syntax -> syntax -> BufferM ()
-- | Buffer-local keymap modification
[modeKeymap] :: Mode syntax -> KeymapSet -> KeymapSet
-- | emacs-style auto-indent line
[modeIndent] :: Mode syntax -> syntax -> IndentBehaviour -> BufferM ()
-- | Follow a "link" in the file. (eg. go to location of error message)
[modeFollow] :: Mode syntax -> syntax -> Action
[modeIndentSettings] :: Mode syntax -> IndentSettings
[modeToggleCommentSelection] :: Mode syntax -> Maybe (BufferM ())
-- | Strokes that should be applied when displaying a syntax element should
-- this be an Action instead?
[modeGetStrokes] :: Mode syntax -> syntax -> Point -> Point -> Point -> [Stroke]
-- | An action that is to be executed when this mode is set
[modeOnLoad] :: Mode syntax -> BufferM ()
-- | buffer-local modeline formatting method
[modeModeLine] :: Mode syntax -> [Text] -> BufferM Text
-- | go to the point where the variable is declared
[modeGotoDeclaration] :: Mode syntax -> BufferM ()
data AnyMode
AnyMode :: Mode syntax -> AnyMode
data BufferId
MemBuffer :: !Text -> BufferId
FileBuffer :: !FilePath -> BufferId
data MarkSet a
MarkSet :: !a -> MarkSet a
[fromMark, insMark, selMark] :: MarkSet a -> !a
type WinMarks = MarkSet Mark
data FBuffer
FBuffer :: !Mode syntax -> !BufferImpl syntax -> !Attributes -> FBuffer
-- | Currently duplicates some of Vim's indent settings. Allowing a buffer
-- to specify settings that are more dynamic, perhaps via closures, could
-- be useful.
data IndentSettings
IndentSettings :: !Bool -> !Int -> !Int -> IndentSettings
-- | Insert spaces instead of tabs as possible
[expandTabs] :: IndentSettings -> !Bool
-- | Size of a Tab
[tabSize] :: IndentSettings -> !Int
-- | Indent by so many columns
[shiftWidth] :: IndentSettings -> !Int
-- | The BufferM monad writes the updates performed.
newtype BufferM a
BufferM :: ReaderT Window (State FBuffer) a -> BufferM a
[fromBufferM] :: BufferM a -> ReaderT Window (State FBuffer) a
stickyEolA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
fontsizeVariationA :: HasAttributes c_aU7d => Lens' c_aU7d Int
lastSyncTimeA :: HasAttributes c_aU7d => Lens' c_aU7d UTCTime
directoryContentA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
identA :: HasAttributes c_aU7d => Lens' c_aU7d BufferId
lastActiveWindowA :: HasAttributes c_aU7d => Lens' c_aU7d Window
keymapProcessA :: HasAttributes c_aU7d => Lens' c_aU7d KeymapProcess
pointFollowsWindowA :: HasAttributes c_aU7d => Lens' c_aU7d (Set WindowRef)
insertingA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
readOnlyA :: HasAttributes c_aU7d => Lens' c_aU7d Bool
pendingUpdatesA :: HasAttributes c_aU7d => Lens' c_aU7d (Seq UIUpdate)
undosA :: HasAttributes c_aU7d => Lens' c_aU7d URList
preferColA :: HasAttributes c_aU7d => Lens' c_aU7d (Maybe Int)
-- | Gets a short identifier of a buffer. If we're given a MemBuffer
-- then just wraps the buffer name like so: *name*. If we're
-- given a FileBuffer, it drops the number of path components.
--
--
-- >>> let memBuf = newB (BufferRef 0) (MemBuffer "foo/bar/hello") ""
--
-- >>> shortIdentString 2 memBuf
-- "*foo/bar/hello*"
--
-- >>> let fileBuf = newB (BufferRef 0) (FileBuffer "foo/bar/hello") ""
--
-- >>> shortIdentString 2 fileBuf
-- "hello"
--
shortIdentString :: Int -> FBuffer -> Text
-- | Gets the buffer's identifier string, emphasising the MemBuffer:
--
--
-- >>> let memBuf = newB (BufferRef 0) (MemBuffer "foo/bar/hello") ""
--
-- >>> identString memBuf
-- "*foo/bar/hello*"
--
-- >>> let fileBuf = newB (BufferRef 0) (FileBuffer "foo/bar/hello") ""
--
-- >>> identString fileBuf
-- "foo/bar/hello"
--
identString :: FBuffer -> Text
miniIdentString :: FBuffer -> Text
-- | update the syntax information (clear the dirty "flag")
clearSyntax :: FBuffer -> FBuffer
file :: FBuffer -> Maybe FilePath
highlightSelectionA :: Lens' FBuffer Bool
rectangleSelectionA :: Lens' FBuffer Bool
-- | Increases the font size in the buffer by specified number. What this
-- number actually means depends on the front-end.
increaseFontSize :: Int -> BufferM ()
-- | Decreases the font size in the buffer by specified number. What this
-- number actually means depends on the front-end.
decreaseFontSize :: Int -> BufferM ()
-- | Given a buffer, and some information update the modeline
--
-- N.B. the contents of modelines should be specified by user, and not
-- hardcoded.
getModeLine :: [Text] -> BufferM Text
-- | Given a point, and the file size, gives us a percent string
getPercent :: Point -> Point -> Text
queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x
-- | Adds an "overlay" to the buffer
addOverlayB :: Overlay -> BufferM ()
getOverlaysOfOwnerB :: YiString -> BufferM (Set Overlay)
-- | Remove an existing "overlay"
delOverlayB :: Overlay -> BufferM ()
delOverlaysOfOwnerB :: YiString -> BufferM ()
isPointInsideOverlay :: Point -> Overlay -> Bool
-- | Execute a BufferM value on a given buffer and window. The new
-- state of the buffer is returned alongside the result of the
-- computation.
runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer)
getMarks :: Window -> BufferM (Maybe WinMarks)
runBufferFull :: Window -> FBuffer -> BufferM a -> (a, Seq Update, FBuffer)
getMarkValueB :: Mark -> BufferM MarkValue
newMarkB :: MarkValue -> BufferM Mark
deleteMarkB :: Mark -> BufferM ()
-- | Execute a BufferM value on a given buffer, using a dummy
-- window. The new state of the buffer is discarded.
runBufferDummyWindow :: FBuffer -> BufferM a -> a
-- | Mark the current point in the undo list as a saved state.
markSavedB :: UTCTime -> BufferM ()
bkey :: FBuffer -> BufferRef
isUnchangedBuffer :: FBuffer -> Bool
startUpdateTransactionB :: BufferM ()
commitUpdateTransactionB :: BufferM ()
undoB :: BufferM ()
redoB :: BufferM ()
-- | Undo all updates that happened since last save, perform a given action
-- and redo all updates again. Given action must not modify undo history.
retroactivelyAtSavePointB :: BufferM a -> BufferM a
-- | Mode applies function that always returns True.
modeAlwaysApplies :: a -> b -> Bool
-- | Mode applies function that always returns False.
modeNeverApplies :: a -> b -> Bool
emptyMode :: Mode syntax
-- | Create buffer named nm with contents s
newB :: BufferRef -> BufferId -> YiString -> FBuffer
-- | Point of eof
sizeB :: BufferM Point
-- | Extract the current point
pointB :: BufferM Point
nelemsB :: Int -> Point -> BufferM YiString
streamB :: Direction -> Point -> BufferM YiString
indexedStreamB :: Direction -> Point -> BufferM [(Point, Char)]
strokesRangesB :: Maybe SearchExp -> Region -> BufferM [[Stroke]]
-- | Move point in buffer to the given index
moveTo :: Point -> BufferM ()
setInserting :: Bool -> BufferM ()
applyUpdate :: Update -> BufferM ()
-- | Revert all the pending updates; don't touch the point.
revertPendingUpdatesB :: BufferM ()
-- | Write an element into the buffer at the current point.
writeB :: Char -> BufferM ()
-- | Write the list into the buffer at current point.
writeN :: YiString -> BufferM ()
-- | Insert newline at current point.
newlineB :: BufferM ()
-- | Insert given YiString at specified point, extending size of the
-- buffer.
insertNAt :: YiString -> Point -> BufferM ()
-- | Insert the YiString at current point, extending size of buffer
insertN :: YiString -> BufferM ()
-- | Insert the char at current point, extending size of buffer
--
-- Implementation note: This just insertBs a singleton.
-- This seems sub-optimal because we should be able to do much better
-- without spewing chunks of size 1 everywhere. This approach is
-- necessary however so an Update can be recorded. A possible
-- improvement for space would be to have ‘yi-rope’ package optimise for
-- appends with length 1.
insertB :: Char -> BufferM ()
-- | deleteNAt n p deletes n characters forwards from
-- position p
deleteNAt :: Direction -> Int -> Point -> BufferM ()
-- | Return the current line number
curLn :: BufferM Int
-- | Top line of the screen
screenTopLn :: BufferM Int
-- | Middle line of the screen
screenMidLn :: BufferM Int
-- | Bottom line of the screen
screenBotLn :: BufferM Int
-- | Return line numbers of marks
markLines :: BufferM (MarkSet Int)
-- | Go to line number n. n is indexed from 1. Returns
-- the actual line we went to (which may be not be the requested line, if
-- it was out of range)
gotoLn :: Int -> BufferM Int
setMode0 :: forall syntax. Mode syntax -> FBuffer -> FBuffer
-- | Set the mode
setAnyMode :: AnyMode -> BufferM ()
setMode :: Mode syntax -> BufferM ()
onMode :: (forall syntax. Mode syntax -> Mode syntax) -> AnyMode -> AnyMode
withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a
withModeB :: (forall syntax. Mode syntax -> BufferM a) -> BufferM a
withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a
focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer
withSyntaxB' :: (forall syntax. Mode syntax -> syntax -> BufferM a) -> BufferM a
-- | Return indices of strings in buffer matched by regex in the given
-- region.
regexRegionB :: SearchExp -> Region -> BufferM [Region]
-- | Return indices of next string in buffer matched by regex in the given
-- direction
regexB :: Direction -> SearchExp -> BufferM [Region]
modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM ()
setMarkHereB :: BufferM Mark
setNamedMarkHereB :: String -> BufferM ()
-- | Highlight the selection
setVisibleSelection :: Bool -> BufferM ()
-- | Whether the selection is highlighted
getVisibleSelection :: BufferM Bool
askMarks :: BufferM WinMarks
getMarkB :: Maybe String -> BufferM Mark
mayGetMarkB :: String -> BufferM (Maybe Mark)
-- | Move point by the given number of characters. A negative offset moves
-- backwards a positive one forward.
moveN :: Int -> BufferM ()
-- | Move point -1
leftB :: BufferM ()
-- | Move cursor -n
leftN :: Int -> BufferM ()
-- | Move cursor +1
rightB :: BufferM ()
-- | Move cursor +n
rightN :: Int -> BufferM ()
-- | Move point down by n lines. n can be negative.
-- Returns the actual difference in lines which we moved which may be
-- negative if the requested line difference is negative.
lineMoveRel :: Int -> BufferM Int
movingToPrefCol :: BufferM a -> BufferM a
-- | Moves to a visual column within the current line as shown on the
-- editor (ie, moving within the current width of a single visual line)
movingToPrefVisCol :: BufferM a -> BufferM a
moveToColB :: Int -> BufferM ()
moveToLineColB :: Int -> Int -> BufferM ()
pointOfLineColB :: Int -> Int -> BufferM Point
forgetPreferCol :: BufferM ()
savingPrefCol :: BufferM a -> BufferM a
-- | Move point up one line
lineUp :: BufferM ()
-- | Move point down one line
lineDown :: BufferM ()
-- | Return the contents of the buffer.
elemsB :: BufferM YiString
-- | Returns the contents of the buffer between the two points.
--
-- If the startPoint >= endPoint, empty string is returned.
-- If the points are out of bounds, as much of the content as possible is
-- taken: you're not guaranteed to get endPoint - startPoint
-- characters.
betweenB :: Point -> Point -> BufferM YiString
-- | Read the character at the current point
readB :: BufferM Char
-- | Read the character at the given index This is an unsafe operation:
-- character NUL is returned when out of bounds
readAtB :: Point -> BufferM Char
replaceCharB :: Char -> BufferM ()
replaceCharWithBelowB :: BufferM ()
replaceCharWithAboveB :: BufferM ()
insertCharWithBelowB :: BufferM ()
insertCharWithAboveB :: BufferM ()
-- | Delete n characters forward from the current point
deleteN :: Int -> BufferM ()
-- | Gives the IndentSettings for the current buffer.
indentSettingsB :: BufferM IndentSettings
-- | Current column. Note that this is different from offset or number of
-- chars from sol. (This takes into account tabs, unicode chars, etc.)
curCol :: BufferM Int
colOf :: Point -> BufferM Int
lineOf :: Point -> BufferM Int
lineCountB :: BufferM Int
-- | Returns start of line point for a given point p
solPointB :: Point -> BufferM Point
-- | Returns end of line for given point.
eolPointB :: Point -> BufferM Point
-- | Go to line indexed from current point Returns the actual moved
-- difference which of course may be negative if the requested difference
-- was negative.
gotoLnFrom :: Int -> BufferM Int
-- | Access to a value into the extensible state, keyed by its type. This
-- allows you to retrieve inside a BufferM monad, ie:
--
--
-- value <- getBufferDyn
--
getBufferDyn :: forall m a. (Default a, YiVariable a, MonadState FBuffer m, Functor m) => m a
-- | Access to a value into the extensible state, keyed by its type. This
-- allows you to save inside a BufferM monad, ie:
--
--
-- putBufferDyn updatedvalue
--
putBufferDyn :: (YiVariable a, MonadState FBuffer m, Functor m) => a -> m ()
-- | perform a BufferM a, and return to the current point. (by
-- using a mark)
savingExcursionB :: BufferM a -> BufferM a
markPointA :: Mark -> Lens' FBuffer Point
-- | Perform an BufferM a, and return to the current point.
savingPointB :: BufferM a -> BufferM a
-- | Perform an BufferM a, and return to the current line and
-- column number. The difference between this and savingPointB is
-- that here we attempt to return to the specific line and column number,
-- rather than a specific number of characters from the beginning of the
-- buffer.
--
-- In case the column is further away than EOL, the point is left at EOL:
-- moveToLineColB is used internally.
savingPositionB :: BufferM a -> BufferM a
pointAt :: BufferM a -> BufferM Point
pointAfterCursorB :: Point -> BufferM Point
-- | What would be the point after doing the given action? The argument
-- must not modify the buffer.
destinationOfMoveB :: BufferM a -> BufferM Point
askWindow :: (Window -> a) -> BufferM a
withEveryLineB :: BufferM () -> BufferM ()
expandTabsA :: Lens' IndentSettings Bool
shiftWidthA :: Lens' IndentSettings Int
tabSizeA :: Lens' IndentSettings Int
modeAppliesA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (FilePath -> YiString -> Bool)
modeFollowA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> Action)
modeGetStrokesA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> Point -> Point -> Point -> [Stroke])
modeGotoDeclarationA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (BufferM ())
modeHLA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (ExtHL syntax_aIGp)
modeIndentA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> IndentBehaviour -> BufferM ())
modeIndentSettingsA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) IndentSettings
modeKeymapA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (KeymapSet -> KeymapSet)
modeModeLineA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) ([Text] -> BufferM Text)
modeNameA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) Text
modeOnLoadA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (BufferM ())
modePrettifyA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (syntax_aIGp -> BufferM ())
modeToggleCommentSelectionA :: forall syntax_aIGp. Lens' (Mode syntax_aIGp) (Maybe (BufferM ()))
winRegionB :: BufferM Region
-- | Delete an arbitrary part of the buffer
deleteRegionB :: Region -> BufferM ()
readRegionB :: Region -> BufferM YiString
-- | Replace a region with a given rope.
replaceRegionB :: Region -> YiString -> BufferM ()
-- | Map the given function over the characters in the region.
mapRegionB :: Region -> (Char -> Char) -> BufferM ()
-- | Swap the content of two Regions
swapRegionsB :: Region -> Region -> BufferM ()
-- | Modifies the given region according to the given string transformation
-- function
modifyRegionB :: (YiString -> YiString) -> Region -> BufferM ()
-- | Extend the right bound of a region to include it.
inclusiveRegionB :: Region -> BufferM Region
-- | See a region as a block/rectangular region, since regions are
-- represented by two point, this returns a list of small regions form
-- this block region.
blockifyRegion :: Region -> BufferM [Region]
-- | Joins lines in the region with a single space, skipping any empty
-- lines.
joinLinesB :: Region -> BufferM ()
-- | Concatenates lines in the region preserving the trailing newline if
-- any.
concatLinesB :: Region -> BufferM ()
-- | Gets the lines of a region (as a region), preserving newlines. Thus
-- the resulting list of regions is a partition of the original region.
--
-- The direction of the region is preserved and all smaller regions will
-- retain that direction.
--
-- Note that regions should never be empty, so it would be odd for this
-- to return an empty list...
linesOfRegionB :: Region -> BufferM [Region]
-- | Boundary side
data BoundarySide
InsideBound :: BoundarySide
OutsideBound :: BoundarySide
-- | Designate a given "unit" of text.
data TextUnit
-- | a single character
Character :: TextUnit
-- | a line of text (between newlines)
Line :: TextUnit
-- | a "vertical" line of text (area of text between two characters at the
-- same column number)
VLine :: TextUnit
-- | the whole document
Document :: TextUnit
GenUnit :: TextUnit -> (Direction -> BufferM Bool) -> TextUnit
[genEnclosingUnit] :: TextUnit -> TextUnit
[genUnitBoundary] :: TextUnit -> Direction -> BufferM Bool
-- | Turns a unit into its "negative" by inverting the boundaries. For
-- example, outsideUnit unitViWord will be the unit of spaces
-- between words. For units without boundaries (Character,
-- Document, ...), this is the identity function.
outsideUnit :: TextUnit -> TextUnit
-- | a word as in use in Emacs (fundamental mode)
unitWord :: TextUnit
-- | delimited on the left and right by given characters, boolean argument
-- tells if whether those are included.
unitDelimited :: Char -> Char -> Bool -> TextUnit
isWordChar :: Char -> Bool
checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
unitViWord :: TextUnit
unitViWORD :: TextUnit
unitViWordAnyBnd :: TextUnit
unitViWORDAnyBnd :: TextUnit
unitViWordOnLine :: TextUnit
unitViWORDOnLine :: TextUnit
-- | Separator characters (space, tab, unicode separators). Most of the
-- units above attempt to identify "words" with various punctuation and
-- symbols included or excluded. This set of units is a simple inverse:
-- it is true for "whitespace" or "separators" and false for anything
-- that is not (letters, numbers, symbols, punctuation, whatever).
isAnySep :: Char -> Bool
-- | unitSep is true for any kind of whitespace/separator
unitSep :: TextUnit
-- | unitSepThisLine is true for any kind of whitespace/separator on this
-- line only
unitSepThisLine :: TextUnit
atBoundaryB :: TextUnit -> Direction -> BufferM Bool
-- | Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitEmacsParagraph :: TextUnit
-- | Paragraph that begins and ends in the paragraph, not the empty lines
-- surrounding it.
unitParagraph :: TextUnit
unitSentence :: TextUnit
-- | Unit that have its left and right boundaries at the left boundary of
-- the argument unit.
leftBoundaryUnit :: TextUnit -> TextUnit
-- | genAtBoundaryB u d s returns whether the point is at a given
-- boundary (d,s) . Boundary (d,s) , taking Word as
-- example, means: Word ^^ ^^ 12 34 1: (Backward,OutsideBound) 2:
-- (Backward,InsideBound) 3: (Forward,InsideBound) 4:
-- (Forward,OutsideBound)
--
-- rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward
-- genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
numberOfB :: TextUnit -> TextUnit -> BufferM Int
whileB :: BufferM Bool -> BufferM a -> BufferM [a]
-- | Repeat an action until the condition is fulfilled or the cursor stops
-- moving. The Action may be performed zero times.
untilB :: BufferM Bool -> BufferM a -> BufferM [a]
doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
-- | Do an action if the current buffer character passes the predicate
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
-- | Generic move operation Warning: moving To the (OutsideBound, Backward)
-- bound of Document is impossible (offset -1!) genMoveB u b d:
-- move in direction d until encountering boundary b or unit u. See
-- genAtBoundaryB for boundary explanation.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | Generic maybe move operation. As genMoveB, but don't move if we are at
-- boundary already.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
-- | Move to the next unit boundary
moveB :: TextUnit -> Direction -> BufferM ()
-- | As moveB, unless the point is at a unit boundary
maybeMoveB :: TextUnit -> Direction -> BufferM ()
transposeB :: TextUnit -> Direction -> BufferM ()
-- | Transforms the region given by TextUnit in the Direction
-- with user-supplied function.
transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
-- | Delete between point and next unit boundary, return the deleted
-- region.
deleteB :: TextUnit -> Direction -> BufferM ()
regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region
-- | Region of the whole textunit where the current point is.
regionOfB :: TextUnit -> BufferM Region
-- | Non empty region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region
-- | Region between the point and the next boundary. The region is empty if
-- the point is at the boundary.
regionOfPartB :: TextUnit -> Direction -> BufferM Region
-- | Non empty region between the point and the next boundary, In fact the
-- region can be empty if we are at the end of file.
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
-- | Non empty region at given point and the next boundary,
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
readPrevUnitB :: TextUnit -> BufferM YiString
readUnitB :: TextUnit -> BufferM YiString
halfUnit :: Direction -> TextUnit -> TextUnit
deleteUnitB :: TextUnit -> Direction -> BufferM ()
getRegionStyle :: BufferM RegionStyle
putRegionStyle :: RegionStyle -> BufferM ()
convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
unitWiseRegion :: TextUnit -> Region -> BufferM Region
-- | Extend the given region to boundaries of the text unit. For instance
-- one can extend the selection to complete lines, or paragraphs.
extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
data BufferFileInfo
BufferFileInfo :: FilePath -> Int -> Int -> Int -> Point -> Text -> Bool -> BufferFileInfo
[bufInfoFileName] :: BufferFileInfo -> FilePath
[bufInfoSize] :: BufferFileInfo -> Int
[bufInfoLineNo] :: BufferFileInfo -> Int
[bufInfoColNo] :: BufferFileInfo -> Int
[bufInfoCharNo] :: BufferFileInfo -> Point
[bufInfoPercent] :: BufferFileInfo -> Text
[bufInfoModified] :: BufferFileInfo -> Bool
-- | Move point between the middle, top and bottom of the screen If the
-- point stays at the middle, it'll be gone to the top else if the point
-- stays at the top, it'll be gone to the bottom else it'll be gone to
-- the middle
moveToMTB :: BufferM ()
-- | Move point to start of line
moveToSol :: BufferM ()
-- | Move point to end of line
moveToEol :: BufferM ()
-- | Move cursor to origin
topB :: BufferM ()
-- | Move cursor to end of buffer
botB :: BufferM ()
-- | Move left if on eol, but not on blank line
leftOnEol :: BufferM ()
-- | Move x chars back, or to the sol, whichever is less
moveXorSol :: Int -> BufferM ()
-- | Move x chars forward, or to the eol, whichever is less
moveXorEol :: Int -> BufferM ()
-- | Move to first char of next word forwards
nextWordB :: BufferM ()
-- | Move to first char of next word backwards
prevWordB :: BufferM ()
gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()
-- | Move to the next occurence of c
nextCInc :: Char -> BufferM ()
nextCInLineInc :: Char -> BufferM ()
-- | Move to the character before the next occurence of c
nextCExc :: Char -> BufferM ()
nextCInLineExc :: Char -> BufferM ()
-- | Move to the previous occurence of c
prevCInc :: Char -> BufferM ()
prevCInLineInc :: Char -> BufferM ()
-- | Move to the character after the previous occurence of c
prevCExc :: Char -> BufferM ()
prevCInLineExc :: Char -> BufferM ()
-- | Move to first non-space character in this line
firstNonSpaceB :: BufferM ()
-- | Move to the last non-space character in this line
lastNonSpaceB :: BufferM ()
-- | Go to the first non space character in the line; if already there,
-- then go to the beginning of the line.
moveNonspaceOrSol :: BufferM ()
-- | True if current line consists of just a newline (no whitespace)
isCurrentLineEmptyB :: BufferM Bool
-- | Note: Returns False if line doesn't have any characters besides a
-- newline
isCurrentLineAllWhiteSpaceB :: BufferM Bool
-- | Move down next n paragraphs
nextNParagraphs :: Int -> BufferM ()
-- | Move up prev n paragraphs
prevNParagraphs :: Int -> BufferM ()
-- | Select next n paragraphs
selectNParagraphs :: Int -> BufferM ()
-- | Return true if the current point is the start of a line
atSol :: BufferM Bool
-- | Return true if the current point is the end of a line
atEol :: BufferM Bool
-- | True if point at start of file
atSof :: BufferM Bool
-- | True if point at end of file
atEof :: BufferM Bool
-- | True if point at the last line
atLastLine :: BufferM Bool
-- | Get the current line and column number
getLineAndCol :: BufferM (Int, Int)
getLineAndColOfPoint :: Point -> BufferM (Int, Int)
-- | Read the line the point is on
readLnB :: BufferM YiString
hasWhiteSpaceBefore :: BufferM Bool
-- | Reads in word at point.
readCurrentWordB :: BufferM YiString
-- | Reads in word before point.
readPrevWordB :: BufferM YiString
-- | Delete one character backward
bdeleteB :: BufferM ()
-- | Delete forward whitespace or non-whitespace depending on the character
-- under point.
killWordB :: BufferM ()
-- | Delete backward whitespace or non-whitespace depending on the
-- character before point.
bkillWordB :: BufferM ()
-- | Delete backward to the sof or the new line character
bdeleteLineB :: BufferM ()
-- | emacs' delete-horizontal-space with the optional argument.
deleteHorizontalSpaceB :: Maybe Int -> BufferM ()
-- | capitalise the word under the cursor
uppercaseWordB :: BufferM ()
-- | lowerise word under the cursor
lowercaseWordB :: BufferM ()
-- | capitalise the first letter of this word
capitaliseWordB :: BufferM ()
switchCaseChar :: Char -> Char
-- | Delete to the end of line, excluding it.
deleteToEol :: BufferM ()
-- | Transpose two characters, (the Emacs C-t action)
swapB :: BufferM ()
-- | Delete trailing whitespace from all lines. Uses savingPositionB
-- to get back to where it was.
deleteTrailingSpaceB :: BufferM ()
-- | Marks
--
-- Set the current buffer selection mark
setSelectionMarkPointB :: Point -> BufferM ()
-- | Get the current buffer selection mark
getSelectionMarkPointB :: BufferM Point
-- | Exchange point & mark.
exchangePointAndMarkB :: BufferM ()
getBookmarkB :: String -> BufferM Mark
-- | File info, size in chars, line no, col num, char num, percent
bufInfoB :: BufferM BufferFileInfo
upScreensB :: Int -> BufferM ()
downScreensB :: Int -> BufferM ()
-- | Scroll up 1 screen
upScreenB :: BufferM ()
-- | Scroll down 1 screen
downScreenB :: BufferM ()
-- | Scroll by n screens (negative for up)
scrollScreensB :: Int -> BufferM ()
-- | Same as scrollB, but also moves the cursor
vimScrollB :: Int -> BufferM ()
-- | Same as scrollByB, but also moves the cursor
vimScrollByB :: (Int -> Int) -> Int -> BufferM ()
-- | Move to middle line in screen
scrollToCursorB :: BufferM ()
-- | Move cursor to the top of the screen
scrollCursorToTopB :: BufferM ()
-- | Move cursor to the bottom of the screen
scrollCursorToBottomB :: BufferM ()
-- | Scroll by n lines.
scrollB :: Int -> BufferM ()
scrollToLineAboveWindowB :: BufferM ()
scrollToLineBelowWindowB :: BufferM ()
-- | Move the point to inside the viewable region
snapInsB :: BufferM ()
-- | Move the visible region to include the point
snapScreenB :: Maybe ScrollStyle -> BufferM Bool
-- | Move to n lines down from top of screen
downFromTosB :: Int -> BufferM ()
-- | Move to n lines up from the bottom of the screen
upFromBosB :: Int -> BufferM ()
-- | Move to middle line in screen
middleB :: BufferM ()
-- | Return the region between point and mark
getRawestSelectRegionB :: BufferM Region
-- | Get the current region boundaries. Extended to the current selection
-- unit.
getSelectRegionB :: BufferM Region
-- | Select the given region: set the selection mark at the
-- regionStart and the current point at the regionEnd.
setSelectRegionB :: Region -> BufferM ()
deleteBlankLinesB :: BufferM ()
-- | Get a (lazy) stream of lines in the buffer, starting at the
-- next line in the given direction.
lineStreamB :: Direction -> BufferM [YiString]
-- | The same as getMaybeNextLineB but avoids the use of the
-- Maybe type in the return by returning the empty string if there
-- is no next line.
getNextLineB :: Direction -> BufferM YiString
-- | Returns the closest line to the current line which is non-blank, in
-- the given direction. Returns the empty string if there is no such line
-- (for example if we are on the top line already).
getNextNonBlankLineB :: Direction -> BufferM YiString
modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM ()
-- | Prefix each line in the selection using the given string.
linePrefixSelectionB :: YiString -> BufferM ()
-- | Uncomments the selection using the given line comment starting string.
-- This only works for the comments which begin at the start of the line.
unLineCommentSelectionB :: YiString -> YiString -> BufferM ()
-- | Just like toggleCommentSelectionB but automatically inserts a
-- whitespace suffix to the inserted comment string. In fact:
toggleCommentB :: YiString -> BufferM ()
-- | Replace the contents of the buffer with some string
replaceBufferContent :: YiString -> BufferM ()
fillParagraph :: BufferM ()
-- | Sort the lines of the region.
sortLines :: BufferM ()
sortLinesWithRegion :: Region -> BufferM ()
-- | Helper function: revert the buffer contents to its on-disk version
revertB :: YiString -> UTCTime -> BufferM ()
shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point)
readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString
insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM ()
flipRectangleB :: Point -> Point -> BufferM (Point, Point)
movePercentageFileB :: Int -> BufferM ()
findMatchingPairB :: BufferM ()
-- | Increase (or decrease if negative) next number on line by n.
incrementNextNumberByB :: Int -> BufferM ()
-- | Is character under cursor a number.
isNumberB :: BufferM Bool
-- | Used by isNumber to test if current character under cursor is a
-- number.
test3CharB :: BufferM Bool
-- | Characters [a..f] are part of a hex number only if
-- preceded by 0x. Test if the current occurence of
-- [a..f] is part of a hex number.
testHexB :: BufferM Bool
-- | Move point down by n lines If line extends past width of
-- window, count moving a single line as moving width points to the
-- right.
lineMoveVisRel :: Int -> BufferM ()
-- | Implements the same logic that emacs' `mark-word` does. Checks the
-- mark point and moves it forth (or backward) for one word.
markWord :: BufferM ()
-- | Return either a t or the number of spaces specified by tabSize in the
-- IndentSettings. Note that if you actually want to insert a tab
-- character (for example when editing makefiles) then you should use:
-- insertB 't'.
tabB :: BufferM String
-- | A specialisation of autoIndentHelperB. This is the most basic
-- and the user is encouraged to specialise autoIndentHelperB on
-- their own.
autoIndentB :: IndentBehaviour -> BufferM ()
-- | Cycles through the indentation hints. It does this without requiring
-- to set/get any state. We just look at the current indentation of the
-- current line and moving to the largest indent that is
cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM ()
-- | Returns the indentation of a given string. Note that this depends on
-- the current indentation settings.
indentOfB :: YiString -> BufferM Int
-- | Indents the current line to the given indentation level. In addition
-- moves the point according to where it was on the line originally. If
-- we were somewhere within the indentation (ie at the start of the line
-- or on an empty line) then we want to just go to the end of the (new)
-- indentation. However if we are currently pointing somewhere within the
-- text of the line then we wish to remain pointing to the same
-- character.
indentToB :: Int -> BufferM ()
-- | Modifies current line indent measured in visible spaces. Respects
-- indent settings. Calling this with value (+ 4) will turn "t" into "tt"
-- if shiftwidth is 4 and into "t " if shiftwidth is 8 If current line is
-- empty nothing happens.
modifyIndentB :: (Int -> Int) -> BufferM ()
-- | Indent as much as the previous line
indentAsPreviousB :: BufferM ()
-- | Indent as much as the next line
indentAsNextB :: BufferM ()
indentAsTheMostIndentedNeighborLineB :: BufferM ()
-- | Insert a newline at point and indent the new line as the previous one.
newlineAndIndentB :: BufferM ()
-- | Increases the indentation on the region by the given amount of
-- shiftWidth
shiftIndentOfRegionB :: Int -> Region -> BufferM ()
-- | Return the number of spaces at the beginning of the line, up to the
-- point.
indentOfCurrentPosB :: BufferM Int
-- | Configuration record. All Yi hooks can be set here.
data Config
-- | 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.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
data UIConfig
bufferUpdateHandlerA :: Lens' Config (Seq (Seq Update -> BufferM ()))
configInputPreprocessA :: Lens' Config (P Event Event)
configKillringAccumulateA :: Lens' Config Bool
configRegionStyleA :: Lens' Config RegionStyle
configUIA :: Lens' Config UIConfig
configVarsA :: Lens' Config DynamicState
debugModeA :: Lens' Config Bool
defaultKmA :: Lens' Config KeymapSet
initialActionsA :: Lens' Config [Action]
layoutManagersA :: Lens' Config [AnyLayoutManager]
modeTableA :: Lens' Config [AnyMode]
startActionsA :: Lens' Config [Action]
startFrontEndA :: Lens' Config UIBoot
configAutoHideScrollBarA :: Lens' UIConfig Bool
configAutoHideTabBarA :: Lens' UIConfig Bool
configCursorStyleA :: Lens' UIConfig CursorStyle
configFontNameA :: Lens' UIConfig (Maybe String)
configFontSizeA :: Lens' UIConfig (Maybe Int)
configLeftSideScrollBarA :: Lens' UIConfig Bool
configLineNumbersA :: Lens' UIConfig Bool
configLineWrapA :: Lens' UIConfig Bool
configScrollStyleA :: Lens' UIConfig (Maybe ScrollStyle)
configScrollWheelAmountA :: Lens' UIConfig Int
configThemeA :: Lens' UIConfig Theme
configWindowFillA :: Lens' UIConfig Char
-- | Facade of the Yi library, for use by confguration file. Just
-- re-exports a bunch of modules.
--
-- You should therefore:
--
--
-- import Yi
--
--
-- in your ~.configyi/yi.hs.
module Yi