Skip to content

Instantly share code, notes, and snippets.

@dhirajforyou
Created January 8, 2017 17:55
Show Gist options
  • Save dhirajforyou/b310cd4f43adc2f00c2af8f60e30c9b6 to your computer and use it in GitHub Desktop.
Save dhirajforyou/b310cd4f43adc2f00c2af8f60e30c9b6 to your computer and use it in GitHub Desktop.
#It might be the case you have redefined the shortcuts. But this is what the default is.
Ctrl+A: move to the start of the current line
Ctrl+E: move to the end of the line
Alt+F: move to the end of the next word
Alt+B: move to the start of the current or previous word
Ctrl+T: swap the two last characters, e.g.: sl<C-t> → ls
Alt+T: swap the last two words, e.g.: foo bar<M-t> → bar foo
Ctrl+U: cut the text of the current command before the cursor.
Ctrl+W: cut only the word before the cursor.
Ctrl+K: cut the text of the current command after the cursor.
Ctrl+Y: paste the previously cut text after the cursor.
This is useful when you have typed a long command and realize that you forget to do something before, e.g.:
% ./my_long_command -v -u foobar -t -x<C-U>
% ./do_something_before
% <C-Y><enter> # paste and execute ./my_long_command…
Alt+U: uppercase the next word, e.g.: ls<C-a><M-u> → LS
Alt+L: lowercase the next word, e.g.: LS<C-a><M-l> → ls
Alt+C: capitalize the next word, e.g.: foo<C-a><M-c> → Foo
Ctrl+L: clear the screen, leaving the current line at the top.
Ctrl+_: undo (incremental).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment