yi-core-0.19.2: Yi editor core library

Yi.Buffer.Indent

Description

Handles indentation in the keymaps. Includes:

• (TODO) Auto-indentation to the previous lines indentation
• Tab-expansion
• Shifting of the indentation for a region of text
Synopsis

# Documentation

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

Indent as much as the next line

Indent as much as the previous line

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

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

Gives the IndentSettings for the current buffer.

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.

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

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

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