Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use a Mac at home and have changed my modifier keys swapping Command and CTRL, so CTRL+T spawns a new tab in chrome, CTRL+C is copy and so forth. I use Windows/Linux at work and I want a consistent layout between these OSes (not having to consciously switch to Command on OSX and back to CTRL when at work).

I've installed iTerm2 to replace OSX Terminal, this allows me to capture CTRL+W without having it kill the window. I don't know what to bind this shortcut to in order to emulate the default behaviour in bash/puTTY (werase?) where it deletes text before the cursor up to the first space.

find . -name "my.file" -type

CTRL+W would delete '-type' from the above command leaving:

find . -name "my.file"
share|improve this question
    
How about all the other commands? Most of ⌃A-Z and ⌘A-Z are already bound to some action at least in iTerm and Terminal. –  ؘؘؘؘ Dec 18 '11 at 11:30

1 Answer 1

Put this line, quotes and all, in your ~/.inputrc file (you may have to restart Bash after you edit that file):

"\C-w": backward-kill-word
share|improve this answer
    
Doesn't answer the question, as the user swapped control and command, meaning he actually wants to handle command-w. –  Daniel Beck May 21 '12 at 17:13
    
@GregK If your CTRL key can do other things you expect to work in Bash (e.g., CTRL-B moves the cursor back one character) then I believe my answer above will work for you. If not, then Daniel is right. –  Fran May 21 '12 at 17:40
    
@Fran I'll try it out when I get home, thanks –  Greg K May 24 '12 at 16:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.