Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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

 
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.