o is a small and fast text editor that is limited to the VT100 standard.
It's a good fit for writing git commit messages, using EDITOR=o git commit.
For a more feature complete editor that is also written in Go, check out micro.
You can install o with Go 1.10 or later:
go get -u github.com/xyproto/o
- Loads up instantly.
- Small executable size (around 500k, when built with
gccgoand then stripped). - Provides syntax highlighting for Go, C++ and Bash.
- Configuration-free, for better and for worse.
- Is limited to the VT100 standard, so hotkeys like
ctrl-aandctrl-emust be used instead ofHomeandEnd. - Compiles with either
goorgccgo. - Tested with
st,urxvtandxfce4-terminal. - Tested on Arch Linux and FreeBSD.
- Loads faster than both
vimandemacs. - Never asks before saving or quitting. Be careful!
- Can format Go or C++ code, just press
ctrl-space. This uses eithergoimports(go get golang.org/x/tools/cmd/goimports) orclang-format. - Will strip trailing whitespace whenever it can.
- Must be given a filename at start.
- Smart indentation.
- Requires
/dev/ttyto be available. - Copy, cut and paste is only for one line at a time.
xclipmust be installed if the system clipboard is to be used. - May take a line number as the second argument, with an optional
+prefix. - The text will be red if a loaded file is read-only.
- The terminal needs to be resized to show the second half of lines that are longer than the terminal width.
- If the filename is
COMMIT_EDITMSG, the look and feel will be adjusted for git commit messages. - Supports
UTF-8. - Respects the
NO_COLORenvironment variable. - Can render text to PDF.
- Only UNIX-style line endings are supported (
\n).
- Files with lines longer than the terminal width are not handled gracefully.
When loading large files, an animated spinner will appear. The loading operation can be stopped at any time by pressing esc, q or ctrl-q.
ctrl-q- Quitctrl-s- Savectrl-o- Format the current file usinggoimportorclang-format, depending on the file extension.ctrl-a- Go to start of line, then start of text on the same line, then the previous paragraph.ctrl-e- Go to end of line, then next paragraph.ctrl-p- Scroll up 10 linesctrl-n- Scroll down 10 lines, or go to the next match if a search is activectrl-k- Delete characters to the end of the line, then delete the linectrl-g- Toggle a status line at the bottom for displaying: filename, line, column, unicode number and word countctrl-d- Delete a single characterctrl-t- Toggle syntax highlightingctrl-w- Toggle between "text" and "draw mode" (for ASCII graphics)ctrl-x- Cut the current linectrl-c- Copy the current linectrl-v- Paste the current linectrl-b- Bookmark the current linectrl-j- Jump to the bookmarkctrl-u- Undo (ctrl-zis also possible, but may background the application)ctrl-l- Jump to a specific line numberctrl-f- Search for a string.esc- Redraw the screen and clear the last search.ctrl-space- Build Go or C++ files, word-wrap other files.ctrl-\- Toggle single-line commentsctrl-r- Render to a PDF document.
-
The
oexecutable is only 541k when built with GCC 9.2 (for 64-bit Linux). -
This isn't as small as e3, an editor written in assembly (which is 234k), but it's resonably lean.
go build -gccgoflags '-Os -s'
It's around 3M when building with Go 1.13 and no particular build flags are given, which is also reasonable.
These four ways of opening file.txt at line 7 are supported:
o file.txt 7o file.txt +7o file.txt:7o file.txt+7
This also means that filenames containing + or : are not supported, if followed by a number. Opening files with the c++ extension works, if you should want that.
If the very first keypress after starting o is O, G or /, it will trigger the following vi-compatible behavior:
O- if followed by an uppercase letter, ignore the initialO/- enter search-mode (same as when pressingctrl-f)G- go to the end of the file
The reason for adding these is to make using o easier to use for long-time vi/vim/neovim users.
- Version: 2.13.2
- License: 3-clause BSD
- Author: Alexander F. Rødseth <xyproto@archlinux.org>
