Hacker News new | ask | show | jobs
by louib 2197 days ago
The vi mode for Bash. Blew my mind when I discovered it and it probably saved me hundreds of hours already. I used to have multiple copies of this cheatsheet [0] at my desk for every new developer I would see editing a terminal command with the left and right arrows.

[0] https://catonmat.net/ftp/bash-vi-editing-mode-cheat-sheet.pd...

2 comments

I dunno, I don't think it really gets you more than just adding some basic mappings

    # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
    "\e[1;5C": forward-word
    "\e[1;5D": backward-word
    "\e[5C": forward-word
    "\e[5D": backward-word
    "\e\e[C": forward-word
    "\e\e[D": backward-word

    ## arrow up
    "\e[A":history-search-backward
    ## arrow down
    "\e[B":history-search-forward
Holy shit. Thank you.