Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I insert a tab character in Iterm?

Simply put, I know you can do ctrl+v+tab to insert a physically real tab character in a bash statement. But how do I do the same for iTerm?

like image 585
E.Cross Avatar asked May 16 '12 23:05

E.Cross


People also ask

How do I add a tab in Mac terminal?

So to type a tab character, just type ^V followed by the tab. You can type any character that has a special meaning in the terminal by preceding it with ^V. So to type a tab character, just type ^V followed by the tab.


2 Answers

The answer was to hit control+v, then tab afterwards, not all together! Hope this helps someone.

like image 95
E.Cross Avatar answered Oct 19 '22 13:10

E.Cross


It's not iTerm, but your shell that affects how you''re able to insert a tab.

First, make sure you're in BASH shell: Type the following command:

$ echo $RANDOM $BASH_VERSINFO
23714 3

The first is a random number, and the second should be the BASH Version number. If you get a blank line or just a random number, you're not in the BASH shell, and that's probably one of your issues.

Another thing is to execute this command:

$ set -o
allexport       off
braceexpand     on
emacs           on
errexit         off
errtrace        off
[...]
privileged      off
verbose         off
vi              off
trace           off

The two lines of interest is the emacs and the vi lines. One of those should be on. If they're both off, you can't do the Ctrl-V-Tab to insert a tab character.

When the vi mode is on, it should be Ctrl-V-Tab like you said. With emacs mode on, it is either Ctrl-V-tab, or possibly Ctrl-Q-tab.

However, this isn't an iTerm thing, this is your shell that's doing it.

like image 25
David W. Avatar answered Oct 19 '22 13:10

David W.