License | GPL-2 |
---|---|
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
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
$ dofontSize
%=
Just
10modeBindKeys
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
- cursorStyle :: Field CursorStyle
- data CursorStyle
- data Side
- 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 {}
- 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 ()
- newtype WindowRef = WindowRef {
- unWindowRef :: Int
- newtype Point = Point {}
- newtype BufferRef = BufferRef Int
- newtype Mark = Mark {}
- data Direction
- data Region
- data SearchExp
- data UIUpdate
- = TextUpdate !Update
- | StyleUpdate !Point !Size
- data TextUnit
- data Update
- data BufferFileInfo = BufferFileInfo {}
- data BoundarySide
- data RegionStyle
- newtype BufferM a = BufferM {
- fromBufferM :: ReaderT Window (State FBuffer) a
- data FBuffer = forall syntax. FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes
- type WinMarks = MarkSet Mark
- data MarkSet a = MarkSet {}
- data MarkValue = MarkValue {
- markPoint :: !Point
- markGravity :: !Direction
- data Overlay
- data AnyMode = forall syntax. AnyMode (Mode syntax)
- data IndentBehaviour
- data IndentSettings = IndentSettings {
- expandTabs :: !Bool
- tabSize :: !Int
- shiftWidth :: !Int
- data BufferId
- = MemBuffer !Text
- | FileBuffer !FilePath
- data URList
- data Change
- moveTo :: Point -> BufferM ()
- moveN :: Int -> BufferM ()
- writeN :: YiString -> BufferM ()
- reverseDir :: Direction -> Direction
- mayReverse :: Direction -> [a] -> [a]
- directionElim :: Direction -> a -> a -> a
- 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
- 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
- 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]
- checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
- genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
- 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
- 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
- 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
- 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 :: forall f. 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 :: forall syntax. 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. Lens' (Mode syntax) Text
- modeAppliesA :: forall syntax. Lens' (Mode syntax) (FilePath -> YiString -> Bool)
- modeHLA :: forall syntax. Lens' (Mode syntax) (ExtHL syntax)
- modePrettifyA :: forall syntax. Lens' (Mode syntax) (syntax -> BufferM ())
- modeKeymapA :: forall syntax. Lens' (Mode syntax) (KeymapSet -> KeymapSet)
- modeIndentA :: forall syntax. Lens' (Mode syntax) (syntax -> IndentBehaviour -> BufferM ())
- modeFollowA :: forall syntax. Lens' (Mode syntax) (syntax -> Action)
- modeIndentSettingsA :: forall syntax. Lens' (Mode syntax) IndentSettings
- modeToggleCommentSelectionA :: forall syntax. Lens' (Mode syntax) (Maybe (BufferM ()))
- modeGetStrokesA :: forall syntax. Lens' (Mode syntax) (syntax -> Point -> Point -> Point -> [Stroke])
- modeOnLoadA :: forall syntax. Lens' (Mode syntax) (BufferM ())
- modeGotoDeclarationA :: forall syntax. Lens' (Mode syntax) (BufferM ())
- modeModeLineA :: forall syntax. Lens' (Mode syntax) ([Text] -> BufferM Text)
- 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
- 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))
- module Yi.Core
- module Yi.Dired
- module Yi.Editor
- module Yi.File
- data Config
- data UIConfig
- data CursorStyle
- 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
The configuration monad. Run it with configMain
.
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
scrollWheelAmount :: Field Int Source #
Amount to move the buffer when using the scroll wheel.
scrollStyle :: Field (Maybe ScrollStyle) Source #
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.
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?
windowFill :: Field Char Source #
The character with which to fill empty window space. Usually '~' for vi-like editors, ' ' for everything else.
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
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.
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.
Module exports
Size of a buffer region
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.
Mode | |
|
Window references
Instances
Enum WindowRef | |
Defined in Yi.Buffer.Basic succ :: WindowRef -> WindowRef # pred :: WindowRef -> WindowRef # fromEnum :: WindowRef -> Int # enumFrom :: WindowRef -> [WindowRef] # enumFromThen :: WindowRef -> WindowRef -> [WindowRef] # enumFromTo :: WindowRef -> WindowRef -> [WindowRef] # enumFromThenTo :: WindowRef -> WindowRef -> WindowRef -> [WindowRef] # | |
Show WindowRef | |
Binary WindowRef | |
Default WindowRef | |
Defined in Yi.Buffer.Basic | |
Eq WindowRef | |
Ord WindowRef | |
Defined in Yi.Buffer.Basic |
A point in a buffer
Reference to a buffer.
Direction of movement inside a buffer
Instances
Bounded Direction | |
Enum Direction | |
Defined in Yi.Buffer.Basic succ :: Direction -> Direction # pred :: Direction -> Direction # fromEnum :: Direction -> Int # enumFrom :: Direction -> [Direction] # enumFromThen :: Direction -> Direction -> [Direction] # enumFromTo :: Direction -> Direction -> [Direction] # enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] # | |
Generic Direction | |
Show Direction | |
Binary Direction | |
Eq Direction | |
Ord Direction | |
Defined in Yi.Buffer.Basic | |
type Rep Direction | |
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
Generic Region | |
Show Region | |
Binary Region | |
type Rep Region | |
Defined in Yi.Region type Rep Region = D1 ('MetaData "Region" "Yi.Region" "yi-language-0.19.1-7yURWM7ILZ1cLAgM9JSB0" 'False) (C1 ('MetaCons "Region" 'PrefixI 'True) (S1 ('MetaSel ('Just "regionDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction) :*: (S1 ('MetaSel ('Just "regionStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "regionEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point)))) |
Instances
Generic UIUpdate Source # | |
Binary UIUpdate Source # | |
type Rep UIUpdate Source # | |
Defined in Yi.Buffer.Implementation type Rep UIUpdate = D1 ('MetaData "UIUpdate" "Yi.Buffer.Implementation" "yi-core-0.19.4-J3b4W1rrtzsIycE9BgrKGW" '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))) |
Designate a given "unit" of text.
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.
Insert | |
| |
Delete | |
|
Instances
Generic Update Source # | |
Show Update Source # | |
Binary Update Source # | |
type Rep Update Source # | |
Defined in Yi.Buffer.Implementation type Rep Update = D1 ('MetaData "Update" "Yi.Buffer.Implementation" "yi-core-0.19.4-J3b4W1rrtzsIycE9BgrKGW" '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)))) |
data BufferFileInfo Source #
BufferFileInfo | |
|
data BoundarySide Source #
Boundary side
Instances
Eq BoundarySide Source # | |
Defined in Yi.Buffer.TextUnit (==) :: BoundarySide -> BoundarySide -> Bool # (/=) :: BoundarySide -> BoundarySide -> Bool # |
data RegionStyle Source #
Instances
Show RegionStyle Source # | |
Defined in Yi.Types showsPrec :: Int -> RegionStyle -> ShowS # show :: RegionStyle -> String # showList :: [RegionStyle] -> ShowS # | |
Binary RegionStyle Source # | |
Defined in Yi.Types | |
Default RegionStyle Source # | |
Defined in Yi.Types def :: RegionStyle # | |
Eq RegionStyle Source # | |
Defined in Yi.Types (==) :: RegionStyle -> RegionStyle -> Bool # (/=) :: RegionStyle -> RegionStyle -> Bool # | |
YiVariable RegionStyle Source # | |
Defined in Yi.Types |
The BufferM monad writes the updates performed.
forall syntax. FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes |
Instances
Foldable MarkSet Source # | |
Defined in Yi.Types fold :: Monoid m => MarkSet m -> m # foldMap :: Monoid m => (a -> m) -> MarkSet a -> m # foldMap' :: Monoid m => (a -> m) -> MarkSet a -> m # foldr :: (a -> b -> b) -> b -> MarkSet a -> b # foldr' :: (a -> b -> b) -> b -> MarkSet a -> b # foldl :: (b -> a -> b) -> b -> MarkSet a -> b # foldl' :: (b -> a -> b) -> b -> MarkSet a -> b # foldr1 :: (a -> a -> a) -> MarkSet a -> a # foldl1 :: (a -> a -> a) -> MarkSet a -> a # elem :: Eq a => a -> MarkSet a -> Bool # maximum :: Ord a => MarkSet a -> a # minimum :: Ord a => MarkSet a -> a # | |
Traversable MarkSet Source # | |
Functor MarkSet Source # | |
Show a => Show (MarkSet a) Source # | |
Binary a => Binary (MarkSet a) Source # | |
MarkValue | |
|
Instances
Generic MarkValue Source # | |
Show MarkValue Source # | |
Binary MarkValue Source # | |
Eq MarkValue Source # | |
Ord MarkValue Source # | |
Defined in Yi.Buffer.Implementation | |
type Rep MarkValue Source # | |
Defined in Yi.Buffer.Implementation type Rep MarkValue = D1 ('MetaData "MarkValue" "Yi.Buffer.Implementation" "yi-core-0.19.4-J3b4W1rrtzsIycE9BgrKGW" '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 IndentBehaviour Source #
Used to specify the behaviour of the automatic indent command.
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
Show IndentBehaviour Source # | |
Defined in Yi.Types showsPrec :: Int -> IndentBehaviour -> ShowS # show :: IndentBehaviour -> String # showList :: [IndentBehaviour] -> ShowS # | |
Eq IndentBehaviour Source # | |
Defined in Yi.Types (==) :: IndentBehaviour -> IndentBehaviour -> Bool # (/=) :: IndentBehaviour -> IndentBehaviour -> Bool # |
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.
IndentSettings | |
|
Instances
Show IndentSettings Source # | |
Defined in Yi.Types showsPrec :: Int -> IndentSettings -> ShowS # show :: IndentSettings -> String # showList :: [IndentSettings] -> ShowS # | |
Eq IndentSettings Source # | |
Defined in Yi.Types (==) :: IndentSettings -> IndentSettings -> Bool # (/=) :: IndentSettings -> IndentSettings -> Bool # |
A URList consists of an undo and a redo list.
Instances
Generic URList Source # | |
Show URList Source # | |
Binary URList Source # | |
type Rep URList Source # | |
Defined in Yi.Buffer.Undo type Rep URList = D1 ('MetaData "URList" "Yi.Buffer.Undo" "yi-core-0.19.4-J3b4W1rrtzsIycE9BgrKGW" '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)))) |
Instances
Generic Change Source # | |
Show Change Source # | |
Binary Change Source # | |
type Rep Change Source # | |
Defined in Yi.Buffer.Undo type Rep Change = D1 ('MetaData "Change" "Yi.Buffer.Undo" "yi-core-0.19.4-J3b4W1rrtzsIycE9BgrKGW" '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)))) |
moveN :: Int -> BufferM () Source #
Move point by the given number of characters. A negative offset moves backwards a positive one forward.
reverseDir :: Direction -> Direction #
mayReverse :: Direction -> [a] -> [a] #
reverse if Backward
directionElim :: Direction -> a -> a -> a #
regionFirst :: Region -> Point #
regionLast :: Region -> Point #
regionSize :: Region -> Size #
intersectRegion :: Region -> Region -> Region #
Take the intersection of two regions
unionRegion :: Region -> Region -> Region #
Take the union of two regions (including what is between them)
mkRegion :: Point -> Point -> Region #
Construct a region from its bounds, emacs style: the right bound is excluded
mkSizeRegion :: Point -> Size -> Region #
emptyRegion :: Region #
The empty region
nearRegion :: Point -> Region -> Bool #
True if the given point is inside the given region or at the end of it.
includedRegion :: Region -> Region -> Bool #
Returns if a region (1st arg) is included in another (2nd arg)
regionIsEmpty :: Region -> Bool #
updateIsDelete :: Update -> Bool Source #
atLastLine :: BufferM Bool Source #
True if point at the last line
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.
bufInfoB :: BufferM BufferFileInfo Source #
File info, size in chars, line no, col num, char num, percent
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
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 #
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)
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 #
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.
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
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
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
nextCInLineExc :: Char -> BufferM () Source #
nextCInLineInc :: Char -> BufferM () Source #
nextNParagraphs :: Int -> BufferM () Source #
Move down next n
paragraphs
prevCInLineExc :: Char -> BufferM () Source #
prevCInLineInc :: Char -> BufferM () Source #
prevNParagraphs :: Int -> BufferM () Source #
Move up prev n
paragraphs
readCurrentWordB :: BufferM YiString Source #
Reads in word at point.
readPrevWordB :: BufferM YiString Source #
Reads in word before point.
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 #
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
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
.
sortLinesWithRegion :: Region -> BufferM () Source #
snapScreenB :: Maybe ScrollStyle -> BufferM Bool Source #
Move the visible region to include the point
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:
unLineCommentSelectionB Source #
:: 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
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
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'
.
Modifies the given region according to the given string transformation function
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 #
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.
unitSepThisLine :: TextUnit Source #
unitSepThisLine is true for any kind of whitespace/separator on this line only
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
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
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.
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.
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
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.
mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region Source #
putRegionStyle :: RegionStyle -> BufferM () 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
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.
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.
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
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.)
lineCountB :: BufferM Int Source #
moveToColB :: 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.
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.
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.
deleteNAt :: Direction -> Int -> Point -> BufferM () Source #
deleteNAt n p
deletes n
characters forwards from position p
insertingA :: HasAttributes c => Lens' c Bool Source #
keymapProcessA :: HasAttributes c => Lens' c KeymapProcess Source #
lastActiveWindowA :: HasAttributes c => Lens' c Window 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 #
setNamedMarkHereB :: String -> BufferM () 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
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 #
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.
revertPendingUpdatesB :: BufferM () Source #
Revert all the pending updates; don't touch the point.
clearSyntax :: FBuffer -> FBuffer Source #
update the syntax information (clear the dirty "flag")
modeIndentA :: forall syntax. Lens' (Mode syntax) (syntax -> IndentBehaviour -> BufferM ()) Source #
modeIndentSettingsA :: forall syntax. Lens' (Mode syntax) IndentSettings Source #
modeGetStrokesA :: forall syntax. Lens' (Mode syntax) (syntax -> Point -> Point -> Point -> [Stroke]) 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.
withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a Source #
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 #
replaceCharB :: Char -> BufferM () Source #
replaceCharWithBelowB :: BufferM () Source #
replaceCharWithAboveB :: BufferM () Source #
insertCharWithBelowB :: BufferM () Source #
insertCharWithAboveB :: BufferM () 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 #
applyUpdate :: Update -> BufferM () Source #
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 #
deleteRegionB :: Region -> BufferM () Source #
Delete an arbitrary part of the buffer
mapRegionB :: Region -> (Char -> Char) -> BufferM () Source #
Map the given function over the characters in the region.
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...
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.
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.
module Yi.Core
module Yi.Dired
module Yi.Editor
module Yi.File
Configuration record. All Yi hooks can be set here.
Instances
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.
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