If I have a tab separated values file, and I say cat it, it nicely renders the file for me all lined up properly. Now if I try to copy paste (using my mouse), to another text editor. The tabs become spaces!?

Is there a terminal emulator that renders tabs as literal tabs, and not as spaces?

Here's a test:

echo -e "first"$'\t'"second"$'\t'"third"$'\n'"1"$'\t'"2"$'\t'"3" > tsv.tsv
cat tsv.tsv

Now try to copy and paste to a GUI text editor.


Terminal emulators based on the vte widget (e.g. gnome-terminal) preserve TABs in this case.

Note that it's limited to the simplest usage scenario only, when the TAB character doesn't advance over already existing content.

Most terminal emulators convert it to spaces because for terminals TAB is not a printable character, it is a control sequence that relocates the cursor. E.g. if you TAB over existing characters, those characters remain there and are not wiped out (not replaced by spaces).

  • Wow. It works. Thanks. Only wish Konsole could do this as well though. – CMCDragonkai May 2 '16 at 14:28

You probably won't find one. In my experience, even the terminals that terminal-emulators are emulating rendered tabs into spaces on display. Certainly you could set tab stops on VT100s, so it was not a hard bound definition of what a tab was on the screen. If you sent the escape sequence to print screen on a real Digital Equipment Corporation VT100, it would send spaces to the printer where tabs had been rendered as spaces.

As an alternate solution, consider opening your tabbed source document in a separate session of your GUI editor. Then select your required text, cut and paste into your target document that you have open in a different session. For instance, I know gvim will copy tab characters into the clipboard.

Whether your particular GUI editor supports it is just a matter of conjecture at this point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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