Skip to content

Instantly share code, notes, and snippets.

@dezza
Last active October 26, 2020 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dezza/27291e05566824cd8935b28c6d713c1b to your computer and use it in GitHub Desktop.
Save dezza/27291e05566824cd8935b28c6d713c1b to your computer and use it in GitHub Desktop.
emacs term keys and bang #! recall
Table 1. zsh/bash key shortcuts (emacs)
Keys Action Section Info

Ctrl + A|E

Cursor to Start|End

Move

Cursor

Ctrl+X+X

Cursor alternate Start|End

Move

Cursor

Alt + F|B

Cursor word Forward|Backward

Move

Cursor

Alt + Left|Right

Next | Previous word

Move

Word

Alt + Backspace|D

Delete word Backward|Forward

Edit

Word

Ctrl+W

Delete word Backward

Edit

Word

Ctrl + U|K

Delete from cursor to Start|End

Edit

Cursor

Alt+U

Capitalize whole WORD

Edit

Capitalize

Alt+C

Capitalize word

Edit

Capitalize

Alt+T

Swap word with previous

Edit

Swap

Ctrl+T

Swap char with previous

Edit

Swap

Ctrl+Y

Paste from terminal clipboard, any of delete/cut key combos

Edit

Paste

Ctrl + N|P

Forward|Backward command history

History

Command

Alt+.

Paste arg from previous command

History

Arg

Ctrl+X+R

Save text in Ctrl+X+R

Extra

Register

!!

Execute last command

bang

!bang

command !!

Prepend command to last command executed

bang

!bang

!foo

Execute last command starting with foo

bang

!bang

!-2

Execute 2nd (nth) command from recent commands

bang

!bang

!!:sfoobar

s/foo/bar in last command

bang

!bang

!$ or $_

Last word/arg of previous command

bang

!bang

!$:p

Print last word/arg of previous command

bang

!bang

!*

Previous command except for last word/arg

bang

!bang

!*:p

Print last word/arg of previous command

bang

!bang

!#$

Recall last argument (left of) cursor

bang

!bang

!#2

Recall 2nd argument from current line

bang

!bang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment