commands

package
v0.0.0-...-586e974 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: BSD-2-Clause Imports: 12 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/jxo/lime/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 Close

type Close struct {
	lime.DefaultCommand
}

Close command closes the currently opened view.

func (*Close) Run

func (c *Close) Run(w *lime.Window) error

Run executes the Close command.

type CloseAll

type CloseAll struct {
	lime.DefaultCommand
}

CloseAll command closes all the open views inside the current window.

func (*CloseAll) Run

func (c *CloseAll) Run(w *lime.Window) error

Run executes the CloseAll command.

type CloseFolderList

type CloseFolderList struct {
	lime.DefaultCommand
}

CloseFolderList removes the folder list from the opened project.

func (*CloseFolderList) Run

func (c *CloseFolderList) Run(w *lime.Window) error

Run executes the CloseFolderList command.

type CloseProject

type CloseProject struct {
	lime.DefaultCommand
}

CloseProject command enables us to close an existing open project.

func (*CloseProject) Run

func (c *CloseProject) Run(w *lime.Window) error

Run executes the CloseProject command.

type CloseWindow

type CloseWindow struct {
	lime.DefaultCommand
}

CloseWindow command lets us close the current window.

func (*CloseWindow) Run

func (c *CloseWindow) Run(w *lime.Window) error

Run executes the CloseWindow command.

type CloseWindowApp

type CloseWindowApp struct {
	lime.DefaultCommand
}

CloseWindowApp command closes all the active windows.

func (*CloseWindowApp) IsChecked

func (c *CloseWindowApp) IsChecked() bool

IsChecked shows if CloseWindowApp has a checkbox in the frontend.

func (*CloseWindowApp) Run

func (c *CloseWindowApp) Run() error

Run executes the CloseWindowApp command.

type Copy

type Copy struct {
	lime.DefaultCommand
}

Copy copies the current selection to the clipboard. If there are multiple selections, they are concatenated in order from top to bottom of the file, separated by newlines

func (*Copy) Run

func (c *Copy) Run(v *lime.View, e *lime.Edit) error

Run executes the Copy command.

type Cut

type Cut struct {
	lime.DefaultCommand
}

Cut copies the current selection to the clipboard, removing it from the buffer. If there are multiple selections, they are concatenated in order from top to bottom of the file, separated by newlines.

func (*Cut) Run

func (c *Cut) Run(v *lime.View, e *lime.Edit) error

Run executes the Cut command.

type DecreaseFontSize

type DecreaseFontSize struct {
	lime.DefaultCommand
}

DecreaseFontSize command decreases the font size by 1.

func (*DecreaseFontSize) Run

func (d *DecreaseFontSize) Run(w *lime.Window) error

Run executes the DecreaseFontSize command.

type DeleteWord

type DeleteWord struct {
	lime.DefaultCommand
	Forward bool
}

DeleteWord Command deletes one word to right or left depending on forward variable.

func (*DeleteWord) Run

func (c *DeleteWord) Run(v *lime.View, e *lime.Edit) error

Run executes the DeleteWord command.

type DuplicateLine

type DuplicateLine struct {
	lime.DefaultCommand
}

Duplicate copies all of the current selections, inserting each copy before the original. If any of the selections are empty, instead, the entire line containing that cursor is copied and inserted before the original.

func (*DuplicateLine) Run

func (c *DuplicateLine) Run(v *lime.View, e *lime.Edit) error

Run executes the DuplicateLine command.

type FindAll

type FindAll struct {
	lime.DefaultCommand
	SearchText []rune
}

func (*FindAll) Run

func (c *FindAll) Run(v *lime.View, e *lime.Edit) error

type FindNext

type FindNext struct {
	lime.DefaultCommand
}

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 (*FindNext) Run

func (c *FindNext) Run(v *lime.View, e *lime.Edit) error

Run executes the FindNext command.

type FindUnderExpand

type FindUnderExpand struct {
	lime.DefaultCommand
}

FindUnderExpand Command 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 (*FindUnderExpand) Run

func (c *FindUnderExpand) Run(v *lime.View, e *lime.Edit) error

Run executes the FindUnderExpand command.

type GlueMarkedUndoGroups

type GlueMarkedUndoGroups struct {
	lime.BypassUndoCommand
}

GlueMarkedUndoGroups Command merges commands from the previously marked undo stack location to the current location into a single entry in the undo stack.

func (*GlueMarkedUndoGroups) Run

func (c *GlueMarkedUndoGroups) Run(v *lime.View, e *lime.Edit) error

Run executes the GlueMarkedUndoGroups command.

type IncreaseFontSize

type IncreaseFontSize struct {
	lime.DefaultCommand
}

IncreaseFontSize command increases the font size by 1.

func (*IncreaseFontSize) Run

func (i *IncreaseFontSize) Run(w *lime.Window) error

Run executes the IncreaseFontSize command.

type Indent

type Indent struct {
	lime.DefaultCommand
}

Indent Command increments indentation of selection.

func (*Indent) Run

func (c *Indent) Run(v *lime.View, e *lime.Edit) error

Run executes the Indent command.

type Insert

type Insert struct {
	lime.DefaultCommand
	// The characters to insert
	Characters string
}

Insert Command inserts the given characters, at all of the current selection locations, possibly replacing text if the selection area covers one or more characters.

func (*Insert) Run

func (c *Insert) Run(v *lime.View, e *lime.Edit) error

Run executes the Insert command.

type JoinLines

type JoinLines struct {
	lime.DefaultCommand
}

JoinLines removes every new line in the selections and the first new line after.

func (*JoinLines) Run

func (c *JoinLines) Run(v *lime.View, e *lime.Edit) error

Run executes the JoinLines command.

type LeftDelete

type LeftDelete struct {
	lime.DefaultCommand
}

LeftDelete Command deletes characters to the left of the current selection or the current selection if it is not empty.

func (*LeftDelete) Run

func (c *LeftDelete) Run(v *lime.View, e *lime.Edit) error

Run executes the LeftDelete command.

type LowerCase

type LowerCase struct {
	lime.DefaultCommand
}

LowerCase Command transforms all selections so that each character in the selection is in its lower case equivalent.

func (*LowerCase) Run

func (c *LowerCase) Run(v *lime.View, e *lime.Edit) error

Run executes the LowerCase command.

type MarkUndoGroupsForGluing

type MarkUndoGroupsForGluing struct {
	lime.BypassUndoCommand
}

MarkUndoGroupsForGluing Command marks the current position in the undo stack as the start of commands to glue, potentially overwriting any existing marks.

func (*MarkUndoGroupsForGluing) Run

Run executes the MarkUndoGroupsForGluing command.

type MaybeMarkUndoGroupsForGluing

type MaybeMarkUndoGroupsForGluing struct {
	lime.BypassUndoCommand
}

MaybeMarkUndoGroupsForGluing Command is similar to MarkUndoGroupsForGluingCommand with the exception that if there is already a mark set, it is not overwritten.

func (*MaybeMarkUndoGroupsForGluing) Run

Run executes the MaybeMarkUndoGroupsForGluing command.

type Move

type Move struct {
	lime.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
}

Move Command moves the current selection.

func (*Move) Default

func (c *Move) Default(key string) interface{}

Default returns the default seprators.

func (*Move) Run

func (c *Move) Run(v *lime.View, e *lime.Edit) error

Run executes the Move command.

type MoveByType

type MoveByType int

MoveByType Specifies the type of "move" operation.

const (
	// Characters by Characters.
	Characters MoveByType = iota
	// Stops will move by Stops (TODO(.): what exactly is a stop?).
	Stops
	// Lines will move by Lines.
	Lines
	// Words will move by Words.
	Words
	// WordEnds will move by Word Ends.
	WordEnds
	// SubWords will move by Sub Words.
	SubWords
	// SubWordEnds will Move by Sub Word Ends.
	SubWordEnds
	// Pages will move by Page.
	Pages
)

func (*MoveByType) Set

func (m *MoveByType) Set(v interface{}) error

Set the type of move.

type MoveTo

type MoveTo struct {
	lime.DefaultCommand
	// The type of "move_to" operation to perform.
	To MoveToType
	// Whether the current selection should be extended or not.
	Extend bool
}

MoveTo Command moves or extends the current selection to the specified location.

func (*MoveTo) Run

func (c *MoveTo) Run(v *lime.View, e *lime.Edit) error

Run executes the MoveTo command.

type MoveToType

type MoveToType int

MoveToType Specifies the type of "move_to" operation to perform.

const (
	// BOL is Beginning of line.
	BOL MoveToType = iota
	// EOL is End of line
	EOL
	//BOF is Beginning of file.
	BOF
	// EOF is End of file.
	EOF
	// Brackets >-> Current level close bracket.
	Brackets
)

func (*MoveToType) Set

func (mt *MoveToType) Set(v interface{}) error

Set will define the type of move

type NewFile

