-
Attribute editing support XML attributes are currently read-only. Extend the pager display and label system to expose attributes as selectable, editable entries (e.g.
1[class],1[id]). The parser, display, and update pipeline all need changes. This is the single most frequent pain point for real XML editing workflows that this tool doesn't yet cover. -
Search / filter mode in the pager Add
/(forward search) andn/N(next/prev match) to the pager, mirroringlessandvimUX. Match against tag names, label strings, and text content. Highlight matches inline and jump the viewport to the first hit. A--grep <pattern>CLI flag for non-interactive filtering would also be valuable as a scripting primitive. -
Undo / redo across a session Currently each edit is immediately written to disk with no recovery path. Implement a session-scoped change stack: each label edit pushes a before/after snapshot. Bind
u(undo) andCtrl+R(redo) in the pager. On clean exit, optionally write a dated.bakfile so the original can always be recovered even after the tool closes.
-
Home / End / Delete keys in the TUI editor
src/editor/tui.tsnotes these are intentionally absent. AddHome(move to BOL),End(move to EOL), andDelete(forward delete) in Insert mode. These are the three most common editing operations missing from the current key map. -
Syntax-aware colorizing in the pager Distinguish tag names (bold cyan), label chips (bold yellow), and text content (default) using ANSI escape codes already used elsewhere in the codebase. Respect a
--no-colorflag andNO_COLORenv var per the de-facto standard. -
--listflag to dump labels without entering the pagerxml-editor file.xml --listprints every label and its text to stdout, one per line, and exits. Enables shell pipelines likexml-editor config.xml --list | grep versionwithout launching the interactive UI. -
Autodetect and display encoding declaration When the XML prolog contains
encoding="ISO-8859-1"(or similar), display a warning in the footer and re-serialize with the same encoding rather than silently converting to UTF-8. Prevents data corruption on legacy files. -
--set-defaultshould also set--editorflag inlinexml-editor --set-default vim(with an argument) should skip the interactive prompt and set the default immediately — useful in CI/dotfile bootstrap scripts. Currently the flag is always interactive. -
Version string sourced from
package.jsonat build time The version string insrc/index.tsis hardcoded. Use a build-time constant orrequire()ofpackage.jsonso bumping the version in one place is sufficient and the two can never drift.
-
Batch / script mode via stdin Accept
label:valuepairs from stdin (or a-f commands.txtfile) so edits can be driven by scripts or other tools without interactive input. Example:echo "1a:hello world\n2b:foo" | xml-editor config.xml --batchUseful for templating and CI pipelines that generate XML programmatically.
-
Dry-run / diff preview before writing
--dry-runrenders a unified diff of what the file would look like after pending edits, then asks for confirmation before touching disk. Pairs naturally with the undo stack and batch mode. Reduces the "oops I saved the wrong thing" class of errors. -
JSON / TOML / YAML side-by-side target format export Add
xml-editor file.xml --export json > output.json(and--export yaml,--export toml). The hierarchical label system maps naturally to nested objects. Opens the tool to config-file conversion workflows without requiring a separate utility. -
Watch mode: auto-reload on external file change
xml-editor file.xml --watchusesfs.watchto detect when the file is modified by another process (build tool, IDE, etc.) and re-renders the pager in place — similar to howtail -fworks. Useful when xml-editor is open alongside a build that regenerates the file.
-
Breadcrumb trail in the pager footer When the viewport is scrolled past the first child of a node, show the ancestor path in the footer (e.g.
> root > settings > database) so the user always knows where they are in deep files — the XML equivalent of a sticky header. -
gkey opens a "go to label" prompt — fuzzy-matched Pressgin the pager, type a partial label or text fragment, and the viewport jumps to the best match ranked by edit distance. Faster than scrolling for large XML files. No extra dependencies needed — a simple Levenshtein over the label list is enough. -
Read-only "inspect" mode for piped input
cat file.xml | xml-editor(no file argument, stdin is not a TTY) enters a read-only pager. All write paths are disabled;qexits. Makes the tool useful as a general-purpose terminal XML viewer in shell pipelines. -
Session transcript log Append every label+old-value+new-value to
~/.local/share/xml-editor/history.log(configurable). A companionxml-editor --historycommand pretty-prints the last N edits across all files. Inexpensive audit trail; trivially useful for undoing changes made days ago. -
Clipboard yank:
ycopies tag text,Ycopies the full label path In the pager, pressingyon the currently highlighted entry copies its text value to the system clipboard viaxclip,xsel,pbcopy, orclip.exe(whichever is available).Ycopies the dotted label path instead. Zero new runtime dependencies; just shell out to the clipboard tool. -
--skeletonflag generates a commented XML template from an existing filexml-editor config.xml --skeleton > template.xmloutputs the same XML with all text content replaced by<!-- <label>: <original truncated to 40 chars> -->comments. Immediately useful for documentation, onboarding, and schema discovery on unfamiliar XML files. -
Color theme config key (4 named themes + custom hex) Add a
themekey to~/.config/xml-editor/config.jsonwith built-in named themes: default,gruvbox,dracula,nord. Each theme specifies ANSI color codes for labels, text, and highlights. A--theme ` CLI flag overrides per-invocation. Purely cosmetic but dramatically improves long-session usability. -
"Show diff" startup hint: show last-session changes on open If the file was edited by
xml-editorin the last 24 hours (detectable from the history log), flash a one-line summary at pager startup:3 edits last session — press H to review. Low cognitive overhead, high recall value. The kind of feature that feels invisible until the one time it saves you.