yi-core-0.19.4: Yi editor core library

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

Extensions

- Cpp
- RankNTypes
- ExplicitForAll

Yi.Config.Simple

Contents

- The main interface
- Modes, commands, and keybindings
- Evaluation of commands
- Appearance
  - Layout
- Debugging
- Startup hooks
- Advanced
- Module exports

Description

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

Synopsis

- data ConfigM a
- type Field a = Lens' Config a
- globalBindKeys :: Keymap -> ConfigM ()
- modeBindKeys :: Mode syntax -> Keymap -> ConfigM ()
- modeBindKeysByName :: Text -> Keymap -> ConfigM ()
- addMode :: Mode syntax -> ConfigM ()
- modifyMode :: Mode syntax -> (forall syntax'. Mode syntax' -> Mode syntax') -> ConfigM ()
- modifyModeByName :: Text -> (forall syntax. Mode syntax -> Mode syntax) -> ConfigM ()
- evaluator :: Field Evaluator
- publishedActionsEvaluator :: Evaluator
- publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
- publishedActions :: Field (HashMap String Action)
- fontName :: Field (Maybe String)
- fontSize :: Field (Maybe Int)
- scrollWheelAmount :: Field Int
- scrollStyle :: Field (Maybe ScrollStyle)
- data ScrollStyle
  - = SnapToCenter
  - | SingleLine
- cursorStyle :: Field CursorStyle
- data CursorStyle
  - = AlwaysFat
  - | NeverFat
  - | FatWhenFocused
  - | FatWhenFocusedAndInserting
- data Side
  - = LeftSide
  - | RightSide
- scrollBarSide :: Field Side
- autoHideScrollBar :: Field Bool
- autoHideTabBar :: Field Bool
- lineWrap :: Field Bool
- windowFill :: Field Char
- theme :: Field Theme
- lineNumbers :: Field Bool
- layoutManagers :: Field [AnyLayoutManager]
- debug :: Field Bool
- runOnStartup :: Action -> ConfigM ()
- runAfterStartup :: Action -> ConfigM ()
- startActions :: Field [Action]
- initialActions :: Field [Action]
- defaultKm :: Field KeymapSet
- inputPreprocess :: Field (P Event Event)
- modes :: Field [AnyMode]
- regionStyle :: Field RegionStyle
- killringAccumulate :: Field Bool
- bufferUpdateHandler :: Field (Seq (Seq Update -> BufferM ()))
- newtype Size = Size {
  - fromSize :: Int
  }
- data Mode syntax = Mode {
  - modeName :: Text
  - modeApplies :: FilePath -> YiString -> Bool
  - modeHL :: ExtHL syntax
  - modePrettify :: syntax -> BufferM ()
  - modeKeymap :: KeymapSet -> KeymapSet
  - modeIndent :: syntax -> IndentBehaviour -> BufferM ()
  - modeFollow :: syntax -> Action
  - modeIndentSettings :: IndentSettings
  - modeToggleCommentSelection :: Maybe (BufferM ())
  - modeGetStrokes :: syntax -> Point -> Point -> Point -> [Stroke]
  - modeOnLoad :: BufferM ()
  - modeModeLine :: [Text] -> BufferM Text
  - modeGotoDeclaration :: BufferM ()
  }
- data TextUnit
  - = Character
  - | Line
  - | VLine
  - | Document
  - | GenUnit {
    - genEnclosingUnit :: TextUnit
    - genUnitBoundary :: Direction -> BufferM Bool
    }
- moveTo :: Point -> BufferM ()
- moveN :: Int -> BufferM ()
- writeN :: YiString -> BufferM ()
- newtype WindowRef = WindowRef {
  - unWindowRef :: Int
  }
- newtype Point = Point {
  - fromPoint :: Int
  }
- newtype BufferRef = BufferRef Int
- newtype Mark = Mark {
  - markId :: Int
  }
- data Direction
  - = Backward
  - | Forward
- reverseDir :: Direction -> Direction
- mayReverse :: Direction -> [a] -> [a]
- directionElim :: Direction -> a -> a -> a
- data Region
- regionFirst :: Region -> Point
- regionLast :: Region -> Point
- fmapRegion :: (Point -> Point) -> Region -> Region
- regionSize :: Region -> Size
- intersectRegion :: Region -> Region -> Region
- unionRegion :: Region -> Region -> Region
- mkRegion :: Point -> Point -> Region
- mkRegion' :: Direction -> Point -> Point -> Region
- mkSizeRegion :: Point -> Size -> Region
- emptyRegion :: Region
- inRegion :: Point -> Region -> Bool
- nearRegion :: Point -> Region -> Bool
- includedRegion :: Region -> Region -> Bool
- regionIsEmpty :: Region -> Bool
- regionsOverlap :: Bool -> Region -> Region -> Bool
- data SearchExp
- data UIUpdate
  - = TextUpdate !Update
  - | StyleUpdate !Point !Size
- data Update
  - = Insert {
    - updatePoint :: !Point
    - updateDirection :: !Direction
    - _insertUpdateString :: !YiString
    }
  - | Delete {
    - updatePoint :: !Point
    - updateDirection :: !Direction
    - _deleteUpdateString :: !YiString
    }
- updateIsDelete :: Update -> Bool
- markGravityAA :: Lens' MarkValue Direction
- markPointAA :: Lens' MarkValue Point
- atEof :: BufferM Bool
- atEol :: BufferM Bool
- atLastLine :: BufferM Bool
- atSol :: BufferM Bool
- atSof :: BufferM Bool
- bdeleteB :: BufferM ()
- bdeleteLineB :: BufferM ()
- bkillWordB :: BufferM ()
- botB :: BufferM ()
- bufInfoB :: BufferM BufferFileInfo
- data BufferFileInfo = BufferFileInfo {
  - bufInfoFileName :: FilePath
  - bufInfoSize :: Int
  - bufInfoLineNo :: Int
  - bufInfoColNo :: Int
  - bufInfoCharNo :: Point
  - bufInfoPercent :: Text
  - bufInfoModified :: Bool
  }
- capitaliseWordB :: BufferM ()
- deleteBlankLinesB :: BufferM ()
- deleteHorizontalSpaceB :: Maybe Int -> BufferM ()
- deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point)
- deleteToEol :: BufferM ()
- deleteTrailingSpaceB :: BufferM ()
- downFromTosB :: Int -> BufferM ()
- downScreenB :: BufferM ()
- downScreensB :: Int -> BufferM ()
- exchangePointAndMarkB :: BufferM ()
- fillParagraph :: BufferM ()
- findMatchingPairB :: BufferM ()
- firstNonSpaceB :: BufferM ()
- flipRectangleB :: Point -> Point -> BufferM (Point, Point)
- getBookmarkB :: String -> BufferM Mark
- getLineAndCol :: BufferM (Int, Int)
- getLineAndColOfPoint :: Point -> BufferM (Int, Int)
- getNextLineB :: Direction -> BufferM YiString
- getNextNonBlankLineB :: Direction -> BufferM YiString
- getRawestSelectRegionB :: BufferM Region
- getSelectionMarkPointB :: BufferM Point
- getSelectRegionB :: BufferM Region
- gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()
- hasWhiteSpaceBefore :: BufferM Bool
- incrementNextNumberByB :: Int -> BufferM ()
- insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM ()
- isCurrentLineAllWhiteSpaceB :: BufferM Bool
- isCurrentLineEmptyB :: BufferM Bool
- isNumberB :: BufferM Bool
- killWordB :: BufferM ()
- lastNonSpaceB :: BufferM ()
- leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- leftOnEol :: BufferM ()
- lineMoveVisRel :: Int -> BufferM ()
- linePrefixSelectionB :: YiString -> BufferM ()
- lineStreamB :: Direction -> BufferM [YiString]
- lowercaseWordB :: BufferM ()
- middleB :: BufferM ()
- modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM ()
- moveNonspaceOrSol :: BufferM ()
- movePercentageFileB :: Int -> BufferM ()
- moveToMTB :: BufferM ()
- moveToEol :: BufferM ()
- moveToSol :: BufferM ()
- moveXorEol :: Int -> BufferM ()
- moveXorSol :: Int -> BufferM ()
- nextCExc :: Char -> BufferM ()
- nextCInc :: Char -> BufferM ()
- nextCInLineExc :: Char -> BufferM ()
- nextCInLineInc :: Char -> BufferM ()
- nextNParagraphs :: Int -> BufferM ()
- nextWordB :: BufferM ()
- prevCExc :: Char -> BufferM ()
- prevCInc :: Char -> BufferM ()
- prevCInLineExc :: Char -> BufferM ()
- prevCInLineInc :: Char -> BufferM ()
- prevNParagraphs :: Int -> BufferM ()
- prevWordB :: BufferM ()
- readCurrentWordB :: BufferM YiString
- readLnB :: BufferM YiString
- readPrevWordB :: BufferM YiString
- readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString
- replaceBufferContent :: YiString -> BufferM ()
- revertB :: YiString -> UTCTime -> BufferM ()
- rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- scrollB :: Int -> BufferM ()
- scrollCursorToBottomB :: BufferM ()
- scrollCursorToTopB :: BufferM ()
- scrollScreensB :: Int -> BufferM ()
- scrollToCursorB :: BufferM ()
- scrollToLineAboveWindowB :: BufferM ()
- scrollToLineBelowWindowB :: BufferM ()
- selectNParagraphs :: Int -> BufferM ()
- setSelectionMarkPointB :: Point -> BufferM ()
- setSelectRegionB :: Region -> BufferM ()
- shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
- sortLines :: BufferM ()
- sortLinesWithRegion :: Region -> BufferM ()
- snapInsB :: BufferM ()
- snapScreenB :: Maybe ScrollStyle -> BufferM Bool
- splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
- swapB :: BufferM ()
- switchCaseChar :: Char -> Char
- test3CharB :: BufferM Bool
- testHexB :: BufferM Bool
- toggleCommentB :: YiString -> BufferM ()
- topB :: BufferM ()
- unLineCommentSelectionB :: YiString -> YiString -> BufferM ()
- upFromBosB :: Int -> BufferM ()
- uppercaseWordB :: BufferM ()
- upScreenB :: BufferM ()
- upScreensB :: Int -> BufferM ()
- vimScrollB :: Int -> BufferM ()
- vimScrollByB :: (Int -> Int) -> Int -> BufferM ()
- markWord :: BufferM ()
- autoIndentB :: IndentBehaviour -> BufferM ()
- cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM ()
- indentAsNextB :: BufferM ()
- indentAsPreviousB :: BufferM ()
- indentAsTheMostIndentedNeighborLineB :: BufferM ()
- indentOfB :: YiString -> BufferM Int
- indentOfCurrentPosB :: BufferM Int
- indentSettingsB :: BufferM IndentSettings
- indentToB :: Int -> BufferM ()
- modifyIndentB :: (Int -> Int) -> BufferM ()
- newlineAndIndentB :: BufferM ()
- shiftIndentOfRegionB :: Int -> Region -> BufferM ()
- tabB :: BufferM String
- modifyRegionB :: (YiString -> YiString) -> Region -> BufferM ()
- readRegionB :: Region -> BufferM YiString
- regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region
- isAnySep :: Char -> Bool
- isWordChar :: Char -> Bool
- leftBoundaryUnit :: TextUnit -> TextUnit
- outsideUnit :: TextUnit -> TextUnit
- unitDelimited :: Char -> Char -> Bool -> TextUnit
- unitEmacsParagraph :: TextUnit
- unitParagraph :: TextUnit
- unitSentence :: TextUnit
- unitSep :: TextUnit
- unitSepThisLine :: TextUnit
- unitViWORD :: TextUnit
- unitViWORDAnyBnd :: TextUnit
- unitViWORDOnLine :: TextUnit
- unitViWord :: TextUnit
- unitViWordAnyBnd :: TextUnit
- unitViWordOnLine :: TextUnit
- unitWord :: TextUnit
- atBoundaryB :: TextUnit -> Direction -> BufferM Bool
- deleteB :: TextUnit -> Direction -> BufferM ()
- doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
- doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- maybeMoveB :: TextUnit -> Direction -> BufferM ()
- moveB :: TextUnit -> Direction -> BufferM ()
- numberOfB :: TextUnit -> TextUnit -> BufferM Int
- readPrevUnitB :: TextUnit -> BufferM YiString
- readUnitB :: TextUnit -> BufferM YiString
- regionOfB :: TextUnit -> BufferM Region
- regionOfNonEmptyB :: TextUnit -> BufferM Region
- regionOfPartB :: TextUnit -> Direction -> BufferM Region
- regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
- regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
- transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
- transposeB :: TextUnit -> Direction -> BufferM ()
- untilB :: BufferM Bool -> BufferM a -> BufferM [a]
- untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- whileB :: BufferM Bool -> BufferM a -> BufferM [a]
- data BoundarySide
  - = InsideBound
  - | OutsideBound
- checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
- genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
- data RegionStyle
  - = LineWise
  - | Inclusive
  - | Exclusive
  - | Block
- convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
- extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
- getRegionStyle :: BufferM RegionStyle
- mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
- putRegionStyle :: RegionStyle -> BufferM ()
- unitWiseRegion :: TextUnit -> Region -> BufferM Region
- newtype BufferM a = BufferM {
  - fromBufferM :: ReaderT Window (State FBuffer) a
  }
- getBufferDyn :: forall m a. (Default a, YiVariable a, MonadState FBuffer m, Functor m) => m a
- pointB :: BufferM Point
- putBufferDyn :: (YiVariable a, MonadState FBuffer m, Functor m) => a -> m ()
- savingPointB :: BufferM a -> BufferM a
- inclusiveRegionB :: Region -> BufferM Region
- data FBuffer = FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes
- type WinMarks = MarkSet Mark
- data MarkSet a = MarkSet {
  - fromMark :: !a
  - insMark :: !a
  - selMark :: !a
  }
- bkey :: FBuffer -> BufferRef
- getMarks :: Window -> BufferM (Maybe WinMarks)
- runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer)
- runBufferFull :: Window -> FBuffer -> BufferM a -> (a, Seq Update, FBuffer)
- runBufferDummyWindow :: FBuffer -> BufferM a -> a
- screenTopLn :: BufferM Int
- screenMidLn :: BufferM Int
- screenBotLn :: BufferM Int
- curLn :: BufferM Int
- curCol :: BufferM Int
- colOf :: Point -> BufferM Int
- lineOf :: Point -> BufferM Int
- lineCountB :: BufferM Int
- sizeB :: BufferM Point
- pointOfLineColB :: Int -> Int -> BufferM Point
- solPointB :: Point -> BufferM Point
- eolPointB :: Point -> BufferM Point
- markLines :: BufferM (MarkSet Int)
- moveToColB :: Int -> BufferM ()
- moveToLineColB :: Int -> Int -> BufferM ()
- lineMoveRel :: Int -> BufferM Int
- lineUp :: BufferM ()
- lineDown :: BufferM ()
- newB :: BufferRef -> BufferId -> YiString -> FBuffer
- data MarkValue = MarkValue {
  - markPoint :: !Point
  - markGravity :: !Direction
  }
- data Overlay
- mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay
- gotoLn :: Int -> BufferM Int
- gotoLnFrom :: Int -> BufferM Int
- leftB :: BufferM ()
- rightB :: BufferM ()
- leftN :: Int -> BufferM ()
- rightN :: Int -> BufferM ()
- insertN :: YiString -> BufferM ()
- insertNAt :: YiString -> Point -> BufferM ()
- insertB :: Char -> BufferM ()
- deleteN :: Int -> BufferM ()
- nelemsB :: Int -> Point -> BufferM YiString
- writeB :: Char -> BufferM ()
- newlineB :: BufferM ()
- deleteNAt :: Direction -> Int -> Point -> BufferM ()
- readB :: BufferM Char
- elemsB :: BufferM YiString
- undosA :: HasAttributes c => Lens' c URList
- preferColA :: HasAttributes c => Lens' c (Maybe Int)
- pendingUpdatesA :: HasAttributes c => Lens' c (Seq UIUpdate)
- readOnlyA :: HasAttributes c => Lens' c Bool
- insertingA :: HasAttributes c => Lens' c Bool
- pointFollowsWindowA :: HasAttributes c => Lens' c (Set WindowRef)
- keymapProcessA :: HasAttributes c => Lens' c KeymapProcess
- lastActiveWindowA :: HasAttributes c => Lens' c Window
- identA :: HasAttributes c => Lens' c BufferId
- directoryContentA :: HasAttributes c => Lens' c Bool
- lastSyncTimeA :: HasAttributes c => Lens' c UTCTime
- fontsizeVariationA :: HasAttributes c => Lens' c Int
- stickyEolA :: HasAttributes c => Lens' c Bool
- 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 :: Functor f => Mark -> (Point -> f Point) -> FBuffer -> f FBuffer
- modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM ()
- newMarkB :: MarkValue -> BufferM Mark
- deleteMarkB :: Mark -> BufferM ()
- getVisibleSelection :: BufferM Bool
- setVisibleSelection :: Bool -> BufferM ()
- isUnchangedBuffer :: FBuffer -> Bool
- setAnyMode :: AnyMode -> BufferM ()
- setMode :: Mode syntax -> BufferM ()
- setMode0 :: Mode syntax -> FBuffer -> FBuffer
- regexRegionB :: SearchExp -> Region -> BufferM [Region]
- regexB :: Direction -> SearchExp -> BufferM [Region]
- readAtB :: Point -> BufferM Char
- getModeLine :: [Text] -> BufferM Text
- getPercent :: Point -> Point -> Text
- setInserting :: Bool -> BufferM ()
- savingPrefCol :: BufferM a -> BufferM a
- forgetPreferCol :: BufferM ()
- movingToPrefCol :: BufferM a -> BufferM a
- movingToPrefVisCol :: BufferM a -> BufferM a
- markSavedB :: UTCTime -> BufferM ()
- retroactivelyAtSavePointB :: BufferM a -> BufferM a
- addOverlayB :: Overlay -> BufferM ()
- delOverlayB :: Overlay -> BufferM ()
- delOverlaysOfOwnerB :: YiString -> BufferM ()
- getOverlaysOfOwnerB :: YiString -> BufferM (Set Overlay)
- isPointInsideOverlay :: Point -> Overlay -> Bool
- savingExcursionB :: BufferM a -> BufferM a
- savingPositionB :: BufferM a -> BufferM a
- highlightSelectionA :: Lens' FBuffer Bool
- rectangleSelectionA :: Lens' FBuffer Bool
- revertPendingUpdatesB :: BufferM ()
- askWindow :: (Window -> a) -> BufferM a
- clearSyntax :: FBuffer -> FBuffer
- focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer
- modeNameA :: forall syntax f. Functor f => (Text -> f Text) -> Mode syntax -> f (Mode syntax)
- modeAppliesA :: forall syntax f. Functor f => ((FilePath -> YiString -> Bool) -> f (FilePath -> YiString -> Bool)) -> Mode syntax -> f (Mode syntax)
- modeHLA :: forall syntax f. Functor f => (ExtHL syntax -> f (ExtHL syntax)) -> Mode syntax -> f (Mode syntax)
- modePrettifyA :: forall syntax f. Functor f => ((syntax -> BufferM ()) -> f (syntax -> BufferM ())) -> Mode syntax -> f (Mode syntax)
- modeKeymapA :: forall syntax f. Functor f => ((KeymapSet -> KeymapSet) -> f (KeymapSet -> KeymapSet)) -> Mode syntax -> f (Mode syntax)
- modeIndentA :: forall syntax f. Functor f => ((syntax -> IndentBehaviour -> BufferM ()) -> f (syntax -> IndentBehaviour -> BufferM ())) -> Mode syntax -> f (Mode syntax)
- modeFollowA :: forall syntax f. Functor f => ((syntax -> Action) -> f (syntax -> Action)) -> Mode syntax -> f (Mode syntax)
- modeIndentSettingsA :: forall syntax f. Functor f => (IndentSettings -> f IndentSettings) -> Mode syntax -> f (Mode syntax)
- modeToggleCommentSelectionA :: forall syntax f. Functor f => (Maybe (BufferM ()) -> f (Maybe (BufferM ()))) -> Mode syntax -> f (Mode syntax)
- modeGetStrokesA :: forall syntax f. Functor f => ((syntax -> Point -> Point -> Point -> [Stroke]) -> f (syntax -> Point -> Point -> Point -> [Stroke])) -> Mode syntax -> f (Mode syntax)
- modeOnLoadA :: forall syntax f. Functor f => (BufferM () -> f (BufferM ())) -> Mode syntax -> f (Mode syntax)
- modeGotoDeclarationA :: forall syntax f. Functor f => (BufferM () -> f (BufferM ())) -> Mode syntax -> f (Mode syntax)
- modeModeLineA :: forall syntax f. Functor f => (([Text] -> BufferM Text) -> f ([Text] -> BufferM Text)) -> Mode syntax -> f (Mode syntax)
- data AnyMode = AnyMode (Mode syntax)
- data IndentBehaviour
  - = IncreaseCycle
  - | DecreaseCycle
  - | IncreaseOnly
  - | DecreaseOnly
- data IndentSettings = IndentSettings {
  - expandTabs :: !Bool
  - tabSize :: !Int
  - shiftWidth :: !Int
  }
- expandTabsA :: Lens' IndentSettings Bool
- tabSizeA :: Lens' IndentSettings Int
- shiftWidthA :: Lens' IndentSettings Int
- modeAlwaysApplies :: a -> b -> Bool
- 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
- 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
- shortIdentString :: Int -> FBuffer -> Text
- identString :: FBuffer -> Text
- miniIdentString :: FBuffer -> Text
- data BufferId
  - = MemBuffer !Text
  - | FileBuffer !FilePath
- file :: FBuffer -> Maybe FilePath
- replaceCharB :: Char -> BufferM ()
- replaceCharWithBelowB :: BufferM ()
- replaceCharWithAboveB :: BufferM ()
- insertCharWithBelowB :: BufferM ()
- insertCharWithAboveB :: BufferM ()
- pointAfterCursorB :: Point -> BufferM Point
- destinationOfMoveB :: BufferM a -> BufferM Point
- withEveryLineB :: BufferM () -> BufferM ()
- startUpdateTransactionB :: BufferM ()
- commitUpdateTransactionB :: BufferM ()
- applyUpdate :: Update -> BufferM ()
- betweenB :: Point -> Point -> BufferM YiString
- decreaseFontSize :: Int -> BufferM ()
- increaseFontSize :: Int -> BufferM ()
- queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x
- swapRegionsB :: Region -> Region -> BufferM ()
- deleteRegionB :: Region -> BufferM ()
- replaceRegionB :: Region -> YiString -> BufferM ()
- mapRegionB :: Region -> (Char -> Char) -> BufferM ()
- winRegionB :: BufferM Region
- blockifyRegion :: Region -> BufferM [Region]
- joinLinesB :: Region -> BufferM ()
- concatLinesB :: Region -> BufferM ()
- linesOfRegionB :: Region -> BufferM [Region]
- halfUnit :: Direction -> TextUnit -> TextUnit
- deleteUnitB :: TextUnit -> Direction -> BufferM ()
- emptyU :: URList
- addChangeU :: Change -> URList -> URList
- deleteInteractivePointsU :: URList -> URList
- setSavedFilePointU :: URList -> URList
- isAtSavedFilePointU :: URList -> Bool
- undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
- redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
- data URList
- data Change
  - = InteractivePoint
  - | AtomicChange !Update
- module Yi.Core
- module Yi.Dired
- module Yi.Editor
- module Yi.File
- data Config
- data UIConfig
- data CursorStyle
  - = AlwaysFat
  - | NeverFat
  - | FatWhenFocused
  - | FatWhenFocusedAndInserting
- startFrontEndA :: Lens' Config UIBoot
- configUIA :: Lens' Config UIConfig
- startActionsA :: Lens' Config [Action]
- initialActionsA :: Lens' Config [Action]
- defaultKmA :: Lens' Config KeymapSet
- configInputPreprocessA :: Lens' Config (P Event Event)
- modeTableA :: Lens' Config [AnyMode]
- debugModeA :: Lens' Config Bool
- configRegionStyleA :: Lens' Config RegionStyle
- configKillringAccumulateA :: Lens' Config Bool
- bufferUpdateHandlerA :: Lens' Config (Seq (Seq Update -> BufferM ()))
- configFontNameA :: Lens' UIConfig (Maybe String)
- configFontSizeA :: Lens' UIConfig (Maybe Int)
- configScrollWheelAmountA :: Lens' UIConfig Int
- configScrollStyleA :: Lens' UIConfig (Maybe ScrollStyle)
- configCursorStyleA :: Lens' UIConfig CursorStyle
- configLeftSideScrollBarA :: Lens' UIConfig Bool
- configAutoHideScrollBarA :: Lens' UIConfig Bool
- configAutoHideTabBarA :: Lens' UIConfig Bool
- configLineWrapA :: Lens' UIConfig Bool
- configWindowFillA :: Lens' UIConfig Char
- configThemeA :: Lens' UIConfig Theme
- layoutManagersA :: Lens' Config [AnyLayoutManager]
- configVarsA :: Lens' Config DynamicState
- configLineNumbersA :: Lens' UIConfig Bool
- module Yi.Config.Default
- module Yi.Keymap
- module Yi.Keymap.Keys
- module Yi.Layout
- module Yi.Search
- module Yi.Style
- module Yi.Style.Library
- module Yi.Misc

# The main interface

data ConfigM a Source #

The configuration monad. Run it with `configMain`.

#### Instances

Instances details

Applicative ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods pure :: a -> ConfigM a Source # (<*>) :: ConfigM (a -> b) -> ConfigM a -> ConfigM b Source # liftA2 :: (a -> b -> c) -> ConfigM a -> ConfigM b -> ConfigM c Source # (*>) :: ConfigM a -> ConfigM b -> ConfigM b Source # (<*) :: ConfigM a -> ConfigM b -> ConfigM a Source #
Functor ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods fmap :: (a -> b) -> ConfigM a -> ConfigM b Source # (<$) :: a -> ConfigM b -> ConfigM a Source #
Monad ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods (>>=) :: ConfigM a -> (a -> ConfigM b) -> ConfigM b Source # (>>) :: ConfigM a -> ConfigM b -> ConfigM b Source # return :: a -> ConfigM a Source #
MonadState Config ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods get :: ConfigM Config Source # put :: Config -> ConfigM () Source # state :: (Config -> (a, Config)) -> ConfigM a Source #
MonadBase IO ConfigM Source # |
Instance details Defined in Yi.Config.Simple.Types Methods liftBase :: IO α -> ConfigM α Source #

type Field a = Lens' Config a Source #

Fields that can be modified with all lens machinery.

# Modes, commands, and keybindings

globalBindKeys :: Keymap -> ConfigM () Source #

Adds the given key bindings to the `global keymap'. The bindings will override existing bindings in the case of a clash.

modeBindKeys :: Mode syntax -> Keymap -> ConfigM () Source #

`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.

modeBindKeysByName :: Text -> Keymap -> ConfigM () Source #

`modeBindKeysByName name keys` adds the keybindings in `keys` to all modes with name `name` (if it is registered). Consider using `modeBindKeys` instead.

addMode :: Mode syntax -> ConfigM () Source #

Register the given mode. It will be preferred over any modes already defined.

