Forcing emacs to use the tab character instead of a number of spaces

落爺英雄遲暮 提交于 2019-11-28 09:59:04

问题


I recently ran into some trouble with cron and crontab because the text editor I use, emacs, inserts several spaces instead of a tab, when I press the tab key. This issue persists throughout all the major modes, regardless of the tab width set for each mode.

How can emacs be forced to use the tab character instead of tabs composed of multiple spaces?


回答1:


If you want to insert a TAB character, then use C-q TAB. The TAB key is used for a different purpose (mostly to indent/align text/code according to various rules, tho it's also used for various other purposes such as performing completion, skipping from one field to another, etc...).




回答2:


Set the variable indent-tabs-mode. You can do that by customizing the variable with M-x customize-variable, on the fly with M-x set-variable, or in Elisp with the setq function.



来源:https://stackoverflow.com/questions/18970809/forcing-emacs-to-use-the-tab-character-instead-of-a-number-of-spaces

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!