Skip to content

Commit 1c08ecf

Browse files
authored
Add ESC-to-clear keybind to "Coming from CMD" and "Coming from PowerShell" pages (#2136)
1 parent 54cfbd0 commit 1c08ecf

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

book/coming_from_cmd.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,19 @@ Executing `./ver` or `ver.bat` *will* execute the local bat file though.
7373

7474
Note that Nushell has its own [`start` command](/commands/docs/start.md) which takes precedence.
7575
You can call the CMD.EXE's internal `START` command with the external command syntax `^start`.
76+
77+
## Clearing the commandline buffer by pressing ESC
78+
79+
CMD.EXE features the ability to clear the commandline buffer by pressing the ESC key.
80+
81+
While Nu does not replicate this by default, a keybind can be added to your `config.nu` to enable similar functionality:
82+
83+
```nu
84+
$env.config.keybindings ++= [{
85+
name: 'esc_clear'
86+
modifier: 'None'
87+
keycode: 'Esc'
88+
mode: ['Emacs', 'Vi_Normal']
89+
event: {edit: 'Clear'}
90+
}]
91+
```

book/coming_from_powershell.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,19 @@ This means:
6565
| `Get-Location` or `$PWD` | `pwd` or `$env.PWD` | Show current directory |
6666
| `Read-Host` | `let var = input` | Read user input |
6767
| `Read-Host -AsSecureString` | `let secret = input -s` | Read secret input |
68+
69+
## Clearing the commandline buffer by pressing ESC
70+
71+
Legacy versions of PowerShell feature the ability to clear the commandline buffer by pressing the ESC key.
72+
73+
While Nu does not replicate this by default, a keybind can be added to your `config.nu` to enable similar functionality:
74+
75+
```nu
76+
$env.config.keybindings ++= [{
77+
name: 'esc_clear'
78+
modifier: 'None'
79+
keycode: 'Esc'
80+
mode: ['Emacs', 'Vi_Normal']
81+
event: {edit: 'Clear'}
82+
}]
83+
```

0 commit comments

Comments
 (0)