算是通用吧。。部分地方需要一点小修改。盘符,路径,启动屏目等。
;;;先设好启动大小的宽高,要不然,其它的我都受不了.
(setq default-frame-alist '((height . 57) (width . 234) (top . 40) (left . 10)))
;;;工作目录
(setq default-directory "/Volumes/VAR/Workspace/")
;;;缺省为text-mode
(setq default-major-mode 'text-mode)
;;;开机画面
(setq inhibit-startup-message t)
;;;php模式(Mac)
(add-to-list 'load-path "~/elisp")
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
;;;actionscript 3.0 mode
(require 'actionscript-mode)
(autoload 'actionscript-mode "actionscript-mode" "Major mode for editing actionscript code." t)
(add-to-list 'auto-mode-alist '("\\.as$" . actionscript-mode))
;;;显示列号
(setq column-number-mode t)
;;;功能键设定
(global-set-key [f5] 'revert-buffer)
(global-set-key [f4] 'ibuffer)
(global-set-key (kbd "
(global-set-key (kbd "M-g g") 'goto-line)
;;;关闭设配提示声(bell)
(setq visible-bell t)
;;;重定Emacs标题
(setq frame-title-format
'(" GNU Emacs - [ " (buffer-file-name "%f \]"
(dired-directory dired-directory "%b \]"))))
;;;鼠标自动"让位"
(mouse-avoidance-mode 'animate)
;;;括号的匹配显示
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;;全局语法加亮
(global-font-lock-mode t)
;;;编辑时不建立备份文件
(setq make-backup-files nil)
;;;没有滚动条和工具栏
(scroll-bar-mode nil)
(tool-bar-mode nil)
;;;光标闪烁
(blink-cursor-mode nil)
;;;配色方案
(require 'color-theme)
(color-theme-charcoal-black)
;;;超级好用的M-/自动扩展功能(hippie-expand)
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
;;;kill ring 设置
(setq kill-ring-max 200)
;;;会话定位
(require 'session)
(setq session-save-file "~/.emacs.d/_session")
(add-hook 'after-init-hook 'session-initialize)
;;;(setq session-save-file-coding-system 'chinese-gbk) ;;;中文出现乱码,可是会提示utf-8存储,所以先屏闭掉
(add-to-list 'session-globals-exclude 'org-mark-ring)
;;;buffer记录
(desktop-save-mode)
(desktop-load-default)
;;;高亮当前所在行
(global-hl-line-mode)
;;;(ido)小型buffer快速查找
(require 'ido)
(ido-mode t)
;;;(kill ring)无法形容的华丽剪贴板查看..
(require 'browse-kill-ring)
(global-set-key (kbd "C-c k") 'browse-kill-ring)
(browse-kill-ring-default-keybindings)
;;;doxymacs很牛逼的注释块
(require 'doxymacs)
(global-set-key [f7] 'doxymacs-insert-function-comment)
(global-set-key [f6] 'doxymacs-insert-file-comment)
;;;类似的快速bookmarks
(global-set-key [(control ?\.)] 'ska-point-to-register)
(global-set-key [(control ?\,)] 'ska-jump-to-register)
(defun ska-point-to-register()
"Store cursorposition _fast_ in a register.
Use ska-jump-to-register to jump back to the stored
position."
(interactive)
(setq zmacs-region-stays t)
(point-to-register 8))
(defun ska-jump-to-register()
"Switches between current cursorposition and position
that was stored with ska-point-to-register."
(interactive)
(setq zmacs-region-stays t)
(let ((tmp (point-marker)))
(jump-to-register 8)
(set-register 8 tmp)))
;; hides and shows blocks
(add-hook 'c-mode-hook 'hs-minor-mode)
(defun my-hs-hook ()
(define-key hs-minor-mode-map [(control c)(h)] 'hs-hide-block)
(define-key hs-minor-mode-map [(control c)(s)] 'hs-show-block)
(define-key hs-minor-mode-map [(control c)(control h)] 'hs-hide-all)
(define-key hs-minor-mode-map [(control c)(control s)] 'hs-show-all)
)
(add-hook 'hs-minor-mode-hook 'my-hs-hook)