The Computer Oracle

How to insert tab character in Text mode?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Unforgiving Himalayas Looping

--

Chapters
00:00 How To Insert Tab Character In Text Mode?
00:29 Accepted Answer Score 85
00:39 Answer 2 Score 4
00:54 Answer 3 Score 4
01:13 Answer 4 Score 1
01:51 Thank you

--

Full question
https://superuser.com/questions/602510/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#emacs #whitespace

#avk47



ACCEPTED ANSWER

Score 85


C-q <tab>

C-q insert the next character as a raw character




ANSWER 2

Score 4


In addition to answer given: Check value of indent-tabs-mode, customize it if needed. Several hooks use it's value doing translations TAB-Blank.




ANSWER 3

Score 4


If you want TAB key to insert a tab character, add this to your ~/.emacs

(global-set-key (kbd "TAB") 'self-insert-command);

More helpful info on emacs + TAB : https://web.archive.org/web/20160312104535/http://vserver1.cscs.lsa.umich.edu/~rlr/Misc/emacs_tabs.htm




ANSWER 4

Score 1


Addition to @Vash2593 answer.

If you want to insert tab to more than one line. You can use indent-rigidly which is bound to C-x TAB. Then you can move the indentation interactively with S-left or S-right.

Or you can supply with emacs universal argument C-u. e.g C-u 4 C-x TAB to add 4 spaces. C-u -4 C-x TAB to remove 4 spaces.

This is very handy when it comes to formatting codes in social forums. Which need 4 spaces indent.