Module Vim.Buffer
type t= Vim__.Native.buffer
val openFile : string -> topenFile(path)opens a file, sets it as the active buffer, and returns a handle to the buffer.
val getFilename : t -> string optiongetFileName(buffer)returns the full file path of the bufferbuffer
val getVersion : t -> intgetVersion(buffer)returns the latest changedtick of the bufferbuffer.The changedtick gets updated with each modification to the buffer
val isModified : t -> boolisModified(buffer)returnstrueif the buffer has been modified since the last save,falseotherwise.
val getLineCount : t -> intgetLineCount(buffer)returns the number of lines in the buffer.
val getLine : t -> int -> stringgetline(buffer, line)returns the text content at the one-based line numberlinefor bufferbuffer.
val getId : t -> intgetId(buffer)returns the id of bufferbuffer;
val getById : int -> t optiongetById(id)returns a buffer if one is available with the specified id if it exists, otherwiseNone.
val getCurrent : unit -> tgetCurrent()returns the currently active buffer.
val setCurrent : t -> unitsetCurrent(buffer)sets the active buffer tobuffer.This will trigger dispatching of autocommands, like
BufEnter.
val onEnter : Vim__.Listeners.bufferListener -> Vim__.Event.unsubscribeonEnter(f)adds a listenerfthat is called whenever a new buffer is entered.This is more reliable than autocommands, as it will dispatch in any case the buffer is changed, even in cases where
BufEnterwould not be dispatched.Returns a function that can be called to unsubscribe.
val onUpdate : Vim__.Listeners.bufferUpdateListener -> Vim__.Event.unsubscribeonUpdate(f)adds a listenerfthat is called whenever a buffer is modified.Returns a function that can be called to unsubscribe.