1edlin(3)                   Erlang Module Definition                   edlin(3)
2
3
4

NAME

6       edlin - Line and input interpretter for the erlang shell.
7

DESCRIPTION

9       This  module  reads  input, handles any escape sequences that have been
10       configured via edlin_key and outputs action requests.  The  action  re‐
11       quests are handled either by modules group or the user_drv.
12

KEY CONFIGURATION

14       You can setup a custom key configuration that overrides the default key
15       configuration. This is done by setting the stdlib application parameter
16       shell_keymap  before  Erlang  is  started. If you want to have the same
17       keymap in all Erlang shells you can do so by putting a config  file  in
18       your  user's  home  directory  and  then  set  ERL_FLAGS  to load it at
19       startup. For example:
20
21       $ cat $HOME/.erlang_keymap.config
22       [{stdlib,
23         [{shell_keymap,
24           #{ normal => #{ "\^[A" => clear } }
25         }]
26       }].
27       $ ERL_FLAGS="-config $HOME/.erlang_keymap" erl
28
29
30       The current keymap configuration can be fetched through edlin:keymap().
31       If  a custom keymap or keymap file is specified, then it will be merged
32       with the default keymap.
33
34       The keymap is a map of maps where the keys in  the  parent  map  corre‐
35       sponds  to  different  editing modes in the shell. The valid modes cur‐
36       rently supported are normal and search.
37
38       The keys in the child maps are the escape sequences that are sent  from
39       the  terminal when a key is pressed and each value is a valid action as
40       seen below.
41
42       The default atom is used to specify that an action should happen when a
43       key is pressed that does not have any mapping. Typically used to exit a
44       mode.
45
46       See tty - A Command-Line Interface for more information about  the  de‐
47       fault keymap.
48

ACTIONS

50       The commands below are the built-in action requests for switching input
51       modes on the normal shell or navigating, or manipulating the line feed.
52       The line feed supports multiple lines.
53
54         auto_blink:
55           Automatically close the closest matching opening parenthesis.
56
57         backward_char:
58           Move backward one character.
59
60         backward_delete_char:
61           Delete the character behind the cursor.
62
63         backward_delete_word:
64           Delete the word behind the cursor.
65
66         backward_kill_line:
67           Delete  all characters from the cursor to the beginning of the line
68           and save them in the kill buffer.
69
70         backward_kill_word:
71           Delete the word behind the cursor and save it in the kill buffer.
72
73         backward_line:
74           Move backward one line.
75
76         backward_word:
77           Move backward one word.
78
79         beginning_of_expression:
80           Move to the beginning of the expression.
81
82         beginning_of_line:
83           Move to the beginning of the line.
84
85         clear:
86           Clear the screen.
87
88         clear_line:
89           Clear the current expression.
90
91         end_of_expression:
92           Move to the end of the expression.
93
94         end_of_line:
95           Move to the end of the line.
96
97         forward_char:
98           Move forward one character.
99
100         forward_delete_char:
101           Delete the character under the cursor.
102
103         forward_line:
104           Move forward one line.
105
106         forward_word:
107           Move forward one word.
108
109         history_down:
110           Move to the next item in the history.
111
112         history_up:
113           Move to the previous item in the history.
114
115         kill_line:
116           Delete all characters from the cursor to the end of  the  line  and
117           save them in the kill buffer.
118
119         kill_word:
120           Delete the word under the cursor and save it in the kill buffer.
121
122         new_line_finish:
123           Add  a  newline at the end of the line and try to evaluate the cur‐
124           rent expression.
125
126         newline:
127           Add a newline at the cursor position.
128
129         open_editor:
130           Open the current line in an editor e.g. EDITOR="code  -w"  opens  a
131           buffer  in vs code. Note that you need to pass a flag to the editor
132           so that it signals the shell when you close the buffer.
133
134         redraw_line:
135           Redraw the current line.
136
137         search_cancel:
138           Cancel the current search.
139
140         search_found:
141           Accept the current search result and submit it.
142
143         search_quit:
144           Accept the current search result, but edit it before submitting.
145
146         search:
147           Enter search mode, search the history.
148
149         search_down:
150           Skip to the next line in  the  history  that  matches  the  current
151           search expression.
152
153         search_up:
154           Skip  to  the previous line in the history that matches the current
155           search expression.
156
157         tab_expand_full:
158           Output all possible tab completions.
159
160         tab_expand_quit:
161           Go back to normal mode.
162
163         tab_expand:
164           Autocomplete the current word, or show 5 lines of possible  comple‐
165           tions.
166
167         transpose_char:
168           Swap the character behind the cursor with the one in front of it.
169
170         transpose_word:
171           Swap the word behind the cursor with the one in front of it.
172
173         yank:
174           Insert the contents of the kill buffer at the cursor position.
175

DATA TYPES

177       keymap() = #{atom() => #{string() | default => atom()}}
178
179              A map of maps for each shell mode containing key, action pairs.
180

EXPORTS

182       keymap() -> keymap()
183
184              Types:
185
186                 keymap() = #{atom() => #{string() | default => atom()}}
187
188              Get the current keymap used in the shell. Each key in the parent
189              map represents a shell mode e.g. normal or search. Each map  as‐
190              sociated with the shell modes contains key sequences represented
191              as strings, paired with an action, which is one of the valid ac‐
192              tions mentioned above.
193
194
195
196Ericsson AB                      stdlib 5.1.1                         edlin(3)
Impressum