http://docstore.mik.ua/orelly/linux/lnut/ch08_07.htm
Emacs mode
Esc, . or Alt + . Insert last word in previous command line after pointEsc, Ctrl + H or Ctrl+w - cut the word before cursor
Esc, d or Alt + d - cut the word after cursor
Ctrl + k - cut the all words after cursor
Ctr+y - paste the world cut in one of the previous commands
Alt + b - Move backward one word
Alt + f - Move forward one word
Alt+U - Change word to uppercase
Alt+L - Change word to lowercase
Alt+c - change character to uppercase
Cursor Positioning Commands (Emacs Mode)
| Command | Description |
|---|---|
| Ctrl-B | Move cursor back (left) one character. |
| Ctrl-F | Move cursor forward (right) one character. |
| Esc b or Alt + b | Move cursor back one word. |
| Esc f or Alt + f | Move cursor forward one word. |
| Ctrl-A | Move cursor to beginning of line. |
| Ctrl-E | Move cursor to end of line. |
Text Deletion Commands (Emacs Mode)
| Command | Description |
|---|---|
| Del or Ctrl-H | Delete character to left of cursor. |
| Ctrl-D | Delete character under cursor. |
| Esc d | Delete word. |
| Esc Del or Esc Ctrl-H | Delete word backward. |
| Ctrl-K | Delete from cursor to end-of-line. |
| Ctrl-U | Delete entire line. |
Command Control (Emacs Mode)
| Command | Description |
|---|---|
| Ctrl-P | Previous command. |
| Ctrl-N | Next command. |
| Up arrow | Previous command. |
| Down arrow | Next command. |
| cmd-fragment Esc p | Search history for cmd-fragment, which must be the beginning of a command. |
| cmd-fragment Esc n | Like Esc p, but search forward. |
| Esc num | Repeat next command num times. |
| Ctrl-Y | Yank previously deleted string. |
vi mode
vi mode has two submodes, insert mode and command mode. The default mode is insert. You can toggle modes by pressing Esc; alternatively, in command mode, typing a (append) or i (insert) will return you to insert mode.Tables 8-4 through 8-10 describe the editing keystrokes available in vi mode.
Commands Available (vi's Insert and Command Mode)
| Command | Description |
|---|---|
| Ctrl-P | Previous command |
| Ctrl-N | Next command |
| Up arrow | Previous command |
| Down arrow | Next command |
| Esc | Toggle mode |
Editing Commands (vi Insert Mode)
| Command | Description |
|---|---|
| Ctrl-B | Move cursor back (left) one character. |
| Ctrl-F | Move cursor forward (right) one character. |
| Ctrl-A | Move cursor to beginning of line. |
| Ctrl-E | Move cursor to end-of-line. |
| DEL or Ctrl-H | Delete character to left of cursor. |
| Ctrl-W | Delete word backward. |
| Ctrl-U | Delete from beginning of line to cursor. |
| Ctrl-K | Delete from cursor to end-of-line. |
Cursor Positioning Commands (vi Command Mode)
| Command | Description |
|---|---|
| h or Ctrl-H | Move cursor back (left) one character. |
| l or SPACE | Move cursor forward (right) one character. |
| w | Move cursor forward (right) one word. |
| b | Move cursor back (left) one word. |
| e | Move cursor to next word ending. |
| W, B, E | Like w, b, and e, but treat just whitespace as word separator instead of any non-alphanumeric character. |
| ^ or Ctrl-A | Move cursor to beginning of line (first nonwhitespace character). |
| 0 | Move cursor to beginning of line. |
| $ or Ctrl-E | Move cursor to end-of-line. |
Text Insertion Commands (vi Command Mode)
| Command | Description |
|---|---|
| a | Append new text after cursor until Esc. |
| i | Insert new text before cursor until Esc. |
| A | Append new text after end of line until Esc. |
| I | Insert new text before beginning of line until Esc. |
Text Deletion Commands (vi Command Mode)
| Command | Description |
|---|---|
| x | Delete character under cursor. |
| X or Del | Delete character to left of cursor. |
| dm | Delete from cursor to end of motion command m. |
| D | Same as d$. |
| Ctrl-W | Delete word backward. |
| Ctrl-U | Delete from beginning of line to cursor. |
| Ctrl-K | Delete from cursor to end of line. |
Text Replacement Commands (vi Command Mode)
| Command | Description |
|---|---|
| cm | Change characters from cursor to end of motion command m until Esc. |
| C | Same as c$. |
| rc | Replace character under cursor with character c. |
| R | Replace multiple characters until Esc. |
| s | Substitute character under cursor with characters typed until Esc. |
Character-Seeking Motion Commands (vi Command Mode)
| Command | Description |
|---|---|
| fc | Move cursor to next instance of c in line. |
| Fc | Move cursor to previous instance of c in line. |
| tc | Move cursor just before next instance of c in line. |
| Tc | Move cursor just after previous instance of c in line. |
| ; | Repeat previous f or F command. |
| , | Repeat previous f or F command in opposite direction. |


No comments:
Post a Comment