Skip to content

Commit 1e4a88e

Browse files
committed
doc: new text-editor topic for cli
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent ba25914 commit 1e4a88e

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

doc/cli/quick.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ keybindings are really useful to learn!
2121
| `help introduction` | An introduction to the CLI |
2222
| `help keybindings` | Lists keybindings and other helpful tricks |
2323
| `help tutorial` | The CLI User Guide |
24+
| `help text-editor` | Help with the built-in text-editor command |
2425

26+
> In `configure` context the `help setting` command shows the YANG
27+
> description text for each node and container. To reach the admin
28+
> exec help from configure context, e.g., `do help text-editor`
2529

doc/cli/text-editor.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Text Editor
2+
3+
The CLI built-in `text-editor` command can be used to edit type `binary`
4+
settings in configure context.
5+
6+
The default editor is a Micro Emacs clone. Users not familiar with
7+
terminal based editors may benefit from this introduction.
8+
9+
10+
## Escape Meta/Alt Control Shift
11+
12+
When starting up, the editor status field at the bottom shows the
13+
following shorthand:
14+
15+
```
16+
C-h q quick help | C-h t tutorial | C-h b key bindings | C = Ctrl | M = Alt
17+
```
18+
19+
Key combinations with a `-` (dash) mean holding down the modifier key.
20+
Combinations without a `-` (dash) mean without any modifier key.
21+
22+
### Quick help `C-h q`
23+
24+
- hold down the `Ctrl` key on
25+
- tap the `h` key
26+
- release `Ctrl`
27+
- tap the `q` key
28+
29+
The bottom part of the terminal now shows a "buffer" called `*quick*`:
30+
31+
```
32+
FILE BUFFER WINDOW MARK/KILL MISC
33+
C-x C-c exit C-x b switch C-x 0 only other C-space mark C-_ undo
34+
C-x C-f find C-x k close C-x 1 only this C-w kill-rg C-s search
35+
C-x C-s save C-x C-b list C-x 2 split two C-k kill-ln C-r r-search
36+
C-x s save-all C-x h mark C-x ^ enlarge C-y yank M-% replace
37+
C-x i insert C-x g goto-ln C-x o other win C-x C-x swap M-q reformat
38+
```
39+
40+
### Save & Exit `C-x C-c`
41+
42+
- Hold down the Ctrl key
43+
- tap `X`
44+
- tap `c`
45+
- release `Ctrl`
46+
47+
> The status field at the bottom asks if you are really sure, and/or if
48+
> you want to add a final Enter/newline to the file. For binary content
49+
> that final newline may be important.
50+
51+
52+
## Changing the Editor
53+
54+
The system has three different built-in editors:
55+
56+
- `emacs` (Micro Emacs)
57+
- `nano` (GNU Nano)
58+
- `vi` (Visual Editor)
59+
60+
Changing editor is done in configure context, in the system container:
61+
62+
```
63+
admin@host:/> configure
64+
admin@host:/config/> edit system
65+
admin@host:/config/system/> set text-editor <TAB>
66+
emacs nano vi
67+
admin@host:/config/system/> set text-editor nano
68+
admin@host:/config/system/> leave
69+
admin@example:/>
70+
```

src/klish-plugin-infix/xml/infix.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,19 @@
123123
<COMMAND name="help" help="Help system (try also the '?' key)">
124124
<PARAM name="topic" ptype="/STRING" min="0" help="Help topic">
125125
<COMPL>
126+
<ACTION sym="printl">introduction</ACTION>
126127
<ACTION sym="printl">keybindings</ACTION>
128+
<ACTION sym="printl">text-editor</ACTION>
127129
<ACTION sym="printl">tutorial</ACTION>
128-
<ACTION sym="printl">introduction</ACTION>
129130
</COMPL>
130131
</PARAM>
131132
<ACTION sym="script">
132133
topic=${KLISH_PARAM_topic:-quick}
133134
fn="/usr/share/infix/cli/${topic}.md"
134135
if [ -f "$fn" ]; then
135-
lowdown -t term "$fn"
136+
lowdown -t term --term-vmargin=1 "$fn"
136137
else
137-
echo "Topic not available."
138+
echo "Topic not available."
138139
fi
139140
</ACTION>
140141
</COMMAND>

0 commit comments

Comments
 (0)