Skip to content

Command Reference

About

Print information about the editor, including where some files are expected to be located such as:

  • The configuration directory
  • The settings file, and if it was loaded on startup
  • The style configuration file, and if it was loaded on startup
  • The SSH key directory, and a list of cached SSH connections
  • The plumbing configuration file
  • The API listener port, and a list of active API sessions

Acq

Acq 'acquires' it's argument. It performs the same function as ALT+Right-Click performs on a text object.

Acquire means the following. First, if the word or selection matches a plumbing rule, execute that plumbing rule. If there is no matching plumbing rule, then if the word or selection is a file or directory path and there is already a window open with that path as the filename portion of it's tag, change focus to that window and make it visible. If there is not already a window open for that path, open one. Finally, if a plumbing rule is not executed and the path ends in :N, #C or !X then go to line N, character C or regex X in the file.

Ansi

Ansi is used to control whether Ansi terminal color escape sequences cause coloring or not. With no argument or the 'on' it enables coloring. With the argument 'off' it disables coloring.

Clr

Clear (delete) the contents of the window body

Cmds

List the most recent external commands executed.

Cmds*

List the most recent external commands executed along with the directory they were executed in.

Cols

Cols lists all the columns, including whether they are visible or not.

Cols*

Cols* lists all the columns verbosely (including the files in each column).

Cut

Cut deletes the last selected text and writes it to the clipboard.

Dbg

Dbg is used to run commands to help debug the internals of Anvil. Its first argument is a subcommand. The various subcommands are documented in the subsections below.

Dbg ProfCpu

Dbg ProfCpu starts writing profiling information to disk until it is executed a second time at which point it stops profiling.

Dbg ProfHeap

Dbg ProfHeap istarts writing profiling information to disk until it is executed a second time at which point it stops profiling.

Dbg Goroutines

Dbg Goroutines writes all goroutine stacks to the errors window.

Dbg Logs

Dbg Logs displays internal debug logs to the +Errors window. With no arguments it writes logs from all categories. With one or more arguments only those categories are printed. The available categories are:

  • Application
  • UI
  • Editable
  • Syntax
  • API
  • Filesystem
  • Completion
  • Plumbing
  • Window
  • Commands
  • Column
  • Config
  • Editor
  • Packing
  • SSH
  • Expressions

Dbg Pid

Print the process ID of Anvil

Dbg Psrv

This command starts the Go pprof debug http server on localhost port 6060. This server can be used to debug Anvil performance. Once started, some useful URLs to browse are:

go tool pprof http://localhost:6060/debug/pprof/heap

go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30

go tool pprof http://localhost:6060/debug/pprof/block

go tool pprof http://localhost:6060/debug/pprof/mutex

Dbg Psrv off

This command stops the pprof debug server started by Dbg Psrv

Del

Del closes the current window.

Del!

Del! closes the current window. If there are unsaved changes, the user is not prompted to save them.

Delcol

Delcol deletes the column in which it is executed.

Do

Do executes it's arguments as a command; i.e. as if the arguments were selceted and executed alone. This is useful to execute commands from one window in the directory of another window.

Dump

Dump saves the editor's state to disk: the size of the open windows and the current value of their tags. With an argument the state is written to the file named by the argument. With no argument state is written to the file anvil.dump. The state can be loaded using Load.

Exit

Exit exits the editor. If there are unsaved changes the user is prompted to save them. If it is executed a second time, the user is not prompted.

Font

Change to the next font defined in the styles. If the last font is active, change back to the first.

With the default style there are two fonts. The first is a variable-width font, and the second is a fixed-width font.

Fuzz

Fuzz performs a fuzzy search through the lines in the window body. The terms for the search are the arguments to the Fuzz command. The lines which match the search are written to a new window for the current directory with the suffix '+Live'.

The Fuzz command is special in that it can be executed dynamically as you type the search terms. If you add the string '◊Fuzz ' to the tag, then as you type the arguments after the command the search is re-executed and the results updated in the +Live window. You can delimit the end of the search arguments using another ◊

Get

Get reads the contents of the path that is the leftmost text in the window tag and replaces the window body contents with it.

Goto

Goto sets the current cursor position in the window body to the named bookmark, created by Mark. If no argument is given it jumps to the bookmark 'def'.

Help

Help shows a bit of help for the editor. With no argument it lists the main commands and a brief description. With an argument displays information about that topic. The argument may be a command, which displays more detail about the command, or it may be another selected topic.

Hidecol

Hidecol hides the current column.

Id

Id prints the window ID to the +Errors window. Useful when using the API.

Kill

Kill kills all the jobs that are currently running that have names matching the argument to the Kill command. If no argument is provided the first job is killed.

Load

Load loads the editor's state from disk as written by the Dump command. With an argument the state is read from the file named by the argument. With no argument state is read from the file anvil.dump

LoadStyle

LoadStyle loads the editor style information from a file: the current font and size, colors, etc. With one argument the style is loaded from the file named by the argument. With no argument it is loaded from the file style.js in the Anvil config directory, which is also the style file loaded when the editor is started.

Look

Look searches for the next string in the window body that exactly matches the argument to Look.

Mark

Mark saves the current cursor position in the window body with the name specified by the argument. If no argument is given it is saved with the name 'def'.

Marks

Marks displays the currently set bookmarks to the Errors window.

Marks-

Marks- clears all the currently set bookmarks.

New

New makes a new unnamed window, or with an argument opens a path. When executed with an argument, if a window for that file is already open, a new window for that file is not created. Otherwise, a new window is created in the column in which the command is executed, and the file or directory with the name of the argument is loaded into the window.

Newcol

Newcol creates a new column.

On

Run expects two or more arguments. The first is a remote path, and the remaining arguments are the command and arguments to run.

Only

When executed in a window or its tag, close the other windows in this column leaving only this window.

Keypass

Keypass is used to specify the password used to decrypt an ssh private key file. It takes two arguments: the first is the ssh filename and the second is the password. This is needed when an ssh private key file is encrypted and ssh-agent is not being used.

Paste

Paste writes the text from the clipboard to the window.

Pic

Pic sets the background picture for the window body. The first argument should be the name of a .png, .gif or .jpeg image. The second argument, if specified, specifies how to scale the image. If the second argument is the word 'fit', without quotes, the image is scaled to the size of the window width. If the second argument is a number followed by the % character (such as 50%) the image is scaled by that percentage.

PrintCfg

Print a sample config file to +Errors. The argument specifies the file to generate. For example, ◊PrintCfg settings.toml◊ generates a settings.toml file.

Put

Put writes the contents of the window body to the path that is the leftmost text in the window tag.

Putall

Putall executes a Put on all open windows, saving all windows.

Recent

Recent writes the list of the paths of the most recently closed windows to the +Errors window.

Redo

Redo the last change

Rot

Rot rotates the selections when there are multiple selections. The primary selection moves to the next selection, that one to the next and so on, with the last moving to the primary.

SaveStyle

SaveStyle saves the editor style information to a file: the current font and size, colors, etc. With one argument the style is saved to the file named by the argument. With no argument it is saved to the file style.js in the Anvil config directory, which is also the style file loaded when the editor is started.

Showcol

Showcol makes the column with the name that matches the first argument visible. If no argument is passed, the first hidden column is made visible.

Shstr

When executed with one or more arguments, set the 'Shell String' for the current window: the template string that is used to build the command run on a remote system. It may contain these substitutions within braces:

Dir: The window directory Cmd: The name of the command to be executed Args: Arguments to the command

The default Shell String (assuming the current shell is sh) is: sh -c $'cd "{Dir}" && {Cmd} {Args}'

When executed with no arguments, set the Shell String for the current window back to the default.

Snarf

Snarf copies the last selected text to the clipboard.

Syn

Syn is used to control syntax highlighting for the current window. With the argument 'off' it disables syntax highlighting, and with the argument 'list' it lists the valid supported languages. With any other argument it enables syntax highlighting and highlights the body using the language named by the argument. With no argument it attempts to analyze the text to autodetect the language.

Tint

Tint is used to color selections of text. When executed with the argument 'list' it shows the pre-defined tint colors. When executed with one argument that is not 'list', it changes the text in all current selections to that color. The argument must be a hex color code in the form #rrggbb or a color name. When executed with no argument and selections present, it removes the coloring for text that overlap the selections. When run with no arguments and no selections it clears all tinting.

The tinting of text is saved to dumpfiles created by the Dump command.

Title

Title sets the title of the editor to it's combined arguments. The title is usually displayed by the OS window manager in the title bar.

Undo

Undo the last change.

Wins

List the filenames of the open windows.

Zerox

Zerox opens a new window which is a copy of the current window.

If there are no selections, insert a ◊ rune at the cursor. If there are selections, insert a ◊ before and after each selection.