https://github.com/lana-20/fast-cli-nav-ops
A fast way to navigate over command line in a shell program.
https://github.com/lana-20/fast-cli-nav-ops
Last synced: 8 months ago
JSON representation
A fast way to navigate over command line in a shell program.
- Host: GitHub
- URL: https://github.com/lana-20/fast-cli-nav-ops
- Owner: lana-20
- Created: 2023-01-13T22:36:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-14T01:35:03.000Z (over 2 years ago)
- Last Synced: 2024-12-30T09:47:48.793Z (9 months ago)
- Size: 58.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A fast way to navigate over command line in a shell program.
Bash, a common shell, uses the Readline library to implement command line input and navigation.
| Command | Description | Command Type |
--- | --- | --- |
|Ctrl+B|Move back one character.|Essentials|
|Ctrl+F|Move forward one character.|Essentials|
|Ctrl+D|Delete the character underneath the cursor.|Essentials|
|⌫ Delete or ⌫ Backspace|Delete the character to the left of the cursor.|Essentials|
|Ctrl+_, Ctrl+X, Ctrl+U, or Ctrl+/|Undo the last editing command. You can undo all the way back to an empty line.|Essentials|
|Ctrl+A|Move to the start of the line.|Movement|
|Ctrl+E|Move to the end of the line.|Movement|
|⎇ Meta+F, ⎇ Alt+Shift+F or ⎇ Option+Shift+F|Move forward a word, where a word is composed of letters and digits.|Movement|
|⎇ Meta+B, ⎇ Alt+Shift+B or ⎇ Option+Shift+B|Move backward a word.|Movement|
|Ctrl+L|Clear the screen, reprinting the current line at the top.|Movement|
|Ctrl+K|Kill the text from the current cursor position to the end of the line.|Kill & Yank (aka Cut & Paste)|
|⎇ Meta+D, ⎇ Alt+Shift+D, or ⎇ Option+Shift+D|Kill from the cursor to the end of the current word, or, if between words, to the end of the next word. Word boundaries are the same as those used by ⎇ Meta+F.|Kill & Yank (aka Cut & Paste)|
|⎇ Meta+⌫ Delete, ⎇ Alt+Shift+⌫ Delete, or ⎇ Option+Shift+⌫ Delete|Kill from the cursor to the start of the current word, or, if between words, to the start of the previous word. Word boundaries are the same as those used by ⎇ Meta+B.|Kill & Yank (aka Cut & Paste)|
|Ctrl+W|Kill from the cursor to the previous whitespace. This is different from ⎇ Meta+⌫ Delete, because the word boundaries differ.|Kill & Yank (aka Cut & Paste)|
|Ctrl+Y|Yank the most recently killed text back into the buffer at the cursor.|Kill & Yank (aka Cut & Paste)|
|⎇ Meta+Y, ⎇ Alt+Shift+Y, or ⎇ Option+Shift+Y|Rotate the kill-ring, and yank the new top. You can only do this if the prior command is Ctrl+Y or ⎇ Meta+Y.|Kill & Yank (aka Cut & Paste)|Readline can operate in two modes:
- emacs mode (default)
- _vi mode_Switch Bash to use vi mode by typing:
$ set -o vi
In macOS Terminal app (and in [iTerm](https://iterm2.com/) emulator), perform Option+Click to move the cursor. The cursor will move to the clicked position. This also works inside _vim_.
For Max OS X Terminal, you can enable "Use option as meta key" in Settings/Keyboard.
For iTerm, the ⎇ Meta key doesn't work, until the following setting is configured __Preferences > Profiles > Default > Keys > Left/Right option key acts as +Esc__.
For Linux, in the standard Ubuntu terminal, for example, ⎇ Meta is ⎇ Alt+Shift, unless you disable the menu access keyboard shortcuts in which case it is just ⎇ Alt.----
🔗[Bash (Unix shell)](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29)
[GNU Readline](https://en.wikipedia.org/wiki/GNU_Readline)
[GNU Readline Library](https://tiswww.case.edu/php/chet/readline/readline.html#SEC22)
[GNU Readline Documentation](https://www.gnu.org/software/bash/manual/bash.html#Readline-Interaction)
[vi Editor Cheat Sheet](https://github.com/lana-20/fast-cli-nav/blob/main/vi_cheat_sheet.pdf)
[Stackoverflow Discussion](https://stackoverflow.com/questions/657130/fastest-ways-to-move-the-cursor-on-a-terminal-command-line)