Skip to content

Instantly share code, notes, and snippets.

@magichim
Last active April 25, 2019 04:00
Show Gist options
  • Save magichim/47d3bea51c132950dc265fc47b23f8d7 to your computer and use it in GitHub Desktop.
Save magichim/47d3bea51c132950dc265fc47b23f8d7 to your computer and use it in GitHub Desktop.
My basic emacs setting.
(package-initialize)
(setq auto-save-default nil)
;; Not make backup files
(setq make-backup-files nil)
;; Set language environment
(set-language-environment "UTF-8")
;; Show line number
(global-linum-mode t)
;; Custom line number style
(setq linum-format "%4d ")
;; set tab size 4
(setq default-tab-width 4)
;; prevent auto indentation
;;(when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
(global-set-key (kbd "<backtab>") 'un-indent-by-removing-4-spaces)
(defun un-indent-by-removing-4-spaces ()
"remove 4 spaces from beginning of of line"
(interactive)
(save-excursion
(save-match-data
(beginning-of-line)
;; get rid of tabs at beginning of line
(when (looking-at "^\\s-+")
(untabify (match-beginning 0) (match-end 0)))
(when (looking-at "^ ")
(replace-match "")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment