DEV Community

Discussion on: Ctrl+R Autocomplete with Bash is a Life Saver

Collapse
 
jakallergis profile image
John A. Kallergis

Another awesome thing to do is set some key mappings to your terminal (I use the magnificent iTerm) to better navigate through the words in your lines.
Like alt-left to go back a word, or cmd-Del to delete the whole line, or alt-Del to delete just a word, etc.
My most used key mappings (OSX):

Cmd + Left Arrow : Send Hex Codes 0x01 (Start Of Line)
Cmd + Right Arrow : Send Hex Codes 0x05 (End Of Line)
Option + Left Arrow : Send Escape Sequence b (Go Back a Word)
Option + Right Arrow : Send Escape Sequence f (Forward a Word)
Cmd + Del : Send Hex Codes 0x15 (Delete Line)

Collapse
 
redgreenrepeat profile image
Andrew

aren't many of these mapping are built into bash by default?

ctrl-a : beginning of line
ctrl-e : end of line
ctrl-w : delete last word

ctrl-k : cut to end of line
ctrl-y : paste cut item

meta/alt/command-f: move forward a word
meta/alt/command-d: cut forward a word
...?

and on OSX/macOS, some of these mappings are system wide:

redgreenrepeat.com/2016/10/14/extr...