todoke 2.2.2

A rule-driven file and URL dispatcher: hands incoming paths (or URLs) to the right handler based on TOML-defined rules.
# todoke default config.
# Lives at ~/.config/todoke/todoke.toml on every platform.
# Values in double-braces are Tera template expressions.

[vars]
# user-defined vars go here, e.g.:
# proj_root = "/home/you/src"

# kind = "neovim" opts into msgpack-RPC reuse of a running nvim on `listen`.
# is_windows()/is_linux()/is_mac() are todoke-provided Tera functions.
[todoke.nvim]
kind = "neovim"
command = "nvim"
listen = '{% if is_windows() %}\\.\pipe\nvim-todoke-{{ group }}{% else %}/tmp/nvim-todoke-{{ group }}.sock{% endif %}'

# git commit / rebase, AI-tool prompt temp files etc. — always a fresh
# nvim, block until it exits so the calling tool (git, gemini-cli,
# claude-code, …) reads the edited file. Gemini CLI only spawns the
# editor for prompt files when it recognises the binary as a vim-family
# name, so the gemini-edit branch only fires when todoke is invoked under
# the `todoke-vim` alias — see README. The patterns below pin the
# `claude-prompt-` / `gemini-edit-` shape to the basename so a project
# directory named `gemini-edit-clone/` doesn't accidentally route as a
# prompt file.
[[rules]]
name = "editor-callback"
match = [
  # git / svn / hg commit + rebase + tag edit messages
  '(?i)/(COMMIT_EDITMSG|MERGE_MSG|TAG_EDITMSG|EDIT_DESCRIPTION|git-rebase-todo|\.gitmessage|NOTES_EDITMSG|svn-commit\.tmp)$',
  # Claude Code prompt temp files (basename starts with claude-prompt-)
  '(?i)/claude-prompt-[^/]+$',
  # Gemini CLI prompt temp files (mkdtemp `gemini-edit-XXXX/buffer.txt`)
  '(?i)/gemini-edit-[^/]+/buffer\.txt$',
]
to = "nvim"
mode = "new"
sync = true

# Neovim-family flags that take a spaced value on the next argv
# (`-c :set ft=md`, `-S session.vim`, `-i NONE`, `--listen /tmp/sock`, …).
# `consumes = 1` keeps the flag and its value together so they reach nvim
# intact. Must come before `any-flag` so the more-specific value-taking
# pattern wins; otherwise the trailing value would be classified as a
# separate input.
#
# `-i NONE` in particular is what Gemini CLI injects when it recognises
# the editor as vim-family — see README.
#
# Note: this binds `-i` (and other letters above) as value-taking by
# default. If you use $EDITOR=todoke with a tool that calls `-i` with
# different semantics, drop a `~/.config/todoke/todoke.toml` and tune
# this rule to taste.
[[rules]]
name = "nvim-value-flag"
match = '^(?:-[cSuUitwW]|--cmd|--startuptime|--listen|--server)$'
passthrough = true
consumes = 1

# Catch-all for ex-editor-style argv: `+42`, lone `-`/`+` flags todoke
# wouldn't otherwise know what to do with. `to` is omitted so the flag
# rides along with whichever input rule built a batch in the same group.
[[rules]]
name = "any-flag"
match = '^[-+]'
passthrough = true

# Everything else: reuse a single long-running nvim called "default".
[[rules]]
name = "default"
match = '.*'
to = "nvim"
group = "default"
mode = "remote"
sync = false