Orbiton is a text editor and a simple IDE with the following leading principles:
- Minimal annoyance (within the limits of
VT100) - Not be configurable, to help users stay focused (with the exception of themes)
- Facilitate rapid edit-format-compile-run cycles
Orbiton might be a good fit for:
- Writing git commit messages (using
EDITOR=o git commit). - Editing
README.mdandTODO.mdfiles. - Writing Markdown and then exporting to HTML or PDF.
- Learning programming languages, like Rust or Zig.
- Editing files deep within larger Go or C++ projects.
- Solving Advent of Code tasks.
- Being placed on a live image for a Linux or BSD distro, since it is limited by VT100, is small and self-contained, has a built-in log, man page and image viewer, has an optional nano/pico mode, comes with a
visudoreplacement (osudo) and has built-in support for neatly formatting/etc/fstabfiles. - Writing any number of words in a distraction-free fullscreen environment (toggle the status bar by pressing
ctrl-gto see the word count).
Screenshots
Screenshot of the VTE GUI application (that can be found in the gtk3 directory), running the o editor:
Stepping through the assembly instructions of a Rust program by entering debug mode with the ctrl-o menu and then stepping with ctrl-n:
Editing a C source file in og using the "synthwave" theme:
There are also light themes available:
Writing commit messages:
!git
Packaging status
| orbiton |
|--------------------------------------------------------------------------------------------------------------------------------|
| |
Quick start
With Go 1.25 or later, the development version of o can be installed like this:
go install github.com/xyproto/orbiton/v2@latest && mv -i ~/go/bin/orbiton ~/go/bin/o
Adjust the mv flags and the ~/go/bin path as needed. Perhaps go install will have an -o flag in the future.
Alternatively, download and install a release version. For example, for Raspberry Pi 2, 3 or 4 running Linux:
curl -sL 'https://github.com/xyproto/orbiton/releases/download/v2.74.5/orbiton-2.74.5-linux_armv7_static.tar.xz' | tar JxC /tmp && sudo install -Dm755 /tmp/orbiton-2.74.5-linux_armv7_static/o /usr/bin/o && sudo install -Dm644 /tmp/orbiton-2.74.5-linux_armv7_static/o.1.gz /usr/share/man/man1/o.1.gz
Setting o as the default editor executable for git
To set:
git config --global core.editor o
To unset:
git config --global --unset core.editor
Viewing man pages
By setting the MANPAGER environment variable, it's possible to use o for viewing man pages:
export MANPAGER=o
An alternative to viewing man pages in o is to use less:
export MANPAGER='less -s -M +Gg'
Setting up o on OpenSUSE
Install o manually, until an OpenSUSE package exists:
git clone https://github.com/xyproto/orbiton cd orbiton make && sudo make install
The following is not strictly needed, but it sets everything up to make full use of o:
Add this to ~/.alias:
alias o=/usr/bin/o
Add this to ~/.profile:
export MANPAGER=/usr/bin/o export EDITOR=/usr/bin/o
Log out and in again to activate the changes.
Unique features
These features are unique to o, as far as I am aware:
- If the loaded file is read-only, all text will be red by default.
- Smart cursor movement, trying to maintain the X position when moving up and down, across short and long lines.
- Press
ctrl-vonce to paste one line, pressctrl-vagain to paste the rest. - When pasting lines copied out of a diff into source code, the leading
+andare removed. - Press
ctrl-conce to copy one line, pressctrl-cagain to copy a block of lines (until a blank line), pressctrl-cagain to copy the current function. - Jump to matching bracket with
ctrl-r, or open or close a portal. Toggle wrap when typing for prose withctrl-rpressed twice. When a portal is open, copy lines across files (or within the same file) withctrl-v. - Build code with
ctrl-spaceorctrl-band format code withctrl-w, for a wide range of programming languages. - Cycle git rebase keywords with
ctrl-worctrl-r, when an interactive git rebase session is in progress. - When opening a file with merge conflict markers, jump to the first marker. Press
ctrl-nto jump to the next one. - Jump to a line with
ctrl-l. Either enter a number to jump to a line or just pressreturn(ort) to jump to the top. Pressctrl-landreturnagain (orb) to jump to the bottom. Presscto jump to the center. - When jumping to a specific line in a file with
ctrl-l, jumping to a percentage (like50%) or a fraction (like0.5or.5) is also possible. It is also possible to jump to one of the highlighted letters. - If tab completion in the terminal went wrong and you are trying to open a
main.file that does not exist, butmain.cppandmain.odoes exists, thenmain.cppwill be opened. - Search by pressing
ctrl-f, entering text and pressingreturn. Replace by pressingtabinstead ofreturn, then enter the replacement text and pressreturn. Searching for unicode runes on the formu+0000is also supported. - Type
iferron a single line in a Go or Odin program and pressreturnto insert a suitableif err != nil { return ... }block, based on koron/iferr. - Use the built-in Markdown table editor by pressing
ctrl-twhen the cursor is on a table. This works best for tables that are not too wide. - Format Markdown tables by moving the cursor to a table and pressing
ctrl-w. - For C-like languages, missing parentheses are added to statements like
if,forandwhilewhen return is pressed. - Pressing
ctrl-ftwice searches for the word under the cursor. - Lines are highlighted only when the up and down arrow keys are used.
- The name of the function that the cursor is within, is shown in the upper right corner of the screen, for some programming languages.
Other features and limitations
- The syntax highlighting is instant.
- Opens files quickly.
- Can compile
"Hello, World"in many popular programming languages simply by pressingctrl-b. - Create, build and run a simple program in C, by running
o main.c, pressingctrl-wand then a doublectrl-b. - Configuration-free, for better and for worse.
- Can preview
.png,.jpg,.jpeg,.gif,.icoand.bmpimages directly in the terminal (using a scaled down version and up to 16 colors). - The
-pflag followed by a filename can be used for just pasting the clipboard to a new file, instead of editing a file. ctrl-tcan jump between a C++ header and source file, when editing C++ code.ctrl-tshows the Markdown table editor, when editing Markdown and the cursor is on a Markdown table.- Can only edit one file at the time, by design.
- Provides syntax highlighting for Go, Rust, C++, Markdown, Bash and several other languages. There is generic syntax highlighting built-in.
- Will jump to the last visited line when opening a recent file.
- Is provided as a single self-contained executable.
- Loads faster than both
vimandemacs, for small files. - Can render text to PDF either by itself or by using
pandoc. - Tested with
alacritty,konsole,st,urxvt,xfce4-terminal,xtermandzutty. - Tested on Arch Linux, Debian, OpenSUSE, macOS, FreeBSD and OpenBSD.
- Never asks before saving or quitting. Be careful.
- The
NO_COLORenvironment variable can be set to disable all colors. - Rainbow parentheses makes lines with many parentheses easier to read.
- When limited to vt100 or vt220, hotkeys like
ctrl-aandctrl-emay need to be used instead ofHomeandEnd. And for browsing up and down,ctrl-nandctrl-pmay be used. - Will strip trailing whitespace whenever it can.
- Usually expects to be given a filename at start.
- Has smart indentation.
- Requires that
/dev/ttyis available. xclipfor X,wl-clipboardfor Wayland orpbcopyfor macOS needs to be installed to access the system clipboard.- May take a line number as the second argument, with an optional
+or:prefix. - If the filename is
COMMIT_EDITMSG, the look and feel will be adjusted for git commit messages. - Supports
UTF-8. (Requires a terminal emulator that supports unicode to be able to display unicode runes, though). - Only UNIX-style line endings are supported (
\n). - Will convert DOS/Windows line endings (
\r\n) to UNIX line endings (just\n), whenever possible. - Will replace non-breaking space (
0xc2 0xa0) with a regular space (0x20) whenever possible. - Will replace annoying tilde (
0xcc 0x88) with a regular tilde (~) whenever possible. - Will replace the greek question mark that looks like a semicolon (
0xcd 0xbe) with a regular semicolon (;) whenever possible. - If interactive rebase is launched with
git rebase -i, then eitherctrl-worctrl-rwill cycle the keywords for the current line (fixup,drop,editetc). - Want to quickly convert Markdown to HTML? Try
o filename.md, pressctrl-btwice and quit withctrl-q. - The default syntax highlighting theme aims to be as pretty as possible with less than 16 colors, but it mainly aims for clarity. It should be easy to spot a keyword, number, string or a stray parenthesis.
- Press
ctrl-torctrl-spaceto toggle the check mark in- [ ] TODO itemboxes in Markdown. - Can load, edit and save gzipped text files or man pages that ends with a
.gzextension. - Can organize imports, for Java and for Kotlin, when formatting code with
ctrl-w. - Has a built-in spellchecker (press
ctrl-fand thentto search for a typo,ctrl-nfor next match and thenctrl-ato add it andctrl-ito ignore it). - Can jump directly to a selection of highlighted letters on the screen, when
ctrl-lis pressed. - Comes with a file browser that can open, rename and delete files.
- Comes with a build tool that can auto-detect the required build flags for C and C++ (
o -b). - Has LSP support for Tab completion, for several programming languages.
Known issues
- For some terminal emulators, if
ois busy performing an operation, pressingctrl-smay lock the terminal. Some terminal emulators, likekonsole, can be configured to turn off this behavior. Pressctrl-qto unlock the terminal again (together with the unfortunate risk of quittingo). To sidestep this issue, thectrl-omenu can be used instead, for saving and quitting. - The Markdown table editor does not have scrolling, so the table must fit within the current terminal emulator width and height. Resize the terminal as needed.
Hotkeys
There are pretty few hotkeys to remember:
ctrl-s- Save.ctrl-q- Quit.ctrl-a- Go to start of text, then start of line and then to the previous line.ctrl-e- Go to end of line and then to the next linectrl-n- Scroll down 10 lines, or go to the next match if a search is active.
ctrl-p- Scroll up 10 lines, or go to the previous match if a search is active.
ctrl-k- Delete characters to the end of the line, then delete the line.ctrl-_- Insert a symbol by typing in a 2-letter digraph. Try the--digraphsor-sflag to list all possible digraphs.ctrl-d- Delete a single character.ctrl-t- For C and C++: jump between the current header and source file. For Agda and Ivy, insert a symbol.
Esc to clear the current macro.
ctrl-o- Open a command menu with actions that can be performed.ctrl-x- Cut the current line. Double press to cut a block of text (to the next blank line). Press thrice to cut the current function.ctrl-c- Copy one line. Double press to copy a block of text. Press thrice to copy the current function.ctrl-v- Paste one trimmed line. Double press to paste multiple untrimmed lines.ctrl-b- Build program, render to PDF or export to man page. Double press to also run.
**) when started directly in book mode.
ctrl-space- Build program, render to PDF or export to man page. Double press to also run.
ctrl-j- Join the current line with the next one.ctrl-u- Undo (ctrl-zis also possible, but may background the application).ctrl-y- Redo.ctrl-l- Jump to a specific line number or percentage. Pressreturnto jump to the top. If at the top, pressreturnto jump to the bottom.
ctrl-f- Search for a string. The search wraps around and is case sensitive. Presstabinstead ofreturnto search and replace.
t, then press ctrl-n for the next word, ctrl-a to add it or ctrl-i to ignore it.
ctrl-i - Toggle italic () in book mode. Terminals that can not display italics, like the Linux console, show it unstyled.
ctrl-w- Format the current file (see the table below), or cycle git rebase keywords. For Markdown, format the table under the cursor.
F1- Show the overview of hotkeys (same asctrl-land then/).F2- Save (same asctrl-s).F3- Go to the next search match (same asctrl-n).F4- Launch the file browser, which is also available from thectrl-omenu.F5- Build or export (same asctrl-space). In debug mode: continue.F6- Toggle block editing mode, which is also available from thectrl-omenu.F7- Jump to the next typo.F8- In debug mode: step over (same asF10, which some terminals take for themselves).F9- In debug mode: toggle a breakpoint (same asctrl-b).F10- In debug mode: step over (same asctrl-o).F11- In debug mode: step out (same asctrl-f).F12- Go to a definition or include (same asctrl-g).
Fn, depending on the keyboard settings.
ctrl-g- Go to include or definition, go back or toggle the status bar.ctrl-r- Jump to matching bracket, otherwise open or close a portal. Double press to toggle "wrap when typing".
ctrl-\- Comment in or out a block of code, or reflow the current paragraph when editing prose.ctrl-~- Insert the current date and time.esc- Go back after having gone to another location or file. Redraw everything and clear the last search.
Screen recordings for a few select programming languages
C
!Building, running and tab-completing C !Debugging C
Go
!Building, running and tab-completing Go !Debugging Go
C++
!Building, running and tab-completing C++
Rust
!Building, running and tab-completing Rust
Gleam
!Building, running and tab-completing Gleam
Zig
!Building, running and tab-completing Zig
Odin
!Building, running and tab-completing Odin
Python
!Building, running and tab-completing Python
Haskell
!Building, running and tab-completing Haskell
Bash
!Running and tab-completing Bash
Build and format
- Press
ctrl-bto build or export the current file. - Press
ctrl-wto format the current file, in an opinionated way. If the current file is empty, a "Hello, World!" template will be inserted, for some file extensions. - If a build or export returns an error code and the status message is not specific enough, the last called command can be run from the command line with
$(o -l), to get more details.o -lcan be used to preview the command.
.abc | WIP | abc2midi $filename | N/A |
| Ada | .adb, .gpr, .ads, .ada | WIP | WIP | WIP |
| Agda | .agda | Yes | agda -c $filename | N/A |
| ALGOL 68 | .a68 | WIP | a68g --compile $filename | WIP |
| Assembly | .asm, .s, .S, .inc, .mac | Yes | yasm -f elf64 -o $output.o $filename | N/A |
| C | .c | Yes | gcc $filename -o $output | clang-format -fallback-style=WebKit -style=file -i -- $filename |
| C++ | .cpp, .cc, .cxx, .h, .hpp, .h++, .c++ | Yes | g++ $filename -o $output | clang-format -fallback-style=WebKit -style=file -i -- $filename |
| C# | .cs | Yes | csc $filename | astyle --mode=cs $filename |
| C3 | .c3 | Yes | c3c compile -o $output $filename | c3fmt --rewrite $filename |
| Clojure | .clj, .cljs, .clojure | WIP | lein compile $filename | WIP |
| COBOL | .cb, .cbl, .cob, .cby, .cobol | WIP | cobc -x -o $output $filename | N/A |
| Crystal | .cr | Yes | crystal build $filename --release | crystal tool format $filename |
| CSS | .css | WIP | No | prettier --tab-width 2 -w $filename |
| D | .d | Yes | dmd $filename -of$output | WIP |
| Dart | .dart | Yes | dart compile exe --output $output $filename | dart format $filename |
| Erlang | .erl | Yes | erlc $filename | WIP |
| Fortran77, Fortran90 | .f, .f90 | Yes | gfortran -o $output $filename | WIP |
| Garnet | .gt | WIP | garnetc -o $output $filename | WIP |
| GLSL | .glsl | WIP | glslangValidator -V -o $output $filename | WIP |
| Gleam | .gleam | Yes | gleam build | gleam format $filename |
| Go | .go | Yes | go build $filename | goimports -w $filename |
| Hare | .ha | Yes | hare build $filename | N/A |
| Haskell | .hs, .hts, .cabal | Yes | ghc -dynamic $filename | ormolu --mode=inplace $filename |
| HTML | .htm, .html | WIP | No | tidy -m $filename |
| Inko | .inko | WIP | inko build $filename | N/A |
| Ivy | .ivy | WIP | WIP | N/A |
| Java | .java | Yes | javac + jar, see details below | google-java-format -a -i $filename |
| JavaScript | .js, .jsx | WIP | No | prettier --tab-width 4 -w $filename |
| Jakt | .jakt | WIP | jakt $filename | WIP |
| Just | justfile, .just, .justfile | No | No | just --unstable --fmt -f $filename |
| Koka | .kk | WIP | koka -o $output $filename | N/A |
| Kotlin | .kt, .kts | Yes | kotlinc $filename -include-runtime -d $output.jar | ktlint -F $filename |
| Kotlin Native | .kt, .kts | Yes | kotlinc-native -nowarn -opt -Xallocator=mimalloc -produce program -linker-option --as-needed $filename -o $output | ktlint -F $filename |
| Lilypond | .ly | WIP | lilypond -o $output $filename (exports to PDF) | N/A |
| Lua | .lua | Yes | luac -o $output.luac $filename | stylua $filename |
| Markdown | .md | WIP | No | prettier --write $filename |
| Nim | .nim | WIP | nim c -o:$output $filename | WIP |
| Objective-C | .m | Yes | clang $filename -o $output | clang-format -fallback-style=WebKit -style=file -i -- $filename |
| Odin | .odin | Yes | odin build $filename | odinfmt -w $filename |
| Objective Pascal | .pas, .pp, .lpr | Yes | fpc $filename | WIP |
| OCaml | .ml | WIP | No | ocamlformat $filename |
| Perl | .pl, .perl | Yes | perl $filename | /usr/bin/vendor_perl/perltidy -se -b -i=2 -ole=unix -bt=2 -pt=2 -sbt=2 -ce $filename |
| PHP | .php, .php3, .php4, .php5, .phtml | WIP | No | php-cs-fixer fix $filename |
| Python | .py | Yes | python -m py_compile $filename | ruff format $filename |
| Ruby | .rb | No | ruby -c $filename | rubocop --autocorrect $filename |
| Rust (with Cargo.toml) | .rs | Yes | cargo build | rustfmt $filename |
| Rust | .rs | Yes | rustc $filename | rustfmt $filename |
| Scala | .scala | Yes | scalac $filename && jar cfe $output MainClass *.class | scalafmt $filename |
| Scheme | .scm, .rkt, .ss, .sch, .sld, .sls | WIP | guile -s $filename | N/A |
| Shell | .sh, PKGBUILD, APKBUILD | WIP | makepkg | shfmt -s -w -i 2 -bn -ci -sr -kp $filename |
| Standard ML | .sml, .fun, .cm | Yes | mlton $filename | WIP |
| Swift | .swift | WIP | WIP | WIP |
| TypeScript | .ts | WIP | No | prettier --tab-width 4 -w $filename |
| V | .v | Yes | v build $filename | v fmt $filename |
| XML | .xml | WIP | No | tidy -w 80 -q -i -utf8 --show-errors 0 --show-warnings no --tidy-mark no -xml -m $filename |
| Zig | .zig, .zir | Yes | zig build-exe $filename | zig fmt $filename |
/etc/fstab, JSON and HTML files are also supported, and can be formatted with ctrl-w.
owill try to jump to the location where the error is and otherwise displaySuccess.- For regular text files,
ctrl-wwill reflow the text to a length of 99. - If
kotlinc-nativeis not available, this build command will be used instead:kotlinc $filename -include-runtime -d $name.jar
.adoc | asciidoctor -b manpage (writes to out.1) |
| Lilypond | .ly | lilypond -o $output $filename (writes to $output.pdf) |
| scdoc | .scd, .scdoc | scdoc (writes to out.1) |
| Markdown | .md | pandoc -N --toc -V geometry:a4paper (writes to $filename.pdf) |
Debug support for C and C++
This is a brand new feature and needs more testing.
- If
gdbis installed, it's possible to select "Debug mode" from thectrl-omenu and then build and step through a program withctrl-b, or set a breakpoint withctrl-band continue withctrl-b. - Messages printed to stdout are displayed as a status message when that line is reached.
- An indication of which line the program is at has not yet been added, and is a work in progress.
- There are status messages indicating when the debug session is started and ended.
LSP support
There is Tab-completion support for Go (gopls), Rust (rust-analyzer), C and C++ (clangd), Python (pyright-langserver or pylsp), Zig (zls), Odin (ols), Haskell (haskell-language-server-wrapper), Gleam (gleam lsp), Lua (lua-language-server), Ruby (ruby-lsp) and Bash (bash-language-server).
Markdown table editor
While in the Markdown table editor:
- Cells can be typed into.
- The arrow keys can be used to move around.
tabcan be used to go to the next cell, or insert new cells if the last cell is reached.returncan be used to either jump to the blank cell below or to insert a new row below.backspacecan be used to delete letters, but also for deleting the current row if it is empty.ctrl-ncan be used to insert a new column to the right.ctrl-dcan be used to delete the current column (if all cells in the column are empty).escorctrl-tcan be used to close the Markdown table editor.ctrl-scan be used to save.
Themes
Themes can be selected with the ctrl-o menu. The theme menu also lists the theme names, which can be specified in the O_THEME environment variable.
The O_THEME environment variable is an exception to the claim that o is configuration-free, but it is completely optional.
For using ie. the Synthwave theme, the /usr/bin/sw symlink to /usr/bin/o can be used, or this can be added to ~/.profile:
export O_THEME=synthwave
It is also possibly to specify any base16 theme, like ie. this:
export O_THEME=/usr/share/base16/monokai.yaml
Inserting a symbol
- To insert a symbol, like
æ, just pressctrl-_and type inae. To insertµ, type inMy. - These are the same digraphs as ViM uses.
- For a full overview of digraphs, see digraphs.txt.
Manual installation on Linux
git clone https://github.com/xyproto/orbiton cd orbiton make && sudo make install
And optionally:
make gui && sudo make gui-install
It is also possible to install the symlinks that are suggested further down in this document.
OpenBSD installation instructions
Install dependencies (use doas if needed):
add_pkg git gmake go vte3
Build both the editor o and the GUI frontend og:
gmake CXX="clang++ -w" o og
Install both executables, a man page, an icon and a desktop shortcut file (use doas if needed):
PREFIX=/usr/local gmake install og-install
Just building and installing o also works:
gmake doas gmake install
It is also possible to install the symlinks that are suggested further down in this document.
Dependencies
C
- For building code with ctrl-b
,gccmust be installed. - For formatting code with ctrl-w
,clang-formatmust be installed. - For tab completion, clangd
must be installed.
- For building code with ctrl-b
,gcc/clang/cmake/make/ninjashould be installed. - For formatting code with ctrl-w
,clang-formatmust be installed. - For tab completion, clangd
must be installed.
- For building code with ctrl-b
, Thegocompiler must be installed. - For formatting code with ctrl-w
,goimportsmust be installed. - For tab completion, gopls
must be installed.
- For building and formatting Zig code, only the zig
command is needed. - For tab completion, zls
must be installed.
- For building and formatting V code, only the v
command is needed.
- For building code with ctrl-b
,odinmust be installed. - For formatting code with ctrl-w
,odinfmtmust be installed. - For tab completion, ols
must be installed.
- For building code with ctrl-b
,gleammust be installed. - For tab completion, gleam lsp
is used.
- For building code with ctrl-b
,luacmust be installed. - For formatting code with ctrl-w
,styluamust be installed. - For tab completion, lua-language-server
must be installed.
- For formatting code with ctrl-w
,rubocopmust be installed. - For tab completion, ruby-lsp
must be installed.
- For tab completion, bash-language-server
must be installed.
- For building code with ctrl-b
,Cargo.tomlmust exist andcargomust be installed. - For formatting code with ctrl-w
,rustfmtmust be installed. - For tab completion, rust-analyzer
must be installed.
- For building the current file with ctrl-b
, theghccompiler must be installed. - For formatting code with ctrl-w
,ormolumust be installed. - For tab completion, haskell-language-server-wrapper
must be installed.
- ctrl-b
only checks the syntax, without executing. This only requirespythonto be available. - For formatting the code with ctrl-w
,ruffmust be installed. - For tab completion, pyright-langserver
orpylspmust be installed.
- For building and formatting Crystal code, only the crystal
command is needed.
- For building code with ctrl-b
,kotlincmust be installed. A.jarfile is created if the compilation succeeded. - For formatting code with ctrl-w
,ktlintmust be installed.
- For building code with ctrl-b
,javacandjarmust be installed. A.jarfile is created if the compilation succeeded. - For formatting code with ctrl-w
,google-java-formatmust be installed.
- For building code with ctrl-b
,scalacandjarmust be installed. A.jarfile is created if the compilation succeeded. - The jar file can be executed with java -jar main.jar
. Usescalac -d main.jar MyFile.scalaif you want to produce a jar that can be executed withscala main.jar. - For formatting code with ctrl-w
,scalafmtmust be installed.
- For building code with ctrl-b
,gdcmust be available.
- The JSON formatter is built-in. Note that for some files it may reorganize items in an undesirable order, so don't save the file if the result is unexpected.
- Formatting fstab
files (usually/etc/fstab) is a built-in feature. Just pressctrl-w. If you need a standalone utility,fstabfmtis available.
- For formatting JavaScript code with , prettier
must be installed.
Filebrowser
- For ctrl-g
in the filebrowser,lazygitis needed. - For ctrl-t
in the filebrowser,tigis needed.
Java
Since kotlinc $filename -include-runtime -d builds to a .jar, I though I should do the same for Java. The idea is to easily compile a single or a small collection of .java files, where one of the files has a main function.
If you know about an easier way to build a .jar file from *.java, without using something like gradle, please let me know by submitting a pull request. This is pretty verbose...
javaFiles=$(find . -type f -name '*.java')
for f in $javaFiles; do
grep -q 'static void main' "$f" && mainJavaFile="$f"
done
className=$(grep -oP '(?<=class )[A-Z]+[a-z,A-Z,0-9]*' "$mainJavaFile" | head -1)
packageName=$(grep -oP '(?<=package )[a-z,A-Z,0-9,.]*' "$mainJavaFile" | head -1)
if [[ $packageName != "" ]]; then
packageName="$packageName."
fi
mkdir -p _o_build/META-INF
javac -d _o_build $javaFiles
cd _o_build
echo "Main-Class: $packageName$className" > META-INF/MANIFEST.MF
classFiles=$(find . -type f -name '*.class')
jar cmf META-INF/MANIFEST.MF ../main.jar $classFiles
cd ..
rm -rf _o_build
Scala
For Scala, this is the code that is used to produce a main.jar file that can be run directly with java -jar main.jar:
#!/bin/sh
scalaFiles=$(find . -type f -name '*.scala')
for f in $scalaFiles; do
grep -q 'def main' "$f" && mainScalaFile="$f"
grep -q ' extends App ' "$f" && mainScalaFile="$f"
done
objectName=$(grep -oP '(?<=object )[A-Z]+[a-z,A-Z,0-9]*' "$mainScalaFile" | head -1);
packageName=$(grep -oP '(?<=package )[a-z,A-Z,0-9,.]*' "$mainScalaFile" | head -1);
if [[ $packageName != "" ]]; then
packageName="$packageName."
fi
mkdir -p _o_build/META-INF
scalac -d _o_build $scalaFiles
cd _o_build
echo -e "Main-Class: $packageName$objectName\nClass-Path: /usr/share/scala/lib/scala-library.jar" > META-INF/MANIFEST.MF
classFiles=$(find . -type f -name '*.class')
jar cmf META-INF/MANIFEST.MF ../main.jar $classFiles
cd ..
rm -rf _o_build
- If /usr/share/scala/lib/scala-library.jar
is not foundscalac -d run_with_scala.jaris used instead. - If scala-library.jar
was not found, then the resultingjarfile will needscalato run.
Agda
ctrl-t brings up a menu with a selection of special symbols.
There are also these shortcuts:
* Insert ⊤ by pressing ctrl-t and then t.
* Insert ℕ by pressing ctrl-t and then n.
Updating PKGBUILD files
When editing PKGBUILD files, it is possible to press ctrl-o and select Call Guessica to update the pkgver= and source= fields, by a combination of guesswork and online searching. This functionality depends on the Guessica package update utility being installed, and will only work for some PKGBUILD files.
List of optional runtime dependencies
- a68g
- for compiling ALGOL 68 code - agda
- for compiling Agda code - asciidoctor
- for writing man pages - astyle
- for formatting C# code - bash-language-server
- for tab completion for Bash - cargo
- for compiling Rust - clang
- for formatting C++ code withclang-format - clangd
- for tab completion for C and C++ - clojure
- for compiling Clojure - crystal
- for compiling Crystal - fpc
- for compiling Object Pascal - g++
- for compiling C++ code - gdc
- for compiling D code - ghc
- for compiling Haskell code - gleam
- for compiling Gleam code and for tab completion - go
- for compiling Go code - go-tools
- for formatting Go code and handling imports withgoimports - google-java-format
- for formatting Java code - gopls
- for tab completion for Go - haskell-language-server-wrapper
- for tab completion for Haskell - jad
- decompile.classfiles on the fly when opening them witho - java-environment
- for compiling Java code and creating.jarfiles withjavacandjar - kotlin
- for compiling Kotlin - ktlint
- for formatting Kotlin code - lua
- for compiling Lua to bytecode - lua-language-server
- for tab completion for Lua - mlton
- for compiling Standard ML - mono
- for compiling C# code - ocaml
- for compiling and formatting OCaml code - odin
- for compiling Odin - odinfmt
- for formatting Odin code - ols
- for tab completion for Odin - ormolu
- for formatting Haskell code - pandoc
- for exporting Markdown to PDF - php-cs-fixer
- for formatting PHP code - prettier
- for formatting JavaScript, TypeScript and CSS - pyright-langserver
- for tab completion for Python (orpylsp) - python
- for compiling Python to bytecode - ruby-lsp
- for tab completion for Ruby - rust-analyzer
- for tab completion for Rust - rustc
- for compiling Rust - ruff
- for formatting Python code - rustfmt
- for formatting Rust - scala
- for compiling Scala - sdoc
- for writing man pages - stylua
- for formatting Lua code - tidy
- for formatting XML - v
- for compiling and formatting V code - zig
- for compiling and formatting Zig code - zls
- for tab completion for Zig
Size
- The o
executable is 1.5M when built with GCC 12 (for 64-bit Linux) and compressed withupx. - This isn't as small as e3, an editor written in assembly (which is 234k), but it's reasonably lean.
and upx (in the v2 directory):
go build -mod=vendor -gccgoflags '-Os -s' -o o && upx --best --lzma o
If the
o executable is built with go instead, the size can be 8.7M, or just 2.8M when packed with upx:
go build -mod=vendor -ldflags='-s -w' -trimpath -o o && upx --best --lzma o
Jumping to a specific line when opening a file
These four ways of opening
file.txt at line 7 are supported:
o file.txt 7
o file.txt +7
o file.txt:7
o file.txt+7`
This also means
... (README truncated for length)