dged
— a text
editor for datagubbar and datagummor
dged |
[-l | --line
line] [-e |
--end ] [-h |
--help ] [file] |
dged
is a small, fast and no bullshit text
editor for the future.
The options are:
-l
n |
--line
=n
- This option directly jumps to line n in the opened
file.
-e
|
--end
- This option directly jumps to the end of the opened
file.
-h
|
--help
- Show the help text.
When a file is loaded in dged
, It is
stored in a
buffer.
This buffer is displayed on the screen in what is called a
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.
Windows can be split and show different buffers.
The dged
editor is built up around
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 “M-x”) or the corresponding key
binding.
- backward-char
- Move dot one char backwards.
- forward-char
- Move dot one char forwards.
- backward-line
- Move dot one line backwards.
- forward-line
- Move dot one line forwards.
- forward-word
- Move dot one word forwards.
- backward-word
- Move dot one word backwards.
- beginning-of-line
- Move dot to the beginning of the line it is currently on.
- end-of-line
- Move doto to the end of the line it is currently on.
- find-next needle
- Find next occurence of needle in the buffer.
- find-prev needle
- Find previous occurence of needle in the
buffer.
- goto-line n
- Move dot to line n.
- goto-beginning
- Move dot to the first character in the buffer.
- goto-end
- Move dot past the last character in the buffer.
- scroll-down
- Scroll the active buffer one page down.
- scroll-up
- Scroll the active buffer one page up.
- newline
- Insert a newline in the active buffer.
- indent
- Insert appropriate indentation (according to the language) in the active
buffer.
- 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.
- kill-line
- Remove all text following dot in the current line, placing it in the kill
ring.
- delete-char
- Delete the char following the dot, placing it in the kill ring.
- delete-word
- Delete the next word following dot, placing it in the kill ring.
- backward-delete-char
- Delete the char preceding the dot, placing it in the kill ring.
- set-mark
- Set the mark at the current dot position, effectively starting a
selection.
- cut
- Cut the text between dot and mark, placing it in the kill ring.
- paste
- Paste the most recent entry from the kill ring into the active
buffer.
- paste-older
- Each time the command is repeated, replace the last paste with an older
one from the kill ring into the active buffer.
- copy
- Copy the text between dot and mark, placing it in the kill ring.
- undo
- Undo the last operation in the active buffer.
- exit
- Exit the editor.
- buffer-write-to-file file
- Write the active buffer to file.
- find-file
- Open a file in a new buffer, relative to current working directory.
- find-file-relative
- Open a file in a new buffer, relative to the active buffer.
- kill-buffer
- Close the buffer and remove it from the editor. Does nothing to the file
on disk.
- switch-buffer
- Switch to another open buffer.
- buffer-list
- Open the buffer list in the currently active window.
- window-close
- Close the currently active window.
- window-close-others
- Close all windows except the active one.
- window-split-horizontal
- Split the active window horizontally.
- window-split-vertical
- Split the active window vertically.
- window-focus-next
- Make the "next" window the active window.
- window-focus-{0..9}
- Make window {0..9} the active window.
- get setting
- Get the value of the setting setting.
- set setting value
- Set the value of the setting setting to
value.
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
COMMANDS.
- M-x
- invoke-command
- C-g
- abort
- C-x C-f
- find-file
- C-x C-g
- find-file-relative
- C-k
- kill-buffer
- C-x-0
- window-close
- C-x-1
- window-close-others
- C-x-2
- window-split-horizontal
- C-x-3
- window-split-vertical
- C-x-o
- window-focus-next
- C-x-w-{0..9}
- window-focus-{0..9}
- C-b | <LEFT-ARROW>
- backward-char
- C-f | <RIGHT-ARROW>
- forward-char
- C-p | <UP-ARROW>
- backward-line
- C-n | <DOWN-ARROW>
- forward-line
- M-f
- forward-word
- M-b
- backward-word
- C-a
- beginning-of-line
- C-e
- end-of-line
- C-s
- find-next
- C-r
- find-prev
- M-g
- goto-line
- M-<
- goto-beginning
- M->
- goto-end
- C-v | <PAGE-DOWN>
- scroll-down
- M-v | <PAGE-UP>
- scroll-up
- C-<SPACE>
- set-mark
- C-w
- cut
- C-y
- paste
- M-y
- paste-older
- M-w
- copy
- C-/
- undo
The main configuration file, dged.toml is
written in a subset of the TOML language. For example, setting the default
tab-width looks like
[editor]
tab-width = 5 # no, no one would do this
The programming language support in dged
can be configured using the TOML configuration file. The configuration for a
language is stored in the key languages.<id> where id is an
alphanumeric identifier for the language. dged
comes
with some built in languages that are automatically defined but to add more
languages, add something like
[languages.mylang]
name = "My Language" # a descriptive name
grammar = "mylang" # name of the treesitter grammar to use (if syntax is enabled)
to the configuration file.
- ~/.config/dged/dged.toml
- Main configuration file.