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

Configuring text editor in cygwin bash

In this post I will show you how to edit files with your favorite windows text editor from the cygwin bash command line. My favorite editor is notepad++ and to edit a file from cygwin, I type: ed myFile.txt


Here is what you need to do: