Documentation ¶
Overview ¶
This package implements a couple of standard commands available to the editor.
Typically the package is imported by a frontend via
import ( _ "github.com/limetext/lime/backend/commands" )
See the wiki page for more details on implementing commands: https://github.com/limetext/lime/wiki/Implementing-commands
Index ¶
- type CloseAllCommand
- type CloseViewCommand
- type CloseWindowAppCommand
- type CloseWindowCommand
- type CopyCommand
- type CutCommand
- type DeleteWordCommand
- type FindNextCommand
- type FindUnderExpandCommand
- type GlueMarkedUndoGroupsCommand
- type IndentCommand
- type InsertCommand
- type JoinCommand
- type LeftDeleteCommand
- type LowerCaseCommand
- type MarkUndoGroupsForGluingCommand
- type MaybeMarkUndoGroupsForGluingCommand
- type MoveByType
- type MoveCommand
- type MoveToCommand
- type MoveToType
- type NewFileCommand
- type NewWindowAppCommand
- type NewWindowCommand
- type NextViewCommand
- type NopApplicationCommand
- type NopTextCommand
- type NopWindowCommand
- type OpenFileCommand
- type PasteCommand
- type PrevViewCommand
- type RedoCommand
- type ReplaceNextCommand
- type RightDeleteCommand
- type SaveAllCommand
- type SaveAsCommand
- type SaveCommand
- type ScrollLinesCommand
- type SelectAllCommand
- type SelectLinesCommand
- type SetFileTypeCommand
- type SetSettingCommand
- type SingleSelectionCommand
- type SortLinesCommand
- type SortSelectionCommand
- type SplitSelectionIntoLinesCommand
- type SwapCaseCommand
- type SwapLineDownCommand
- type SwapLineUpCommand
- type TitleCaseCommand
- type ToggleCommentCommand
- type ToggleSettingCommand
- type TransposeCommand
- type UndoCommand
- type UnindentCommand
- type UnmarkUndoGroupsForGluingCommand
- type UpperCaseCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseAllCommand ¶
type CloseAllCommand struct {
DefaultCommand
}
func (*CloseAllCommand) Run ¶
func (c *CloseAllCommand) Run(w *Window) error
type CloseViewCommand ¶
type CloseViewCommand struct {
DefaultCommand
}
func (*CloseViewCommand) Run ¶
func (c *CloseViewCommand) Run(w *Window) error
type CloseWindowAppCommand ¶
type CloseWindowAppCommand struct {
DefaultCommand
}
func (*CloseWindowAppCommand) IsChecked ¶
func (c *CloseWindowAppCommand) IsChecked() bool
func (*CloseWindowAppCommand) Run ¶
func (c *CloseWindowAppCommand) Run() error
type CloseWindowCommand ¶
type CloseWindowCommand struct {
DefaultCommand
}
func (*CloseWindowCommand) Run ¶
func (c *CloseWindowCommand) Run(w *Window) error
type CopyCommand ¶
type CopyCommand struct {
DefaultCommand
}
func (*CopyCommand) Run ¶
func (c *CopyCommand) Run(v *View, e *Edit) error
type CutCommand ¶
type CutCommand struct {
DefaultCommand
}
func (*CutCommand) Run ¶
func (c *CutCommand) Run(v *View, e *Edit) error
type DeleteWordCommand ¶
type DeleteWordCommand struct { DefaultCommand Forward bool }
The DeleteWordCommand deletes one word to right or left depending on forward variable
func (*DeleteWordCommand) Run ¶
func (c *DeleteWordCommand) Run(v *View, e *Edit) error
type FindNextCommand ¶
type FindNextCommand struct {
DefaultCommand
}
The FindNext command searches for the last search term, starting at the end of the last selection in the buffer, and wrapping around. If it finds the term, it clears the current selections and selects the newly-found regions.
func (*FindNextCommand) Run ¶
func (c *FindNextCommand) Run(v *View, e *Edit) error
type FindUnderExpandCommand ¶
type FindUnderExpandCommand struct {
DefaultCommand
}
The FindUnderExpandCommand extends the selection to the current word if the current selection region is empty. If one character or more is selected, the text buffer is scanned for the next occurrence of the selection and that region too is added to the selection set.
func (*FindUnderExpandCommand) Run ¶
func (c *FindUnderExpandCommand) Run(v *View, e *Edit) error
type GlueMarkedUndoGroupsCommand ¶
type GlueMarkedUndoGroupsCommand struct {
BypassUndoCommand
}
The GlueMarkedUndoGroupsCommand merges commands from the previously marked undo stack location to the current location into a single entry in the undo stack.
func (*GlueMarkedUndoGroupsCommand) Run ¶
func (c *GlueMarkedUndoGroupsCommand) Run(v *View, e *Edit) error
type IndentCommand ¶
type IndentCommand struct {
DefaultCommand
}
The IndentCommand increments indentation of selection.
func (*IndentCommand) Run ¶
func (c *IndentCommand) Run(v *View, e *Edit) error
type InsertCommand ¶
type InsertCommand struct { DefaultCommand // The characters to insert Characters string }
The InsertCommand inserts the given characters, at all of the current selection locations, possibly replacing text if the selection area covers one or more characters.
func (*InsertCommand) Run ¶
func (c *InsertCommand) Run(v *View, e *Edit) error
type JoinCommand ¶
type JoinCommand struct {
DefaultCommand
}
JoinCommand removes every new line in the selections and the first new line after
func (*JoinCommand) Run ¶
func (c *JoinCommand) Run(v *View, e *Edit) error
type LeftDeleteCommand ¶
type LeftDeleteCommand struct {
DefaultCommand
}
The LeftDeleteCommand deletes characters to the left of the current selection or the current selection if it is not empty.
func (*LeftDeleteCommand) Run ¶
func (c *LeftDeleteCommand) Run(v *View, e *Edit) error
type LowerCaseCommand ¶
type LowerCaseCommand struct {
DefaultCommand
}
The LowerCaseCommand transforms all selections so that each character in the selection is in its lower case equivalent
func (*LowerCaseCommand) Run ¶
func (c *LowerCaseCommand) Run(v *View, e *Edit) error
type MarkUndoGroupsForGluingCommand ¶
type MarkUndoGroupsForGluingCommand struct {
BypassUndoCommand
}
The MarkUndoGroupsForGluingCommand marks the current position in the undo stack as the start of commands to glue, potentially overwriting any existing marks.
func (*MarkUndoGroupsForGluingCommand) Run ¶
func (c *MarkUndoGroupsForGluingCommand) Run(v *View, e *Edit) error
type MaybeMarkUndoGroupsForGluingCommand ¶
type MaybeMarkUndoGroupsForGluingCommand struct {
BypassUndoCommand
}
The MaybeMarkUndoGroupsForGluingCommand is similar to MarkUndoGroupsForGluingCommand with the exception that if there is already a mark set, it is not overwritten.
func (*MaybeMarkUndoGroupsForGluingCommand) Run ¶
func (c *MaybeMarkUndoGroupsForGluingCommand) Run(v *View, e *Edit) error
type MoveByType ¶
type MoveByType int
Specifies the type of "move" operation
const ( // Move by Characters Characters MoveByType = iota // Move by Stops (TODO(.): what exactly is a stop?) Stops // Move by Lines Lines // Move by Words Words // Move by Word Ends WordEnds // Move by Sub Words SubWords // Move by Sub Word Ends SubWordEnds // Move by Page Pages )
func (*MoveByType) Set ¶
func (m *MoveByType) Set(v interface{}) error
type MoveCommand ¶
type MoveCommand struct { DefaultCommand // Specifies the type of "move" operation By MoveByType // Whether the current selection should be extended or not Extend bool // Whether to move forward or backwards Forward bool // Used together with By=Stops, extends "word_separators" defined by settings Separators string // Used together with By=Stops, go to word begin WordBegin bool // Used together with By=Stops, go to word end WordEnd bool // Used together with By=Stops, go to punctuation begin PunctBegin bool // Used together with By=Stops, go to punctuation end PunctEnd bool // Used together with By=Stops, go to an empty line EmptyLine bool // Used together with By=Stops, TODO: ??? ClipToLine bool }
The MoveCommand moves the current selection
func (*MoveCommand) Default ¶
func (c *MoveCommand) Default(key string) interface{}
func (*MoveCommand) Run ¶
func (c *MoveCommand) Run(v *View, e *Edit) error
type MoveToCommand ¶
type MoveToCommand struct { DefaultCommand // The type of "move_to" operation to perform To MoveToType // Whether the current selection should be extended or not Extend bool }
The MoveToCommand moves or extends the current selection to the specified location
func (*MoveToCommand) Run ¶
func (c *MoveToCommand) Run(v *View, e *Edit) error
type MoveToType ¶
type MoveToType int
Specifies the type of "move_to" operation to perform
const ( // Beginning of line BOL MoveToType = iota // End of line EOL // Beginning of file BOF // End of file EOF // Current level close bracket Brackets )
func (*MoveToType) Set ¶
func (mt *MoveToType) Set(v interface{}) error
type NewFileCommand ¶
type NewFileCommand struct {
DefaultCommand
}
func (*NewFileCommand) Run ¶
func (c *NewFileCommand) Run(w *Window) error
type NewWindowAppCommand ¶
type NewWindowAppCommand struct {
DefaultCommand
}
func (*NewWindowAppCommand) IsChecked ¶
func (c *NewWindowAppCommand) IsChecked() bool
func (*NewWindowAppCommand) Run ¶
func (c *NewWindowAppCommand) Run() error
type NewWindowCommand ¶
type NewWindowCommand struct {
DefaultCommand
}
func (*NewWindowCommand) Run ¶
func (c *NewWindowCommand) Run(w *Window) error
type NextViewCommand ¶
type NextViewCommand struct {
DefaultCommand
}
func (*NextViewCommand) Run ¶
func (c *NextViewCommand) Run(w *Window) error
type NopApplicationCommand ¶
type NopApplicationCommand struct {
BypassUndoCommand
}
func (*NopApplicationCommand) Run ¶
func (c *NopApplicationCommand) Run() error
type NopTextCommand ¶
type NopTextCommand struct {
BypassUndoCommand
}
func (*NopTextCommand) Run ¶
func (c *NopTextCommand) Run(v *View, e *Edit) error
type NopWindowCommand ¶
type NopWindowCommand struct {
BypassUndoCommand
}
func (*NopWindowCommand) Run ¶
func (c *NopWindowCommand) Run(w *Window) error
type OpenFileCommand ¶
type OpenFileCommand struct { DefaultCommand Path string }
func (*OpenFileCommand) Run ¶
func (o *OpenFileCommand) Run(w *Window) error
type PasteCommand ¶
type PasteCommand struct {
DefaultCommand
}
func (*PasteCommand) Run ¶
func (c *PasteCommand) Run(v *View, e *Edit) error
type PrevViewCommand ¶
type PrevViewCommand struct {
DefaultCommand
}
func (*PrevViewCommand) Run ¶
func (c *PrevViewCommand) Run(w *Window) error
type RedoCommand ¶
type RedoCommand struct { BypassUndoCommand // contains filtered or unexported fields }
func (*RedoCommand) Run ¶
func (c *RedoCommand) Run(v *View, e *Edit) error
type ReplaceNextCommand ¶
type ReplaceNextCommand struct {
DefaultCommand
}
The ReplaceNextCommand searches for the "old" argument text, and at the first occurance of the text, replaces it with the "new" argument text. If there are multiple regions, the find starts from the max region.
func (*ReplaceNextCommand) Run ¶
func (c *ReplaceNextCommand) Run(v *View, e *Edit) error
type RightDeleteCommand ¶
type RightDeleteCommand struct {
DefaultCommand
}
The RightDeleteCommand deletes characters to the right of the current selection or the current selection if it is not empty.
func (*RightDeleteCommand) Run ¶
func (c *RightDeleteCommand) Run(v *View, e *Edit) error
type SaveAllCommand ¶
type SaveAllCommand struct {
DefaultCommand
}
func (*SaveAllCommand) Run ¶
func (c *SaveAllCommand) Run(w *Window) error
type SaveAsCommand ¶
type SaveAsCommand struct { DefaultCommand Name string }
func (*SaveAsCommand) Run ¶
func (c *SaveAsCommand) Run(v *View, e *Edit) error
type SaveCommand ¶
type SaveCommand struct {
DefaultCommand
}
func (*SaveCommand) Run ¶
func (c *SaveCommand) Run(v *View, e *Edit) error
type ScrollLinesCommand ¶
type ScrollLinesCommand struct { BypassUndoCommand // The number of lines to scroll (positive or negative direction) Amount int }
The ScrollLinesCommand moves the viewpoint "Amount" lines from the current location
func (*ScrollLinesCommand) Run ¶
func (c *ScrollLinesCommand) Run(v *View, e *Edit) error
type SelectAllCommand ¶
type SelectAllCommand struct {
DefaultCommand
}
The SelectAllCommand selects the whole buffer of the current file
func (*SelectAllCommand) Run ¶
func (c *SelectAllCommand) Run(v *View, e *Edit) error
type SelectLinesCommand ¶
type SelectLinesCommand struct { DefaultCommand Forward bool }
func (*SelectLinesCommand) Run ¶
func (c *SelectLinesCommand) Run(v *View, e *Edit) error
type SetFileTypeCommand ¶
type SetFileTypeCommand struct { DefaultCommand Syntax string }
func (*SetFileTypeCommand) Run ¶
func (c *SetFileTypeCommand) Run(v *View, e *Edit) error
type SetSettingCommand ¶
type SetSettingCommand struct { BypassUndoCommand Setting string Value interface{} }
The SetSettingCommand set the value of a setting.
func (*SetSettingCommand) Run ¶
func (c *SetSettingCommand) Run(v *View, e *Edit) error
type SingleSelectionCommand ¶
type SingleSelectionCommand struct {
DefaultCommand
}
The SingleSelectionCommand merges multiple cursors into a single one.
func (*SingleSelectionCommand) Run ¶
func (c *SingleSelectionCommand) Run(v *View, e *Edit) error
type SortLinesCommand ¶
type SortLinesCommand struct { DefaultCommand CaseSensitive bool Reverse bool RemoveDuplicates bool }
The SortLinesCommand sorts all lines intersecting a selection region
func (*SortLinesCommand) Run ¶
func (c *SortLinesCommand) Run(v *View, e *Edit) error
type SortSelectionCommand ¶
type SortSelectionCommand struct { DefaultCommand CaseSensitive bool Reverse bool RemoveDuplicates bool }
The SortSelectionCommand sorts contents of each selection region with respect to each other
func (*SortSelectionCommand) Run ¶
func (c *SortSelectionCommand) Run(v *View, e *Edit) error
type SplitSelectionIntoLinesCommand ¶
type SplitSelectionIntoLinesCommand struct {
DefaultCommand
}
func (*SplitSelectionIntoLinesCommand) Run ¶
func (c *SplitSelectionIntoLinesCommand) Run(v *View, e *Edit) error
type SwapCaseCommand ¶
type SwapCaseCommand struct {
DefaultCommand
}
The SwapCaseCommand transforms all selections so that each character in the selection is the opposite case. For example, the text: "Hello, World!" turns in to: "hELLO, wORLD!"
func (*SwapCaseCommand) Run ¶
func (c *SwapCaseCommand) Run(v *View, e *Edit) error
type SwapLineDownCommand ¶
type SwapLineDownCommand struct {
DefaultCommand
}
func (*SwapLineDownCommand) Run ¶
func (c *SwapLineDownCommand) Run(v *View, e *Edit) error
type SwapLineUpCommand ¶
type SwapLineUpCommand struct {
DefaultCommand
}
func (*SwapLineUpCommand) Run ¶
func (c *SwapLineUpCommand) Run(v *View, e *Edit) error
type TitleCaseCommand ¶
type TitleCaseCommand struct {
DefaultCommand
}
The TitleCaseCommand transforms all selections to be in Title Case. For instance, the text: "this is some sample text" turns in to: "This Is Some Sample Text"
func (*TitleCaseCommand) Run ¶
func (c *TitleCaseCommand) Run(v *View, e *Edit) error
type ToggleCommentCommand ¶
type ToggleCommentCommand struct {
DefaultCommand
}
func (*ToggleCommentCommand) Run ¶
func (c *ToggleCommentCommand) Run(v *View, e *Edit) error
type ToggleSettingCommand ¶
type ToggleSettingCommand struct { BypassUndoCommand Setting string }
The ToggleSettingCommand toggles the value of a setting, making it false when it was true or true when it was false.
func (*ToggleSettingCommand) Run ¶
func (c *ToggleSettingCommand) Run(v *View, e *Edit) error
type TransposeCommand ¶
type TransposeCommand struct {
DefaultCommand
}
Transpose: Swap the characters on either side of the cursor, then move the cursor forward one character.
func (*TransposeCommand) Run ¶
func (c *TransposeCommand) Run(v *View, e *Edit) error
type UndoCommand ¶
type UndoCommand struct { BypassUndoCommand // contains filtered or unexported fields }
func (*UndoCommand) Run ¶
func (c *UndoCommand) Run(v *View, e *Edit) error
type UnindentCommand ¶
type UnindentCommand struct {
DefaultCommand
}
The UnindentCommand decrements indentation of selection.
func (*UnindentCommand) Run ¶
func (c *UnindentCommand) Run(v *View, e *Edit) error
type UnmarkUndoGroupsForGluingCommand ¶
type UnmarkUndoGroupsForGluingCommand struct {
BypassUndoCommand
}
The UnmarkUndoGroupsForGluingCommand removes the glue mark set by either MarkUndoGroupsForGluingCommand or MaybeMarkUndoGroupsForGluingCommand if it was set.
func (*UnmarkUndoGroupsForGluingCommand) Run ¶
func (c *UnmarkUndoGroupsForGluingCommand) Run(v *View, e *Edit) error
type UpperCaseCommand ¶
type UpperCaseCommand struct {
DefaultCommand
}
The UpperCaseCommand transforms all selections so that each character in the selection is in its upper case equivalent (if any.)
func (*UpperCaseCommand) Run ¶
func (c *UpperCaseCommand) Run(v *View, e *Edit) error