License | GPL-2 |
---|---|
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
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 ()))
- data SearchExp
- regionsOverlap :: Bool -> Region -> Region -> Bool
- regionIsEmpty :: Region -> Bool
- includedRegion :: Region -> Region -> Bool
- nearRegion :: Point -> Region -> Bool
- inRegion :: Point -> Region -> Bool
- emptyRegion :: Region
- mkSizeRegion :: Point -> Size -> Region
- mkRegion' :: Direction -> Point -> Point -> Region
- mkRegion :: Point -> Point -> Region
- unionRegion :: Region -> Region -> Region
- intersectRegion :: Region -> Region -> Region
- regionSize :: Region -> Size
- fmapRegion :: (Point -> Point) -> Region -> Region
- regionLast :: Region -> Point
- regionFirst :: Region -> Point
- data Region
- directionElim :: Direction -> a -> a -> a
- mayReverse :: Direction -> [a] -> [a]
- reverseDir :: Direction -> Direction
- data Direction
- newtype Mark = Mark {}
- newtype BufferRef = BufferRef Int
- newtype Point = Point {}
- newtype Size = Size {}
- newtype WindowRef = WindowRef {
- unWindowRef :: Int
- data MarkValue = MarkValue {
- markPoint :: !Point
- markGravity :: !Direction
- data UIUpdate
- = TextUpdate !Update
- | StyleUpdate !Point !Size
- data Update
- data Overlay
- markGravityAA :: Lens' MarkValue Direction
- markPointAA :: Lens' MarkValue Point
- updateIsDelete :: Update -> Bool
- mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay
- data URList
- data Change
- emptyU :: URList
- addChangeU :: Change -> URList -> URList
- deleteInteractivePointsU :: URList -> URList
- setSavedFilePointU :: URList -> URList
- undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
- redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, Seq Update))
- isAtSavedFilePointU :: URList -> Bool
- data RegionStyle
- data IndentBehaviour
- 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 AnyMode = forall syntax. AnyMode (Mode syntax)
- data BufferId
- = MemBuffer !Text
- | FileBuffer !FilePath
- data MarkSet a = MarkSet {}
- type WinMarks = MarkSet Mark
- data FBuffer = forall syntax. FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes
- data IndentSettings = IndentSettings {
- expandTabs :: !Bool
- tabSize :: !Int
- shiftWidth :: !Int
- newtype BufferM a = BufferM {
- fromBufferM :: ReaderT Window (State FBuffer) a
- stickyEolA :: HasAttributes c => Lens' c Bool
- fontsizeVariationA :: HasAttributes c => Lens' c Int
- lastSyncTimeA :: HasAttributes c => Lens' c UTCTime
- directoryContentA :: HasAttributes c => Lens' c Bool
- identA :: HasAttributes c => Lens' c BufferId
- lastActiveWindowA :: HasAttributes c => Lens' c Window
- keymapProcessA :: HasAttributes c => Lens' c KeymapProcess
- pointFollowsWindowA :: HasAttributes c => Lens' c (Set WindowRef)
- insertingA :: HasAttributes c => Lens' c Bool
- readOnlyA :: HasAttributes c => Lens' c Bool
- pendingUpdatesA :: HasAttributes c => Lens' c (Seq UIUpdate)
- undosA :: HasAttributes c => Lens' c URList
- preferColA :: HasAttributes c => Lens' c (Maybe Int)
- shortIdentString :: Int -> FBuffer -> Text
- identString :: FBuffer -> Text
- miniIdentString :: FBuffer -> Text
- clearSyntax :: FBuffer -> FBuffer
- file :: FBuffer -> Maybe FilePath
- highlightSelectionA :: Lens' FBuffer Bool
- rectangleSelectionA :: Lens' FBuffer Bool
- increaseFontSize :: Int -> BufferM ()
- decreaseFontSize :: Int -> BufferM ()
- getModeLine :: [Text] -> BufferM Text
- getPercent :: Point -> Point -> Text
- queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x
- addOverlayB :: Overlay -> BufferM ()
- getOverlaysOfOwnerB :: YiString -> BufferM (Set Overlay)
- delOverlayB :: Overlay -> BufferM ()
- delOverlaysOfOwnerB :: YiString -> BufferM ()
- isPointInsideOverlay :: Point -> Overlay -> Bool
- runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer)
- getMarks :: Window -> BufferM (Maybe WinMarks)
- runBufferFull :: Window -> FBuffer -> BufferM a -> (a, Seq Update, FBuffer)
- getMarkValueB :: Mark -> BufferM MarkValue
- newMarkB :: MarkValue -> BufferM Mark
- deleteMarkB :: Mark -> BufferM ()
- runBufferDummyWindow :: FBuffer -> BufferM a -> a
- markSavedB :: UTCTime -> BufferM ()
- bkey :: FBuffer -> BufferRef
- isUnchangedBuffer :: FBuffer -> Bool
- startUpdateTransactionB :: BufferM ()
- commitUpdateTransactionB :: BufferM ()
- undoB :: BufferM ()
- redoB :: BufferM ()
- retroactivelyAtSavePointB :: BufferM a -> BufferM a
- modeAlwaysApplies :: a -> b -> Bool
- modeNeverApplies :: a -> b -> Bool
- emptyMode :: Mode syntax
- newB :: BufferRef -> BufferId -> YiString -> FBuffer
- sizeB :: BufferM Point
- pointB :: BufferM Point
- nelemsB :: Int -> Point -> BufferM YiString
- streamB :: Direction -> Point -> BufferM YiString
- indexedStreamB :: Direction -> Point -> BufferM [(Point, Char)]
- strokesRangesB :: Maybe SearchExp -> Region -> BufferM [[Stroke]]
- moveTo :: Point -> BufferM ()
- setInserting :: Bool -> BufferM ()
- applyUpdate :: Update -> BufferM ()
- revertPendingUpdatesB :: BufferM ()
- writeB :: Char -> BufferM ()
- writeN :: YiString -> BufferM ()
- newlineB :: BufferM ()
- insertNAt :: YiString -> Point -> BufferM ()
- insertN :: YiString -> BufferM ()
- insertB :: Char -> BufferM ()
- deleteNAt :: Direction -> Int -> Point -> BufferM ()
- curLn :: BufferM Int
- screenTopLn :: BufferM Int
- screenMidLn :: BufferM Int
- screenBotLn :: BufferM Int
- markLines :: BufferM (MarkSet Int)
- gotoLn :: Int -> BufferM Int
- setMode0 :: forall syntax. Mode syntax -> FBuffer -> FBuffer
- setAnyMode :: AnyMode -> BufferM ()
- setMode :: Mode syntax -> BufferM ()
- onMode :: (forall syntax. Mode syntax -> Mode syntax) -> AnyMode -> AnyMode
- withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a
- withModeB :: (forall syntax. Mode syntax -> BufferM a) -> BufferM a
- withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a
- focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer
- withSyntaxB' :: (forall syntax. Mode syntax -> syntax -> BufferM a) -> BufferM a
- regexRegionB :: SearchExp -> Region -> BufferM [Region]
- regexB :: Direction -> SearchExp -> BufferM [Region]
- modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM ()
- setMarkHereB :: BufferM Mark
- setNamedMarkHereB :: String -> BufferM ()
- setVisibleSelection :: Bool -> BufferM ()
- getVisibleSelection :: BufferM Bool
- askMarks :: BufferM WinMarks
- getMarkB :: Maybe String -> BufferM Mark
- mayGetMarkB :: String -> BufferM (Maybe Mark)
- moveN :: Int -> BufferM ()
- leftB :: BufferM ()
- leftN :: Int -> BufferM ()
- rightB :: BufferM ()
- rightN :: Int -> BufferM ()
- lineMoveRel :: Int -> BufferM Int
- movingToPrefCol :: BufferM a -> BufferM a
- movingToPrefVisCol :: BufferM a -> BufferM a
- moveToColB :: Int -> BufferM ()
- moveToLineColB :: Int -> Int -> BufferM ()
- pointOfLineColB :: Int -> Int -> BufferM Point
- forgetPreferCol :: BufferM ()
- savingPrefCol :: BufferM a -> BufferM a
- lineUp :: BufferM ()
- lineDown :: BufferM ()
- elemsB :: BufferM YiString
- betweenB :: Point -> Point -> BufferM YiString
- readB :: BufferM Char
- readAtB :: Point -> BufferM Char
- replaceCharB :: Char -> BufferM ()
- replaceCharWithBelowB :: BufferM ()
- replaceCharWithAboveB :: BufferM ()
- insertCharWithBelowB :: BufferM ()
- insertCharWithAboveB :: BufferM ()
- deleteN :: Int -> BufferM ()
- indentSettingsB :: BufferM IndentSettings
- curCol :: BufferM Int
- colOf :: Point -> BufferM Int
- lineOf :: Point -> BufferM Int
- lineCountB :: BufferM Int
- solPointB :: Point -> BufferM Point
- eolPointB :: Point -> BufferM Point
- gotoLnFrom :: Int -> BufferM Int
- getBufferDyn :: forall m a. (Default a, YiVariable a, MonadState FBuffer m, Functor m) => m a
- putBufferDyn :: (YiVariable a, MonadState FBuffer m, Functor m) => a -> m ()
- savingExcursionB :: BufferM a -> BufferM a
- markPointA :: Mark -> Lens' FBuffer Point
- savingPointB :: BufferM a -> BufferM a
- savingPositionB :: BufferM a -> BufferM a
- pointAt :: BufferM a -> BufferM Point
- pointAfterCursorB :: Point -> BufferM Point
- destinationOfMoveB :: BufferM a -> BufferM Point
- askWindow :: (Window -> a) -> BufferM a
- withEveryLineB :: BufferM () -> BufferM ()
- expandTabsA :: Lens' IndentSettings Bool
- shiftWidthA :: Lens' IndentSettings Int
- tabSizeA :: Lens' IndentSettings Int
- modeAppliesA :: forall syntax. Lens' (Mode syntax) (FilePath -> YiString -> Bool)
- modeFollowA :: forall syntax. Lens' (Mode syntax) (syntax -> Action)
- modeGetStrokesA :: forall syntax. Lens' (Mode syntax) (syntax -> Point -> Point -> Point -> [Stroke])
- modeGotoDeclarationA :: forall syntax. Lens' (Mode syntax) (BufferM ())
- modeHLA :: forall syntax. Lens' (Mode syntax) (ExtHL syntax)
- modeIndentA :: forall syntax. Lens' (Mode syntax) (syntax -> IndentBehaviour -> BufferM ())
- modeIndentSettingsA :: forall syntax. Lens' (Mode syntax) IndentSettings
- modeKeymapA :: forall syntax. Lens' (Mode syntax) (KeymapSet -> KeymapSet)
- modeModeLineA :: forall syntax. Lens' (Mode syntax) ([Text] -> BufferM Text)
- modeNameA :: forall syntax. Lens' (Mode syntax) Text
- modeOnLoadA :: forall syntax. Lens' (Mode syntax) (BufferM ())
- modePrettifyA :: forall syntax. Lens' (Mode syntax) (syntax -> BufferM ())
- modeToggleCommentSelectionA :: forall syntax. Lens' (Mode syntax) (Maybe (BufferM ()))
- winRegionB :: BufferM Region
- deleteRegionB :: Region -> BufferM ()
- readRegionB :: Region -> BufferM YiString
- replaceRegionB :: Region -> YiString -> BufferM ()
- mapRegionB :: Region -> (Char -> Char) -> BufferM ()
- swapRegionsB :: Region -> Region -> BufferM ()
- modifyRegionB :: (YiString -> YiString) -> Region -> BufferM ()
- inclusiveRegionB :: Region -> BufferM Region
- blockifyRegion :: Region -> BufferM [Region]
- joinLinesB :: Region -> BufferM ()
- concatLinesB :: Region -> BufferM ()
- linesOfRegionB :: Region -> BufferM [Region]
- data BoundarySide
- data TextUnit
- outsideUnit :: TextUnit -> TextUnit
- unitWord :: TextUnit
- unitDelimited :: Char -> Char -> Bool -> TextUnit
- isWordChar :: Char -> Bool
- checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
- unitViWord :: TextUnit
- unitViWORD :: TextUnit
- unitViWordAnyBnd :: TextUnit
- unitViWORDAnyBnd :: TextUnit
- unitViWordOnLine :: TextUnit
- unitViWORDOnLine :: TextUnit
- isAnySep :: Char -> Bool
- unitSep :: TextUnit
- unitSepThisLine :: TextUnit
- atBoundaryB :: TextUnit -> Direction -> BufferM Bool
- unitEmacsParagraph :: TextUnit
- unitParagraph :: TextUnit
- unitSentence :: TextUnit
- leftBoundaryUnit :: TextUnit -> TextUnit
- genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
- numberOfB :: TextUnit -> TextUnit -> BufferM Int
- whileB :: BufferM Bool -> BufferM a -> BufferM [a]
- untilB :: BufferM Bool -> BufferM a -> BufferM [a]
- doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
- genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- moveB :: TextUnit -> Direction -> BufferM ()
- maybeMoveB :: TextUnit -> Direction -> BufferM ()
- transposeB :: TextUnit -> Direction -> BufferM ()
- transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
- deleteB :: TextUnit -> Direction -> BufferM ()
- regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region
- regionOfB :: TextUnit -> BufferM Region
- regionOfNonEmptyB :: TextUnit -> BufferM Region
- regionOfPartB :: TextUnit -> Direction -> BufferM Region
- regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
- regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
- readPrevUnitB :: TextUnit -> BufferM YiString
- readUnitB :: TextUnit -> BufferM YiString
- halfUnit :: Direction -> TextUnit -> TextUnit
- deleteUnitB :: TextUnit -> Direction -> BufferM ()
- getRegionStyle :: BufferM RegionStyle
- putRegionStyle :: RegionStyle -> BufferM ()
- convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
- mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
- unitWiseRegion :: TextUnit -> Region -> BufferM Region
- extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
- data BufferFileInfo = BufferFileInfo {}
- moveToMTB :: BufferM ()
- moveToSol :: BufferM ()
- moveToEol :: BufferM ()
- topB :: BufferM ()
- botB :: BufferM ()
- leftOnEol :: BufferM ()
- moveXorSol :: Int -> BufferM ()
- moveXorEol :: Int -> BufferM ()
- nextWordB :: BufferM ()
- prevWordB :: BufferM ()
- gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()
- nextCInc :: Char -> BufferM ()
- nextCInLineInc :: Char -> BufferM ()
- nextCExc :: Char -> BufferM ()
- nextCInLineExc :: Char -> BufferM ()
- prevCInc :: Char -> BufferM ()
- prevCInLineInc :: Char -> BufferM ()
- prevCExc :: Char -> BufferM ()
- prevCInLineExc :: Char -> BufferM ()
- firstNonSpaceB :: BufferM ()
- lastNonSpaceB :: BufferM ()
- moveNonspaceOrSol :: BufferM ()
- isCurrentLineEmptyB :: BufferM Bool
- isCurrentLineAllWhiteSpaceB :: BufferM Bool
- nextNParagraphs :: Int -> BufferM ()
- prevNParagraphs :: Int -> BufferM ()
- selectNParagraphs :: Int -> BufferM ()
- atSol :: BufferM Bool
- atEol :: BufferM Bool
- atSof :: BufferM Bool
- atEof :: BufferM Bool
- atLastLine :: BufferM Bool
- getLineAndCol :: BufferM (Int, Int)
- getLineAndColOfPoint :: Point -> BufferM (Int, Int)
- readLnB :: BufferM YiString
- hasWhiteSpaceBefore :: BufferM Bool
- readCurrentWordB :: BufferM YiString
- readPrevWordB :: BufferM YiString
- bdeleteB :: BufferM ()
- killWordB :: BufferM ()
- bkillWordB :: BufferM ()
- bdeleteLineB :: BufferM ()
- deleteHorizontalSpaceB :: Maybe Int -> BufferM ()
- uppercaseWordB :: BufferM ()
- lowercaseWordB :: BufferM ()
- capitaliseWordB :: BufferM ()
- switchCaseChar :: Char -> Char
- deleteToEol :: BufferM ()
- swapB :: BufferM ()
- deleteTrailingSpaceB :: BufferM ()
- setSelectionMarkPointB :: Point -> BufferM ()
- getSelectionMarkPointB :: BufferM Point
- exchangePointAndMarkB :: BufferM ()
- getBookmarkB :: String -> BufferM Mark
- bufInfoB :: BufferM BufferFileInfo
- upScreensB :: Int -> BufferM ()
- downScreensB :: Int -> BufferM ()
- upScreenB :: BufferM ()
- downScreenB :: BufferM ()
- scrollScreensB :: Int -> BufferM ()
- vimScrollB :: Int -> BufferM ()
- vimScrollByB :: (Int -> Int) -> Int -> BufferM ()
- scrollToCursorB :: BufferM ()
- scrollCursorToTopB :: BufferM ()
- scrollCursorToBottomB :: BufferM ()
- scrollB :: Int -> BufferM ()
- scrollToLineAboveWindowB :: BufferM ()
- scrollToLineBelowWindowB :: BufferM ()
- snapInsB :: BufferM ()
- snapScreenB :: Maybe ScrollStyle -> BufferM Bool
- downFromTosB :: Int -> BufferM ()
- upFromBosB :: Int -> BufferM ()
- middleB :: BufferM ()
- getRawestSelectRegionB :: BufferM Region
- getSelectRegionB :: BufferM Region
- setSelectRegionB :: Region -> BufferM ()
- deleteBlankLinesB :: BufferM ()
- lineStreamB :: Direction -> BufferM [YiString]
- getNextLineB :: Direction -> BufferM YiString
- getNextNonBlankLineB :: Direction -> BufferM YiString
- modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM ()
- linePrefixSelectionB :: YiString -> BufferM ()
- unLineCommentSelectionB :: YiString -> YiString -> BufferM ()
- toggleCommentB :: YiString -> BufferM ()
- replaceBufferContent :: YiString -> BufferM ()
- fillParagraph :: BufferM ()
- sortLines :: BufferM ()
- sortLinesWithRegion :: Region -> BufferM ()
- revertB :: YiString -> UTCTime -> BufferM ()
- shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
- leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
- deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point)
- readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString
- insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM ()
- flipRectangleB :: Point -> Point -> BufferM (Point, Point)
- movePercentageFileB :: Int -> BufferM ()
- findMatchingPairB :: BufferM ()
- incrementNextNumberByB :: Int -> BufferM ()
- isNumberB :: BufferM Bool
- test3CharB :: BufferM Bool
- testHexB :: BufferM Bool
- lineMoveVisRel :: Int -> BufferM ()
- markWord :: BufferM ()
- tabB :: BufferM String
- autoIndentB :: IndentBehaviour -> BufferM ()
- cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM ()
- indentOfB :: YiString -> BufferM Int
- indentToB :: Int -> BufferM ()
- modifyIndentB :: (Int -> Int) -> BufferM ()
- indentAsPreviousB :: BufferM ()
- indentAsNextB :: BufferM ()
- indentAsTheMostIndentedNeighborLineB :: BufferM ()
- newlineAndIndentB :: BufferM ()
- shiftIndentOfRegionB :: Int -> Region -> BufferM ()
- indentOfCurrentPosB :: BufferM Int
- module Yi.Core
- module Yi.Dired
- module Yi.Editor
- module Yi.File
- data Config
- data CursorStyle
- data UIConfig
- bufferUpdateHandlerA :: Lens' Config (Seq (Seq Update -> BufferM ()))
- configInputPreprocessA :: Lens' Config (P Event Event)
- configKillringAccumulateA :: Lens' Config Bool
- configRegionStyleA :: Lens' Config RegionStyle
- configUIA :: Lens' Config UIConfig
- configVarsA :: Lens' Config DynamicState
- debugModeA :: Lens' Config Bool
- defaultKmA :: Lens' Config KeymapSet
- initialActionsA :: Lens' Config [Action]
- layoutManagersA :: Lens' Config [AnyLayoutManager]
- modeTableA :: Lens' Config [AnyMode]
- startActionsA :: Lens' Config [Action]
- startFrontEndA :: Lens' Config UIBoot
- configAutoHideScrollBarA :: Lens' UIConfig Bool
- configAutoHideTabBarA :: Lens' UIConfig Bool
- configCursorStyleA :: Lens' UIConfig CursorStyle
- configFontNameA :: Lens' UIConfig (Maybe String)
- configFontSizeA :: Lens' UIConfig (Maybe Int)
- configLeftSideScrollBarA :: Lens' UIConfig Bool
- configLineNumbersA :: Lens' UIConfig Bool
- configLineWrapA :: Lens' UIConfig Bool
- configScrollStyleA :: Lens' UIConfig (Maybe ScrollStyle)
- configScrollWheelAmountA :: Lens' UIConfig Int
- configThemeA :: Lens' UIConfig Theme
- configWindowFillA :: Lens' UIConfig Char
- 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 functinality, 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
regionIsEmpty :: Region -> Bool #
includedRegion :: Region -> Region -> Bool #
Returns if a region (1st arg) is included in another (2nd arg)
nearRegion :: Point -> Region -> Bool #
True if the given point is inside the given region or at the end of it.
emptyRegion :: Region #
The empty region
mkSizeRegion :: Point -> Size -> Region #
mkRegion :: Point -> Point -> Region #
Construct a region from its bounds, emacs style: the right bound is excluded
unionRegion :: Region -> Region -> Region #
Take the union of two regions (including what is between them)
intersectRegion :: Region -> Region -> Region #
Take the intersection of two regions
regionSize :: Region -> Size #
regionLast :: Region -> Point #
regionFirst :: Region -> Point #
The region data type. The region is semi open: it includes the start but not the end bound. This allows simpler region-manipulation algorithms. Invariant : regionStart r <= regionEnd r
Instances
Show Region | |
Generic Region | |
Binary Region | |
type Rep Region | |
Defined in Yi.Region type Rep Region = D1 ('MetaData "Region" "Yi.Region" "yi-language-0.19.0-IdyJrIEoDq11Qjn5TopPkH" '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)))) |
directionElim :: Direction -> a -> a -> a #
mayReverse :: Direction -> [a] -> [a] #
reverse if Backward
reverseDir :: Direction -> Direction #
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] # | |
Eq Direction | |
Ord Direction | |
Defined in Yi.Buffer.Basic | |
Show Direction | |
Generic Direction | |
Binary Direction | |
type Rep Direction | |
Reference to a buffer.
A point in a buffer
Size of a buffer region
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] # | |
Eq WindowRef | |
Ord WindowRef | |
Defined in Yi.Buffer.Basic | |
Show WindowRef | |
Binary WindowRef | |
Default WindowRef | |
Defined in Yi.Buffer.Basic |
MarkValue | |
|
Instances
Eq MarkValue Source # | |
Ord MarkValue Source # | |
Defined in Yi.Buffer.Implementation | |
Show MarkValue Source # | |
Generic MarkValue Source # | |
Binary MarkValue Source # | |
type Rep MarkValue Source # | |
Defined in Yi.Buffer.Implementation type Rep MarkValue = D1 ('MetaData "MarkValue" "Yi.Buffer.Implementation" "yi-core-0.19.2-E39Ao5fNBKQEmSrSHU3CM4" 'False) (C1 ('MetaCons "MarkValue" 'PrefixI 'True) (S1 ('MetaSel ('Just "markPoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "markGravity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Direction))) |
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.2-E39Ao5fNBKQEmSrSHU3CM4" '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))) |
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
Show Update Source # | |
Generic 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.2-E39Ao5fNBKQEmSrSHU3CM4" '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 #
mkOverlay :: YiString -> Region -> StyleName -> YiString -> Overlay Source #
Create an "overlay" for the style sty
between points s
and e
A URList consists of an undo and a redo list.
Instances
Show URList Source # | |
Generic 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.2-E39Ao5fNBKQEmSrSHU3CM4" '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
Show Change Source # | |
Generic 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.2-E39Ao5fNBKQEmSrSHU3CM4" '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)))) |
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.
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 iteraction step.
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.
data RegionStyle Source #
Instances
Eq RegionStyle Source # | |
Defined in Yi.Types (==) :: RegionStyle -> RegionStyle -> Bool # (/=) :: RegionStyle -> RegionStyle -> Bool # | |
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 # | |
YiVariable RegionStyle Source # | |
Defined in Yi.Types |
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
Eq IndentBehaviour Source # | |
Defined in Yi.Types (==) :: IndentBehaviour -> IndentBehaviour -> Bool # (/=) :: IndentBehaviour -> IndentBehaviour -> Bool # | |
Show IndentBehaviour Source # | |
Defined in Yi.Types showsPrec :: Int -> IndentBehaviour -> ShowS # show :: IndentBehaviour -> String # showList :: [IndentBehaviour] -> ShowS # |
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 | |
|
Instances
Functor MarkSet Source # | |
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 # | |
Show a => Show (MarkSet a) Source # | |
Binary a => Binary (MarkSet a) Source # | |
forall syntax. FBuffer !(Mode syntax) !(BufferImpl syntax) !Attributes |
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
Eq IndentSettings Source # | |
Defined in Yi.Types (==) :: IndentSettings -> IndentSettings -> Bool # (/=) :: IndentSettings -> IndentSettings -> Bool # | |
Show IndentSettings Source # | |
Defined in Yi.Types showsPrec :: Int -> IndentSettings -> ShowS # show :: IndentSettings -> String # showList :: [IndentSettings] -> ShowS # |
The BufferM monad writes the updates performed.
stickyEolA :: HasAttributes c => Lens' c Bool Source #
fontsizeVariationA :: HasAttributes c => Lens' c Int Source #
lastSyncTimeA :: HasAttributes c => Lens' c UTCTime Source #
directoryContentA :: HasAttributes c => Lens' c Bool Source #
lastActiveWindowA :: HasAttributes c => Lens' c Window Source #
keymapProcessA :: HasAttributes c => Lens' c KeymapProcess Source #
insertingA :: HasAttributes c => Lens' c Bool 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 #
clearSyntax :: FBuffer -> FBuffer Source #
update the syntax information (clear the dirty "flag")
increaseFontSize :: Int -> BufferM () Source #
Increases the font size in the buffer by specified number. What this number actually means depends on the front-end.
decreaseFontSize :: Int -> BufferM () Source #
Decreases the font size in the buffer by specified number. What this number actually means depends on the front-end.
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
queryBuffer :: (forall syntax. BufferImpl syntax -> x) -> BufferM x Source #
addOverlayB :: Overlay -> BufferM () Source #
Adds an "overlay" to the buffer
delOverlayB :: Overlay -> BufferM () Source #
Remove an existing "overlay"
delOverlaysOfOwnerB :: YiString -> BufferM () 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.
deleteMarkB :: Mark -> BufferM () 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.
markSavedB :: UTCTime -> BufferM () Source #
Mark the current point in the undo list as a saved state.
isUnchangedBuffer :: FBuffer -> Bool Source #
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.
modeAlwaysApplies :: a -> b -> Bool Source #
Mode applies function that always returns True.
modeNeverApplies :: a -> b -> Bool Source #
Mode applies function that always returns False.
setInserting :: Bool -> BufferM () Source #
applyUpdate :: Update -> BufferM () Source #
revertPendingUpdatesB :: BufferM () Source #
Revert all the pending updates; don't touch the point.
insertNAt :: YiString -> Point -> BufferM () Source #
Insert given YiString
at specified point, extending size of the
buffer.
insertN :: YiString -> BufferM () Source #
Insert the YiString
at current point, extending size of 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
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
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)
setAnyMode :: AnyMode -> BufferM () Source #
Set the mode
withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a 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
setNamedMarkHereB :: String -> BufferM () Source #
setVisibleSelection :: Bool -> BufferM () Source #
Highlight the selection
getVisibleSelection :: BufferM Bool Source #
Whether the selection is highlighted
moveN :: Int -> BufferM () Source #
Move point by the given number of characters. A negative offset moves backwards a positive one forward.
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.
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)
moveToColB :: Int -> BufferM () Source #
forgetPreferCol :: BufferM () Source #
savingPrefCol :: BufferM a -> BufferM a 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.
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
replaceCharB :: Char -> BufferM () Source #
replaceCharWithBelowB :: BufferM () Source #
replaceCharWithAboveB :: BufferM () Source #
insertCharWithBelowB :: BufferM () Source #
insertCharWithAboveB :: BufferM () Source #
indentSettingsB :: BufferM IndentSettings Source #
Gives the IndentSettings
for the current buffer.
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 #
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.
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
savingExcursionB :: BufferM a -> BufferM a Source #
perform a BufferM a
, and return to the current point. (by using a mark)
savingPointB :: BufferM a -> BufferM a Source #
Perform an BufferM a
, and return to the current point.
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.
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 #
modeGetStrokesA :: forall syntax. Lens' (Mode syntax) (syntax -> Point -> Point -> Point -> [Stroke]) Source #
modeIndentA :: forall syntax. Lens' (Mode syntax) (syntax -> IndentBehaviour -> BufferM ()) Source #
modeIndentSettingsA :: forall syntax. Lens' (Mode syntax) IndentSettings 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.
Modifies the given region according to the given string transformation function
inclusiveRegionB :: Region -> BufferM Region Source #
Extend the right bound of a region to include it.
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...
data BoundarySide Source #
Boundary side
Instances
Eq BoundarySide Source # | |
Defined in Yi.Buffer.TextUnit (==) :: BoundarySide -> BoundarySide -> Bool # (/=) :: BoundarySide -> BoundarySide -> Bool # |
Designate a given "unit" of text.
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.
isWordChar :: Char -> Bool 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).
unitSepThisLine :: TextUnit Source #
unitSepThisLine is true for any kind of whitespace/separator on this line only
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.
leftBoundaryUnit :: TextUnit -> TextUnit Source #
Unit that have its left and right boundaries at the left boundary of the argument unit.
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
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.
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM () Source #
Do an action if the current buffer character passes the predicate
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.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM () Source #
Generic maybe move operation. As genMoveB, but don't move if we are at boundary already.
maybeMoveB :: TextUnit -> Direction -> BufferM () Source #
As moveB
, unless the point is at a unit boundary
deleteB :: TextUnit -> Direction -> BufferM () Source #
Delete between point and next unit boundary, return the deleted region.
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.
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.
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region Source #
Non empty region at given point and the next boundary,
putRegionStyle :: RegionStyle -> BufferM () Source #
convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region Source #
mkRegionOfStyleB :: Point -> Point -> 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.
data BufferFileInfo Source #
BufferFileInfo | |
|
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
moveXorSol :: Int -> BufferM () Source #
Move x
chars back, or to the sol, whichever is less
moveXorEol :: Int -> BufferM () Source #
Move x
chars forward, or to the eol, whichever is less
gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM () Source #
nextCInLineInc :: Char -> BufferM () Source #
nextCInLineExc :: Char -> BufferM () Source #
prevCInLineInc :: Char -> BufferM () Source #
prevCInLineExc :: Char -> BufferM () Source #
firstNonSpaceB :: BufferM () Source #
Move to first non-space character in this line
lastNonSpaceB :: BufferM () Source #
Move to the last non-space character in this line
moveNonspaceOrSol :: BufferM () Source #
Go to the first non space character in the line; if already there, then go to the beginning of the line.
isCurrentLineEmptyB :: BufferM Bool Source #
True if current line consists of just a newline (no whitespace)
isCurrentLineAllWhiteSpaceB :: BufferM Bool Source #
Note: Returns False if line doesn't have any characters besides a newline
nextNParagraphs :: Int -> BufferM () Source #
Move down next n
paragraphs
prevNParagraphs :: Int -> BufferM () Source #
Move up prev n
paragraphs
selectNParagraphs :: Int -> BufferM () Source #
Select next n
paragraphs
atLastLine :: BufferM Bool Source #
True if point at the last line
readCurrentWordB :: BufferM YiString Source #
Reads in word at point.
readPrevWordB :: BufferM YiString Source #
Reads in word before point.
killWordB :: BufferM () Source #
Delete forward whitespace or non-whitespace depending on the character under point.
bkillWordB :: BufferM () Source #
Delete backward whitespace or non-whitespace depending on the character before point.
bdeleteLineB :: BufferM () Source #
Delete backward to the sof or the new line character
deleteHorizontalSpaceB :: Maybe Int -> BufferM () Source #
emacs' delete-horizontal-space
with the optional argument.
uppercaseWordB :: BufferM () Source #
capitalise the word under the cursor
lowercaseWordB :: BufferM () Source #
lowerise word under the cursor
capitaliseWordB :: BufferM () Source #
capitalise the first letter of this word
switchCaseChar :: Char -> Char 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.
setSelectionMarkPointB :: Point -> BufferM () Source #
Marks
Set the current buffer selection mark
getSelectionMarkPointB :: BufferM Point Source #
Get the current buffer selection mark
exchangePointAndMarkB :: BufferM () Source #
Exchange point & mark.
bufInfoB :: BufferM BufferFileInfo Source #
File info, size in chars, line no, col num, char num, percent
upScreensB :: Int -> BufferM () Source #
downScreensB :: Int -> BufferM () Source #
downScreenB :: BufferM () Source #
Scroll down 1 screen
scrollScreensB :: Int -> BufferM () Source #
Scroll by n screens (negative for up)
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
scrollToCursorB :: BufferM () Source #
Move to middle line in screen
scrollCursorToTopB :: BufferM () Source #
Move cursor to the top of the screen
scrollCursorToBottomB :: BufferM () Source #
Move cursor to the bottom of the screen
snapScreenB :: Maybe ScrollStyle -> BufferM Bool Source #
Move the visible region to include the point
downFromTosB :: Int -> BufferM () Source #
Move to n
lines down from top of screen
upFromBosB :: Int -> BufferM () Source #
Move to n
lines up from the bottom of the screen
getRawestSelectRegionB :: BufferM Region Source #
Return the region between point and mark
getSelectRegionB :: BufferM Region Source #
Get the current region boundaries. Extended to the current selection unit.
setSelectRegionB :: Region -> BufferM () Source #
Select the given region: set the selection mark at the regionStart
and the current point at the regionEnd
.
deleteBlankLinesB :: BufferM () Source #
lineStreamB :: Direction -> BufferM [YiString] Source #
Get a (lazy) stream of lines in the buffer, starting at the next line in the given direction.
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).
Prefix each line in the selection using the given string.
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.
toggleCommentB :: YiString -> BufferM () Source #
Just like toggleCommentSelectionB
but automatically inserts a
whitespace suffix to the inserted comment string. In fact:
replaceBufferContent :: YiString -> BufferM () Source #
Replace the contents of the buffer with some string
fillParagraph :: BufferM () Source #
sortLinesWithRegion :: Region -> BufferM () Source #
revertB :: YiString -> UTCTime -> BufferM () Source #
Helper function: revert the buffer contents to its on-disk version
leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point] Source #
rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point] Source #
deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point) Source #
insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM () Source #
movePercentageFileB :: Int -> BufferM () Source #
findMatchingPairB :: BufferM () Source #
incrementNextNumberByB :: Int -> BufferM () Source #
Increase (or decrease if negative) next number on line by n.
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 occurence of [a
..f
] is part of a hex number.
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.
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.
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'
.
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
indentOfB :: YiString -> BufferM Int Source #
Returns the indentation of a given string. Note that this depends on the current indentation settings.
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.
indentAsPreviousB :: BufferM () Source #
Indent as much as the previous line
indentAsNextB :: BufferM () Source #
Indent as much as the next line
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
indentOfCurrentPosB :: BufferM Int Source #
Return the number of spaces at the beginning of the line, up to the point.
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