Skip to content

Commit c5e4649

Browse files
committed
Feedback from review
1 parent 08ed206 commit c5e4649

File tree

1 file changed

+54
-36
lines changed

1 file changed

+54
-36
lines changed

book/line_editor.md

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,28 @@ Reedline allows Nushell commandlines to extend across multiple lines. This can b
3333

3434
It can even be used to continue a single command across multiple lines:
3535

36+
::: details Example
37+
3638
```nu
3739
(
38-
ffmpeg
39-
-i input.mp4
40-
-vf "scale=1280:720,setsar=1:1"
41-
-b:v 1500k
42-
-preset veryfast
43-
-crf 23
44-
-c:a aac
45-
-b:a 192k
46-
-movflags +faststart
47-
-y
48-
output.mp4
40+
tar
41+
-cvz
42+
-f archive.tgz
43+
--exclude='*.temp'
44+
--directory=../project/
45+
./
4946
)
5047
```
5148

49+
:::
50+
5251
2. Pressing <kbd>Enter</kbd> at the end of a line with a trailing pipe-symbol (`|`).
5352

5453
```nu
5554
ls |
56-
where name =~ '^[0-9]' | # filenames starting with a digit
57-
get name | # get the filenames
58-
mv ...$in ./backups/ # and move to backups folder
55+
where name =~ '^[0-9]' | # Comments after a trailing pipe are okay
56+
get name |
57+
mv ...$in ./backups/
5958
```
6059

6160
3. Manually insert a newline using <kbd>Alt</kbd>+<kbd>Enter</kbd> or <kbd>Shift</kbd>+<kbd>Enter</kbd>.
@@ -64,9 +63,9 @@ Reedline allows Nushell commandlines to extend across multiple lines. This can b
6463

6564
```nu
6665
ls
67-
| where name =~ '^[0-9]' # filenames starting with a digit
68-
| get name # get the filenames
69-
| mv ...$in ./backups/ # and move to backups folder
66+
| where name =~ '^[0-9]' # Files starting with a digit
67+
| get name
68+
| mv ...$in ./backups/
7069
```
7170

7271
::: tip
@@ -107,6 +106,8 @@ Each edit mode comes with common keybindings for Vi and Emacs text editing.
107106

108107
### Emacs and Vi-insert Keybindings
109108

109+
These keybinding events apply to both Emacs and Vi-insert mode:
110+
110111
| Key | Event |
111112
| ------------------------------------------ | ----------------------------------- |
112113
| <kbd>Shift</kbd>+<kbd>Enter</kbd> | Insert newline |
@@ -122,53 +123,45 @@ Each edit mode comes with common keybindings for Vi and Emacs text editing.
122123
| <kbd>Ctrl</kbd>+<kbd>→</kbd> (Right Arrow) | Move word right |
123124
| <kbd>Ctrl</kbd>+<kbd>←</kbd> (Left Arrow) | Move word left |
124125
| <kbd>↑</kbd> (Up Arrow) | Move up |
125-
| <kbd>Ctrl</kbd>+<kbd>P</kbd> | Move up |
126-
| <kbd>↑</kbd> (Up Arrow) | Move menu up |
127-
| <kbd>Ctrl</kbd>+<kbd>P</kbd> | Move menu up |
128126
| <kbd>↓</kbd> (Down Arrow) | Move down |
129-
| <kbd>Ctrl</kbd>+<kbd>N</kbd> | Move down |
130-
| <kbd>↓</kbd> (Down Arrow) | Move menu down |
131-
| <kbd>Ctrl</kbd>+<kbd>N</kbd> | Move menu down |
132127
| <kbd>←</kbd> (Left Arrow) | Move left |
133-
| <kbd>Ctrl</kbd>+<kbd>B</kbd> | Move left |
134-
| <kbd>←</kbd> (Left Arrow) | Move menu left |
135-
| <kbd>Ctrl</kbd>+<kbd>B</kbd> | Move menu left |
136128
| <kbd>→</kbd> (Right Arrow) | Move right |
129+
| <kbd>Ctrl</kbd>+<kbd>P</kbd> | Move up |
130+
| <kbd>Ctrl</kbd>+<kbd>N</kbd> | Move down |
131+
| <kbd>Ctrl</kbd>+<kbd>B</kbd> | Move left |
137132
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Move right |
138-
| <kbd>→</kbd> (Right Arrow) | Move menu right |
139-
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Move menu right |
140133
| <kbd>→</kbd> (Right Arrow) | History-hint complete |
141134
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | History-hint complete |
142135
| <kbd>Alt</kbd>+<kbd>F</kbd> | History-hint complete one word |
143136
| <kbd>Alt</kbd>+<kbd>←</kbd> (Left Arrow) | History-hint complete one word less |
144137

145138
### Vi-insert Keybindings
146139

