diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-03-10 14:59:14 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-03-10 14:59:14 +0100 |
| commit | 1100562e29f6476448b656dbddd4cf22505523f6 (patch) | |
| tree | 442eec492199104bd49dfd74474ce89ade8fcac9 /content/notes/2023-05-31-extending-dte-editor.md | |
| parent | a40d80be378e46a6c490e1b99b0d8f4acd968503 (diff) | |
| download | mitjafelicijan.com-1100562e29f6476448b656dbddd4cf22505523f6.tar.gz | |
Move back to JBMAFP
Diffstat (limited to 'content/notes/2023-05-31-extending-dte-editor.md')
| -rw-r--r-- | content/notes/2023-05-31-extending-dte-editor.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/content/notes/2023-05-31-extending-dte-editor.md b/content/notes/2023-05-31-extending-dte-editor.md new file mode 100644 index 0000000..8135bdc --- /dev/null +++ b/content/notes/2023-05-31-extending-dte-editor.md | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | --- | ||
| 2 | title: "Extending dte editor" | ||
| 3 | url: /extending-dte-editor.html | ||
| 4 | date: 2023-05-31T08:12:45+02:00 | ||
| 5 | type: note | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | [`dte`](https://craigbarnes.gitlab.io/dte/) is an interesting editor I started | ||
| 10 | using lately more and more. Since it is using | ||
| 11 | [`execvp()`](https://linux.die.net/man/3/execvp) it can be easily extended. I | ||
| 12 | needed comment/uncomment feature so I created a small utility that does this for | ||
| 13 | me. Code lives on repository [dte | ||
| 14 | extensions](https://git.mitjafelicijan.com/dte-extensions.git/about/) but this | ||
| 15 | utilities can be used for whatever you want. Make sure you have version 1.11 or | ||
| 16 | above. | ||
| 17 | |||
| 18 | Next one will be invoking formatter based on the type of a file. | ||
| 19 | |||
| 20 | My config that works for me. | ||
| 21 | |||
| 22 | ```sh | ||
| 23 | set show-line-numbers true; | ||
| 24 | set tab-width 4; | ||
| 25 | set case-sensitive-search false; | ||
| 26 | |||
| 27 | # Special aliases | ||
| 28 | alias m_comment 'exec -s -i line -o buffer -e errmsg ~/.dte/bin/comment' | ||
| 29 | alias m_format 'save; exec go fmt .; reload' | ||
| 30 | alias m_duplicate 'copy;paste'; | ||
| 31 | |||
| 32 | # Useful aliases. | ||
| 33 | alias m_force_close 'quit -f'; | ||
| 34 | alias m_reload 'close; open $FILE' | ||
| 35 | |||
| 36 | # Key bindings. | ||
| 37 | bind M-s save; | ||
| 38 | bind M-q m_force_close; | ||
| 39 | bind M-z refresh; | ||
| 40 | bind C-down blkdown; | ||
| 41 | bind C-up blkup; | ||
| 42 | bind C-_ m_comment; | ||
| 43 | bind M-. m_format; | ||
| 44 | bind C-d m_duplicate; | ||
| 45 | |||
| 46 | # Syntax highlighting. | ||
| 47 | hi preproc magenta; | ||
| 48 | hi keyword red; | ||
| 49 | hi linenumber blue; | ||
| 50 | hi comment cyan; | ||
| 51 | ``` | ||
