commands

package
v0.0.0-...-6557315 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2014 License: BSD-2-Clause Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 {
	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
)

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 {
	BypassUndoCommand
	// contains filtered or unexported fields
}

func (*RedoCommand) Run

func (c *RedoCommand) 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 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 {
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL