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 AllSelectionCommand
- type CloseWindowAppCommand
- type CloseWindowCommand
- type DeleteWordCommand
- 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 RedoCommand
- type RightDeleteCommand
- type SaveAllCommand
- type SaveAsCommand
- type SaveCommand
- type ScrollLinesCommand
- type SelectLinesCommand
- type SetSettingCommand
- type SingleSelectionCommand
- type SortLinesCommand
- type SortSelectionCommand
- type SplitSelectionIntoLinesCommand
- type SwapCaseCommand
- type SwapLineDownCommand
- type SwapLineUpCommand
- type TitleCaseCommand
- type ToggleSettingCommand
- 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 AllSelectionCommand ¶
type AllSelectionCommand struct {
DefaultCommand
}
The AllSelectionCommand selects the whole buffer of the current file
func (*AllSelectionCommand) Run ¶
func (c *AllSelectionCommand) Run(v *View, e *Edit) 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 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 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 {
backend.BypassUndoCommand
}
The GlueMarkedUndoGroupsCommand merges commands from the previously marked undo stack location to the current location into a single entry in the undo stack.
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 {
backend.BypassUndoCommand
}
The MarkUndoGroupsForGluingCommand marks the current position in the undo stack as the start of commands to glue, potentially overwriting any existing marks.
type MaybeMarkUndoGroupsForGluingCommand ¶
type MaybeMarkUndoGroupsForGluingCommand struct {
backend.BypassUndoCommand
}
The MaybeMarkUndoGroupsForGluingCommand is similar to MarkUndoGroupsForGluingCommand with the exception that if there is already a mark set, it is not overwritten.
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 )
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, and ??? (TODO(.): document better) WordBegin bool // Used together with By=Stops, and ??? (TODO(.): document better) WordEnd bool }
The MoveCommand moves the current selection
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 )
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 RedoCommand ¶
type RedoCommand struct { backend.BypassUndoCommand // contains filtered or unexported fields }
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 SelectLinesCommand ¶
type SelectLinesCommand struct { DefaultCommand Forward bool }
func (*SelectLinesCommand) Run ¶
func (c *SelectLinesCommand) 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 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 UndoCommand ¶
type UndoCommand struct { backend.BypassUndoCommand // contains filtered or unexported fields }
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 {
backend.BypassUndoCommand
}
The UnmarkUndoGroupsForGluingCommand removes the glue mark set by either MarkUndoGroupsForGluingCommand or MaybeMarkUndoGroupsForGluingCommand if it was set.
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