edlin(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– 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 -w matters, 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 to normal mode.
  • 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