Skip to content

mithraeums/hako-edit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hake — a quiet box around the cursor

A minimalistic modal text environment, containing your code without distraction.

v0.1.6 GPL-3.0 C99 single file 18 themes 40+ languages

site  ·  releases  ·  hako-code  ·  org


hake — splash, syntax, theme picker, help popup

Kami explorer
箱 Kami: file explorer
Rei AI pane
箱 Rei AI (powered by hako-code)
Split panes
Multi-pane splits · resize with Ctrl-W
Launch splash
Launch splash · mithraeum theme

Rei lives inside hake; powered by hako-code:

 ▄█████▄
██ ███ ██ Rei: v1.1
█████████ Provider: You Choose
▀█▀▀█▀▀█▀ Model: You Choose

—— I ——

Overview

  • Modal Editing: Vim-inspired normal, insert, visual, and visual-line modes
  • Full Motion Set: counts, named registers, text objects (diw, ci", da(), marks, jumplist, dot-repeat, :s/ substitution, bracket match
  • Multi-Pane Support: Split horizontally and vertically, resize with Ctrl-W +/-/</>
  • File Explorer: 箱 Kami - directory navigation, hidden-file toggle, dirs-first sort
  • AI Assistant: 箱 Rei - powered by hako-code in a split pane. Local hako models (hako-sho 3B / hako-koi 7B) or any of its 13 cloud providers, function-calling tool loop, SSE streaming, per-project trust and history
  • Skills: drop ~/.hako/skills/*.md into the system prompt, install from any URL with /skill install
  • Syntax Highlighting: 40+ languages, search-match highlighting persists across edits
  • Undo/Redo: time-bounded undo blocks, configurable depth
  • Visual Selection: character and line modes with yank/delete/change, count feedback
  • Clipboard: bracketed paste, system clipboard via Ctrl-C/Ctrl-V
  • Fast Search: incremental with n/N, all matches highlighted
  • Runner: :build / :test / :run stream into a bottom pane while you edit; ]e/[e jump to file:line errors; a hands the error to Rei. :!<cmd> for quick one-shots
  • Line Numbers: absolute or relative, dynamic width
  • Mouse Support: click to position, scroll wheel moves cursor
  • 18 Themes: mithraeum, dark, light, gruvbox, nord, dracula, monokai, solarized, tokyonight, catppuccin, onedark, material, everforest, rosepine, github-dark, github-light, ayu, kanagawa — live-preview picker via :theme
  • Customizable: every setting in .hakorc, model/provider choices persist in ~/.hako/state

—— II ——

Build

# One-liner - works on Linux, macOS, Windows (mingw)
gcc hake.c -o hake -lpthread

# Or use the Makefile to also embed the executable icon where the OS allows
make

# Build flavors
make BUNDLE_HAKO=1   # default — also builds the hako agent next to hake
make BUNDLE_HAKO=0   # editor only; :install-agent fetches the agent later
make NO_AGENT=1      # editor with no agent path at all (Rei pane stays inert)

Run

./hake              # or  ./hake [filename]

Install (drop the binary into your PATH):

cp hake /usr/local/bin/hake          # Linux / macOS

Deps: C standard library + POSIX/Win32 system headers + pthread. No third-party libraries linked. AI features shell out to curl(1) at runtime.

Install

# Curl one-liner (Linux / macOS / Windows-MinGW)
curl -fsSL https://raw.githubusercontent.com/mithraeums/hako-edit/main/install.sh | sh

Verifies sha256, installs to /usr/local/bin if writable else ~/.local/bin. macOS quarantine xattr stripped post-install. Set VERIFY=0 to skip sha verify, PREFIX=/opt to relocate.

Executable icon

The icon files live in icon/:

Platform File What make does
Windows hake.ico Embeds icon into .exe via windres; real OS icon.
macOS hake.icns Attaches icon as a resource fork via Rez+SetFile (Xcode CLT). Best-effort.
Linux hake.png ELF can't embed icons; ship hake.png and reference it from a .desktop file.

A plain gcc hake.c -o hake produces a working binary on every platform; the icon is purely cosmetic.

iSh (iOS - experimental)

hake compiles on Alpine via iSh:

apk add gcc make musl-dev curl
make

Notes:

  • AI panel needs curl for HTTPS requests; apk add curl is required before using Rei.
  • Narrow screens auto-stack the AI panel below the editor instead of squeezing horizontally.
  • iSh runs single-threaded under emulation; expect slower stream rendering.

—— III ——

Key Bindings & Commands

Normal Mode

Key Action
i Enter insert mode
I Insert at first non-blank
a Append after cursor
A Append at end of line
o Open line below
O Open line above
v Visual mode (character)
V Visual mode (line)
h,j,k,l Navigate (←↓↑→)
w,b Next/previous word
0,$ Start/end of line
gg,G Top/bottom of file
dd Delete line (yanks)
D Delete to end of line
x Delete character
C Change to end of line
yy Yank (copy) line
p,P Paste after/before
u Undo
Ctrl-R Redo
r Replace character
J Join lines
/ Search
n,N Next/previous match
Ctrl-C Copy to system clipboard
Ctrl-V Paste from system clipboard
:w Save
:e <file|dir> Open file, or explorer at a directory (:e ..)
:q Quit
:wq Save and quit
Ctrl-F Page forward
Ctrl-B Page backward
]e,[e Next/previous runner error
:!<cmd> Run shell command (popup)
:run <cmd> Run in the runner pane (async)
:build,:test Run build_cmd / test_cmd from .hakorc

Visual Mode

Key Action
h,j,k,l Extend selection
w,b Word-wise selection
0,$ Select to start/end
gg,G Select to top/bottom
Ctrl-F Page forward selection
Ctrl-B Page backward selection
y Yank selection
d,x Delete selection
c Change selection
Ctrl-C Copy to system clipboard
Esc Exit visual mode

Window Management

Key Action
Ctrl-W s Split horizontal
Ctrl-W v Split vertical
Ctrl-W w Switch pane
Ctrl-W c Close pane

File Explorer (箱 Kami)

Key Action
:e,:explorer Toggle explorer
j,k Navigate files
h,l Parent/open
g,G Top/bottom of list
. Toggle hidden files
r Refresh
q,Esc Close explorer

Runner (bottom pane)

:build, :test, :run <cmd> stream a command's output into a bottom pane while you keep editing. Lines that look like file:line[:col] are highlighted and jumpable — the compile/fix loop without leaving the editor.

Key Action
j,k Select line
Enter Jump to file:line[:col] under selection
],[ Next / previous error line
a Ask the agent to fix the selected error
r Rerun
q Stop if running, close otherwise

AI Assistant (箱 Rei)

Key Action
:ai Toggle AI panel
i Enter prompt mode
Enter In INSERT: newline. In NORMAL: send
Esc Back to NORMAL
v Visual select (copy-only in history)
j,k Navigate history
Ctrl-W w Switch pane
Ctrl-C Close panel
:q Close panel

Pane commands (editor-owned — the : line, not sent to the agent)

Command Action
:auto / :noauto Skip / restore per-tool permission prompts for the session
:install-agent Install the hako agent in place when none is found, then connect
:update-agent Self-update the agent (hako --update) and relaunch it
:clear Wipe visible history · :w saves the chat to ai_chat.txt

When the agent asks to write a file or run a command, the pane prompts inline — ● write_file foo.c then [y] once [n] no [a] always. :auto skips the prompts.

Slash commands (inside prompt — forwarded to the agent):

Command Action
/help List commands
/provider <name> ollama, anthropic, openai, deepseek, mistral, together, fireworks, openrouter, groq, xai (auto-fills endpoint)
/model <id> Switch model (persists to ~/.hako/state)
/tools on / off Toggle function calling
/trust / /trust revoke Grant or revoke file-ops in this project
/skills [reload] List / reload ~/.hako/skills/*.md
/skill install <url> Download a skill into ~/.hako/skills/
/history local / global Show path, or move to <cwd>/.hako/history
/file <path> Inject a local file into context
/clear Wipe visible history
/usage Show provider/model/trust + token totals
/sessions List up to 16 prior sessions
/session [new] Show session info; new resets
/resume <id> Switch to prior session
/quit Close the panel

Tools (when trusted): read_file, list_dir, read_open_file, list_open_files, write_file (path constrained to project; staged when ai_autowrite=0), run_shell (project must be trusted).

Pane control (any focused pane): :q rei / :q kami (also :close <name>) closes the named side panel.

—— IV ——

Configuration

Use supplied config, or generate one with :config inside the editor. HAKE looks for .hakorc in the current directory first, then your home directory.

# Example .hakorc
tab_stop=4
use_tabs=1
show_line_numbers=2
auto_indent=1
smart_indent=1
mouse_enabled=1
theme=dark
explorer_width=30

# Runner pane
# build_cmd=make
# test_cmd=make test
# run_cmd=./a.out

# AI panel (Rei)
ai_provider=deepseek          # or anthropic | openai | ollama | mistral | ...
ai_api_key=sk-...             # not needed for ollama
ai_model=deepseek-chat
ai_max_tokens=2048
ai_tools_enabled=1
ai_stream=1
ai_autowrite=1                # 0 stages writes to <path>.hako-pending
# ai_endpoint=                # auto-set for known providers

Run :config to generate a fully documented .hakorc with all options.

—— V ——

Supported Languages

hake provides syntax color for 40+ languages, some of which include:

Systems: C, C++, Rust, Go, Zig, Assembly
Scripting: Python, Ruby, Perl, Lua, Shell, PHP
Web: JavaScript, TypeScript, HTML, CSS, JSON
JVM: Java, Kotlin, Scala, Clojure
Functional: Haskell, OCaml, F#, Elixir
Modern: Swift, Dart, Julia, Nim
Config: YAML, TOML, Dockerfile, Makefile

—— VI ——

Change Log

v0.1.6 (Latest)

A lean pass plus the compile loop: smaller, straighter code and a runner pane.

  • −1000 lines — comments stripped to structure, dead scaffolding deleted, duplicated logic folded into shared helpers, theme presets now a data table. Zero behavior change.
  • Runner pane:build / :test / :run <cmd> stream output live into a bottom pane; ]e/[e jump straight to file:line errors; a sends the selected error to the agent.
  • :!<cmd> — shell command output in a popup, vim-style.
  • Fixes — mithraeum status-bar contrast, visual selection is a real highlight box (syntax colors kept), the explorer can't clobber unsaved work (splits instead), :e <dir> opens the explorer, fast key bursts after Esc are no longer swallowed.

v0.1.5

Interface polish, an on-brand theme, a unified config — plus two crash fixes.

  • Popup menus:help, a bare :theme (live-preview picker), and :registers open scrollable popups (mouse + keyboard).
  • Mithraeum theme on-brand — matches the site palette; gold #b89656 is the primary UI accent (borders, splash, popups, status, line numbers).
  • One unified ~/.hakorc:config merges and preserves the agent's ai_* and other tools' keys; defaults theme=mithraeum.
  • Agent integration — in-pane tool-permission prompts ([y]/[n]/[a]), :install-agent / :update-agent, agent auto-respawn, and a no-agent build (make NO_AGENT=1).
  • Crash fixes — closing the Rei pane (Ctrl-C) no longer use-after-frees the agent reader thread; search no longer reads out of bounds at end of line.

Full history → CHANGELOG.md.

—— VII ——

Roadmap

  • Windows parity (pipe agent + runner pane)
  • Custom themes from .hakorc in the theme picker
  • Write-file diff preview with confirm
  • OpenAI/Ollama tool parity
  • Buffer list (:ls, :b)
  • :e tab completion

—— VIII ——

Contributing

If you share the belief that simplicity empowers creativity, feel free to contribute.

Contribution is welcome in the form of:

  • Forking this repo
  • Submitting a Pull Request
  • Bug reports and feature requests

Please ensure your code follows the existing style. I realize the single file is a personal choice, though if you choose to assist, I have divided the code.

Sections of codebase are as follows:

  1. Includes
  2. Defines
  3. Enums
  4. Struct Declarations
  5. Function Prototypes
  6. Syntax Highlighting
  7. Terminal
  8. Buffer
  9. Helpers
  10. Color
  11. Clipboard
  12. Pane Management
  13. Row Operations
  14. Editor Operations
  15. Cursor Movement
  16. Scrolling
  17. Visual Mode
  18. Undo/Redo
  19. Search
  20. File I/O
  21. Drawing
  22. Input
  23. Mode and Commands
  24. Main Drawing Functions
  25. Input Processing
  26. Splash Screen
  27. Explorer
  28. AI Assistant
  29. Init
  30. Main

Thank you for your attention.

This project started out of curiosity and a simple C text editor tutorial. If you hit any issues, feel free to open an issue on GitHub. Pull requests, suggestions, or even thoughtful discussions are welcome.

— SEE LICENSE —  ·  GPL-3.0

— deus sol invictus mithras —

Releases

Contributors

Languages