Saturday, April 9, 2011

How to configure cygwin to use ctrl + arrow to move cursor forward / backward

If you have used Windows for a while, you probably feel more comfortable using ctrl + left arrow and ctrl + right arrow to navigate the cursor through words. The default behavior in bash however is to use alt+f and alt+b. If you don't want to train yourself to learn yet another shortcut, follow three easy steps below to configure cygwin key bindings to use ctrl + left and ctrl + right.

  1. Modify existing or create a new file called .inputrc under your cygwin home directory
  2. Add the following lines:

    "\e[1;5C": forward-word   # ctrl + right
    "\e[1;5D": backward-word  # ctrl + left 
    

  3. Save the file and restart cygwin

5 comments: