From eabf7f9a958026c073faecf7504cbd8bb484a6c1 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Thu, 14 Mar 2024 08:57:10 +0100 Subject: Update README and man page Add all commands and keybinds to the manual. --- README.md | 63 ++++++++++++++++- dged.1 | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 298 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b6d6e25..56d45a9 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,77 @@ Because there is room for one more minimalistic text editor! DGED is what happens if I remove everything I do not need from -GNU Emacs and only implement the things I personally need to be productive. +GNU Emacs and only implement the things I need to be productive. The editor was created as a learning exercise and to create something that I -can use as a daily driver. +can use as a daily driver. If anyone else happens to find it useful I will +be flattered and suprised. ## Features - [x] Syntax highlighting - [x] TOML configuration file +- [x] Editor commands (M-x) - [x] Absolutely no plugin system +- [x] Terminal only +- [x] Mouse-free editing - [ ] LSP Client implementation ## Contributing Contributions are of course welcome. Please open a PR on the Github repository. + +## Development Setup + +The editor is built using BSD make so that needs to be installed. + +To enable syntax highlighting (default) you will also need the tree-sitter library +installed. + +All of this can be obtained using the Nix flake. To create a development shell with all +needed dependencies, issue: + +``` +$ nix develop +``` +Currently, tree-sitter grammars can only be automatically fetched when using the Nix setup. + +To build the editor, first create the build folder + +``` +$ mkdir -p build +``` + +Then call make + +``` +$ bmake +``` + +## Installing + +If using nix, installation can be done by referring the flake with for example `nix profile`: + +``` +$ nix profile install . +``` + +or by using `home-manager` or `configuration.nix`. + +If not using Nix, obtain the needed dependencies and then issue + +``` +$ make +``` + +followed by + +``` +# make install +``` + +Optionally, you can set `prefix` to a value of your liking. + +## Documentation + +The features of the editor are documented in the man page (`man dged`). diff --git a/dged.1 b/dged.1 index 6c40449..3e9102d 100644 --- a/dged.1 +++ b/dged.1 @@ -3,10 +3,245 @@ .Os .Sh NAME .Nm dged -.Nd a text editor for datagubbar +.Nd a text editor for datagubbar and datagummor .Sh SYNOPSIS .Nm dged -.Op Pa file +.Op Fl l | -line Ar line +.Op Fl e | -end +.Op Fl h | -help +.Op Ar file .Sh DESCRIPTION .Nm is a small, fast and no bullshit text editor for the future. +.Pp +The options are: +.Bl -tag -width XXXX +.It Fl l Ar n | Fl -line Ns = Ns Ar n +This option directly jumps to line +.Ar n +in the opened +.Ar file . +.It Fl e | Fl -end +This option directly jumps to the end of the opened +.Ar file . +.It Fl h | Fl -help +Show the help text. +.El +.Sh EDITING TEXT +When a file is loaded in +.Nm , +It is stored in a +.Em buffer . +This buffer is displayed on the screen in what is called a +.Em window . +A buffer is an in-memory representation of a file and no changes +to it are written to disk until the buffer is saved. +.Pp +Windows can be split and show different buffers. +.Sh COMMANDS +The +.Nm +editor is built up around +.Em commands . +Commands perform some function either +globally, or on the active window or buffer. Commands can also take arguments. +To invoke a command, use the command prompt (default +.Dq M-x ) +or the corresponding key binding. +.Bl -tag -width xxxx +.It backward-char +Move dot one char backwards. +.It forward-char +Move dot one char forwards. +.It backward-line +Move dot one line backwards. +.It forward-line +Move dot one line forwards. +.It forward-word +Move dot one word forwards. +.It backward-word +Move dot one word backwards. +.It beginning-of-line +Move dot to the beginning of the line it is currently on. +.It end-of-line +Move doto to the end of the line it is currently on. +.It find-next Ar needle +Find next occurence of +.Ar needle +in the buffer. +.It find-prev Ar needle +Find previous occurence of +.Ar needle +in the buffer. +.It goto-line Ar n +Move dot to line +.Ar n . +.It goto-beginning +Move dot to the first character in the buffer. +.It goto-end +Move dot past the last character in the buffer. +.It scroll-down +Scroll the active buffer one page down. +.It scroll-up +Scroll the active buffer one page up. +.It newline +Insert a newline in the active buffer. +.It indent +Insert appropriate indentation (according to the language) +in the active buffer. +.It indent-alt +Insert the opposite (w.r.t. indent) type of indentation in +the active buffer. I.e. if the buffer type usually uses tabs, +this inserts spaces. +.It kill-line +Remove all text following dot in the current line, placing it +in the kill ring. +.It delete-char +Delete the char following the dot, placing it in the kill ring. +.It delete-word +Delete the next word following dot, placing it in the kill ring. +.It backward-delete-char +Delete the char preceding the dot, placing it in the kill ring. +.It set-mark +Set the mark at the current dot position, effectively starting a +selection. +.It cut +Cut the text between dot and mark, placing it in the kill ring. +.It paste +Paste the most recent entry from the kill ring into the active buffer. +.It paste-older +Each time the command is repeated, replace the last paste with an older +one from the kill ring into the active buffer. +.It copy +Copy the text between dot and mark, placing it in the kill ring. +.It undo +Undo the last operation in the active buffer. +.It exit +Exit the editor. +.It buffer-write-to-file Ar file +Write the active buffer to +.Ar file . +.It find-file +Open a file in a new buffer, relative to current working directory. +.It find-file-relative +Open a file in a new buffer, relative to the active buffer. +.It switch-buffer +Switch to another open buffer. +.It buffer-list +Open the buffer list in the currently active window. +.It window-close +Close the currently active window. +.It window-close-others +Close all windows except the active one. +.It window-split-horizontal +Split the active window horizontally. +.It window-split-vertical +Split the active window vertically. +.It window-focus-next +Make the "next" window the active window. +.It window-focus-{0..9} +Make window {0..9} the active window. +.It get Ar setting +Get the value of the setting +.Ar setting . +.It set Ar setting Ar value +Set the value of the setting +.Ar setting +to +.Ar value . +.Sh KEY BINDINGS +In the following table, C-x means Control+x, M-x means Meta+x +where Meta is usually the ALT key or a special key on the keyboard. The +corresponding value for each key combination is a command +described in +.Sx COMMANDS . +.Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -compact +.It M-x +invoke-command +.It C-g +abort +.It C-x-0 +window-close +.It C-x-1 +window-close-others +.It C-x-2 +window-split-horizontal +.It C-x-3 +window-split-vertical +.It C-x-o +window-focus-next +.It C-x-w-{0..9} +window-focus-{0..9} +.It C-b | +backward-char +.It C-f | +forward-char +.It C-p | +backward-line +.It C-n | +forward-line +.It M-f +forward-word +.It M-b +backward-word +.It C-a +beginning-of-line +.It C-e +end-of-line +.It C-s +find-next +.It C-r +find-prev +.It M-g +goto-line +.It M-< +goto-beginning +.It M-> +goto-end +.It C-v | +scroll-down +.It M-v | +scroll-up +.It C- +set-mark +.It C-w +cut +.It C-y +paste +.It M-y +paste-older +.It M-w +copy +.It C-/ +undo +.Sh CONFIGURATION FILE +The main configuration file, +.Pa dged.toml +is written in a subset of the TOML language. For example, setting the default +tab-width looks like +.Bd -literal +[editor] +tab-width = 5 # no, no one would do this +.Ed +.Ss Configuring Programming Languages +The programming language support in +.Nm +can be configured using the TOML configuration file. The +configuration for a language is stored in the key +languages. where id is an alphanumeric identifier for the language. +.Nm +comes with some built in languages that are automatically defined but to add +more languages, add something like +.Bd -literal +[languages.mylang] +name = "My Language" # a descriptive name +grammar = "mylang" # name of the treesitter grammar to use (if syntax is enabled) +.Ed + +to the configuration file. +.Sh FILES +.Bl -tag -width XX +.It Pa ~/.config/dged/dged.toml +Main configuration file. +.Sh SEE ALSO +.Xr emacs 1 -- cgit v1.2.3