140+
These keybinding events apply only to Vi-insert mode:
141+
147142
| Key | Event |
148143
| -------------- | ------------------------ |
149144
| <kbd>Esc</kbd> | Switch to Vi-normal mode |
150145

151146
### Vi-normal Keybindings
152147

148+
These keybinding events apply only to Vi-normal mode:
149+
153150
| Key | Event |
154151
| ------------------------------------------- | ------------------- |
155152
| <kbd>Ctrl</kbd>+<kbd>C</kbd> | Cancel current line |
156153
| <kbd>Ctrl</kbd>+<kbd>L</kbd> | Clear screen |
157-
| <kbd>↑</kbd> (Up Arrow) | Move menu up |
158154
| <kbd>↑</kbd> (Up Arrow) | Move up |
159-
| <kbd>↓</kbd> (Down Arrow) | Move menu down |
160155
| <kbd>↓</kbd> (Down Arrow) | Move down |
161-
| <kbd>←</kbd> (Left Arrow) | Move menu left |
162156
| <kbd>←</kbd> (Left Arrow) | Move left |
163-
| <kbd>→</kbd> (Right Arrow) | Move menu right |
164157
| <kbd>→</kbd> (Right Arrow) | Move right |
165158
| <kbd>Ctrl></kbd>+<kbd>→</kbd> (Right Arrow) | Move right one word |
166159
| <kbd>Ctrl></kbd>+<kbd>←</kbd> (Left Arrow) | Move left one word |
167160

168-
As with Vi, many motions and actions can be combined with an optional count in normal-mode. For example, <kbd>3</kbd><kbd>d</kbd><kbd>w</kbd> deletes the next three words.
169-
170161
### Vi-normal Motions
171162

163+
As with Vi, many motions and actions can be combined with an optional count in normal-mode. For example, <kbd>3</kbd><kbd>d</kbd><kbd>w</kbd> deletes the next three words.
164+
172165
| Key | Motion |
173166
| -------------------------------------- | --------------------------------------------- |
174167
| <kbd>w</kbd> | Move to beginning of next word |
@@ -187,6 +180,8 @@ As with Vi, many motions and actions can be combined with an optional count in n
187180

188181
### Vi-normal Actions
189182

183+
These actions can be combined with many of the [motions above](#vi-normal-motions).
184+
190185
| Key | Action |
191186
| ----------------------------- | -------------------------------------------------- |
192187
| <kbd>d</kbd> | Delete |
@@ -585,15 +580,38 @@ e.g. to disable screen clearing with `Ctrl + l` for all edit modes
585580

586581
### Troubleshooting Keybinding Problems
587582

588-
Your terminal environment may not always propagate your key combinations on to nushell the way you expect it to.
589-
You can use the command [`keybindings listen`](/commands/docs/keybindings_listen.md) to figure out if certain keypresses are actually received by nushell, and how.
583+
Your terminal environment may not always propagate your key combinations on to Nushell the way you expect it to. You can use the command [`keybindings listen`](/commands/docs/keybindings_listen.md) to determine if certain keypresses are actually received by Nushell, and how.
590584

591585
## Menus
592586

593587
Thanks to Reedline, Nushell has menus that can help you with your day to day
594588
shell scripting. Next we present the default menus that are always available
595589
when using Nushell
596590

591+
### Menu Keybindings
592+
593+
When a menu is active, some keybindings change based on the keybinding [`until` specifier](#until-type) discussed above. Common keybindings for menus are:
594+
595+
| Key | Event |
596+
| ------------------------------- | -------------------- |
597+
| <kbd>Tab</kbd> | Select next item |
598+
| <kbd>Shift</kbd>+<kbd>Tab</kbd> | Select previous item |
599+
| <kbd>Enter</kbd> | Accept selection |
600+
| <kbd>↑</kbd> (Up Arrow) | Move menu up |
601+
| <kbd>↓</kbd> (Down Arrow) | Move menu down |
602+
| <kbd>←</kbd> (Left Arrow) | Move menu left |
603+
| <kbd>→</kbd> (Right Arrow) | Move menu right |
604+
| <kbd>Ctrl</kbd>+<kbd>P</kbd> | Move menu up |
605+
| <kbd>Ctrl</kbd>+<kbd>N</kbd> | Move menu down |
606+
| <kbd>Ctrl</kbd>+<kbd>B</kbd> | Move menu left |
607+
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Move menu right |
608+
609+
::: note
610+
Menu direction behavior varies based on the menu type (see below). For example,
611+
in a `description` menu, "Up" and "Down" apply to the "Extra" list, but in a
612+
`list` menu the directions apply to the selection.
613+
:::
614+
597615
### Help Menu
598616

599617
The help menu is there to ease your transition into Nushell. Say you are

0 commit comments

Comments
 (0)