Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/themes/anima/includes/loop.php on line 296

Emacs 基礎設定

  • ~/.emacs.d/init.el : Emacs 設定檔
  • 從 Emacs 24 版本以後,可以使用 package 套件
  • 預設 package-archives 是 ((“gnu” . “https://elpa.gnu.org/packages/“))
  • 建議加入 melpa (“melpa” . “https://melpa.org/packages/“)
  • use-package 可以自動安裝套件及管理套件,使用 :mode 可以延遲載入套件,讓整個 Emacs 快速啟動

Youtube 影片

Package 設定

(require ‘package)

(add-to-list ‘package-archives ‘("melpa" . "https://melpa.org/packages/"))
(add-to-list ‘package-archives ‘("marmalade" . "http://marmalade-repo.org/packages/"))

(package-initialize)
;;
;; use-package
;;
(unless (package-installed-p ‘use-package)
(package-refresh-contents)
(package-install ‘use-package))

(use-package diminish :ensure t)
(use-package bind-key :ensure t)

自動套件更新

(use-package auto-package-update
:config
(setq auto-package-update-delete-old-versions t)
(setq auto-package-update-hide-results t)
(auto-package-update-maybe))

基本設定

(menu-bar-mode -1)

(show-paren-mode t)
(electric-pair-mode t)
(setq electric-pair-pairs
‘(
(?\’ . ?\’)
))

(setq-default indent-tabs-mode nil)

(winner-mode t)

設定客製化參數檔案

(setq custom-file "~/.emacs.d/custom.variables.el")
(load custom-file)

設定自動儲存及備份目錄

(defconst emacs-tmp-dir (format "%s/%s%s/" temporary-file-directory "emacs" (user-uid)))
(setq backup-directory-alist
`((".*" . ,emacs-tmp-dir)))
(setq auto-save-file-name-transforms
`((".*" ,emacs-tmp-dir t)))
(setq auto-save-list-file-prefix emacs-tmp-dir)

兩個次模式幫助寫程式

  • hideshow mode: 程式折疊
  • multiple cursors: 多重游標

(add-hook ‘prog-mode-hook #’hs-minor-mode)

(use-package multiple-cursors
:ensure t
:bind (
("M-3" . mc/mark-next-like-this)
("M-4" . mc/mark-previouse-like-this)
:map ctl-x-map
("\C-m" . mc/mark-all-dwim)
("<return>" . mule-keymap)
))

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *