Skip to content
feraxhpPublic

About

Simple, fast terminal editor with sintax highlight to edit a single file without without opening a full TUI editor over the terminal.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

ie (Inline Editor)

.github/workflows/build.yml

ie is a simple, fast terminal editor with syntax highlighting to edit a single file without opening a full TUI editor over the terminal.

Important

ie does not aims to replace any code-editor nor an IDE, so dont spect to see full AST parsing, or syntax errors...

ie is just a plain text editor, that happends to have syntax highlitghing

Really handy to use as a git inline editor for cherry-pick, amends, merge messages, etc.

example

Install

cargo install ie

CLI Usage

# Open file in inline mode (default 8 lines)
ie config.toml

# Jump directly to line (e.g. from compiler, linter or systemctl error)
ie config.toml:45
ie +45 config.toml
ie config.toml +45

# Jump directly to line and column
ie config.toml:45:10
ie +45:10 config.toml
ie config.toml +45:10

# Open in fullscreen mode
ie --full config.toml:45

# Specify number of lines in inline mode
ie -l 15 +45 config.toml

# Override syntax highlighting language
ie -f toml config.custom

# Create backup before first save (e.g. /etc/fstab -> /etc/fstab.bak)
ie -b /etc/fstab
ie --backup config.toml

Default Keybindings

Navigation & Cursor

Shortcut Action Description
Left move-left Move cursor left
Right move-right Move cursor right
Up move-up Move cursor up
Down move-down Move cursor down
Home move-line-start Move cursor to start of line
End move-line-end Move cursor to end of line

Selection

Shortcut Action Description
Shift + Left select-left Select character to the left
Shift + Right select-right Select character to the right
Shift + Up select-up Select line upward
Shift + Down select-down Select line downward
Shift + Home select-line-start Select to start of line
Shift + End select-line-end Select to end of line
Ctrl + a select-all Select all text in file

History (Undo / Redo)

Shortcut Action Description
Ctrl + z undo Undo last edit
Ctrl + y redo Redo edit
Ctrl + Shift + z redo Redo edit

Multi-cursor

Shortcut Action Description
Alt + Up add-cursor-above Add another cursor on the line above
Alt + Down add-cursor-below Add another cursor on the line below

Editing & Line Manipulation

Shortcut Action Description
Backspace delete-backward Delete character before cursor
Delete delete-forward Delete character at cursor
Enter insert-newline Insert a newline
Tab insert-tab Insert a tab indentation
Shift + Tab insert-hard-tab Insert a literal hard tab (\t) character
Shift + Enter add-line-below Add an empty line below current line
Ctrl + Enter add-line-above Add an empty line above current line
Shift + Delete / Shift + Backspace delete-line Delete current line
Ctrl + Shift + Down clone-line-down Duplicate/clone current line down
Ctrl + Shift + Up clone-line-up Duplicate/clone current line up
Alt + Shift + Down move-selection-down Move selected lines (or current line) down
Alt + Shift + Up move-selection-up Move selected lines (or current line) up
Ctrl + k toggle-comments Toggle comment on current line or selection

Search Mode

Shortcut Action Description
Ctrl + f search Open search prompt
Ctrl + n next-match Go to next search match
Ctrl + p prev-match Go to previous search match
Ctrl + e focus-editor Focus editor while search bar remains open
Ctrl + Shift + s focus-search Focus search bar input

General & View Controls

Shortcut Action Description
Ctrl + s save-file Save file
Ctrl + c abort Abort operation and exit with error (exit code 130)
Esc escape Close search, collapse multi-selection, or exit clean (exit code 0)
F1 toggle-help Toggle status and shortcut help bar
F2 toggle-gutter Toggle gutter (line numbers & status marks)
F3 toggle-wrap Toggle soft line wrapping
F5 increase-lines Increase inline viewport height by 1 line (inline mode only)
F6 decrease-lines Decrease inline viewport height by 1 line (inline mode only)
F11 toggle-fullscreen Toggle between fullscreen (alternate screen) and inline mode

Custom Keymaps

ie allows full keymap customization through a keymap.json file placed in the user configuration directory:

OS Configuration Path
Linux ~/.config/ie/keymap.json
macOS ~/Library/Application Support/ie/keymap.json
Windows %APPDATA%\ie\keymap.json

Configuration Modes

In keymap.json, the "mode" property defines how custom keys are applied:

  • "extend" (default): Keeps default keybindings and overrides/adds your specified keys.
  • "absolute": Disables all default keybindings and only enables the keys explicitly defined in keys.

Example keymap.json

To customize your keybindings, create the folder and file:

mkdir -p ~/.config/ie

Then create ~/.config/ie/keymap.json:

{
  "mode": "extend",
  "keys": {
    "ctrl-w": "save-file",
    "ctrl-q": "exit",
    "ctrl-d": "delete-line",
    "alt-d": "clone-line-down",
    "ctrl-slash": "toggle-comments",
    "f4": "toggle-gutter"
  }
}

Key Combination Syntax

Keys are written as hyphen-separated values: [modifier-][modifier-]key

  • Modifiers: ctrl (or ctr, control), alt (or opt, option), shift, super (or win, cmd)
  • Special Keys: enter, backspace, tab, backtab, delete (or del), insert (or ins), esc (or escape), space, left, right, up, down, home, end, pageup, pagedown, f1–f12, slash (or /), underscore (or _)
  • Characters: Any letter or digit (e.g., s, c, z, f, 1)

Available Actions

Action Alias Description
save-file save Save file to disk
exit quit Exit ie cleanly (exit code 0)
abort cancel Abort operation and exit with error (exit code 130)
escape esc Dismiss search, clear multi-selection, or exit clean (exit code 0)
toggle-help toggle-hints, help Toggle status and shortcut help bar
toggle-gutter - Toggle line numbers / gutter
toggle-wrap - Toggle soft line wrap
toggle-fullscreen toggle-alternate-screen, fullscreen Toggle between fullscreen and inline mode
increase-lines add-line, increase-inline-lines Increase inline viewport height by 1 line
decrease-lines remove-line, decrease-inline-lines Decrease inline viewport height by 1 line
search - Open search dialog
next-match - Jump to next search result
prev-match - Jump to previous search result
focus-editor - Shift focus back to editor
focus-search - Shift focus back to search input
clone-line-down - Duplicate line(s) downward
clone-line-up - Duplicate line(s) upward
move-selection-down - Shift line(s) down
move-selection-up - Shift line(s) up
delete-line - Delete line(s)
add-line-below - Insert blank line below
add-line-above - Insert blank line above
toggle-comments - Toggle comment markers
undo - Undo edit
redo - Redo edit
select-all - Select entire document
insert-newline newline, enter Insert newline
insert-tab tab, add-tab, soft-tab Insert soft tab (spaces)
insert-hard-tab hard-tab, hardtab, add-hard-tab Insert literal hard tab (\t)
delete-backward backspace Delete previous character
delete-forward delete Delete next character
move-left / move-right - Move cursor left / right
move-up / move-down - Move cursor up / down
select-left / select-right - Select left / right
select-up / select-down - Select up / down
move-line-start / move-line-end home / end Move cursor to line start / end
select-line-start / select-line-end - Select to line start / end
move-doc-start / move-doc-end - Move cursor to document start / end
add-cursor-above / add-cursor-below - Add cursor above / below

Editor Configuration (config.json)

ie supports global configuration through a config.json file located in the user configuration directory:

OS Configuration Path
Linux ~/.config/ie/config.json
macOS ~/Library/Application Support/ie/config.json
Windows %APPDATA%\ie\config.json

Whitespace Visualization

ie visualizes whitespace characters using customizable glyphs. By default:

  • Spaces are rendered as middle dots (·)
  • Tab fillers are rendered as spaces ( )
  • Tab terminators are rendered as right tab arrows (⇥)

You can customize these characters in ~/.config/ie/config.json:

{
  "whitespace": {
    "space": "·",
    "tab_filler": " ",
    "tab_terminator": "⇥"
  }
}

Or directly at the root level:

{
  "space": "·",
  "tab_filler": " ",
  "tab_terminator": "⇥"
}

Language Highlighting & Themes

You can customize the color theme and tokenizer rules of any built-in language, or add your own custom language highlighters on demand.

This is done by placing definitions in the languages configuration directory:

OS Languages Directory
Linux ~/.config/ie/languages/
macOS ~/Library/Application Support/ie/languages/
Windows %APPDATA%\ie\languages\

Directory Structure

You can organize your custom languages in two ways:

1. Folder per Language (Recommended)

Place a subdirectory named after the language containing its grammar (<lang>.toml or syntax.toml) and/or theme (theme.json):

~/.config/ie/languages/
├── rust/
│   └── theme.json           # Overrides token colors for Rust
└── mylang/
    ├── mylang.toml          # Grammar definition for a new language
    └── theme.json           # Color palette for mylang

2. Flat Files

Alternatively, place .toml and .json files directly in languages/:

~/.config/ie/languages/
├── python.json              # Overrides colors for Python
├── mylang.toml              # Grammar for mylang
└── mylang.json              # Colors for mylang

3. Global Theme Fallback

You can also create a global_theme.json (or theme.json) directly in languages/ to override the fallback token colors across all languages:

{
  "keyword": "cyan",
  "string": "green",
  "comment": "darkgray",
  "function": "blue",
  "type": "yellow",
  "number": "magenta"
}

Overriding an Existing Language

ie includes built-in syntax support for over 30 languages (Rust, Python, JavaScript, TypeScript, Go, C, C++, C#, Java, HTML, CSS, JSON, TOML, YAML, Shell, Markdown, Dockerfile, Git commits/rebases, systemd, etc.).

Any file placed in ~/.config/ie/languages/ takes strict precedence over built-in definitions:

  • To customize token colors for an existing language, create languages/<lang>/theme.json (for example, languages/rust/theme.json).
  • To override syntax parsing rules, provide a <lang>.toml file.

Adding a New Language

To add support for a custom language (for example, mylang):

1. Create the grammar file (~/.config/ie/languages/mylang/mylang.toml)

[meta]
name = "mylang"
extensions = ["mylang", "ml"]

[states.root]
rules = [
    # Comments starting with #
    { match = '#.*', token = "comment" },

    # Keywords
    { match = '\b(?:fn|let|if|else|return|import)\b', token = "keyword" },

    # Function declarations
    { match = '\b([a-zA-Z_]\w*)\s*(?=\()', token = "function" },

    # Strings (double and single quoted)
    { match = '"(?:[^"\\]|\\.)*"', token = "string" },
    { match = "'(?:[^'\\]|\\.)*'", token = "string" },

    # Numbers
    { match = '\b\d+(?:\.\d+)?\b', token = "number" },

    # Types
    { match = '\b(?:Int|Float|String|Bool)\b', token = "type" },

    # Operators
    { match = '[+\-*/=<>!&|]+', token = "operator" },

    # Delimiters and brackets
    { match = '[{}()\[\]]', token = "punctuation.bracket" },
    { match = '[,;:]', token = "punctuation.delimiter" },
]

2. Create the theme file (~/.config/ie/languages/mylang/theme.json)

{
  "keyword": "magenta",
  "function": "blue",
  "type": "yellow",
  "string": "green",
  "number": "yellow",
  "operator": "cyan",
  "comment": "darkgray",
  "punctuation.bracket": "darkgray",
  "punctuation.delimiter": "darkgray"
}

Supported Color Names: magenta, blue, cyan, yellow, green, red, white, black, gray, darkgray, lightred, lightgreen, lightblue, lightyellow, lightmagenta, lightcyan.


Usage & On-Demand Highlighting

  • File Extension: Files with extensions matching the grammar's extensions list or language name are highlighted automatically.
  • CLI Override: You can force any file to use your highlighter with the -f / --format flag:
    ie -f mylang document.txt
  • Markdown Codeblocks: When editing Markdown files, embedded codeblocks (e.g. mylang ... ) automatically load your custom grammar and theme on demand.

Dependencies

About

Simple, fast terminal editor with sintax highlight to edit a single file without without opening a full TUI editor over the terminal.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages