Metadata-Version: 2.3
Name: denary
Version: 0.0.2
Summary: A curses-based text editor with syntax highlighting
License: MIT
Author: Jordaly Suriel
Requires-Python: >=3.11,<3.15
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: Pygments (>=2.20)
Requires-Dist: pathspec (>=1.0.4)
Requires-Dist: platformdirs (>=4.9.6)
Requires-Dist: windows-curses (>=2.4.2) ; sys_platform == "win32"
Description-Content-Type: text/markdown


## Editor Documentation
```
 ,gggggggggggg,
dP"""88""""""Y8b,
Yb,  88       `8b,
 `"  88        `8b
     88         Y8
     88         d8  ,ggg,    ,ggg,,ggg,     ,gggg,gg   ,gggggg,  gg     gg
     88        ,8P i8" "8i  ,8" "8P" "8,   dP"  "Y8I   dP""""8I  I8     8I
     88       ,8P' I8, ,8I  I8   8I   8I  i8'    ,8I  ,8'    8I  I8,   ,8I
     88______,dP'  `YbadP' ,dP   8I   Yb,,d8,   ,d8b,,dP     Y8,,d8b, ,d8I
    888888888P"   888P"Y8888P'   8I   `Y8P"Y8888P"`Y88P      `Y8P""Y88P"888
                                                                      ,d8I'
                                                                    ,dP'8I
                                                                   ,8"  8I
                                                                   I8   8I
                                                                   `8, ,8I
                                                                    `Y8P"
```

A modal terminal editor built on curses with a command-driven,
event-based architecture and chunked text storage.

Includes syntax highlighting, multi-buffer management,
registers and markers, undo/redo history, Git integration,
async LSP support, subprocess execution, and HTTP requests.

## Key Bindings

### Core Editing

| Shortcut   | Action                    |
| ---------- | ------------------------- |
| **Ctrl-S** | Save file                 |
| **Ctrl-Q** | Quit editor               |
| **Ctrl-Y** | Copy                      |
| **Ctrl-X** | Cut                       |
| **Ctrl-U** | Paste                     |
| **Ctrl-E** | Undo                      |
| **Ctrl-O** | Open file                 |
| **Ctrl-D** | Delete buffer             |
| **Ctrl-/** | Search files              |
| **Ctrl-Z** | Send editor to background |

---

### Buffer / File Management

| Shortcut   | Action          |
| ---------- | --------------- |
| **Ctrl-L** | Buffer picker   |
| **Ctrl-P** | Previous buffer |
| **Ctrl-N** | Next buffer     |
| **Ctrl-W** | File explorer   |

---

### Navigation & Searching

| Shortcut       | Action           |
| -------------- | ---------------- |
| **Ctrl-F**     | Find             |
| **Ctrl-G**     | Go to line       |
| **Ctrl-Space** | Show suggestions |

---

### Vim-Style Navigation

| Shortcut              | Action                    |
| --------------------- | ------------------------- |
| **Alt-H / J / K / L** | Move cursor (vim style)   |
| **Alt-;**             | Toggle selection mode     |
| **Alt-I / Alt-O**     | Jump between punctuation  |
| **Alt-9 / Alt-0**     | Jump to start/end of line |
| **Alt-↑ / Alt-↓**     | Scroll up/down            |
| **Alt-U**             | Paste system clipboard    |
| **Alt-N**             | Repeat last search        |
| **Alt-P**             | Reverse search repeat     |
| **Alt-M**             | Search word under cursor  |
| **Alt-W**             | File search               |

---

### Normal Mode Marks & LSP

| Shortcut | Action                           |
| -------- | -------------------------------- |
| **m**    | Set marker                       |
| **'**    | Save and use clipboard registers |
| **`**    | Go to last buffer                |
| **K**    | Show LSP definition              |
| **q**    | Show line diagnostics            |
| **;**    | Go to LSP definition             |

---

## Commands

### Buffer Actions

| Command                           | Description         |
| --------------------------------- | ------------------- |
| `h` / `help`                      | Show help           |
| `q` / `quit`                      | Exit editor         |
| `w` / `write`                     | Save current buffer |
| `ls` / `list`                     | List open buffers   |
| `open`                            | Open a file         |
| `bufnew`                          | Create new buffer   |
| `nbuf` / `nextbuf` / `next` / `n` | Next buffer         |
| `pbuf` / `prevbuf` / `prev` / `p` | Previous buffer     |
| `delbuf` / `d`                    | Delete buffer       |
| `ff`                              | File search         |
| `ffr`                             | New file search     |
| `fb`                              | Buffer picker       |
| `ex`                              | File explorer       |

---

### UI & Behavior

| Command         | Description          |
| --------------- | -------------------- |
| `themes`        | Change editor theme  |
| `ln`            | Toggle line numbers  |
| `gch`           | Toggle Git highlight |
| `scrolloff <n>` | Set scroll offset    |

---

### Markers

| Command        | Description                   |
| -------------- | ----------------------------- |
| `m` / `marker` | Add local/global marker       |
| `pm`           | Pick marker                   |
| `dm`           | Delete markers in this buffer |
| `dgm`          | Delete global markers         |
| `dpm`          | Delete specific marker        |
| `dam`          | Delete all markers            |

---

### Text Utilities

| Command                          | Description        |
| -------------------------------- | ------------------ |
| `clear_registers`                | Reset registers    |
| `reset_h_matches`                | Reset highlighting |
| `replace`                        | Replace text       |
| `comment`                        | Toggle comment     |
| `upper` / `lower` / `capitalize` | Change case        |
| `filetype <type>`                | Set syntax mode    |

---

## Utilities

| Command                          | Description                                                       |
|----------------------------------|-------------------------------------------------------------------|
| `align`                          | Align text by a delimiter (e.g. `=`, `:`, `,`, `|`)               |
| `column_edit`                    | Insert, replace, or delete text within column ranges per line     |
| `date`                           | Copy date                                                         |
| `datetime`                       | Copy current date & time                                          |
| `file_path`                      | Copy current file path                                            |
| `json_format`                    | Format JSON in selection or entire file                           |
| `number_lines`                   | Add line numbers to each line                                     |
| `rejoin`                         | Split and rejoin selection or entire file using a delimiter       |
| `remove_empty_lines`             | Remove blank or whitespace-only lines                             |
| `reverse_lines`                  | Reverse the order of lines                                        |
| `shuffle_lines`                  | Randomly shuffle lines                                            |
| `slugify`                        | Convert text to URL-friendly slug format                          |
| `sort` / `sort_r`                | Sort selection or entire file by lines (normal or reverse)        |
| `trim` / `trim_l` / `trim_r`     | Trim whitespace (both, left, or right) per line                   |
| `unique_lines` / `dedup`         | Remove duplicate lines (keep first occurrence)                    |
| `uuid`                           | Copy random UUID                                                  |
| `wrap`                           | Wrap text to a specified width                                    |

---

## Git Commands

| Command          | Description                           |
| ---------------- | ------------------------------------- |
| `git_status`     | Show Git status                       |
| `git_diff`       | Show diff                             |
| `git_commit_all` | Commit all                            |
| `git_blame`      | Show blame                            |
| `git_log`        | Show history                          |
| `git_refresh`    | Refresh state                         |
| `git_hunk`       | Show previous version of changed code |

---

## LSP Commands

| Command                     | Description                        |
| --------------------------- | ---------------------------------- |
| `lsp_diagnostics`           | Show buffer diagnostics            |
| `lsp_hover`                 | Show hover info                    |
| `lsp_definition`            | Go to definition                   |
| `lsp_refresh`               | Restart LSP for buffer             |
| `lsp_line_diagnostics`      | Show diagnostics for current line  |
| `lsp_clear_diagnostics`     | Clear diagnostics                  |
| `clear_line_diag` / `clrld` | Clear diagnostics for current line |

---

## AI Commands

| Command             | Description                               |
| ------------------- | ----------------------------------------- |
| `ai`                | Send a custom instruction to the AI       |
| `ai_gen`            | Generate code at the cursor               |
| `ai_review`         | Review Git diff for issues                |
| `ai_commit_message` | Generate a commit message from Git diff   |
| `ai_get`            | Retrieve AI result at the cursor          |
| `ai_show`           | Show AI completion picker                 |
| `ai_remove`         | Cancel/remove AI completion at the cursor |
| `change_ai_model`   | Change the active AI model                |

---

## HTTP Request Execution

Select a block and run:

| Command                     | Description                        |
| --------------------------- | ---------------------------------- |
| `req`                       | Make http request                  |

### Request Format

```
<HTTP_METHOD> <URL>
<Header>: <Value>
<Header>: <Value>

<Optional Body>
```

### Examples

#### GET:

```
GET https://jsonplaceholder.typicode.com/todos/1
Accept: application/json
```

#### POST:

```
POST https://jsonplaceholder.typicode.com/posts
Content-Type: application/json

{
    "title": "Hello world",
    "body": "Testing request from editor",
    "userId": 1
}
```


## Regex Replacement

Perform regex-based find and replace in the current buffer.

| Command   | Description                    |
| --------- | ------------------------------ |
| `replace` | Run a regex search and replace |

---

## Capture Groups

Parentheses create **capture groups** that can be reused in the replacement.

| Syntax | Meaning      |
| ------ | ------------ |
| `\0`   | Entire match |
| `\1`   | First group  |
| `\2`   | Second group |
| `\3`   | Third group  |

Example

Find

```
(\w+)\s+(\w+)
```

Replace

```
\2 \1
```

Result

```
hello world → world hello
```

---

## Named Capture Groups

Groups can also be named.

```
(?P<name>pattern)
```

Named groups are referenced in the replacement using:

```
\g<name>
```

Example

Find

```
(?P<first>\w+)\s+(?P<last>\w+)
```

Replace

```
\g<last> \g<first>
```

Result

```
john doe → doe john
```

---

## Case Transformations

The replacement string supports case modifiers.

| Syntax | Effect                   |
| ------ | ------------------------ |
| `\U`   | Uppercase until `\E`     |
| `\L`   | Lowercase until `\E`     |
| `\u`   | Uppercase next character |
| `\l`   | Lowercase next character |
| `\E`   | End transformation       |

Example

Find

```
select
```

Replace

```
\U\0\E
```

Result

```
select → SELECT
```

---

## Word Boundaries

`\b` matches the boundary between a word and a non-word character.

Example

Find

```
\bselect\b
```

Matches

```
select
```

Does not match

```
selected
```

---

## Example: SQL Keyword Formatting

Find

```
\b(select|from|where|join|group\s+by|order\s+by)\b
```

Replace

```
\U\0\E
```

Result

```
select name from users where id = 1
↓
SELECT name FROM users WHERE id = 1
```