type NewFile struct {
	lime.DefaultCommand
}

NewFile command creates a new file.

func (*NewFile) Run

func (c *NewFile) Run(w *lime.Window) error

Run executes the NewFile command.

type NewWindow

type NewWindow struct {
	lime.DefaultCommand
}

NewWindow command opens a new window.

func (*NewWindow) Run

func (c *NewWindow) Run(w *lime.Window) error

Run executes the NewWindow command.

type NewWindowApp

type NewWindowApp struct {
	lime.DefaultCommand
}

NewWindowApp creates a new window, setting it as active.

func (*NewWindowApp) IsChecked

func (c *NewWindowApp) IsChecked() bool

IsChecked shows if NewWindowApp has a checkbox in the frontend.

func (*NewWindowApp) Run

func (c *NewWindowApp) Run() error

Run executes the NewWindowApp command.

type NextView

type NextView struct {
	lime.DefaultCommand
}

NextView command switches to the view which is immediately to the next of the current view.

func (*NextView) Run

func (c *NextView) Run(w *lime.Window) error

Run executes the NextView command.

type NopApplication

type NopApplication struct {
	lime.BypassUndoCommand
}

NopApplication performs NOP.

func (*NopApplication) IsChecked

func (c *NopApplication) IsChecked() bool

IsChecked represents if the command contains a checkbox in the frontend

func (*NopApplication) Run

func (c *NopApplication) Run() error

Run executes the NopApplication command.

type NopText

type NopText struct {
	lime.BypassUndoCommand
}

NopText performs NOP.

func (*NopText) Run

func (c *NopText) Run(v *lime.View, e *lime.Edit) error

Run executes the NopText command.

type NopWindow

type NopWindow struct {
	lime.BypassUndoCommand
}

NopWindow performs NOP.

func (*NopWindow) Run

func (c *NopWindow) Run(w *lime.Window) error

Run executes the NopWindow command.

type Paste

type Paste struct {
	lime.DefaultCommand
}

Paste pastes the contents of the clipboard, overwriting the current selection, if any. If there are multiple selections, the clipboard is split into lines. If the number of lines equals the number of selections, the lines are pasted separately into each selection in order from top to bottom of the file. Otherwise the entire clipboard is pasted over every selection.

func (*Paste) Run

func (c *Paste) Run(v *lime.View, e *lime.Edit) error

Run executes the Paste command.

type PrevView

type PrevView struct {
	lime.DefaultCommand
}

PrevView command switches to the view which is immediately before hte current view.

func (*PrevView) Run

func (c *PrevView) Run(w *lime.Window) error

Run executes the PrevView command.

type PromptAddFolder

type PromptAddFolder struct {
	lime.DefaultCommand
}

PromptAddFolder adds a folder to the existing opened project.

func (*PromptAddFolder) Run

func (c *PromptAddFolder) Run(w *lime.Window) error

Run executes the PromptAddFolder command.

type PromptOpenFile

type PromptOpenFile struct {
	lime.DefaultCommand
}

PromptOpenFile command prompts opening an existing file from the filesystem.

func (*PromptOpenFile) Run

func (o *PromptOpenFile) Run(w *lime.Window) error

Run executes the PromptOpenFile command.

type PromptOpenProject

type PromptOpenProject struct {
	lime.DefaultCommand
}

PromptOpenProject command enables us to open the project file saved using the SaveProjectAs command.

func (*PromptOpenProject) Run

func (c *PromptOpenProject) Run(w *lime.Window) error

Run executes the PromptOpenProject command.

type PromptSaveAs

type PromptSaveAs struct {
	lime.DefaultCommand
}

PromptSaveAs command lets us save the currently active file with a different name.

func (*PromptSaveAs) Run

func (c *PromptSaveAs) Run(v *lime.View, e *lime.Edit) error

Run executes the PromptSaveAs command.

type Redo

type Redo struct {
	lime.BypassUndoCommand
	// contains filtered or unexported fields
}

func (*Redo) Run

func (c *Redo) Run(v *lime.View, e *lime.Edit) error

Run executes the Redo command.

type ReplaceAll

type ReplaceAll struct {
	lime.DefaultCommand
	SearchText  []rune
	ReplaceText []rune
}

func (*ReplaceAll) Run

func (c *ReplaceAll) Run(v *lime.View, e *lime.Edit) error

type ReplaceNext

type ReplaceNext struct {
	lime.DefaultCommand
}

ReplaceNext Command 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 (*ReplaceNext) Run

func (c *ReplaceNext) Run(v *lime.View, e *lime.Edit) error

Run executes the ReplaceNext command.

type RightDelete

type RightDelete struct {
	lime.DefaultCommand
}

RightDelete Command deletes characters to the right of the current selection or the current selection if it is not empty.

func (*RightDelete) Run

func (c *RightDelete) Run(v *lime.View, e *lime.Edit) error

Run executes the RightDelete command.

type Save

type Save struct {
	lime.DefaultCommand
}

Save command writes the currently opened file to the disk.

func (*Save) Run

func (c *Save) Run(v *lime.View, e *lime.Edit) error

Run executes the Save command.

type SaveAll

type SaveAll struct {
	lime.DefaultCommand
}

SaveAll command saves all the open files to the disk.

func (*SaveAll) Run

func (c *SaveAll) Run(w *lime.Window) error

Run executes the SaveAll command.

type SaveProjectAs

type SaveProjectAs struct {
	lime.DefaultCommand
}

SaveProjectAs command enables us to save the project as a text file, which can then be imported into lime using PromptOpenProject command.

func (*SaveProjectAs) Run

func (c *SaveProjectAs) Run(w *lime.Window) error

Run executes the SaveProjectAs command.

type ScrollLines

type ScrollLines struct {
	lime.BypassUndoCommand
	// The number of lines to scroll (positive or negative direction).
	Amount int
}

ScrollLines Command moves the viewpoint "Amount" lines from the current location.

func (*ScrollLines) Run

func (c *ScrollLines) Run(v *lime.View, e *lime.Edit) error

Run executes the ScrollLines command.

type SelectAll

type SelectAll struct {
	lime.DefaultCommand
}

SelectAll command selects the whole buffer of the current file.

func (*SelectAll) Run

func (c *SelectAll) Run(v *lime.View, e *lime.Edit) error

Run executes the SelectAll command.

type SelectLines

type SelectLines struct {
	lime.DefaultCommand
	Forward bool
}

SelectLines makes the selection fill the lines covered by it currently.

func (*SelectLines) Run

func (c *SelectLines) Run(v *lime.View, e *lime.Edit) error

Run executes the SelectLines command.

type SetFileType

type SetFileType struct {
	lime.DefaultCommand
	Syntax string
}

SetFileType command will let us set the file type for the currently active view, eg: for Syntax highlighting.

func (*SetFileType) Run

func (c *SetFileType) Run(v *lime.View, e *lime.Edit) error

Run executes the SetFileType command.

type SetSetting

type SetSetting struct {
	lime.BypassUndoCommand
	Setting string
	Value   interface{}
}

SetSetting Command set the value of a setting.

func (*SetSetting) Run

func (c *SetSetting) Run(v *lime.View, e *lime.Edit) error

Run executes the SetSetting command.

type SingleSelection

type SingleSelection struct {
	lime.DefaultCommand
}

SingleSelection command merges multiple cursors into a single one.

func (*SingleSelection) Run

func (c *SingleSelection) Run(v *lime.View, e *lime.Edit) error

Run executes the SingleSelection command.

type SortLines

type SortLines struct {
	lime.DefaultCommand
	CaseSensitive    bool
	Reverse          bool
	RemoveDuplicates bool
}

SortLines Command sorts all lines intersecting a selection region.

func (*SortLines) Run

func (c *SortLines) Run(v *lime.View, e *lime.Edit) error

Run executes the SortLines command.

type SortSelection

type SortSelection struct {
	lime.DefaultCommand
	CaseSensitive    bool
	Reverse          bool
	RemoveDuplicates bool
}

SortSelection Command sorts contents of each selection region with respect to each other.

func (*SortSelection) Run

func (c *SortSelection) Run(v *lime.View, e *lime.Edit) error

Run executes the sort slection command.

type SplitSelectionIntoLines

type SplitSelectionIntoLines struct {
	lime.DefaultCommand
}

SplitSelectionIntoLines will split the current selection into lines.

func (*SplitSelectionIntoLines) Run

Run executes the SplitSelectionIntoLines command

type SwapCase

type SwapCase struct {
	lime.DefaultCommand
}

SwapCase Command 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 (*SwapCase) Run

func (c *SwapCase) Run(v *lime.View, e *lime.Edit) error

Run executes the SwapCase command.

type SwapLineDown

type SwapLineDown struct {
	lime.DefaultCommand
}

SwapLineDown swaps the currently selected lines with the ones below.

func (*SwapLineDown) Run

func (c *SwapLineDown) Run(v *lime.View, e *lime.Edit) error

