Documentation ¶
Index ¶
- Constants
- Variables
- func Die(err error)
- type Editor
- func (e *Editor) Close() error
- func (e *Editor) CutRow()
- func (e *Editor) DeleteChar()
- func (e *Editor) DeleteRow(at int)
- func (e *Editor) ExecuteCommand() error
- func (e *Editor) ExecuteMotion() error
- func (e *Editor) Find() error
- func (e *Editor) Init(logger *log.Logger) error
- func (e *Editor) InsertChar(c rune)
- func (e *Editor) InsertNewline()
- func (e *Editor) InsertRow(at int, chars string)
- func (e *Editor) JumpParagraph(k keys.Key)
- func (e *Editor) MoveCursor(k keys.Key)
- func (e *Editor) MoveCursorByRepeat(k keys.Key, repeat int)
- func (e *Editor) OpenFile(filename string) error
- func (e *Editor) PasteRow(at int)
- func (e *Editor) ProcessKey() error
- func (e *Editor) ProcessKeyCommandMode() error
- func (e *Editor) ProcessKeyInsertMode() error
- func (e *Editor) ProcessKeyNormalMode() error
- func (e *Editor) Prompt(prompt string, cb func(query string, k keys.Key)) (string, error)
- func (e *Editor) Render()
- func (e *Editor) Save(opts ...string) (int, error)
- func (e *Editor) SetMode(mode modes.Mode)
- func (e *Editor) SetStatusMessage(format string, a ...interface{})
- func (e *Editor) Undo()
- func (e *Editor) YankRow()
- type Row
- type UndoNode
Constants ¶
View Source
const NullBufferPath = "/dev/null"
Variables ¶
View Source
var ( ErrQuitEditor = errors.New("quit editor") ErrUnknownMode = errors.New("unknown mode") ErrUnknownCommand = errors.New("unknown command") ErrUnkownMotion = errors.New("unknown motion") )
View Source
var ErrPromptCanceled = fmt.Errorf("user canceled the input prompt")
Functions ¶
Types ¶
type Editor ¶
type Editor struct { Rows []*Row // contains filtered or unexported fields }
func (*Editor) DeleteChar ¶
func (e *Editor) DeleteChar()
func (*Editor) ExecuteCommand ¶
func (*Editor) ExecuteMotion ¶
func (*Editor) Find ¶
FIXME: Sometimes the patterm match will match the line above the rowOffset FIXME: Crashes sometimes in big files
func (*Editor) InsertChar ¶
func (*Editor) InsertNewline ¶
func (e *Editor) InsertNewline()
func (*Editor) JumpParagraph ¶
func (*Editor) MoveCursor ¶
func (*Editor) OpenFile ¶
OpenFile opens a file with the given filename. If a file does not exist, it returns os.ErrNotExist.
func (*Editor) ProcessKey ¶
func (*Editor) ProcessKeyCommandMode ¶
func (*Editor) ProcessKeyInsertMode ¶
func (*Editor) ProcessKeyNormalMode ¶
func (*Editor) Prompt ¶
Prompt shows the given prompt in the command bar and get user input until to user presses the Enter key to confirm the input or until the user presses the Escape key to cancel the input. Returns the user input and nil if the user enters the input. Returns an empty string and ErrPromptCancel if the user cancels the input. It takes an optional callback function, which takes the query string and the last key pressed.
func (*Editor) SetStatusMessage ¶
Click to show internal directories.
Click to hide internal directories.