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-ony.

-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.

-r or --clear-locks
    Clear all file locks.

-o or --ollama
    Use Ollama for tab completion with the model specified in the ORBITON_OLLAMA environment variable. This requires that Ollama is up and running, either locally or at the host specified in the OLLAMA_HOST environment variable.

-b or --bat
    List the file with syntax highlighting using the bat command, if installed.

-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 --format
    Format the given file instead of opening it for editing.

-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 goimport or clang-format, depending on the file extension.
  Zig, V, Rust (rustfmt), Haskell (brittany) and Python (autopep8) 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.

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. 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.

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

ctrl-g
  Jump to definition, for some programming languages (experimental feature) 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
  Jump back after jumping to a definition with `ctrl-g`.
  Bookmark the current line. Press again to remove the bookmark.
  If a bookmark is set, and not on the bookmarked line, jump to the bookmark.
  Toggle the breakpoint if the editor is in debug mode.

ctrl-j
  Join lines.

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

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 fP to find the previous function signature.

esc
  Redraw the screen and clear the last search.

ctrl-space
  Build Go programs with `go`.
  Build C++ programs with `cxx`.
  Build Rust programs with `cargo` or `rustc`.
  Build Zig programs with `zig`.
  Build Haskell programs with `ghc`.
  Check Python programs with `python -m py_compile`.
  Build Crystal programs with `crystal`.
  Build Kotlin programs with `kotlinc`,
    or `kotlinc-native` if available.
  Build Java programs with `javac` and `jar`.
  Build Scala programs with `scalac`.
  Build Lua programs with `luac`.
  Build Object Pascal programs with `fpc`.
  Build Nim programs with `nim`.
  Build Odin programs with `odin`.
  Build V programs with `v`.
  Build C# programs with `csc -nollogo -unsafe`.
  Build D programs with `gdc`.
  Build Standard ML programs with `mlton`.
  Build OCaml programs with `ocamlopt`.
  Export scdoc files to man using `scdoc`.
  Export asciidoctor files to man using `asciidoctor`.
  Build Arch Linux packages with `makepkg`.
  Build Agda programs with `agda`.
  Double press to render Markdown to HTML.

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

ctrl-~
  Jump to a matching parenthesis, curly bracket or square bracket.

  `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-_
  If the cursor is on a parenthesis, jump to the matching parenthesis.
  If not, 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
  Open or close a portal. Text can be pasted from the portal into another file with `ctrl-v`.
  For "git interactive rebase" mode, cycle the rebase keywords.

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 tab 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.68.5

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