Run executes the SwapLineDown command.

type SwapLineUp

type SwapLineUp struct {
	lime.DefaultCommand
}

SwapLineUp swaps the currently selected lines with the ones above.

func (*SwapLineUp) Run

func (c *SwapLineUp) Run(v *lime.View, e *lime.Edit) error

Run executes the SwapLineUp command.

type TitleCase

type TitleCase struct {
	lime.DefaultCommand
}

TitleCase Command 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 (*TitleCase) Run

func (c *TitleCase) Run(v *lime.View, e *lime.Edit) error

Run executes the TitleCase command.

type ToggleComment

type ToggleComment struct {
	lime.DefaultCommand
}

ToggleComment toggles the comment status for the current selection. If the current selection has any content which is not currently contained within a comment, the entire selection is commented out, with existing comments being commented by an extra level. If the current selection has only content contained within comments, all of the comments are reduced by one level. All lines containing only whitespace are ignored in every case.

func (*ToggleComment) Run

func (c *ToggleComment) Run(v *lime.View, e *lime.Edit) error

Run executes the ToggleComment command.

type ToggleDistractionFree

type ToggleDistractionFree struct {
	// contains filtered or unexported fields
}

func (*ToggleDistractionFree) Run

func (t *ToggleDistractionFree) Run(w *lime.Window) error

type ToggleFullScreen

type ToggleFullScreen struct {
	// contains filtered or unexported fields
}

ToggleFullScreen command enables us to toggle full screen.

func (*ToggleFullScreen) Run

func (t *ToggleFullScreen) Run(w *lime.Window) error

type ToggleMinimap

type ToggleMinimap struct {
	// contains filtered or unexported fields
}

func (*ToggleMinimap) Run

func (t *ToggleMinimap) Run(w *lime.Window) error

type ToggleSetting

type ToggleSetting struct {
	lime.BypassUndoCommand
	Setting string
}

ToggleSetting Command toggles the value of a setting, making it false when it was true or true when it was false.

func (*ToggleSetting) Run

func (c *ToggleSetting) Run(v *lime.View, e *lime.Edit) error

Run executes the ToggleSetting command.

type ToggleSideBar

type ToggleSideBar struct {
	// contains filtered or unexported fields
}

ToggleSideBar Command enables us to toggle the sidebar when the sidebar is visible, it'll be made invisible and vice versa.

func (*ToggleSideBar) Run

func (t *ToggleSideBar) Run(w *lime.Window) error

type ToggleStatusBar

type ToggleStatusBar struct {
	// contains filtered or unexported fields
}

ToggleStatusBar command enables us to toggle the status bar.

func (*ToggleStatusBar) Run

func (t *ToggleStatusBar) Run(w *lime.Window) error

type ToggleTabs

type ToggleTabs struct {
	// contains filtered or unexported fields
}

func (*ToggleTabs) Run

func (t *ToggleTabs) Run(w *lime.Window) error

type Transpose

type Transpose struct {
	lime.DefaultCommand
}

Transpose will Swap the characters on either side of the cursor, then move the cursor forward one character.

func (*Transpose) Run

func (c *Transpose) Run(v *lime.View, e *lime.Edit) error

Run executes the transpose command.

type Undo

type Undo struct {
	lime.BypassUndoCommand
	// contains filtered or unexported fields
}

func (*Undo) Run

func (c *Undo) Run(v *lime.View, e *lime.Edit) error

Run executes the Undo command.

type Unindent

type Unindent struct {
	lime.DefaultCommand
}

Unindent Command decrements indentation of selection.

func (*Unindent) Run

func (c *Unindent) Run(v *lime.View, e *lime.Edit) error

Run executes the Unindent command.

type UnmarkUndoGroupsForGluing

type UnmarkUndoGroupsForGluing struct {
	lime.BypassUndoCommand
}

UnmarkUndoGroupsForGluing Command removes the glue mark set by either MarkUndoGroupsForGluingCommand or MaybeMarkUndoGroupsForGluingCommand if it was set.

func (*UnmarkUndoGroupsForGluing) Run

Run executes the UnmarkUndoGroupsForGluing command.

type UpperCase

type UpperCase struct {
	lime.DefaultCommand
}

UpperCase Command transforms all selections so that each character in the selection is in its upper case equivalent (if any.)

func (*UpperCase) Run

func (c *UpperCase) Run(v *lime.View, e *lime.Edit) error

Run executes the UpperCase command.

Jump to

Keyboard shortcuts

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