Emacs 配置文件

来源:互联网 发布:划痕检测算法 编辑:程序博客网 时间:2024/05/21 23:51
;;支持鼠标滚轮
;;(mouse-wheel-mode t)

;;色彩模式
;; color-theme.el
(require 'color-theme)
(color-theme-tty-dark)

;;支持模板文件
;; template.el
(require 'template)
(template-initialize)

;;支持整行操作
;; screen-lines.el
(autoload 'screen-lines-mode "screen-lines"
"Toggle Screen Lines minor mode for the current buffer." t)
(autoload 'turn-on-screen-lines-mode "screen-lines"
"Turn on Screen Lines minor mode for the current buffer." t)
(autoload 'turn-off-screen-lines-mode "screen-lines"
"Turn off Screen Lines minor mode for the current buffer." t)

;;显示行号
;; line-num.el
(require 'line-num)

;;导出为 html 代码文件
;; htmlize.el
(require 'htmlize)

;;折叠代码
;; hideshow.el
(require 'hideshow)
(add-hook 'c++-mode-hook 'hs-minor-mode)

;;快捷键
;; Meta
(global-set-key [?/M- ] 'set-mark-command);
(global-set-key [?/M-g] 'goto-line);

;; Function Keys
(global-set-key [f6] 'bs-show)
(global-set-key [f7] 'compile)
(global-set-key [(control tab)] 'bs-cycle-next)

;;将备份文件放入指定文件夹
;; cancel backup
(setq backup-directory-alist '(("." . "~/Backups")))

;;设置代码样式
;; coding style
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "stroustrup")
(imenu-add-menubar-index)))
;; (c-toggle-auto-state)))

(add-hook 'c++-mode-hook
'(lambda ()
(c-set-style "stroustrup")
(imenu-add-menubar-index)))
;; (c-toggle-auto-state)))

;;
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq frame-title-format "Emacs@%b")
(tool-bar-mode nil)
(setq inhibit-startup-message t)
(setq cursor-in-non-selected-windows nil)
(setq default-cursor-type 'bar)
(set-scroll-bar-mode 'right)
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;设置中文字体
(if window-system
(create-fontset-from-fontset-spec
"-*-courier-medium-r-normal-*-14-*-*-*-*-*-fontset-gbk,
chinese-gb2312:-*-simsun-medium-r-normal-*-14-*-*-*-*-*-gbk-0*"
t) )

(setq default-frame-alist
(append '(
(font . "fontset-gbk")
(top . 0)
(left . 0)
(width . 110)
(height . 47) ) default-frame-alist) )

(setq x-select-enable-clipboard t)
(set-keyboard-coding-system 'cn-gb)
(set-clipboard-coding-system 'cn-gb)
(set-selection-coding-system 'cn-gb)

(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(bs-default-configuration "files")
'(case-fold-search t)
'(current-language-environment "Chinese-GB")
'(default-input-method "chinese-py-punct")
'(global-font-lock-mode t nil (font-lock)))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
)
原创粉丝点击