代码主题
;; ----------------------------- color theme ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/emacs/plugins/color theme/")
(require 'color-theme)
(color-theme-initialize)
(color-theme-oswald)
全局配置
;; ----------------------------- global config ----------------------------- ;;
(custom-set-variables '(tool-bar-mode nil)) ;; -*- 删除工具栏 -*-
(custom-set-faces '(default ((t (:family "Monaco"))))) ;; -*- 设置字体 -*-
(global-linum-mode t) ;; -*- 显示行号 -*-
(setq default-make-backup-files nil) ;; -*- 不自动备份 -*-
(setq default-frame-alist '((width . 160) (height . 40))) ;; -*- 设置窗体大小 -*-
(set-frame-parameter (selected-frame) 'alpha '(85 85)) ;; -*- 设置透明度 -*-
(setq inhibit-startup-screen t) ;; -*- 启动界面 -*-
(setq default-buffer-file-coding-system 'utf-8-unix) ;; -*- 设置文件编码 -*-
(set-terminal-coding-system 'utf-8-unix) ;; -*- 设置终端编码 -*-
(set-keyboard-coding-system 'utf-8-unix) ;; -*- 设置输入编码 -*-
(setq-default indent-tabs-mode nil tab-always-indent nil tab-width 4) ;; -*- 使用空格代替缩进 -*-
(setq default-directory "~/Desktop") ;; -*- 默认路径 -*-
(show-paren-mode t) ;; -*- 显示括号匹配, 而不是匹配后短暂的跳到另一个括号 -*-
(setq show-paren-style 'parentheses) ;; -*- 显示括号匹配样式 -*-
(setq-default kill-whole-line t) ;; -*- 使用 C-k 删除整行 -*-
(defalias 'yes-or-no-p 'y-or-n-p) ;; -*- 不要问 yes-or-no,只问 y-or-n -*-
(setq frame-title-format "Emacs@%b %f") ;; -*- 设置 emacs 的标题 -*-
(icomplete-mode t) ;; -*- 在minibuffer里启用自动补全函数和变量 -*-
(setq-default cursor-type 'bar) ;; -*- 光标为竖线 -*-
(global-set-key [f2] 'undo) ;; -*- 撤销 -*-
(global-set-key [f4] 'kill-this-buffer) ;; -*- 关闭当前buffer -*-
(global-set-key [M-left] 'windmove-left) ;; -*- 移动到左边的buffer -*-
(global-set-key [M-right] 'windmove-right) ;; -*- 移动到右边的buffer -*-
(global-set-key [M-up] 'windmove-up) ;; -*- 移动到上边的buffer -*-
(global-set-key [M-down] 'windmove-down) ;; -*- 移动到下边的buffer -*-
(global-set-key [C-tab] 'next-buffer) ;; -*- 切换buffer -*-
自动提示
;; ----------------------------- auto-complete ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/emacs/plugins/auto-complete/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "C:/Program Files/emacs/plugins/auto-complete/ac-dict")
(ac-config-default)
(local-set-key (kbd "M-/") 'semantic-complete-analyze-inline)
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert)
tab标签栏
;; ----------------------------- tabbar ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/emacs/plugins/one/")
(require 'tabbar)
(setq tabbar-ruler-global-tabbar 't) ; If you want tabbar
(require 'tabbar-ruler)
(tabbar-mode 1)
ccl
;; ----------------------------- ccl lisp ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/ccl/")
(setq inferior-lisp-program "wx86cl")
slime
;; ----------------------------- slime ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/emacs/plugins/slime/")
(require 'slime-autoloads)
(slime-setup '(slime-fancy))
(slime-setup '(slime-repl))
(require 'ac-slime)
(add-hook 'slime-mode-hook 'set-up-slime-ac)
(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'slime-repl-mode))
erlang
;; ----------------------------- erlang ----------------------------- ;;
(setq load-path (cons "C:/Program Files/erl5.9.2/lib/tools-2.6.8/emacs" load-path))
(setq erlang-root-dir "C:/Program Files/erl5.9.2")
(setq exec-path (cons "C:/Program Files/erl5.9.2/bin" exec-path))
(require 'erlang-start)
golang
;; ----------------------------- golang ----------------------------- ;;
(setq load-path (cons "C:/Program Files/emacs/plugins/golang" load-path))
(require 'go-mode-load)
(require 'go-autocomplete)
;(speedbar 1)
;(speedbar-add-supported-extension ".go")
(add-hook
'go-mode-hook
'(lambda ()
;; gocode
(auto-complete-mode 1)
(setq ac-sources '(ac-source-go))
;; Imenu & Speedbar
(setq imenu-generic-expression
'(("type" "^type *\\([^ \t\n\r\f]*\\)" 1)
("func" "^func *\\(.*\\) {" 1)))
(imenu-add-to-menubar "Index")
;; Outline mode
(make-local-variable 'outline-regexp)
(setq outline-regexp "//\\.\\|//[^\r\n\f][^\r\n\f]\\|pack\\|func\\|impo\\|cons\\|var.\\|type\\|\t\t*....")
(outline-minor-mode 1)
(local-set-key "\M-a" 'outline-previous-visible-heading)
(local-set-key "\M-e" 'outline-next-visible-heading)
;; Menu bar
(require 'easymenu)
(defconst go-hooked-menu
'("Go tools"
["Go run buffer" go t]
["Go reformat buffer" go-fmt-buffer t]
["Go check buffer" go-fix-buffer t]))
(easy-menu-define
go-added-menu
(current-local-map)
"Go tools"
go-hooked-menu)
;; Other
(setq show-trailing-whitespace t)))
;; helper function
(defun go ()
"run current buffer"
(interactive)
(compile (concat "go run " (buffer-file-name))))
;; helper function
(defun go-fmt-buffer ()
"run gofmt on current buffer"
(interactive)
(if buffer-read-only
(progn
(ding)
(message "Buffer is read only"))
(let ((p (line-number-at-pos))
(filename (buffer-file-name))
(old-max-mini-window-height max-mini-window-height))
(show-all)
(if (get-buffer "*Go Reformat Errors*")
(progn
(delete-windows-on "*Go Reformat Errors*")
(kill-buffer "*Go Reformat Errors*")))
(setq max-mini-window-height 1)
(if (= 0 (shell-command-on-region (point-min) (point-max) "gofmt" "*Go Reformat Output*" nil "*Go Reformat Errors*" t))
(progn
(erase-buffer)
(insert-buffer-substring "*Go Reformat Output*")
(goto-char (point-min))
(forward-line (1- p)))
(with-current-buffer "*Go Reformat Errors*"
(progn
(goto-char (point-min))
(while (re-search-forward "<standard input>" nil t)
(replace-match filename))
(goto-char (point-min))
(compilation-mode))))
(setq max-mini-window-height old-max-mini-window-height)
(delete-windows-on "*Go Reformat Output*")
(kill-buffer "*Go Reformat Output*"))))
;; helper function
(defun go-fix-buffer ()
"run gofix on current buffer"
(interactive)
(show-all)
(shell-command-on-region (point-min) (point-max) "go tool fix -diff"))
cedet ecb
;; ----------------------------- cedet + ecb ----------------------------- ;;
(setq stack-trace-on-error t)
(require 'cedet)
(require 'semantic/analyze)
(provide 'semantic-analyze)
(provide 'semantic-ctxt)
(provide 'semanticdb)
(provide 'semanticdb-find)
(provide 'semanticdb-mode)
(provide 'semantic-load)
(add-to-list 'load-path "C:/Program Files/emacs/plugins/ecb/")
(setq ecb-options-version "2.40"
ecb-auto-compatibility-check nil
ecb-auto-activate t
ecb-tip-of-the-day nil
ecb-windows-witdh 0.1
ecb-fix-window-size t
ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1)
ecb-source-path '("D:/Code/"
"D:/Code/Erlang"
"D:/Code/Lisp"))
(require 'ecb)
(require 'ecb-autoloads)
yasnippet
;; ----------------------------- yasnippet ----------------------------- ;;
(add-to-list 'load-path "C:/Program Files/emacs/plugins/yasnippet/")
(require 'yasnippet)
(setq yas/snippet-dirs '("C:/Program Files/emacs/plugins/yasnippet/snippets"
"C:/Program Files/emacs/plugins/yasnippet/extras/imported"))
(yas/global-mode 1)