modifyMode :: Mode syntax -> (forall syntax'. Mode syntax' -> Mode syntax') -> ConfigM () Source #

`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

modifyModeByName :: Text -> (forall syntax. Mode syntax -> Mode syntax) -> ConfigM () Source #

`modifyModeByName name f` modifies the mode with name `name` using the function `f`. Consider using `modifyMode` instead.

# Evaluation of commands

evaluator :: Field Evaluator Source #

The evaluator to use for `execEditorAction` and `getAllNamesInScope`.

publishedActionsEvaluator :: Evaluator Source #

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

publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM () Source #

Publish the given action, by the given name. This will overwrite any existing actions by the same name.

publishedActions :: Field (HashMap String Action) Source #

Accessor for the published actions. Consider using `publishAction`.

# Appearance

fontName :: Field (Maybe String) Source #

`Just` the font name, or `Nothing` for default.

fontSize :: Field (Maybe Int) Source #

`Just` the font size, or `Nothing` for default.

scrollWheelAmount :: Field Int Source #

Amount to move the buffer when using the scroll wheel.

scrollStyle :: Field (Maybe ScrollStyle) Source #

`Just` the scroll style, or `Nothing` for default.

data ScrollStyle Source #

Constructors

SnapToCenter |
SingleLine |

cursorStyle :: Field CursorStyle Source #

See `CursorStyle` for documentation.

data CursorStyle Source #

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

Constructors

AlwaysFat |
NeverFat |
FatWhenFocused |
FatWhenFocusedAndInserting |

data Side Source #

Constructors

LeftSide |
RightSide |

scrollBarSide :: Field Side Source #

Which side to display the scroll bar on.

autoHideScrollBar :: Field Bool Source #

Should the scroll bar autohide?

autoHideTabBar :: Field Bool Source #

Should the tab bar autohide?

lineWrap :: Field Bool Source #

Should lines be wrapped?

windowFill :: Field Char Source #

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

theme :: Field Theme Source #

UI colour theme.

lineNumbers :: Field Bool Source #

Line numbers.

## Layout

layoutManagers :: Field [AnyLayoutManager] Source #

List of registered layout managers. When cycling through layouts, this list will be consulted.

# Debugging

debug :: Field Bool Source #

Produce a .yi.dbg file with debugging information?

# Startup hooks

runOnStartup :: Action -> ConfigM () Source #

Run when the editor is started (this is run after all actions which have already been registered)

runAfterStartup :: Action -> ConfigM () Source #

Run after the startup actions have completed, or on reload (this is run after all actions which have already been registered)

# Advanced

These fields are here for completeness -- that is, to expose all the functionality of the Yi.Config module. However, most users probably need not use these fields, typically because they provide advanced functionality, or because a simpler interface for the common case is available above.

startActions :: Field [Action] Source #

Actions to run when the editor is started. Consider using `runOnStartup` or `runManyOnStartup` instead.

initialActions :: Field [Action] Source #

Actions to run after startup or reload. Consider using `runAfterStartup` or `runManyAfterStartup` instead.

defaultKm :: Field KeymapSet Source #

Default keymap to use.

inputPreprocess :: Field (P Event Event) Source #

?

modes :: Field [AnyMode] Source #

List of modes by order of preference. Consider using `addMode`, `modeBindKeys`, or `modifyMode` instead.

regionStyle :: Field RegionStyle Source #

Set to `Exclusive` for an emacs-like behaviour. Consider starting with `defaultEmacsConfig`, `defaultVimConfig`, or `defaultCuaConfig` to instead.

killringAccumulate :: Field Bool Source #

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.

bufferUpdateHandler :: Field (Seq (Seq Update -> BufferM ())) Source #

?

# Module exports

newtype Size Source #

Size of a buffer region

Constructors

Size |

Fields

- fromSize :: Int

#### Instances

Instances details

Binary Size |
Instance details Defined in Yi.Buffer.Basic Methods put :: Size -> Put Source # get :: Get Size Source # putList :: [Size] -> Put Source #
Enum Size |
Instance details Defined in Yi.Buffer.Basic Methods succ :: Size -> Size Source # pred :: Size -> Size Source # toEnum :: Int -> Size Source # fromEnum :: Size -> Int Source # enumFrom :: Size -> [Size] Source # enumFromThen :: Size -> Size -> [Size] Source # enumFromTo :: Size -> Size -> [Size] Source # enumFromThenTo :: Size -> Size -> Size -> [Size] Source #
Num Size |
Instance details Defined in Yi.Buffer.Basic Methods (+) :: Size -> Size -> Size Source # (-) :: Size -> Size -> Size Source # (*) :: Size -> Size -> Size Source # negate :: Size -> Size Source # abs :: Size -> Size Source # signum :: Size -> Size Source # fromInteger :: Integer -> Size Source #
Integral Size |
Instance details Defined in Yi.Buffer.Basic Methods quot :: Size -> Size -> Size Source # rem :: Size -> Size -> Size Source # div :: Size -> Size -> Size Source # mod :: Size -> Size -> Size Source # quotRem :: Size -> Size -> (Size, Size) Source # divMod :: Size -> Size -> (Size, Size) Source # toInteger :: Size -> Integer Source #
Real Size |
Instance details Defined in Yi.Buffer.Basic Methods toRational :: Size -> Rational Source #
Show Size |
Instance details Defined in Yi.Buffer.Basic Methods showsPrec :: Int -> Size -> ShowS Source # show :: Size -> String Source # showList :: [Size] -> ShowS Source #
Eq Size |
Instance details Defined in Yi.Buffer.Basic Methods (==) :: Size -> Size -> Bool Source # (/=) :: Size -> Size -> Bool Source #
Ord Size |
Instance details Defined in Yi.Buffer.Basic Methods compare :: Size -> Size -> Ordering Source # (<) :: Size -> Size -> Bool Source # (<=) :: Size -> Size -> Bool Source # (>) :: Size -> Size -> Bool Source # (>=) :: Size -> Size -> Bool Source # max :: Size -> Size -> Size Source # min :: Size -> Size -> Size Source #
SemiNum Point Size |
Instance details Defined in Yi.Buffer.Basic Methods (+~) :: Point -> Size -> Point Source # (-~) :: Point -> Size -> Point Source # (~-) :: Point -> Point -> Size Source #

data Mode syntax Source #

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

Constructors

Mode |

Fields

- modeName :: Text

  so this can be serialized, debugged.

- modeApplies :: FilePath -> YiString -> Bool

  What type of files does this mode apply to?

- modeHL :: ExtHL syntax

  Syntax highlighter

- modePrettify :: syntax -> BufferM ()

  Prettify current "paragraph"

- modeKeymap :: KeymapSet -> KeymapSet

  Buffer-local keymap modification

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

  emacs-style auto-indent line

- modeFollow :: syntax -> Action

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

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

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

- modeOnLoad :: BufferM ()

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

- modeModeLine :: [Text] -> BufferM Text

  buffer-local modeline formatting method

- modeGotoDeclaration :: BufferM ()

  go to the point where the variable is declared

#### Instances

Instances details

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

data TextUnit Source #

Designate a given "unit" of text.

Constructors

Character | a single character
Line | a line of text (between newlines)
VLine | a "vertical" line of text (area of text between two characters at the same column number)
Document | the whole document
GenUnit |

Fields

- genEnclosingUnit :: TextUnit
- genUnitBoundary :: Direction -> BufferM Bool

moveTo :: Point -> BufferM () Source #

Move point in buffer to the given index

moveN :: Int -> BufferM () Source #

Move point by the given number of characters. A negative offset moves backwards a positive one forward.

writeN :: YiString -> BufferM () Source #

Write the list into the buffer at current point.

newtype WindowRef Source #

Window references

Constructors

WindowRef |

Fields

- unWindowRef :: Int

#### Instances

Instances details

Binary WindowRef |
Instance details Defined in Yi.Buffer.Basic Methods put :: WindowRef -> Put Source # get :: Get WindowRef Source # putList :: [WindowRef] -> Put Source #
Default WindowRef |
Instance details Defined in Yi.Buffer.Basic Methods def :: WindowRef Source #
Enum WindowRef |

Instance details

Defined in Yi.Buffer.Basic

Methods

succ :: WindowRef -> WindowRef Source #

pred :: WindowRef -> WindowRef Source #

toEnum :: Int -> WindowRef Source #

fromEnum :: WindowRef -> Int Source #

enumFrom :: WindowRef -> [WindowRef] Source #

enumFromThen :: WindowRef -> WindowRef -> [WindowRef] Source #

enumFromTo :: WindowRef -> WindowRef -> [WindowRef] Source #

enumFromThenTo :: WindowRef -> WindowRef -> WindowRef -> [WindowRef] Source #

Show WindowRef |
Instance details Defined in Yi.Buffer.Basic Methods showsPrec :: Int -> WindowRef -> ShowS Source # show :: WindowRef -> String Source # showList :: [WindowRef] -> ShowS Source #
Eq WindowRef |
Instance details Defined in Yi.Buffer.Basic Methods (==) :: WindowRef -> WindowRef -> Bool Source # (/=) :: WindowRef -> WindowRef -> Bool Source #
Ord WindowRef |
Instance details Defined in Yi.Buffer.Basic Methods compare :: WindowRef -> WindowRef -> Ordering Source # (<) :: WindowRef -> WindowRef -> Bool Source # (<=) :: WindowRef -> WindowRef -> Bool Source # (>) :: WindowRef -> WindowRef -> Bool Source # (>=) :: WindowRef -> WindowRef -> Bool Source # max :: WindowRef -> WindowRef -> WindowRef Source # min :: WindowRef -> WindowRef -> WindowRef Source #

newtype Point Source #

A point in a buffer

Constructors

Point |

Fields

- fromPoint :: Int

#### Instances

Instances details

Binary Point |
Instance details Defined in Yi.Buffer.Basic Methods put :: Point -> Put Source # get :: Get Point Source # putList :: [Point] -> Put Source #
Bounded Point |
Instance details Defined in Yi.Buffer.Basic Methods minBound :: Point Source # maxBound :: Point Source #
Enum Point |
Instance details Defined in Yi.Buffer.Basic Methods succ :: Point -> Point Source # pred :: Point -> Point Source # toEnum :: Int -> Point Source # fromEnum :: Point -> Int Source # enumFrom :: Point -> [Point] Source # enumFromThen :: Point -> Point -> [Point] Source # enumFromTo :: Point -> Point -> [Point] Source # enumFromThenTo :: Point -> Point -> Point -> [Point] Source #
Ix Point |
Instance details Defined in Yi.Buffer.Basic Methods range :: (Point, Point) -> [Point] Source # index :: (Point, Point) -> Point -> Int Source # unsafeIndex :: (Point, Point) -> Point -> Int Source # inRange :: (Point, Point) -> Point -> Bool Source # rangeSize :: (Point, Point) -> Int Source # unsafeRangeSize :: (Point, Point) -> Int Source #
Num Point |
Instance details Defined in Yi.Buffer.Basic Methods (+) :: Point -> Point -> Point Source # (-) :: Point -> Point -> Point Source # (*) :: Point -> Point -> Point Source # negate :: Point -> Point Source # abs :: Point -> Point Source # signum :: Point -> Point Source # fromInteger :: Integer -> Point Source #
Integral Point |
Instance details Defined in Yi.Buffer.Basic Methods quot :: Point -> Point -> Point Source # rem :: Point -> Point -> Point Source # div :: Point -> Point -> Point Source # mod :: Point -> Point -> Point Source # quotRem :: Point -> Point -> (Point, Point) Source # divMod :: Point -> Point -> (Point, Point) Source # toInteger :: Point -> Integer Source #
Real Point |
Instance details Defined in Yi.Buffer.Basic Methods toRational :: Point -> Rational Source #
Show Point |
Instance details Defined in Yi.Buffer.Basic Methods showsPrec :: Int -> Point -> ShowS Source # show :: Point -> String Source # showList :: [Point] -> ShowS Source #
Eq Point |
Instance details Defined in Yi.Buffer.Basic Methods (==) :: Point -> Point -> Bool Source # (/=) :: Point -> Point -> Bool Source #
Ord Point |
Instance details Defined in Yi.Buffer.Basic Methods compare :: Point -> Point -> Ordering Source # (<) :: Point -> Point -> Bool Source # (<=) :: Point -> Point -> Bool Source # (>) :: Point -> Point -> Bool Source # (>=) :: Point -> Point -> Bool Source # max :: Point -> Point -> Point Source # min :: Point -> Point -> Point Source #
SemiNum Point Size |
Instance details Defined in Yi.Buffer.Basic Methods (+~) :: Point -> Size -> Point Source # (-~) :: Point -> Size -> Point Source # (~-) :: Point -> Point -> Size Source #

newtype BufferRef Source #

Reference to a buffer.

Constructors

BufferRef Int |

#### Instances

Instances details

Binary BufferRef |
Instance details Defined in Yi.Buffer.Basic Methods put :: BufferRef -> Put Source # get :: Get BufferRef Source # putList :: [BufferRef] -> Put Source #
Num BufferRef |
Instance details Defined in Yi.Buffer.Basic Methods (+) :: BufferRef -> BufferRef -> BufferRef Source # (-) :: BufferRef -> BufferRef -> BufferRef Source # (*) :: BufferRef -> BufferRef -> BufferRef Source # negate :: BufferRef -> BufferRef Source # abs :: BufferRef -> BufferRef Source # signum :: BufferRef -> BufferRef Source # fromInteger :: Integer -> BufferRef Source #
Show BufferRef |
Instance details Defined in Yi.Buffer.Basic Methods showsPrec :: Int -> BufferRef -> ShowS Source # show :: BufferRef -> String Source # showList :: [BufferRef] -> ShowS Source #
Eq BufferRef |
Instance details Defined in Yi.Buffer.Basic Methods (==) :: BufferRef -> BufferRef -> Bool Source # (/=) :: BufferRef -> BufferRef -> Bool Source #
Ord BufferRef |
Instance details Defined in Yi.Buffer.Basic Methods compare :: BufferRef -> BufferRef -> Ordering Source # (<) :: BufferRef -> BufferRef -> Bool Source # (<=) :: BufferRef -> BufferRef -> Bool Source # (>) :: BufferRef -> BufferRef -> Bool Source # (>=) :: BufferRef -> BufferRef -> Bool Source # max :: BufferRef -> BufferRef -> BufferRef Source # min :: BufferRef -> BufferRef -> BufferRef Source #

newtype Mark Source #

A mark in a buffer

Constructors

Mark |

Fields

- markId :: Int

#### Instances

Instances details

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

data Direction Source #

Direction of movement inside a buffer

Constructors

Backward |
Forward |

#### Instances

Instances details

Binary Direction |
Instance details Defined in Yi.Buffer.Basic Methods put :: Direction -> Put Source # get :: Get Direction Source # putList :: [Direction] -> Put Source #
Bounded Direction |
Instance details Defined in Yi.Buffer.Basic Methods minBound :: Direction Source # maxBound :: Direction Source #
Enum Direction |

Instance details

Defined in Yi.Buffer.Basic

Methods

succ :: Direction -> Direction Source #

pred :: Direction -> Direction Source #

toEnum :: Int -> Direction Source #

fromEnum :: Direction -> Int Source #

enumFrom :: Direction -> [Direction] Source #

enumFromThen :: Direction -> Direction -> [Direction] Source #

enumFromTo :: Direction -> Direction -> [Direction] Source #

enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] Source #

Generic Direction |

Instance details

Defined in Yi.Buffer.Basic

Associated Types

type Rep Direction |
Instance details Defined in Yi.Buffer.Basic type Rep Direction = D1 ('MetaData "Direction" "Yi.Buffer.Basic" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "Backward" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Forward" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Direction -> Rep Direction x Source #

to :: Rep Direction x -> Direction Source #

Show Direction |
Instance details Defined in Yi.Buffer.Basic Methods showsPrec :: Int -> Direction -> ShowS Source # show :: Direction -> String Source # showList :: [Direction] -> ShowS Source #
Eq Direction |
Instance details Defined in Yi.Buffer.Basic Methods (==) :: Direction -> Direction -> Bool Source # (/=) :: Direction -> Direction -> Bool Source #
Ord Direction |
Instance details Defined in Yi.Buffer.Basic Methods compare :: Direction -> Direction -> Ordering Source # (<) :: Direction -> Direction -> Bool Source # (<=) :: Direction -> Direction -> Bool Source # (>) :: Direction -> Direction -> Bool Source # (>=) :: Direction -> Direction -> Bool Source # max :: Direction -> Direction -> Direction Source # min :: Direction -> Direction -> Direction Source #
type Rep Direction |
Instance details Defined in Yi.Buffer.Basic type Rep Direction = D1 ('MetaData "Direction" "Yi.Buffer.Basic" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "Backward" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Forward" 'PrefixI 'False) (U1 :: Type -> Type))

reverseDir :: Direction -> Direction Source #

mayReverse :: Direction -> [a] -> [a] Source #

reverse if Backward

directionElim :: Direction -> a -> a -> a Source #

`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.

data Region Source #

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

#### Instances

Instances details

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

Instance details

Defined in Yi.Region

Associated Types

type Rep Region |

Instance details

Defined in Yi.Region

type Rep Region = D1 ('MetaData "Region" "Yi.Region" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "Region" 'PrefixI 'True) (S1 ('MetaSel ('Just "regionDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: (S1 ('MetaSel ('Just "regionStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Point) :*: S1 ('MetaSel ('Just "regionEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Point))))

Methods

from :: Region -> Rep Region x Source #

to :: Rep Region x -> Region Source #

Show Region |
Instance details Defined in Yi.Region Methods showsPrec :: Int -> Region -> ShowS Source # show :: Region -> String Source # showList :: [Region] -> ShowS Source #
type Rep Region |

Instance details

Defined in Yi.Region

type Rep Region = D1 ('MetaData "Region" "Yi.Region" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "Region" 'PrefixI 'True) (S1 ('MetaSel ('Just "regionDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: (S1 ('MetaSel ('Just "regionStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Point) :*: S1 ('MetaSel ('Just "regionEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Point))))

regionFirst :: Region -> Point Source #

regionLast :: Region -> Point Source #

fmapRegion :: (Point -> Point) -> Region -> Region Source #

regionSize :: Region -> Size Source #

intersectRegion :: Region -> Region -> Region Source #

Take the intersection of two regions

unionRegion :: Region -> Region -> Region Source #

Take the union of two regions (including what is between them)

mkRegion :: Point -> Point -> Region Source #

Construct a region from its bounds, emacs style: the right bound is excluded

mkRegion' :: Direction -> Point -> Point -> Region Source #

mkSizeRegion :: Point -> Size -> Region Source #

emptyRegion :: Region Source #

The empty region

inRegion :: Point -> Region -> Bool Source #

True if the given point is inside the given region.

nearRegion :: Point -> Region -> Bool Source #

True if the given point is inside the given region or at the end of it.

includedRegion :: Region -> Region -> Bool Source #

Returns if a region (1st arg) is included in another (2nd arg)

regionIsEmpty :: Region -> Bool Source #

regionsOverlap :: Bool -> Region -> Region -> Bool Source #

data SearchExp Source #

#### Instances

Instances details

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

data UIUpdate Source #

Constructors

TextUpdate !Update |
StyleUpdate !Point !Size |

#### Instances

Instances details

Binary UIUpdate Source # |
Instance details Defined in Yi.Buffer.Implementation Methods put :: UIUpdate -> Put Source # get :: Get UIUpdate Source # putList :: [UIUpdate] -> Put Source #
Generic UIUpdate Source # |

Instance details

Defined in Yi.Buffer.Implementation

Associated Types

type Rep UIUpdate |

Instance details

Defined in Yi.Buffer.Implementation

type Rep UIUpdate = D1 ('MetaData "UIUpdate" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "TextUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Update)) :+: C1 ('MetaCons "StyleUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Size)))

Methods

from :: UIUpdate -> Rep UIUpdate x Source #

to :: Rep UIUpdate x -> UIUpdate Source #

type Rep UIUpdate Source # |

Instance details

Defined in Yi.Buffer.Implementation

type Rep UIUpdate = D1 ('MetaData "UIUpdate" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "TextUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Update)) :+: C1 ('MetaCons "StyleUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Size)))

data Update Source #

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.

Constructors

Insert |

Fields

- updatePoint :: !Point
- updateDirection :: !Direction
- _insertUpdateString :: !YiString

Delete |

Fields

- updatePoint :: !Point
- updateDirection :: !Direction
- _deleteUpdateString :: !YiString

#### Instances

Instances details

Binary Update Source # |
Instance details Defined in Yi.Buffer.Implementation Methods put :: Update -> Put Source # get :: Get Update Source # putList :: [Update] -> Put Source #
Generic Update Source # |

Instance details

Defined in Yi.Buffer.Implementation

Associated Types

type Rep Update |

Instance details

Defined in Yi.Buffer.Implementation

type Rep Update = D1 ('MetaData "Update" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "Insert" 'PrefixI 'True) (S1 ('MetaSel ('Just "updatePoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: (S1 ('MetaSel ('Just "updateDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: S1 ('MetaSel ('Just "_insertUpdateString") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 YiString))) :+: C1 ('MetaCons "Delete" 'PrefixI 'True) (S1 ('MetaSel ('Just "updatePoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: (S1 ('MetaSel ('Just "updateDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: S1 ('MetaSel ('Just "_deleteUpdateString") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 YiString))))

Methods

from :: Update -> Rep Update x Source #

to :: Rep Update x -> Update Source #

Show Update Source # |
Instance details Defined in Yi.Buffer.Implementation Methods showsPrec :: Int -> Update -> ShowS Source # show :: Update -> String Source # showList :: [Update] -> ShowS Source #
type Rep Update Source # |

Instance details

Defined in Yi.Buffer.Implementation

type Rep Update = D1 ('MetaData "Update" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "Insert" 'PrefixI 'True) (S1 ('MetaSel ('Just "updatePoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: (S1 ('MetaSel ('Just "updateDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: S1 ('MetaSel ('Just "_insertUpdateString") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 YiString))) :+: C1 ('MetaCons "Delete" 'PrefixI 'True) (S1 ('MetaSel ('Just "updatePoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: (S1 ('MetaSel ('Just "updateDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: S1 ('MetaSel ('Just "_deleteUpdateString") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 YiString))))

updateIsDelete :: Update -> Bool Source #

markGravityAA :: Lens' MarkValue Direction Source #

markPointAA :: Lens' MarkValue Point Source #

atEof :: BufferM Bool Source #

True if point at end of file

atEol :: BufferM Bool Source #

Return true if the current point is the end of a line

atLastLine :: BufferM Bool Source #

True if point at the last line

atSol :: BufferM Bool Source #

Return true if the current point is the start of a line

atSof :: BufferM Bool Source #

True if point at start of file

bdeleteB :: BufferM () Source #

Delete one character backward

bdeleteLineB :: BufferM () Source #

Delete backward to the sof or the new line character

bkillWordB :: BufferM () Source #

Delete backward whitespace or non-whitespace depending on the character before point.

botB :: BufferM () Source #

Move cursor to end of buffer

bufInfoB :: BufferM BufferFileInfo Source #

File info, size in chars, line no, col num, char num, percent

data BufferFileInfo Source #

Constructors

BufferFileInfo |

Fields

- bufInfoFileName :: FilePath
- bufInfoSize :: Int
- bufInfoLineNo :: Int
- bufInfoColNo :: Int
- bufInfoCharNo :: Point
- bufInfoPercent :: Text
- bufInfoModified :: Bool

capitaliseWordB :: BufferM () Source #

capitalise the first letter of this word

deleteBlankLinesB :: BufferM () Source #

deleteHorizontalSpaceB :: Maybe Int -> BufferM () Source #

emacs' `delete-horizontal-space` with the optional argument.

deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point) Source #

deleteToEol :: BufferM () Source #

Delete to the end of line, excluding it.

deleteTrailingSpaceB :: BufferM () Source #

Delete trailing whitespace from all lines. Uses `savingPositionB` to get back to where it was.

downFromTosB :: Int -> BufferM () Source #

Move to `n` lines down from top of screen

downScreenB :: BufferM () Source #

Scroll down 1 screen

downScreensB :: Int -> BufferM () Source #

exchangePointAndMarkB :: BufferM () Source #

Exchange point & mark.

fillParagraph :: BufferM () Source #

findMatchingPairB :: BufferM () Source #

firstNonSpaceB :: BufferM () Source #

Move to first non-space character in this line

flipRectangleB :: Point -> Point -> BufferM (Point, Point) Source #

getBookmarkB :: String -> BufferM Mark Source #

getLineAndCol :: BufferM (Int, Int) Source #

Get the current line and column number

getLineAndColOfPoint :: Point -> BufferM (Int, Int) Source #

getNextLineB :: Direction -> BufferM YiString Source #

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.

getNextNonBlankLineB :: Direction -> BufferM YiString Source #

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).

getRawestSelectRegionB :: BufferM Region Source #

Return the region between point and mark

getSelectionMarkPointB :: BufferM Point Source #

Get the current buffer selection mark

getSelectRegionB :: BufferM Region Source #

Get the current region boundaries. Extended to the current selection unit.

gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM () Source #

hasWhiteSpaceBefore :: BufferM Bool Source #

incrementNextNumberByB :: Int -> BufferM () Source #

Increase (or decrease if negative) next number on line by n.

insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM () Source #

isCurrentLineAllWhiteSpaceB :: BufferM Bool Source #

Note: Returns False if line doesn't have any characters besides a newline

isCurrentLineEmptyB :: BufferM Bool Source #

True if current line consists of just a newline (no whitespace)

isNumberB :: BufferM Bool Source #

Is character under cursor a number.

killWordB :: BufferM () Source #

Delete forward whitespace or non-whitespace depending on the character under point.

lastNonSpaceB :: BufferM () Source #

Move to the last non-space character in this line

leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point] Source #

leftOnEol :: BufferM () Source #

Move left if on eol, but not on blank line

lineMoveVisRel :: Int -> BufferM () Source #

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.

linePrefixSelectionB Source #

Arguments

:: YiString | The string that starts a line comment
-> BufferM () |

Prefix each line in the selection using the given string.

lineStreamB :: Direction -> BufferM [YiString] Source #

Get a (lazy) stream of lines in the buffer, starting at the next line in the given direction.

lowercaseWordB :: BufferM () Source #

lowerise word under the cursor

middleB :: BufferM () Source #

Move to middle line in screen

modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM () Source #

moveNonspaceOrSol :: BufferM () Source #

Go to the first non space character in the line; if already there, then go to the beginning of the line.

movePercentageFileB :: Int -> BufferM () Source #

moveToMTB :: BufferM () Source #

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

moveToEol :: BufferM () Source #

Move point to end of line

moveToSol :: BufferM () Source #

Move point to start of line

moveXorEol :: Int -> BufferM () Source #

Move `x` chars forward, or to the eol, whichever is less

moveXorSol :: Int -> BufferM () Source #

Move `x` chars back, or to the sol, whichever is less

nextCExc :: Char -> BufferM () Source #

Move to the character before the next occurrence of `c`

nextCInc :: Char -> BufferM () Source #

Move to the next occurrence of `c`

nextCInLineExc :: Char -> BufferM () Source #

nextCInLineInc :: Char -> BufferM () Source #

nextNParagraphs :: Int -> BufferM () Source #

Move down next `n` paragraphs

nextWordB :: BufferM () Source #

Move to first char of next word forwards

prevCExc :: Char -> BufferM () Source #

Move to the character after the previous occurrence of `c`

prevCInc :: Char -> BufferM () Source #

Move to the previous occurrence of `c`

prevCInLineExc :: Char -> BufferM () Source #

prevCInLineInc :: Char -> BufferM () Source #

prevNParagraphs :: Int -> BufferM () Source #

Move up prev `n` paragraphs

prevWordB :: BufferM () Source #

Move to first char of next word backwards

readCurrentWordB :: BufferM YiString Source #

Reads in word at point.

readLnB :: BufferM YiString Source #

Read the line the point is on

readPrevWordB :: BufferM YiString Source #

Reads in word before point.

readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString Source #

replaceBufferContent :: YiString -> BufferM () Source #

Replace the contents of the buffer with some string

revertB :: YiString -> UTCTime -> BufferM () Source #

Helper function: revert the buffer contents to its on-disk version

rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point] Source #

scrollB :: Int -> BufferM () Source #

Scroll by n lines.

scrollCursorToBottomB :: BufferM () Source #

Move cursor to the bottom of the screen

scrollCursorToTopB :: BufferM () Source #

Move cursor to the top of the screen

scrollScreensB :: Int -> BufferM () Source #

Scroll by n screens (negative for up)

scrollToCursorB :: BufferM () Source #

Move to middle line in screen

scrollToLineAboveWindowB :: BufferM () Source #

scrollToLineBelowWindowB :: BufferM () Source #

selectNParagraphs :: Int -> BufferM () Source #

Select next `n` paragraphs

setSelectionMarkPointB :: Point -> BufferM () Source #

Marks

Set the current buffer selection mark

setSelectRegionB :: Region -> BufferM () Source #

Select the given region: set the selection mark at the `regionStart` and the current point at the `regionEnd`.

shapeOfBlockRegionB :: Region -> BufferM (Point, [Int]) Source #

sortLines :: BufferM () Source #

Sort the lines of the region.

sortLinesWithRegion :: Region -> BufferM () Source #

snapInsB :: BufferM () Source #

Move the point to inside the viewable region

snapScreenB :: Maybe ScrollStyle -> BufferM Bool Source #

Move the visible region to include the point

splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region] Source #

swapB :: BufferM () Source #

Transpose two characters, (the Emacs C-t action)

switchCaseChar :: Char -> Char Source #

test3CharB :: BufferM Bool Source #

Used by isNumber to test if current character under cursor is a number.

testHexB :: BufferM Bool Source #

Characters [`a`..`f`] are part of a hex number only if preceded by 0x. Test if the current occurrence of [`a`..`f`] is part of a hex number.

toggleCommentB :: YiString -> BufferM () Source #

Just like `toggleCommentSelectionB` but automatically inserts a whitespace suffix to the inserted comment string. In fact:

topB :: BufferM () Source #

Move cursor to origin

unLineCommentSelectionB Source #

Arguments

:: YiString | The string which begins a line comment
-> YiString | A potentially shorter string that begins a comment
-> 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.

upFromBosB :: Int -> BufferM () Source #

Move to `n` lines up from the bottom of the screen

uppercaseWordB :: BufferM () Source #

capitalise the word under the cursor

upScreenB :: BufferM () Source #

Scroll up 1 screen

upScreensB :: Int -> BufferM () Source #

vimScrollB :: Int -> BufferM () Source #

Same as scrollB, but also moves the cursor

vimScrollByB :: (Int -> Int) -> Int -> BufferM () Source #

Same as scrollByB, but also moves the cursor

markWord :: BufferM () Source #

Implements the same logic that emacs' `mark-word` does. Checks the mark point and moves it forth (or backward) for one word.

autoIndentB :: IndentBehaviour -> BufferM () Source #

A specialisation of `autoIndentHelperB`. This is the most basic and the user is encouraged to specialise `autoIndentHelperB` on their own.

cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM () Source #

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

indentAsNextB :: BufferM () Source #

Indent as much as the next line

indentAsPreviousB :: BufferM () Source #

Indent as much as the previous line

indentAsTheMostIndentedNeighborLineB :: BufferM () Source #

indentOfB :: YiString -> BufferM Int Source #

Returns the indentation of a given string. Note that this depends on the current indentation settings.

indentOfCurrentPosB :: BufferM Int Source #

Return the number of spaces at the beginning of the line, up to the point.

indentSettingsB :: BufferM IndentSettings Source #

Gives the `IndentSettings` for the current buffer.

indentToB :: Int -> BufferM () Source #

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.

modifyIndentB :: (Int -> Int) -> BufferM () Source #

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.

newlineAndIndentB :: BufferM () Source #

Insert a newline at point and indent the new line as the previous one.

shiftIndentOfRegionB :: Int -> Region -> BufferM () Source #

Increases the indentation on the region by the given amount of shiftWidth

tabB :: BufferM String Source #

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'`.

modifyRegionB Source #

Arguments

:: (YiString -> YiString) | The string modification function
-> Region | The region to modify
-> BufferM () |

Modifies the given region according to the given string transformation function

readRegionB :: Region -> BufferM YiString Source #

regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region Source #

isAnySep :: Char -> Bool Source #

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).

isWordChar :: Char -> Bool Source #

leftBoundaryUnit :: TextUnit -> TextUnit Source #

Unit that have its left and right boundaries at the left boundary of the argument unit.

outsideUnit :: TextUnit -> TextUnit Source #

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.

unitDelimited :: Char -> Char -> Bool -> TextUnit Source #

delimited on the left and right by given characters, boolean argument tells if whether those are included.

unitEmacsParagraph :: TextUnit Source #

Paragraph to implement emacs-like forward-paragraph/backward-paragraph

unitParagraph :: TextUnit Source #

Paragraph that begins and ends in the paragraph, not the empty lines surrounding it.

unitSentence :: TextUnit Source #

unitSep :: TextUnit Source #

unitSep is true for any kind of whitespace/separator

unitSepThisLine :: TextUnit Source #

unitSepThisLine is true for any kind of whitespace/separator on this line only

unitViWORD :: TextUnit Source #

unitViWORDAnyBnd :: TextUnit Source #

unitViWORDOnLine :: TextUnit Source #

unitViWord :: TextUnit Source #

unitViWordAnyBnd :: TextUnit Source #

unitViWordOnLine :: TextUnit Source #

unitWord :: TextUnit Source #

a word as in use in Emacs (fundamental mode)

atBoundaryB :: TextUnit -> Direction -> BufferM Bool Source #

deleteB :: TextUnit -> Direction -> BufferM () Source #

Delete between point and next unit boundary, return the deleted region.

doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM () Source #

Do an action if the current buffer character passes the predicate

doUntilB_ :: BufferM Bool -> BufferM a -> BufferM () Source #

genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM () Source #

Generic maybe move operation. As genMoveB, but don't move if we are at boundary already.

genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM () Source #

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.

maybeMoveB :: TextUnit -> Direction -> BufferM () Source #

As `moveB`, unless the point is at a unit boundary

moveB :: TextUnit -> Direction -> BufferM () Source #

Move to the next unit boundary

numberOfB :: TextUnit -> TextUnit -> BufferM Int Source #

readPrevUnitB :: TextUnit -> BufferM YiString Source #

readUnitB :: TextUnit -> BufferM YiString Source #

regionOfB :: TextUnit -> BufferM Region Source #

Region of the whole textunit where the current point is.

regionOfNonEmptyB :: TextUnit -> BufferM Region Source #

Non empty region of the whole textunit where the current point is.

regionOfPartB :: TextUnit -> Direction -> BufferM Region Source #

Region between the point and the next boundary. The region is empty if the point is at the boundary.

regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region Source #

Non empty region at given point and the next boundary,

regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region Source #

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.

transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM () Source #

Transforms the region given by `TextUnit` in the `Direction` with user-supplied function.

transposeB :: TextUnit -> Direction -> BufferM () Source #

untilB :: BufferM Bool -> BufferM a -> BufferM [a] Source #

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 () Source #

whileB :: BufferM Bool -> BufferM a -> BufferM [a] Source #

data BoundarySide Source #

Boundary side

Constructors

InsideBound |
OutsideBound |

#### Instances

Instances details

Eq BoundarySide Source # |
Instance details Defined in Yi.Buffer.TextUnit Methods (==) :: BoundarySide -> BoundarySide -> Bool Source # (/=) :: BoundarySide -> BoundarySide -> Bool Source #

checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool Source #

genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool Source #

`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

data RegionStyle Source #

Constructors

LineWise |
Inclusive |
Exclusive |
Block |

#### Instances

Instances details

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

convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region Source #

extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region Source #

Extend the given region to boundaries of the text unit. For instance one can extend the selection to complete lines, or paragraphs.

getRegionStyle :: BufferM RegionStyle Source #

mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region Source #

putRegionStyle :: RegionStyle -> BufferM () Source #

unitWiseRegion :: TextUnit -> Region -> BufferM Region Source #

newtype BufferM a Source #

The BufferM monad writes the updates performed.

Constructors

BufferM |

Fields

- fromBufferM :: ReaderT Window (State FBuffer) a

#### Instances

Instances details

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

getBufferDyn :: forall m a. (Default a, YiVariable a, MonadState FBuffer m, Functor m) => m a Source #

Access to a value into the extensible state, keyed by its type. This allows you to retrieve inside a `BufferM` monad, ie:

    value <- getBufferDyn

pointB :: BufferM Point Source #

Extract the current point

putBufferDyn :: (YiVariable a, MonadState FBuffer m, Functor m) => a -> m () Source #

Access to a value into the extensible state, keyed by its type. This allows you to save inside a `BufferM` monad, ie:

    putBufferDyn updatedvalue

savingPointB :: BufferM a -> BufferM a Source #

Perform an `BufferM a`, and return to the current point.

inclusiveRegionB :: Region -> BufferM Region Source #

Extend the right bound of a region to include it.

data FBuffer Source #

Constructors

FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes |

#### Instances

Instances details

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

type WinMarks = MarkSet Mark Source #

data MarkSet a Source #

Constructors

MarkSet |

Fields

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

#### Instances

Instances details

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

Instance details

Defined in Yi.Types

Methods

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

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

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

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

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

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

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

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

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

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

null :: MarkSet a -> Bool Source #

length :: MarkSet a -> Int Source #

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

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

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

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

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

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

bkey :: FBuffer -> BufferRef Source #

getMarks :: Window -> BufferM (Maybe WinMarks) Source #

runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer) Source #

Execute a `BufferM` value on a given buffer and window. The new state of the buffer is returned alongside the result of the computation.

runBufferFull :: Window -> FBuffer -> BufferM a -> (a, Seq Update, FBuffer) Source #

runBufferDummyWindow :: FBuffer -> BufferM a -> a Source #

Execute a `BufferM` value on a given buffer, using a dummy window. The new state of the buffer is discarded.

screenTopLn :: BufferM Int Source #

Top line of the screen

screenMidLn :: BufferM Int Source #

Middle line of the screen

screenBotLn :: BufferM Int Source #

Bottom line of the screen

curLn :: BufferM Int Source #

Return the current line number

curCol :: BufferM Int Source #

Current column. Note that this is different from offset or number of chars from sol. (This takes into account tabs, unicode chars, etc.)

colOf :: Point -> BufferM Int Source #

lineOf :: Point -> BufferM Int Source #

lineCountB :: BufferM Int Source #

sizeB :: BufferM Point Source #

Point of eof

pointOfLineColB :: Int -> Int -> BufferM Point Source #

solPointB :: Point -> BufferM Point Source #

Returns start of line point for a given point `p`

eolPointB :: Point -> BufferM Point Source #

Returns end of line for given point.

markLines :: BufferM (MarkSet Int) Source #

Return line numbers of marks

moveToColB :: Int -> BufferM () Source #

moveToLineColB :: Int -> Int -> BufferM () Source #

lineMoveRel :: Int -> BufferM Int Source #

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.

lineUp :: BufferM () Source #

Move point up one line

lineDown :: BufferM () Source #

Move point down one line

newB :: BufferRef -> BufferId -> YiString -> FBuffer Source #

Create buffer named `nm` with contents `s`

data MarkValue Source #

Constructors

MarkValue |

Fields

- markPoint :: !Point
- markGravity :: !Direction

#### Instances

Instances details

Binary MarkValue Source # |
Instance details Defined in Yi.Buffer.Implementation Methods put :: MarkValue -> Put Source # get :: Get MarkValue Source # putList :: [MarkValue] -> Put Source #
Generic MarkValue Source # |

Instance details

Defined in Yi.Buffer.Implementation

Associated Types

type Rep MarkValue |

Instance details

Defined in Yi.Buffer.Implementation

type Rep MarkValue = D1 ('MetaData "MarkValue" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "MarkValue" 'PrefixI 'True) (S1 ('MetaSel ('Just "markPoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "markGravity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction)))

Methods

from :: MarkValue -> Rep MarkValue x Source #

to :: Rep MarkValue x -> MarkValue Source #

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

Instance details

Defined in Yi.Buffer.Implementation

Methods

compare :: MarkValue -> MarkValue -> Ordering Source #

(<) :: MarkValue -> MarkValue -> Bool Source #

(<=) :: MarkValue -> MarkValue -> Bool Source #

(>) :: MarkValue -> MarkValue -> Bool Source #

(>=) :: MarkValue -> MarkValue -> Bool Source #

max :: MarkValue -> MarkValue -> MarkValue Source #

min :: MarkValue -> MarkValue -> MarkValue Source #

type Rep MarkValue Source # |

Instance details

Defined in Yi.Buffer.Implementation

type Rep MarkValue = D1 ('MetaData "MarkValue" "Yi.Buffer.Implementation" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "MarkValue" 'PrefixI 'True) (S1 ('MetaSel ('Just "markPoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "markGravity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction)))

data Overlay Source #

#### Instances

Instances details

Show Overlay Source # |
Instance details Defined in Yi.Buffer.Implementation Methods showsPrec :: Int -> Overlay -> ShowS Source # show :: Overlay -> String Source # showList :: [Overlay] -> ShowS Source #
Eq Overlay Source # |
Instance details Defined in Yi.Buffer.Implementation Methods (==) :: Overlay -> Overlay -> Bool Source # (/=) :: Overlay -> Overlay -> Bool Source #
Ord Overlay Source # |
Instance details Defined in Yi.Buffer.Implementation Methods compare :: Overlay -> Overlay -> Ordering Source # (<) :: Overlay -> Overlay -> Bool Source # (<=) :: Overlay -> Overlay -> Bool Source # (>) :: Overlay -> Overlay -> Bool Source # (>=) :: Overlay -> Overlay -> Bool Source # max :: Overlay -> Overlay -> Overlay Source # min :: Overlay -> Overlay -> Overlay Source #

mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay Source #

Create an "overlay" for the style `sty` between points `s` and `e`

gotoLn :: Int -> BufferM Int Source #

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)

gotoLnFrom :: Int -> BufferM Int Source #

Go to line indexed from current point Returns the actual moved difference which of course may be negative if the requested difference was negative.

leftB :: BufferM () Source #

Move point -1

rightB :: BufferM () Source #

Move cursor +1

leftN :: Int -> BufferM () Source #

Move cursor -n

rightN :: Int -> BufferM () Source #

Move cursor +n

insertN :: YiString -> BufferM () Source #

Insert the `YiString` at current point, extending size of buffer

insertNAt :: YiString -> Point -> BufferM () Source #

Insert given `YiString` at specified point, extending size of the buffer.

insertB :: Char -> BufferM () Source #

Insert the char at current point, extending size of buffer

Implementation note: This just `insertB`s 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.

deleteN :: Int -> BufferM () Source #

Delete `n` characters forward from the current point

nelemsB :: Int -> Point -> BufferM YiString Source #

writeB :: Char -> BufferM () Source #

Write an element into the buffer at the current point.

newlineB :: BufferM () Source #

Insert newline at current point.

deleteNAt :: Direction -> Int -> Point -> BufferM () Source #

`deleteNAt n p` deletes `n` characters forwards from position `p`

readB :: BufferM Char Source #

Read the character at the current point

elemsB :: BufferM YiString Source #

Return the contents of the buffer.

undosA :: HasAttributes c => Lens' c URList Source #

preferColA :: HasAttributes c => Lens' c (Maybe Int) Source #

pendingUpdatesA :: HasAttributes c => Lens' c (Seq UIUpdate) Source #

readOnlyA :: HasAttributes c => Lens' c Bool Source #

insertingA :: HasAttributes c => Lens' c Bool Source #

pointFollowsWindowA :: HasAttributes c => Lens' c (Set WindowRef) Source #

keymapProcessA :: HasAttributes c => Lens' c KeymapProcess Source #

lastActiveWindowA :: HasAttributes c => Lens' c Window Source #

identA :: HasAttributes c => Lens' c BufferId Source #

directoryContentA :: HasAttributes c => Lens' c Bool Source #

lastSyncTimeA :: HasAttributes c => Lens' c UTCTime Source #

fontsizeVariationA :: HasAttributes c => Lens' c Int Source #

stickyEolA :: HasAttributes c => Lens' c Bool Source #

undoB :: BufferM () Source #

redoB :: BufferM () Source #

getMarkB :: Maybe String -> BufferM Mark Source #

setMarkHereB :: BufferM Mark Source #

setNamedMarkHereB :: String -> BufferM () Source #

mayGetMarkB :: String -> BufferM (Maybe Mark) Source #

getMarkValueB :: Mark -> BufferM MarkValue Source #

markPointA :: Functor f => Mark -> (Point -> f Point) -> FBuffer -> f FBuffer Source #

modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM () Source #

newMarkB :: MarkValue -> BufferM Mark Source #

deleteMarkB :: Mark -> BufferM () Source #

getVisibleSelection :: BufferM Bool Source #

Whether the selection is highlighted

setVisibleSelection :: Bool -> BufferM () Source #

Highlight the selection

isUnchangedBuffer :: FBuffer -> Bool Source #

setAnyMode :: AnyMode -> BufferM () Source #

Set the mode

setMode :: Mode syntax -> BufferM () Source #

setMode0 :: Mode syntax -> FBuffer -> FBuffer Source #

regexRegionB :: SearchExp -> Region -> BufferM [Region] Source #

Return indices of strings in buffer matched by regex in the given region.

regexB :: Direction -> SearchExp -> BufferM [Region] Source #

Return indices of next string in buffer matched by regex in the given direction

readAtB :: Point -> BufferM Char Source #

Read the character at the given index This is an unsafe operation: character NUL is returned when out of bounds

getModeLine :: [Text] -> BufferM Text Source #

Given a buffer, and some information update the modeline

N.B. the contents of modelines should be specified by user, and not hardcoded.

getPercent :: Point -> Point -> Text Source #

Given a point, and the file size, gives us a percent string

setInserting :: Bool -> BufferM () Source #

savingPrefCol :: BufferM a -> BufferM a Source #

forgetPreferCol :: BufferM () Source #

movingToPrefCol :: BufferM a -> BufferM a Source #

movingToPrefVisCol :: BufferM a -> BufferM a Source #

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)

markSavedB :: UTCTime -> BufferM () Source #

Mark the current point in the undo list as a saved state.

retroactivelyAtSavePointB :: BufferM a -> BufferM a Source #

Undo all updates that happened since last save, perform a given action and redo all updates again. Given action must not modify undo history.

addOverlayB :: Overlay -> BufferM () Source #

Adds an "overlay" to the buffer

delOverlayB :: Overlay -> BufferM () Source #

Remove an existing "overlay"

delOverlaysOfOwnerB :: YiString -> BufferM () Source #

getOverlaysOfOwnerB :: YiString -> BufferM (Set Overlay) Source #

isPointInsideOverlay :: Point -> Overlay -> Bool Source #

savingExcursionB :: BufferM a -> BufferM a Source #

perform a `BufferM a`, and return to the current point. (by using a mark)

savingPositionB :: BufferM a -> BufferM a Source #

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.

highlightSelectionA :: Lens' FBuffer Bool Source #

rectangleSelectionA :: Lens' FBuffer Bool Source #

revertPendingUpdatesB :: BufferM () Source #

Revert all the pending updates; don't touch the point.

askWindow :: (Window -> a) -> BufferM a Source #

clearSyntax :: FBuffer -> FBuffer Source #

update the syntax information (clear the dirty "flag")

focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer Source #

modeNameA :: forall syntax f. Functor f => (Text -> f Text) -> Mode syntax -> f (Mode syntax) Source #

modeAppliesA :: forall syntax f. Functor f => ((FilePath -> YiString -> Bool) -> f (FilePath -> YiString -> Bool)) -> Mode syntax -> f (Mode syntax) Source #

modeHLA :: forall syntax f. Functor f => (ExtHL syntax -> f (ExtHL syntax)) -> Mode syntax -> f (Mode syntax) Source #

modePrettifyA :: forall syntax f. Functor f => ((syntax -> BufferM ()) -> f (syntax -> BufferM ())) -> Mode syntax -> f (Mode syntax) Source #

modeKeymapA :: forall syntax f. Functor f => ((KeymapSet -> KeymapSet) -> f (KeymapSet -> KeymapSet)) -> Mode syntax -> f (Mode syntax) Source #

modeIndentA :: forall syntax f. Functor f => ((syntax -> IndentBehaviour -> BufferM ()) -> f (syntax -> IndentBehaviour -> BufferM ())) -> Mode syntax -> f (Mode syntax) Source #

modeFollowA :: forall syntax f. Functor f => ((syntax -> Action) -> f (syntax -> Action)) -> Mode syntax -> f (Mode syntax) Source #

modeIndentSettingsA :: forall syntax f. Functor f => (IndentSettings -> f IndentSettings) -> Mode syntax -> f (Mode syntax) Source #

modeToggleCommentSelectionA :: forall syntax f. Functor f => (Maybe (BufferM ()) -> f (Maybe (BufferM ()))) -> Mode syntax -> f (Mode syntax) Source #

modeGetStrokesA :: forall syntax f. Functor f => ((syntax -> Point -> Point -> Point -> [Stroke]) -> f (syntax -> Point -> Point -> Point -> [Stroke])) -> Mode syntax -> f (Mode syntax) Source #

modeOnLoadA :: forall syntax f. Functor f => (BufferM () -> f (BufferM ())) -> Mode syntax -> f (Mode syntax) Source #

modeGotoDeclarationA :: forall syntax f. Functor f => (BufferM () -> f (BufferM ())) -> Mode syntax -> f (Mode syntax) Source #

modeModeLineA :: forall syntax f. Functor f => (([Text] -> BufferM Text) -> f ([Text] -> BufferM Text)) -> Mode syntax -> f (Mode syntax) Source #

data AnyMode Source #

Constructors

AnyMode (Mode syntax) |

data IndentBehaviour Source #

Used to specify the behaviour of the automatic indent command.

Constructors

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

#### Instances

Instances details

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

data IndentSettings Source #

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

Constructors

IndentSettings |

Fields

- expandTabs :: !Bool

  Insert spaces instead of tabs as possible

- tabSize :: !Int

  Size of a Tab

- shiftWidth :: !Int

  Indent by so many columns

#### Instances

Instances details

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

expandTabsA :: Lens' IndentSettings Bool Source #

tabSizeA :: Lens' IndentSettings Int Source #

shiftWidthA :: Lens' IndentSettings Int Source #

modeAlwaysApplies :: a -> b -> Bool Source #

Mode applies function that always returns True.

modeNeverApplies :: a -> b -> Bool Source #

Mode applies function that always returns False.

emptyMode :: Mode syntax Source #

withModeB :: (forall syntax. Mode syntax -> BufferM a) -> BufferM a Source #

withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a Source #

onMode :: (forall syntax. Mode syntax -> Mode syntax) -> AnyMode -> AnyMode Source #

withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a Source #

withSyntaxB' :: (forall syntax. Mode syntax -> syntax -> BufferM a) -> BufferM a Source #

strokesRangesB :: Maybe SearchExp -> Region -> BufferM [[Stroke]] Source #

streamB :: Direction -> Point -> BufferM YiString Source #

indexedStreamB :: Direction -> Point -> BufferM [(Point, Char)] Source #

askMarks :: BufferM WinMarks Source #

pointAt :: BufferM a -> BufferM Point Source #

shortIdentString Source #

Arguments

:: Int | Number of characters to drop from FileBuffer names
-> FBuffer | Buffer to work with
-> Text |

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"

identString :: FBuffer -> Text Source #

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"

miniIdentString :: FBuffer -> Text Source #

data BufferId Source #

Constructors

MemBuffer !Text |
FileBuffer !FilePath |

#### Instances

Instances details

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

file :: FBuffer -> Maybe FilePath Source #

replaceCharB :: Char -> BufferM () Source #

replaceCharWithBelowB :: BufferM () Source #

replaceCharWithAboveB :: BufferM () Source #

insertCharWithBelowB :: BufferM () Source #

insertCharWithAboveB :: BufferM () Source #

pointAfterCursorB :: Point -> BufferM Point Source #

destinationOfMoveB :: BufferM a -> BufferM Point Source #

What would be the point after doing the given action? The argument must not modify the buffer.

withEveryLineB :: BufferM () -> BufferM () Source #

startUpdateTransactionB :: BufferM () Source #

commitUpdateTransactionB :: BufferM () Source #

applyUpdate :: Update -> BufferM () Source #

betweenB Source #

Arguments

:: Point | Point to start at
-> Point | Point to stop at
-> 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.

decreaseFontSize :: Int -> BufferM () Source #

Decreases the font size in the buffer by specified number. What this number actually means depends on the front-end.

increaseFontSize :: Int -> BufferM () Source #

Increases the font size in the buffer by specified number. What this number actually means depends on the front-end.

queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x Source #

swapRegionsB :: Region -> Region -> BufferM () Source #

Swap the content of two Regions

deleteRegionB :: Region -> BufferM () Source #

Delete an arbitrary part of the buffer

replaceRegionB :: Region -> YiString -> BufferM () Source #

Replace a region with a given rope.

mapRegionB :: Region -> (Char -> Char) -> BufferM () Source #

Map the given function over the characters in the region.

winRegionB :: BufferM Region Source #

blockifyRegion :: Region -> BufferM [Region] Source #

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.

joinLinesB :: Region -> BufferM () Source #

Joins lines in the region with a single space, skipping any empty lines.

concatLinesB :: Region -> BufferM () Source #

Concatenates lines in the region preserving the trailing newline if any.

linesOfRegionB :: Region -> BufferM [Region] Source #

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...

halfUnit :: Direction -> TextUnit -> TextUnit Source #

deleteUnitB :: TextUnit -> Direction -> BufferM () Source #

emptyU :: URList Source #

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

addChangeU :: Change -> URList -> URList Source #

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.

deleteInteractivePointsU :: URList -> URList Source #

setSavedFilePointU :: URList -> URList Source #

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.

isAtSavedFilePointU :: URList -> Bool Source #

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.

undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update)) Source #

This undoes one interaction step.

redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update)) Source #

This redoes one interaction step.

data URList Source #

A URList consists of an undo and a redo list.

#### Instances

Instances details

Binary URList Source # |
Instance details Defined in Yi.Buffer.Undo Methods put :: URList -> Put Source # get :: Get URList Source # putList :: [URList] -> Put Source #
Generic URList Source # |

Instance details

Defined in Yi.Buffer.Undo

Associated Types

type Rep URList |

Instance details

Defined in Yi.Buffer.Undo

type Rep URList = D1 ('MetaData "URList" "Yi.Buffer.Undo" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "URList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Seq Change)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Seq Change))))

Methods

from :: URList -> Rep URList x Source #

to :: Rep URList x -> URList Source #

Show URList Source # |
Instance details Defined in Yi.Buffer.Undo Methods showsPrec :: Int -> URList -> ShowS Source # show :: URList -> String Source # showList :: [URList] -> ShowS Source #
type Rep URList Source # |

Instance details

Defined in Yi.Buffer.Undo

type Rep URList = D1 ('MetaData "URList" "Yi.Buffer.Undo" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "URList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Seq Change)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Seq Change))))

data Change Source #

Constructors

InteractivePoint |
AtomicChange !Update |

#### Instances

Instances details

Binary Change Source # |
Instance details Defined in Yi.Buffer.Undo Methods put :: Change -> Put Source # get :: Get Change Source # putList :: [Change] -> Put Source #
Generic Change Source # |

Instance details

Defined in Yi.Buffer.Undo

Associated Types

type Rep Change |

Instance details

Defined in Yi.Buffer.Undo

type Rep Change = D1 ('MetaData "Change" "Yi.Buffer.Undo" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "SavedFilePoint" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InteractivePoint" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AtomicChange" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Update))))

Methods

from :: Change -> Rep Change x Source #

to :: Rep Change x -> Change Source #

Show Change Source # |
Instance details Defined in Yi.Buffer.Undo Methods showsPrec :: Int -> Change -> ShowS Source # show :: Change -> String Source # showList :: [Change] -> ShowS Source #
type Rep Change Source # |

Instance details

Defined in Yi.Buffer.Undo

type Rep Change = D1 ('MetaData "Change" "Yi.Buffer.Undo" "yi-core-0.19.4-4E7mid7TC5Y9v8ChZSA8gi" 'False) (C1 ('MetaCons "SavedFilePoint" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InteractivePoint" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AtomicChange" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Update))))

module Yi.Core

module Yi.Dired

module Yi.Editor

module Yi.File

data Config Source #

Configuration record. All Yi hooks can be set here.

#### Instances

Instances details

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

data UIConfig Source #

data CursorStyle Source #

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

Constructors

AlwaysFat |
NeverFat |
FatWhenFocused |
FatWhenFocusedAndInserting |

startFrontEndA :: Lens' Config UIBoot Source #

configUIA :: Lens' Config UIConfig Source #

startActionsA :: Lens' Config [Action] Source #

initialActionsA :: Lens' Config [Action] Source #

defaultKmA :: Lens' Config KeymapSet Source #

configInputPreprocessA :: Lens' Config (P Event Event) Source #

modeTableA :: Lens' Config [AnyMode] Source #

debugModeA :: Lens' Config Bool Source #

configRegionStyleA :: Lens' Config RegionStyle Source #

configKillringAccumulateA :: Lens' Config Bool Source #

bufferUpdateHandlerA :: Lens' Config (Seq (Seq Update -> BufferM ())) Source #

configFontNameA :: Lens' UIConfig (Maybe String) Source #

configFontSizeA :: Lens' UIConfig (Maybe Int) Source #

configScrollWheelAmountA :: Lens' UIConfig Int Source #

configScrollStyleA :: Lens' UIConfig (Maybe ScrollStyle) Source #

configCursorStyleA :: Lens' UIConfig CursorStyle Source #

configLeftSideScrollBarA :: Lens' UIConfig Bool Source #

configAutoHideScrollBarA :: Lens' UIConfig Bool Source #

configAutoHideTabBarA :: Lens' UIConfig Bool Source #

configLineWrapA :: Lens' UIConfig Bool Source #

configWindowFillA :: Lens' UIConfig Char Source #

configThemeA :: Lens' UIConfig Theme Source #

layoutManagersA :: Lens' Config [AnyLayoutManager] Source #

configVarsA :: Lens' Config DynamicState Source #

configLineNumbersA :: Lens' UIConfig Bool Source #

module Yi.Config.Default

module Yi.Keymap

module Yi.Keymap.Keys

module Yi.Layout

module Yi.Search

module Yi.Style

module Yi.Style.Library

module Yi.Misc