edlin(3)
π edlin(3) β Erlang Module Definition π
okay bestie, buckle up, this is the edlin era and she's the line + input interpreter for the Erlang shell. literally the little gremlin behind the scenes reading everything you type. β¨
β¨ NAME β¨
edlin β Line and input interpretter for the erlang shell. π
(yes, "interpretter", that's the spelling in the original, we keep it, no notes, periodt)
πΈ DESCRIPTION πΈ
so this module reads input, handles any escape sequences that have been configured via edlin_key, and outputs action requests. those action requests then get handled either by the group module or by user_drv. that's the whole vibe. π¦
π Key configuration π
you can set up a custom key configuration that overrides the default key configuration, which is lowkey iconic behavior. how? by setting the stdlib application parameter shell_keymap before Erlang is started. and if you want the same keymap in all your Erlang shells (yes queen, consistency), you can put a config file in your user's home directory and then set ERL_FLAGS to load it at startup. for example:
$ cat $HOME/.erlang_keymap.config
[{stdlib,
[{shell_keymap,
#{ normal => #{ "\^[A" => clear } }
}]
}].
$ ERL_FLAGS="-config $HOME/.erlang_keymap" erl
the current keymap configuration can be fetched through edlin:keymap(). and heads up π
β if a custom keymap or keymap file is specified, then it will be merged with the default keymap.
the keymap is a map of maps where the keys in the parent map correspond to different editing modes in the shell. the valid modes currently supported are normal and search. (only two rn, they're babygirls.)
the keys in the child maps are the escape sequences that are sent from the terminal when a key is pressed, and each value is a valid action, as seen below. π
the default atom is used to specify that an action should happen when a key is pressed that does not have any mapping. typically used to exit a mode. πͺ
see tty - A Command-Line Interface for more information about the default keymap. go read it, iykyk. π
π¬ Actions π¬
the commands below are the built-in action requests for switching input modes on the normal shell, or navigating, or manipulating the line feed. the line feed supports multiple lines. multi-line? she ate. π₯
auto_blinkβ automatically close the closest matching opening parenthesis. (she closes what you refuse to close π)backward_charβ move backward one character.backward_delete_charβ delete the character behind the cursor.backward_delete_wordβ delete the word behind the cursor.backward_kill_lineβ delete all characters from the cursor to the beginning of the line and save them in the kill buffer.backward_kill_wordβ delete the word behind the cursor and save it in the kill buffer.backward_lineβ move backward one line.backward_wordβ move backward one word.beginning_of_expressionβ move to the beginning of the expression.beginning_of_lineβ move to the beginning of the line.clearβ clear the screen. clean slate energy β¨clear_lineβ clear the current expression.end_of_expressionβ move to the end of the expression.end_of_lineβ move to the end of the line.forward_charβ move forward one character.forward_delete_charβ delete the character under the cursor.forward_lineβ move forward one line.forward_wordβ move forward one word.helpβ display help for the module or function closest on the left of the cursor.help_fullβ display the whole help text for the module or function closest on the left of the cursor.history_downβ move to the next item in the history.history_upβ move to the previous item in the history.kill_lineβ delete all characters from the cursor to the end of the line and save them in the kill buffer.kill_wordβ delete the word under the cursor and save it in the kill buffer.move_expand_downβ move down one line in the expand area, e.g. help or tab completion pager.move_expand_upβ move up one line in the expand area, e.g. help or tab completion pager.new_line_finishβ add a newline at the end of the line and try to evaluate the current expression.newlineβ add a newline at the cursor position.open_editorβ open the current line in an editor, e.g.EDITOR="code -w"opens a buffer in vs code. > note that you need to pass a flag to the editor so that it signals the shell when you close the buffer. (yes, the-wmatters, don't skip it bestie π«Ά)redraw_lineβ redraw the current line.scroll_expand_downβ scroll down five lines in the expand area, e.g. help or tab completion pager.scroll_expand_upβ scroll up five lines in the expand area, e.g. help or tab completion pager.search_cancelβ cancel the current search.search_foundβ accept the current search result and submit it.search_quitβ accept the current search result, but edit it before submitting.searchβ enter search mode, search the history.skip_downβ skip to the next line in the history that matches the current search expression.skip_upβ skip to the previous line in the history that matches the current search expression.tab_expand_fullβ output all possible tab completions.tab_expand_quitβ go back tonormalmode.tab_expandβ autocomplete the current word, or show 5 lines of possible completions.transpose_charβ swap the character behind the cursor with the one in front of it.transpose_wordβ swap the word behind the cursor with the one in front of it.yankβ insert the contents of the kill buffer at the cursor position. the kill buffer comeback tour π€
π§ DATA TYPES π§
keymap() :: #{atom() => #{string() | default => atom()}}.
a map of maps for each shell mode containing key, action pairs. π
β FUNCTIONS β
keymap() -> keymap().
get the current keymap used in the shell. each key in the parent map represents a shell mode, e.g. normal or search. each map associated with the shell modes contains key sequences represented as strings, paired with an action, which is one of the valid actions mentioned above. π
fr fr that's the whole module. go remap your keys and be the main character of your own shell. π β¨
mwah π this page came to you from Ericsson AB, running stdlib 8.0.4, and it's the edlin(3) manual page β thanks for reading, bestie, you're iconic for making it to the end ππ¦π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms