edtui 0.8.3

A TUI based vim inspired editor
Documentation

EdTUI

Overview

EdTUI is a text editor widget for the Ratatui ecosystem. It is designed to provide a light-weight user experience inspired by Vim.

use edtui::{EditorState, EditorTheme, EditorView};
use ratatui::widgets::Widget;

let mut state = EditorState::default();
EditorView::new(&mut state)
        .theme(EditorTheme::default())
        .wrap(true) // line wrapping
        .render(area, buf)

Features

  • Vim-like keybindings and editing modes for efficient text manipulation.
  • Normal, Insert and Visual mode.
  • Clipboard: Uses the arboard clibpboard by default which allows copy pasting between the system clipboard and the editor.
  • Line wrapping

Keybindings

EdTUI offers a set of keybindings similar to Vim. Here are some of the most common keybindings:

Normal/Visual Mode:
Keybinding Description
i Enter Insert mode
v Enter Visual mode
h, j, k, l Navigate left, down, up, and right
w, b Move forward or backward by word
x Delete the character under the cursor
u, <ctrl>+r Undo/Redo last action
Esc Escape Visual mode
0 Move cursor to start of line
^ Move cursor to first non-blank character
$ Move cursor to end of line
gg Move cursor to the first row
G Move cursor to the last row
% Move cursor to closing/opening bracket
a Append after the cursor
A Append at the end of the line
o Add a new line below and enter Insert mode
O Add a new line above and enter Insert mode
d Delete the selection
dd Delete the current line
ciw Select between delimiters. Supported: ["]
u Undo the last change
r Redo the last undone action
y Copy the selected text
p Paste the copied text
Insert Mode:
Keybinding Description
Esc Return to Normal mode
Backspace Delete the previous character
Enter Insert line break
Arrows Navigation

For more keybindings and customization options, refer to the code.

Demo

Experimental Mouse Support

Edtui now includes experimental mouse support. To enable it activate the feature

[dependencies.edtui]
version = "0.7"
features = ["mouse-support"]

and use the mouse event handler

let event_handler = EditorEvent::default();
event_handler.on_mouse_event(mouse_event, &mut state);

Note: This feature is experimental, so expect potential bugs and breaking changes. It does currently not work correctly on wrapped lines.

Roadmap

  • Clipboard

  • Search

  • Soft-wrap lines

  • Vims f/t go to first

  • Support termwiz and termion

  • Display line numbers

  • Remap keybindings

License: MIT