Modal terminal editor written in C23. hed keeps a small core but ships useful modern tools: tree-sitter highlights, fuzzy file/search pickers, ripgrep-backed quickfix lists, window splits, tmux runner support, and an explicit C API for adding commands, keybindings, and hooks.
- Normal / Insert / Command plus Visual (char + block) modes with Vim-like motions and operators, undo/redo, registers, and shared clipboard across buffers.
- Unlimited buffers and multiple windows with vertical/horizontal splits; quickfix pane stays in sync with the cursor for previews.
- Search stack:
/and*for intra-file search, ripgrep integrations (:rg,:ssearch,:rgword) that populate quickfix, and jump list navigation (Ctrl-o/Ctrl-i). - Tree-sitter highlighting with queries in
queries/and prebuilt grammars ints-langs/; runtime toggle and per-buffer language selection. - Fuzzy tools:
:fzffile picker,:recentrecent files,:ccommand picker, optionalbatpreviews. - Integrations: tmux runner pane (
:tmux_toggle,:tmux_send), lazygit wrapper (:git), shell passthrough (:shell), formatter hook (:fmt), optional word wrap and line-number toggles.
- clang, make, POSIX terminal.
libtree-sitterheaders/runtime (-ltree-sitteris linked).- Optional but recommended:
ripgrep,fzf,tmux,lazygit,bat(for previews),nnn(directory browsing)
make # builds build/hed and build/tsi, copies ts-langs/
make run # run the binary after building
make clean # remove build artifactsOutputs: build/hed (editor) and build/tsi (tree-sitter grammar installer).
./build/hed [file ...]Use -c "<command>" to run a command at startup (same as typing :<command>), e.g., -c "e other.txt" or -c "q!". Multiple filenames open multiple buffers. Logs go to .hedlog (clear with :logclear).
- Modes:
ESC-> Normal,i/aenter Insert/Append,o/Oopen a new line,vVisual,Ctrl-vblock-visual,:Command line. - Movement:
h j k lor arrows,0/$,gg/G,Ctrl-u/Ctrl-d,%match bracket,*find under cursor,/search,nnext match. - Editing:
xdelete char,dddelete line,dw/dbdelete word forward/back,yyyank line,ppaste,uundo,Ctrl-rredo,Jjoin lines,>>/<<indent/outdent,cctoggle comment on the line. - Visual:
vorCtrl-vto start,yyank selection,ddelete selection,i/ajump to insert/append. - Buffers:
:e <file>,:lsor<space>bblist,:b Nto switch,:bd[ N]close,:bn/:bpnext/prev. - Files:
:w,:q,:wq,:q!,:newopens an empty split. - Windows:
:split/:vsplit,<space>ws/wvsplit,<space>wwcycle focus,<space>wh|wj|wk|wlmove focus,<space>wdclose window. - Search & quickfix:
<space><space>or<space>ffrun:fzf,<space>frrecent files,<space>sd(:rg) and<space>ss(:ssearch),<space>saripgrep word under cursor, quickfix toggle<space>tq, next/prevCtrl-n/Ctrl-porgn/gp,:copen/:cclose/:cclear. - Tmux runner:
<space>tttoggle runner pane,<space>tTkill it,<space>tssend current line, or:tmux_send <cmd>. - Misc:
<space>cfformat buffer (:fmt),<space>twtoggle wrap,<space>qqforce quit,<space>rmrunsmakevia shell,<space>ggopens lazygit.
Key chord notation uses literal spaces; <space>ff means press Space then f then f in Normal mode.
- hed looks for grammars in
$HED_TS_PATH(defaults to$XDG_CONFIG_HOME/hedor$XDG_HOME/.config/hed, falling back tots-langs/). Included: c, c-sharp, html, make, python, rust. - Install another grammar:
./build/tsi <lang>(clonestree-sitter-<lang>, builds<lang>.sointots-langs/, copies queries intoqueries/<lang>/). - Commands:
:ts on|off|auto(auto detects by extension),:tslang <name>to force a language,:tsi <name>installs via the helper.
:rg <pattern>(non-interactive) populates quickfix;:rgwith no args opens an interactive fzf+rg picker.:ssearchsearches the current file with live reload and can populate quickfix.- Quickfix commands:
:copen,:cclose,:ctoggle,:cnext/cprev,:copenidx N,:cclear. The quickfix buffer follows the cursor and previews the selected item.
- All user-facing customization lives in
src/config.c:user_commands_initregisters commands (cmd(name, fn, desc)macro).user_keybinds_initsets keybindings for each mode (mapn/mapi/mapvandcmapn/cmapvto map commands).user_hooks_initwires editor hooks (e.g., mode change, buffer lifecycle, cursor movement). Extra quickfix hook logic is insrc/user_hooks_quickfix.c.
- Extend in C, and run
:reloadfrom inside hed to rebuild and restart.
src/core editor (buffers, windows, terminal, commands, keybinds, hooks, undo, quickfix, tmux/fzf/rg helpers, tree-sitter glue).src/ui/rendering helpers and window layout tree.src/buf/buffer and row data structures.src/utils/higher-level features (tree-sitter, quickfix, fzf, tmux, jump list, history, recent files).ts/ts_lang_install.cgrammar installer;ts-langs/shared objects;queries/highlight queries.
- Logs:
tail -f .hedlog, clear with:logclear. - If fzf/rg/tmux/lazygit are missing, related commands/keybinds will fail silently or set a status message.