Emacs配置文件4
;;普通设置
(setq inhibit-startup-message t);关闭起动时闪屏
(setq visible-bell t);关闭出错时的提示声
(show-paren-mode t);显示括号匹配
;(set-default-font "-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso10646-1");;字体设置
(column-number-mode t);显示列号
(setq frame-title-format "%n%F/%b");在窗口的标题栏上显示文件名称
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq default-frame-alist '((height . 25) (width . 80) (menu-bar-lines . 80) (tool-bar-lines . 80)));设置窗口启动大小
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(setq-default make-backup-files nil);;不要生成临时文件
(setq x-select-enable-clipboard t);;允许emacs和外部其他程序的粘贴
(setq mouse-yank-at-point t);支持中键粘贴
;(show-paren-mode 't); 高亮显示匹配括号
;;自动插入匹配的括号
;; enable skeleton-pair insert globally
(setq skeleton-pair t)
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
;(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
;;热键设置
(global-set-key [f9] 'delete-window);F9 关闭d当前窗口
(global-set-key [f8] 'other-window);F8窗口间跳转
(global-set-key [(f2)] 'ansi-term);F2 切换到shell模式
;(global-set-key [f3] 'split-window-vertically);F3分割窗口
(global-set-key [f12] 'my-fullscreen);F12 全屏
(global-set-key [(f4)] 'compile);编译
(global-set-key [f5] 'gdb);启动gdb
(global-set-key [(f6)] 'gdb-many-windows);启动窗口gdb
(global-set-key [f1] 'goto-line);设置M-g为goto-line
;(global-set-key [f7] 'other-frame);跳到其它窗格
(global-set-key [(f3)] 'speedbar);打开speedbar
;;显示行号
(load-file "~/dos/emacs/display-line-number.el")
;;(autoload `display-line-number-mode-on "display-line-number" "display mode" t)
(require 'display-line-number)
(global-display-line-number-mode t)
;;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 3))
(defun down-slightly () (interactive) (scroll-down 3))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
;;代码折
(add-hook 'c-mode-common-hook 'hs-minor-mode)
(add-hook 'c++-mode-common-hook 'hs-minor-mode)
;全屏
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0)))
;;配色方案
(load-file "~/dos/emacs/color-theme.el")
(require 'color-theme)
;(add-hook 'c-mode-common-hook 'color-theme-taylor)
;(add-hook 'c++-mode-common-hook 'color-theme-taylor)
;;打开多缓冲区
(load-file "~/dos/emacs/tabbar.el")
(require 'tabbar)
(global-set-key (kbd "<left>") 'tabbar-backward-tab)
(global-set-key (kbd "<right>") 'tabbar-forward-tab)
(global-set-key (kbd "<up>") 'tabbar-forward-group)
(global-set-key (kbd "<down>") 'tabbar-backward-group)
;;自动补全
(load-file "~/dos/emacs/msf-abbrev.el")
;; ensure abbrev mode is always on
(setq-default abbrev-mode t)
;; do not bug me about saving my abbreviations
(setq save-abbrevs nil)
;; load up modes I use
(require 'cc-mode)
(require 'perl-mode)
(require 'cperl-mode)
(require 'sh-script)
(require 'shell)
;(require 'tex-site) ;; I use AUCTeX
;(require 'latex) ;; needed to define LaTeX-mode-hook under AUCTeX
;(require 'tex) ;; needed to define TeX-mode-hook under AUCTeX
;; (require 'python) ;; I use python.el from Emacs CVS, uncomment if you do also
;; load up abbrevs for these modes
(require 'msf-abbrev)
(setq msf-abbrev-verbose t) ;; optional
(setq msf-abbrev-root "~/dos/emacs/mode-abbrevs")
(global-set-key (kbd "C-c l") 'msf-abbrev-goto-root)
(global-set-key (kbd "C-c a") 'msf-abbrev-define-new-abbrev-this-mode)
(msf-abbrev-load)
;;导入cscope
(load-file "~/dos/emacs/cscope-15.6/contrib/xcscope/xcscope.el")
;(add-to-list 'load-path "~/dos/emacs/cscope-15.6/contrib/xcscope")
(require 'xcscope) ;;加载xcscope
;;导入cedet
(load-file "~/dos/emacs/cedet-1.0pre4/common/cedet.el")
;(add-to-list 'load-path "~/dos/emacs/cedet-1.0pre4/common/cedet.el")
(require 'cedet) ;;加载cedet
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;(semantic-load-enable-minimum-features)
;(semantic-load-enable-code-helpers)
;(semantic-load-enable-guady-code-helpers)
;(semantic-load-enable-excessive-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)
;;导入ecb
(add-to-list 'load-path "~/dos/emacs/ecb-2.32")
(require 'ecb)
;;;删除一行
(defun zl-delete-line nil
"delete the whole line"
(interactive)
(beginning-of-line);光标移动到行首
(push-mark);做个标记
(beginning-of-line 2);移动到下一行行首
(kill-region (point) (mark)));光标和标记之间的删掉
(global-set-key (kbd "M-k") 'zl-delete-line);删除一行
;;语言风格
(defun program-mode()
(setq tab-width 8 indent-tabs-mode nil)
;;下面这句是自动换行
; (c-toggle-auto-hungry-state 1)
(c-set-style "stroustrup"))
(add-hook 'c-mode-common-hook 'program-mode)
(add-hook 'c++-mode-common-hook 'program-mode)
;;auctex
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-hook 'LaTeX-mode-hook #'LaTeX-install-toolbar)
(add-hook 'LaTeX-mode-hook 'outline-minor-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
(setq TeX-auto-save t)
(setq TeX-parse-self t)
本文出自 “cmdblock” 博客,谢绝转载!