yi-core-0.19.4: Yi editor core library

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

Extensions

- OverloadedStrings
- LambdaCase
- MultiWayIf

Yi.Buffer.HighLevel

Description

High level operations on buffers.

Synopsis

- atEof :: BufferM Bool
- atEol :: BufferM Bool
- atLastLine :: BufferM Bool
- atSol :: BufferM Bool
- atSof :: BufferM Bool
- bdeleteB :: BufferM ()
- bdeleteLineB :: BufferM ()
- bkillWordB :: BufferM ()
- botB :: BufferM ()
- bufInfoB :: BufferM BufferFileInfo
- data BufferFileInfo = BufferFileInfo {
  - bufInfoFileName :: FilePath
  - bufInfoSize :: Int
  - bufInfoLineNo :: Int
  - bufInfoColNo :: Int
  - bufInfoCharNo :: Point
  - bufInfoPercent :: Text
  - bufInfoModified :: Bool
  }
- capitaliseWordB :: BufferM ()
- deleteBlankLinesB :: BufferM ()
- deleteHorizontalSpaceB :: Maybe Int -> BufferM ()
- deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM (NonEmpty Point)
- deleteToEol :: BufferM ()
- deleteTrailingSpaceB :: BufferM ()
- downFromTosB :: Int -> BufferM ()
- downScreenB :: BufferM ()
- downScreensB :: Int -> BufferM ()
- exchangePointAndMarkB :: BufferM ()
- fillParagraph :: BufferM ()
- findMatchingPairB :: BufferM ()
- firstNonSpaceB :: BufferM ()
- flipRectangleB :: Point -> Point -> BufferM (Point, Point)
- getBookmarkB :: String -> BufferM Mark
- getLineAndCol :: BufferM (Int, Int)
- getLineAndColOfPoint :: Point -> BufferM (Int, Int)
- getNextLineB :: Direction -> BufferM YiString
- getNextNonBlankLineB :: Direction -> BufferM YiString
- getRawestSelectRegionB :: BufferM Region
- getSelectionMarkPointB :: BufferM Point
- getSelectRegionB :: BufferM Region
- gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()
- hasWhiteSpaceBefore :: BufferM Bool
- incrementNextNumberByB :: Int -> BufferM ()
- insertRopeWithStyleB :: YiString -> RegionStyle -> BufferM ()
- isCurrentLineAllWhiteSpaceB :: BufferM Bool
- isCurrentLineEmptyB :: BufferM Bool
- isNumberB :: BufferM Bool
- killWordB :: BufferM ()
- lastNonSpaceB :: BufferM ()
- leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- leftOnEol :: BufferM ()
- lineMoveVisRel :: Int -> BufferM ()
- linePrefixSelectionB :: YiString -> BufferM ()
- lineStreamB :: Direction -> BufferM [YiString]
- lowercaseWordB :: BufferM ()
- middleB :: BufferM ()
- modifyExtendedSelectionB :: TextUnit -> (YiString -> YiString) -> BufferM ()
- moveNonspaceOrSol :: BufferM ()
- movePercentageFileB :: Int -> BufferM ()
- moveToMTB :: BufferM ()
- moveToEol :: BufferM ()
- moveToSol :: BufferM ()
- moveXorEol :: Int -> BufferM ()
- moveXorSol :: Int -> BufferM ()
- nextCExc :: Char -> BufferM ()
- nextCInc :: Char -> BufferM ()
- nextCInLineExc :: Char -> BufferM ()
- nextCInLineInc :: Char -> BufferM ()
- nextNParagraphs :: Int -> BufferM ()
- nextWordB :: BufferM ()
- prevCExc :: Char -> BufferM ()
- prevCInc :: Char -> BufferM ()
- prevCInLineExc :: Char -> BufferM ()
- prevCInLineInc :: Char -> BufferM ()
- prevNParagraphs :: Int -> BufferM ()
- prevWordB :: BufferM ()
- readCurrentWordB :: BufferM YiString
- readLnB :: BufferM YiString
- readPrevWordB :: BufferM YiString
- readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM YiString
- replaceBufferContent :: YiString -> BufferM ()
- revertB :: YiString -> UTCTime -> BufferM ()
- rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
- scrollB :: Int -> BufferM ()
- scrollCursorToBottomB :: BufferM ()
- scrollCursorToTopB :: BufferM ()
- scrollScreensB :: Int -> BufferM ()
- scrollToCursorB :: BufferM ()
- scrollToLineAboveWindowB :: BufferM ()
- scrollToLineBelowWindowB :: BufferM ()
- selectNParagraphs :: Int -> BufferM ()
- setSelectionMarkPointB :: Point -> BufferM ()
- setSelectRegionB :: Region -> BufferM ()
- shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
- sortLines :: BufferM ()
- sortLinesWithRegion :: Region -> BufferM ()
- snapInsB :: BufferM ()
- snapScreenB :: Maybe ScrollStyle -> BufferM Bool
- splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
- swapB :: BufferM ()
- switchCaseChar :: Char -> Char
- test3CharB :: BufferM Bool
- testHexB :: BufferM Bool
- toggleCommentB :: YiString -> BufferM ()
- topB :: BufferM ()
- unLineCommentSelectionB :: YiString -> YiString -> BufferM ()
- upFromBosB :: Int -> BufferM ()
- uppercaseWordB :: BufferM ()
- upScreenB :: BufferM ()
- upScreensB :: Int -> BufferM ()
- vimScrollB :: Int -> BufferM ()
- vimScrollByB :: (Int -> Int) -> Int -> BufferM ()
- markWord :: BufferM ()

# Documentation

atEof :: BufferM Bool Source #

True if point at end of file

atEol :: BufferM Bool Source #

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

atLastLine :: BufferM Bool Source #

True if point at the last line

atSol :: BufferM Bool Source #

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

atSof :: BufferM Bool Source #

True if point at start of file

bdeleteB :: BufferM () Source #

Delete one character backward

bdeleteLineB :: BufferM () Source #

Delete backward to the sof or the new line character

bkillWordB :: BufferM () Source #

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

botB :: BufferM () Source #

Move cursor to end of buffer

bufInfoB :: BufferM BufferFileInfo Source #

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

data BufferFileInfo Source #

Constructors

BufferFileInfo |

Fields

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

capitaliseWordB :: BufferM () Source #

capitalise the first letter of this word

deleteBlankLinesB :: BufferM () Source #

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

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

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

deleteToEol :: BufferM () Source #

Delete to the end of line, excluding it.

deleteTrailingSpaceB :: BufferM () Source #

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

downFromTosB :: Int -> BufferM () Source #

Move to `n` lines down from top of screen

downScreenB :: BufferM () Source #

Scroll down 1 screen

downScreensB :: Int -> BufferM () Source #

exchangePointAndMarkB :: BufferM () Source #

Exchange point & mark.

fillParagraph :: BufferM () Source #

findMatchingPairB :: BufferM () Source #

firstNonSpaceB :: BufferM () Source #

Move to first non-space character in this line

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

getBookmarkB :: String -> BufferM Mark Source #

getLineAndCol :: BufferM (Int, Int) Source #

Get the current line and column number

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

getNextLineB :: Direction -> BufferM YiString Source #

The same as `getMaybeNextLineB` but avoids the use of the `Maybe` type in the return by returning the empty string if there is no next line.

getNextNonBlankLineB :: Direction -> BufferM YiString Source #

Returns the closest line to the current line which is non-blank, in the given direction. Returns the empty string if there is no such line (for example if we are on the top line already).

getRawestSelectRegionB :: BufferM Region Source #

Return the region between point and mark

getSelectionMarkPointB :: BufferM Point Source #

Get the current buffer selection mark

getSelectRegionB :: BufferM Region Source #

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

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

hasWhiteSpaceBefore :: BufferM Bool Source #

incrementNextNumberByB :: Int -> BufferM () Source #

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

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

isCurrentLineAllWhiteSpaceB :: BufferM Bool Source #

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

isCurrentLineEmptyB :: BufferM Bool Source #

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

isNumberB :: BufferM Bool Source #

Is character under cursor a number.

killWordB :: BufferM () Source #

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

lastNonSpaceB :: BufferM () Source #

Move to the last non-space character in this line

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

leftOnEol :: BufferM () Source #

Move left if on eol, but not on blank line

lineMoveVisRel :: Int -> BufferM () Source #

Move point down by `n` lines If line extends past width of window, count moving a single line as moving width points to the right.

linePrefixSelectionB Source #

Arguments

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

Prefix each line in the selection using the given string.

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

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

lowercaseWordB :: BufferM () Source #

lowerise word under the cursor

middleB :: BufferM () Source #

Move to middle line in screen

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

moveNonspaceOrSol :: BufferM () Source #

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

movePercentageFileB :: Int -> BufferM () Source #

moveToMTB :: BufferM () Source #

Move point between the middle, top and bottom of the screen If the point stays at the middle, it'll be gone to the top else if the point stays at the top, it'll be gone to the bottom else it'll be gone to the middle

moveToEol :: BufferM () Source #

Move point to end of line

moveToSol :: BufferM () Source #

Move point to start of line

moveXorEol :: Int -> BufferM () Source #

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

moveXorSol :: Int -> BufferM () Source #

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

nextCExc :: Char -> BufferM () Source #

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

nextCInc :: Char -> BufferM () Source #

Move to the next occurrence of `c`

nextCInLineExc :: Char -> BufferM () Source #

nextCInLineInc :: Char -> BufferM () Source #

nextNParagraphs :: Int -> BufferM () Source #

Move down next `n` paragraphs

nextWordB :: BufferM () Source #

Move to first char of next word forwards

prevCExc :: Char -> BufferM () Source #

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

prevCInc :: Char -> BufferM () Source #

Move to the previous occurrence of `c`

prevCInLineExc :: Char -> BufferM () Source #

prevCInLineInc :: Char -> BufferM () Source #

prevNParagraphs :: Int -> BufferM () Source #

Move up prev `n` paragraphs

prevWordB :: BufferM () Source #

Move to first char of next word backwards

readCurrentWordB :: BufferM YiString Source #

Reads in word at point.

readLnB :: BufferM YiString Source #

Read the line the point is on

readPrevWordB :: BufferM YiString Source #

Reads in word before point.

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

replaceBufferContent :: YiString -> BufferM () Source #

Replace the contents of the buffer with some string

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

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

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

scrollB :: Int -> BufferM () Source #

Scroll by n lines.

scrollCursorToBottomB :: BufferM () Source #

Move cursor to the bottom of the screen

scrollCursorToTopB :: BufferM () Source #

Move cursor to the top of the screen

scrollScreensB :: Int -> BufferM () Source #

Scroll by n screens (negative for up)

scrollToCursorB :: BufferM () Source #

Move to middle line in screen

scrollToLineAboveWindowB :: BufferM () Source #

scrollToLineBelowWindowB :: BufferM () Source #

selectNParagraphs :: Int -> BufferM () Source #

Select next `n` paragraphs

setSelectionMarkPointB :: Point -> BufferM () Source #

Marks

Set the current buffer selection mark

setSelectRegionB :: Region -> BufferM () Source #

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

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

sortLines :: BufferM () Source #

Sort the lines of the region.

sortLinesWithRegion :: Region -> BufferM () Source #

snapInsB :: BufferM () Source #

Move the point to inside the viewable region

snapScreenB :: Maybe ScrollStyle -> BufferM Bool Source #

Move the visible region to include the point

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

swapB :: BufferM () Source #

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

switchCaseChar :: Char -> Char Source #

test3CharB :: BufferM Bool Source #

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

testHexB :: BufferM Bool Source #

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

toggleCommentB :: YiString -> BufferM () Source #

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

topB :: BufferM () Source #

Move cursor to origin

unLineCommentSelectionB Source #

Arguments

:: YiString | The string which begins a line comment
-> YiString | A potentially shorter string that begins a comment
-> BufferM () |

Uncomments the selection using the given line comment starting string. This only works for the comments which begin at the start of the line.

upFromBosB :: Int -> BufferM () Source #

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

uppercaseWordB :: BufferM () Source #

capitalise the word under the cursor

upScreenB :: BufferM () Source #

Scroll up 1 screen

upScreensB :: Int -> BufferM () Source #

vimScrollB :: Int -> BufferM () Source #

Same as scrollB, but also moves the cursor

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

Same as scrollByB, but also moves the cursor

markWord :: BufferM () Source #

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