emacs配置文件3

Emacs配置文件3
;;普通设置
(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-hook 'hs-minor-mode)
(add-hook 'c++-mode-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);删除一行






;;语言风格
;;(add-hook 'c-mode-hook
;;          '(lambda ()
;;             (c-set-style "gnu")))
;;(add-hook 'c++-mode-hook
;;          '(lambda ()
;;             (c-set-style "gnu")))


;(defun my-c-mode-common-hook()
;  (setq tab-width 4 indent-tabs-mode nil)
  ;;; hungry-delete and auto-newline
;  (c-toggle-auto-hungry-state 2)
  ;;按键定义
;  (define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
;  (define-key c-mode-base-map [(return)] 'newline-and-indent)
;  (define-key c-mode-base-map [(f7)] 'compile)
;  (define-key c-mode-base-map [(f8)] 'ff-get-other-file)
;  (define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;  (define-key c-mode-base-map [(tab)] 'hippie-expand)
;  (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
;  (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
  ;;预处理设置
;  (setq c-macro-shrink-window-flag t)
;  (setq c-macro-preprocessor "cpp")
;  (setq c-macro-cppflags " ")
;  (setq c-macro-prompt-flag t)
;  (setq hs-minor-mode t)
;  (setq abbrev-mode t)
;  (setq tab-width 4 indent-tabs-mode nil)
;)
;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;;;我的C++语言编辑策略
;(defun my-c++-mode-hook()
;  (setq tab-width 4 indent-tabs-mode nil)
;  (c-set-style "stroustrup")
;;  (define-key c++-mode-map [f3] 'replace-regexp)
;)

;(add-hook 'c++-mode-hook 'my-c++-mode-hook)

;;;;C/C++语言启动时自动加载semantic对/usr/include的索引数据库
;(setq semanticdb-search-system-databases t)
;  (add-hook 'c-mode-common-hook
;          (lambda ()
;            (setq semanticdb-project-system-databases
;                  (list (semanticdb-create-database
;                           semanticdb-new-database-class
;                           "/usr/include")))))










(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-hook 'program-mode)
;(add-hook 'c-mode-hook 'program-mode)







你可能感兴趣的:(职场,emacs,休闲)