yi-0.12.5: The Haskell-Scriptable Editor

LicenseGPL-2
Maintaineryi-devel@googlegroups.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • OverloadedStrings
  • NondecreasingIndentation
  • LambdaCase
  • MultiWayIf

Yi.Buffer.HighLevel

Description

High level operations on buffers.

Synopsis

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

capitaliseWordB :: BufferM () Source

capitalise the first letter of this word

deleteHorizontalSpaceB :: Maybe Int -> BufferM () Source

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

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

exchangePointAndMarkB :: BufferM () Source

Exchange point & mark.

firstNonSpaceB :: BufferM () Source

Move to first non-space character in this line

getLineAndCol :: BufferM (Int, Int) Source

Get the current line and column number

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.

incrementNextNumberByB :: Int -> BufferM () Source

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

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

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

moveNonspaceOrSol :: BufferM () Source

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

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 occurence of c

nextCInc :: Char -> BufferM () Source

Move to the next occurence of c

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 occurence of c

prevCInc :: Char -> BufferM () Source

Move to the previous occurence of c

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.

replaceBufferContent :: YiString -> BufferM () Source

Replace the contents of the buffer with some string

revertB :: YiString -> Maybe ConverterName -> UTCTime -> BufferM () Source

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

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

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.

sortLines :: BufferM () Source

Sort the lines of the region.

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

swapB :: BufferM () Source

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

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.

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

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.