edtui_papier/
lib.rs

1//! ## `EdTUI`
2//!
3//! ### Overview
4//! `EdTUI` is a text editor widget for the [Ratatui](https://github.com/ratatui-org/ratatui) ecosystem.
5//! It is designed to provide a light-weight user experience inspired by Vim.
6//!
7//! ## Features
8//! - Vim-like keybindings and editing modes for efficient text manipulation.
9//! - Normal, Insert and Visual mode.
10//! - Clipboard: Uses the `arboard` clibpboard by default which allows copy pasting between the
11//!   system clipboard and the editor.
12//!
13//! ## Keybindings
14//! `EdTUI` offers a set of keybindings similar to Vim. Here are some of the most common keybindings:
15//!
16//! #### Normal/Visual Mode:
17//!
18//! | Keybinding              | Description                                  |
19//! |-------------------------|----------------------------------------------|
20//! | `i`                     | Enter Insert mode                            |
21//! | `v`                     | Enter Visual mode                            |
22//! | `h`, `j`, `k`, `l`      | Navigate left, down, up, and right           |
23//! | `w`, `b`                | Move forward or backward by word             |
24//! | `x`                     | Delete the character under the cursor        |
25//! | `Del`                   | Delete the character left of the cursor      |
26//! | `u`, `r`                | Undo/Redo last action                        |
27//! | `Esc`                   | Escape Insert mode or Visual mode            |
28//! | `0`                     | Move cursor to start of line                 |
29//! | `^`                     | Move cursor to first non-blank character     |
30//! | `$`                     | Move cursor to end of line                   |
31//! | `a`                     | Append after the cursor                      |
32//! | `A`                     | Append at the end of the line                |
33//! | `o`                     | Add a new line below and enter Insert mode   |
34//! | `O`                     | Add a new line above and enter Insert mode   |
35//! | `Backspace`             | Delete the previous character                |
36//! | `d`                     | Delete the selection                         |
37//! | `dd`                    | Delete the current line                      |
38//! | `ciw`                   | Select between delimiters. Supported: ["]    |
39//! | `u`                     | Undo the last change                         |
40//! | `r`                     | Redo the last undone action                  |
41//! | `y`                     | Copy the selected text                       |
42//! | `p`                     | Paste the copied text                        |
43//!
44//! #### Insert Mode:
45//!
46//! | Keybinding | Description                             |
47//! |------------|-----------------------------------------|
48//! | `Esc`      | Return to Normal mode                   |
49//!
50//! For more keybindings and customization options, refer to the code.
51//!
52//! ## Demo
53//!
54//!![](resources/app.gif)
55//!
56//! ### Roadmap
57//!
58//! - [x] Clipboard
59//! - [x] Search
60//!
61//! - [ ] Vims `f`/`t` go to first
62//! - [ ] Support termwiz and termion
63//! - [ ] Display line numbers
64//! - [ ] Remap keybindings
65//! - [ ] Soft-wrap lines
66#![allow(dead_code, clippy::module_name_repetitions, clippy::cast_possible_truncation)]
67pub mod actions;
68pub mod clipboard;
69mod debug;
70mod helper;
71pub mod input;
72pub mod state;
73pub mod view;
74
75pub use input::Input;
76pub use state::{mode::EditorMode, EditorState};
77pub use view::{theme::EditorTheme, EditorView, StatusLine};
78
79/// A data structure that contains chars organized in rows and columns
80pub type Lines = jagged::Jagged<char>;
81pub use jagged::Index2;