Skip to content

Instantly share code, notes, and snippets.

@ZhouMeichen
Created September 30, 2019 09:58
Show Gist options
  • Save ZhouMeichen/e6f9f483434cad7e0d5e80abf1f3d131 to your computer and use it in GitHub Desktop.
Save ZhouMeichen/e6f9f483434cad7e0d5e80abf1f3d131 to your computer and use it in GitHub Desktop.
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(if window-system
(progn
(tool-bar-mode -1)
(setq frame-title-format '("%b [%m] Emacs " emacs-version))
(set-frame-size (selected-frame) 100 36))
(progn
(menu-bar-mode -1)
(setq ring-bell-function 'ignore)))
;; No tabs when indenting
(setq-default indent-tabs-mode nil)
(global-font-lock-mode t)
(global-linum-mode t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t)
'(package-selected-packages (quote (yaml-mode)))
'(warning-suppress-types (quote ((undo discard-info)))))
(setq backup-inhibited t)
(setq auto-save-default nil)
(setq c-default-style "linux")
(setq c-basic-offset 4)
(setq url-using-proxy t)
(defun comment-or-uncomment-line-or-region ()
"Comments or uncomments the current line or region."
(interactive)
(if (region-active-p)
(comment-or-uncomment-region (region-beginning) (region-end))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))))
(global-set-key "\M-;" 'comment-or-uncomment-line-or-region)
(defun format-xml-region()
(interactive)
(delete-trailing-whitespace)
(goto-char (point-min))
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region (point-min) (point-max) nil)
(untabify (point-min) (point-max)))
(require 'cc-mode)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(add-hook 'c-mode-common-hook
(lambda()
(c-set-offset 'inextern-lang 0)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment