Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to bind TAB so that it outputs 2 space characters? I know you can do this in a text editor like Vim, but I wanted to carry over this functionality to cat >>.

share|improve this question
up vote 1 down vote accepted

Not at the xmodmap level. You could make a program grab the key and inject two spaces into the focused window. Or you could configure your terminal emulator to do the transformation. For example, in xterm, you'd do it with a resource setting:

XTerm.VT100.translations: #override \
    ~Ctrl ~Meta ~Shift <Key>Tab: string("  ")

However, I definitely recommend against this. You'd lose the ability to use Tab for anything else, such as completion in shells and other text mode programs.

share|improve this answer

Your Answer


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.