o(1)

NAME
o - an editor

SYNOPSIS
o filename [LINE NUMBER]

DESCRIPTION
Edit an existing file or create a new one.

OPTIONS

The line number can be prefixed with +, or be a suffix of the filename if prefixed with :.

-c FILENAME or --copy FILENAME
    Copy the given file into the clipboard.

-f or --force
    Ignore file locks when opening files.

-l or --last-command
    Output the last used build/format/export command.

-m FILENAME or --monitor FILENAME
    Monitor the given file for changes, and open it as read-only.

-n or --no-cache
    Avoid writing the location history, search history, game highscore and last build/format/export command to the cache directory.

-p FILENAME or --paste FILENAME
    Paste the contents of the clipboard into the given file. Combine with -f to overwrite the file.

-e or --clear-locks
    Clear all file locks and close all portals.

-o or --ollama
    Enable Ollama-specific features. The model can be specified in the OLLAMA_MODEL environment variable. This requires that Ollama is up and running, either locally or at the host specified in the OLLAMA_HOST environment variable.

-r or --release
    Build release executables when ctrl-b is pressed, or projects when no filenames are given.

-t or --list
    List the file in a colorful way without opening it for editing.

-b or --build
    Build the given file instead of opening it for editing.

-F or --fmt
    Format the given file in place and quit. Runs headless: no TTY, no UI.

-k or --create-dir
    When opening a new file, create directories as needed.

-d or --debug
    Start in debug mode.

-s or --digraphs
    List all possible digraphs.

-i FILENAME or --input-file FILENAME
    Used as stdin when running programs with ctrl-b. The default filename is input.txt.

-a or --nano
    Emulate Pico/Nano.

-q or --quick-help
    Always display the quick help pane at start.

-z or --no-quick-help
    Never display the quick help pane at start.

-x or --noapprox
    Disable approximate filename matching.

-g GLOB or --glob GLOB
    Search for and open the first filename that matches the given substring.

-v or --version
    Display the current version.

-h or --help
    Display brief usage information.

KEYBINDINGS

ctrl-q
  Quit o.

ctrl-s
  Save the file.

ctrl-w
  Format the current file with goimports or clang-format, depending on the file extension.
  Zig, V, Rust (rustfmt), Haskell (ormolu) and Python (ruff format) are also supported.
  If in git mode, cycle the git interactive rebase keyword on the current line.
  If in Markdown mode, format the table under the cursor.
  Double press to toggle block editing mode.

ctrl-a
  Go to start of the text, then the start of the line and then the previous line.

ctrl-e
  Go to end of the line and then the next line.

ctrl-n
  Scroll down 10 lines or go to the next match if a search is active.
  Insert a new column when in the Markdown table editor.
  Jump to a matching parenthesis or bracket if the arrow keys were just used. ctrl-p
  Scroll up 10 lines or go to the previous match if a search is active.
  Remove an empty column when in the Markdown table editor.
  Jump to a matching parenthesis or bracket if the arrow keys were just used.

ctrl-k
  Delete all characters to the end of the line. Delete the line if it is empty.

ctrl-g
  Go to an include or definition, or toggle the status bar.

ctrl-d
  Delete a single character.

ctrl-o
  Open the command menu, which is a list of actions that can be performed.
  If editing a PKGBUILD file and guessica is installed, there will be a menu option for updating the pkgver + source fields.
  If pandoc is installed, a menu option for rendering to PDF may appear.

ctrl-t
  For C and C++: switch between the corresponding header and implementation.
  For Agda, insert a symbol.
  For Markdown, if the cursor is on a table, launch the Markdown table editor.
  For the rest, record and play back keypresses. Press escape to clear the current macro.

ctrl-c
  Press twice to copy the current block of text (until a blank line or the end of the file).
  Press once to only copy the current line.
  Also closes the portal.

ctrl-v
  Press once to paste only the first line of the copied text, trimmed.
  Press twice to paste the all copied text, untrimmed.

ctrl-x
  Press once to only cut the current line (or delete the line, if empty).
  Press twice to cut the current block of text (until a blank line or the end of the file).
  Also closes the portal.

ctrl-b
  Build programs, render to PDF or export to man page.
  Press twice to also run after building.
  Use o -l to view the last build command.
  Toggle bold in book mode. Toggle a breakpoint in debug mode.

ctrl-j
  Join lines.

ctrl-u
  Undo (ctrl-z is also possible, but may background the application).

ctrl-y
  Redo.

ctrl-l
  Jump to a specific line number or percentage. Press return to jump to the top. Press return again to jump to the bottom.
  Press one of the highlighted on-screen letters to jump to that location.

ctrl-f
  Search for a string from the current location. The search wraps around and is case sensitive.
  There is also support for text replacement, after typing in the search term:
  To replace all, press tab instead of return, enter a replace term and then press tab.
  To replace once, press tab instead of return, enter a replace term and then press return.
  Search for just f to find the previous function signature.

esc
  Go back after having gone to another location or file.
  Redraw the screen and clear the last search.

ctrl-space
  Build programs, render to PDF or export to man page.
  Press twice to also run after building.
  Toggle checkboxes in Markdown. Cycle display and export options in book mode.

  The last used external command by `o` can be found in `~/.cache/o/last_command.sh`.

ctrl-~
  Insert the current date and time.

  `o` will try to jump to the location where the error is and otherwise display "Success".

ctrl-\\
  Toggle single-line comments for a block of code.

ctrl-_
  Insert a symbol by typing in a 2-letter digraph.
  The digraphs are the same as for ViM.
  For a full overview, see: https://raw.githubusercontent.com/xyproto/digraph/main/digraphs.txt

ctrl-r
  Jump to matching bracket or rename something when programming, otherwise toggle "wrap when typing".
  For git interactive rebase, cycle keywords.
  Press twice to open or close a portal.

ENV

The NO_COLOR environment variable can be set to 1 to disable all colors.

If XTERM_VERSION is set (usually automatically by xterm), the "light" color scheme will be used.

The ORBITON_OLLAMA environment variable can be set to 1 to enable Ollama-specific features.

The OLLAMA_MODEL environment variable can be set to specify which Ollama model to use for code completion.

The OLLAMA_HOST environment variable specifies the host for the Ollama service if a non-local service should be used.

MAN PAGER
O can be used for viewing man pages by setting MANPAGER to "o" with ie. export MANPAGER=o.

WHY

I wanted to write a simple editor that only used VT100 terminal codes.

SEE ALSO
e3(1) nano(1) micro(1)

KNOWN BUGS
In some terminal emulators, scrolling quickly up or down with the arrow keys can make the text jump around (it works fine in alacritty). Scroll up and down with ctrl-n and ctrl-p instead to avoid this. Press esc to repaint the text, if needed.

Some unicode runes may disrupt the text flow. This is generally not a problem for editing code and configuration files, but may be an issue when editing files that contains text in many languages.

For some terminal emulators, if o is busy performing an operation, pressing ctrl-s may lock the terminal. Some terminal emulators, like konsole, can be configured to turn off this behavior. Press ctrl-q to unlock the terminal again (together with the unfortunate risk of quitting o). You can also use the ctrl-o menu for saving and quitting.

o may have issues with large files (of several MB+). For normal text files or source code files, this is a non-issue.

Middle-click pasting (instead of pasting with ctrl-v) may have issues with only pasting the first character.

The smart indentation is not always smart.

VERSION
2.74.4

AUTHOR
o was written by Alexander F. Rødseth <xyproto@archlinux.org>