How can I configure ~/.emacs so that I indent how nano does by default?

  • Uses a tab character instead of 5 spaces
  • I can add as many tabs to a line as I please

I added the following to ~/.emacs:

(setq-default indent-tabs-mode t)
(setq backward-delete-char-untabify-method nil)
(setq indent-tabs-mode t)

(defun my-insert-tab-char ()
"Insert a tab char. (ASCII 9, \t)"
(insert "\t"))
(global-set-key (kbd "TAB") 'my-insert-tab-char) ; same as Ctrl+i

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.