DTE(1)

πŸ“¦
version 1.10 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– DTE(1) πŸ’–

okay bestie, gather round, because today we're talking about dte β€” a small, configurable text editor. yes. small. configurable. text editor. she's giving tiny-but-mighty, she's giving main character energy, and honestly? we're obsessed. πŸŽ€


✨ NAME ✨

dte β€” a small, configurable text editor πŸ¦‹


✨ SYNOPSIS ✨

dte [-HR] [-c command] [-t ctag] [-r rcfile] [[+line] file]...
dte [-h|-B|-K|-V|-b rcname|-s file]

✨ OPTIONS ✨

okay so here's the whole flag menu, no skips, no skips at all, we're listing every single one:

  • -c command β€” runs command β€” but like, after the rc file gets read and after any file arguments get opened. (the order matters, bestie, don't come for me.) peep dterc(5) for the commands you can use here.
  • -t ctag β€” jumps straight to the source location of ctag. heads up: this needs a tags file that was generated by ctags(1).
  • -r rcfile β€” reads config from rcfile instead of ~/.dte/rc. your usual file? ghosted. πŸ’…
  • -s file β€” loads file as a dte-syntax(5) file and then exits. any errors it hits get printed to stderr(3) and the exit status gets set accordingly.
  • -b rcname β€” dumps the contents of the built-in rc or syntax file named rcname, then dips. bye.
  • -B β€” prints a whole list of every built-in config name you could use with the -b option, then exits.
  • -H β€” don't load history files at startup and don't save them on exit (scroll down to the FILES section for the deets). history stuff still works exactly like normal, it's just in-memory only and never persisted to the filesystem. so it's like… a memory. gone the second you leave. 😭
  • -R β€” don't read the rc file at all. rebellious. love that for her.
  • -K β€” starts in a special mode that just continuously reads input and prints the symbolic name of every key you press. it's a keypress x-ray basically. πŸ”₯
  • -h β€” shows the help summary and exits.
  • -V β€” shows the version number and exits.
  • -b rcname β€” (yes we're doing it again, it's literally listed twice up there in the options block, keep both, that's the vibe) dumps the built-in rc or syntax file named rcname and exits.

wait, okay, one sec β€” the original options section lists -b rcname twice, once near the top and once at the bottom of the list. so we keep both. consistency queen. πŸ‘‘


✨ KEY BINDINGS ✨

so there are 3 editor modes and each one has its own set of key bindings. the Normal mode bindings can be customized with the bind command (check dterc(5)) or you can just look at them with the show bind command.

the bindings below are written in the exact same format the bind command accepts. and specifically, key combos look like this:

  • M-x is Alt+x
  • C-V (or ^V) is Ctrl+v
  • S-left is Shift+left
  • C-M-S-left is Ctrl+Alt+Shift+left

πŸ¦‹ Normal Mode

Normal mode is where the editor starts. pressing the basic keys (like, the ones with no modifiers) just inserts text into the buffer. plain and simple. but there are also a bunch of key combos bound by default:

  • S-up, S-down, S-left, S-right β€” move the cursor and select characters
  • C-S-left, C-S-right β€” move the cursor and select whole words
  • C-S-up, C-S-down β€” move the cursor and select whole lines
  • ^C β€” copy the current line or the selection
  • ^X β€” cut the current line or the selection
  • ^V β€” paste
  • ^Z β€” undo
  • ^Y β€” redo
  • M-x β€” enter command mode
  • ^F β€” enter search mode
  • F3 β€” search next
  • F4 β€” search previous
  • ^T β€” open a new buffer
  • M-1, M-2 ... M-9 β€” switch to buffer 1 (or 2, 3, 4, etc.)
  • ^W β€” close the current buffer
  • ^S β€” save
  • ^Q β€” quit

🌸 Command Mode

Command mode is where you run all kinds of editor commands, using a language that's similar to a Unix shell. the next and prev commands switch to the next/previous file. the open, save and quit commands are pretty self-explanatory honestly, you got this. for the full list of available commands, go read dterc(5).

the key bindings for command mode are:

  • up, down β€” browse the previous command history
  • tab β€” auto-complete the current command or argument
  • ^A, home β€” go to the beginning of the command line
  • ^B, left β€” move left
  • ^C, ^G, Esc β€” exit command mode
  • ^D, delete β€” delete
  • ^E, end β€” go to the end of the command line
  • ^F, right β€” move right
  • ^K, M-delete β€” delete to the end of the command line
  • ^U β€” delete to the beginning of the command line
  • ^W, M-C-? (Alt+Backspace) β€” erase word

🧚 Search Mode

Search mode lets you type in a regular expression to search the current buffer.

the key bindings for search mode are mostly the same as command mode, plus these extra keys:

  • M-c β€” toggle the case sensitive search option.
  • M-r β€” reverse the search direction.
  • Enter β€” perform the regex search.
  • M-Enter β€” perform a plain-text search (it escapes the regex for you 🫢).

✨ ENVIRONMENT ✨

these environment variables get inspected at startup:

  • DTE_HOME β€” the user configuration directory. defaults to $HOME/.dte if it's not set.
  • HOME β€” the user home directory. used when expanding ~/ in filenames, and also used to figure out the default value for DTE_HOME.
  • XDG_RUNTIME_DIR β€” the directory used to store lock files. defaults to $DTE_HOME if it's not set.
  • TERM β€” the terminal identifier. used to determine which terminal capabilities are supported.
  • COLORTERM β€” enables support for 24-bit terminal colors, if it's set to truecolor. 🌈

✨ FILES ✨

  • $DTE_HOME/rc β€” the user configuration file. see dterc(5) for a full list of available commands and options, or run dte -b rc to see the built-in, default config.
  • $DTE_HOME/syntax/* β€” user syntax files. these override the syntax files that come with the program. see dte-syntax(5) for more info, or run dte -b syntax/dte for a basic example.
  • $DTE_HOME/file-history β€” history of edited files and cursor positions. only used if the file-history option is enabled.
  • $DTE_HOME/command-history β€” history of dterc(5) commands used while in command mode.
  • $DTE_HOME/search-history β€” history of search patterns used while in search mode.
  • $XDG_RUNTIME_DIR/dte-locks β€” list of files currently open in a dte process (if the lock-files option is enabled).

✨ EXIT STATUS ✨

  • 0 β€” program exited normally. slay. πŸ’…
  • 64 β€” command-line usage error (see "synopsis" above).
  • 65 β€” input data error (e.g. data specified by the -s option).
  • 71 β€” operating system error.
  • 74 β€” input/output error.
Note: those exit codes above are set by the editor itself, with values that are in accordance with sysexits(3). the exit code can also be set to values in the range 0..125 by the quit command. so yeah, don't assume it's always one of the five above. πŸ‘€

✨ EXAMPLES ✨

open /etc/passwd with the cursor sitting on line 3:

dte +3 /etc/passwd

run a few commands at startup:

dte -c 'set filetype sh; insert -m "#!/bin/sh\n"'

read a buffer from standard input:

echo 'Hello, World!' | dte

interactively filter a shell pipeline:

echo 'A B C D E F' | tr ' ' '\n' | dte | tac

✨ NOTES ✨

bestie. listen. it is advised to NOT run shell pipelines with multiple interactive programs that try to control the terminal. for example:

echo 'Don't run this example!!' | dte | less

a shell will run these processes in parallel, and then both dte(1) and less will try to control the terminal at the same time, clobbering the input/output of both of them. it's giving chaos, it's giving πŸ’€, it's giving absolutely not. do not.


✨ SEE ALSO ✨

dterc(5), dte-syntax(5)


✨ AUTHORS ✨

  • Craig Barnes
  • Timo Hirvonen

and that's the whole page, bestie!! this one's from February 2021, and it's the DTE(1) manual β€” from the General Commands Manual, iykyk. go forth and edit text, you absolute icon. πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from