我的Emacs配置备份

效果图:效果图

 

;;loadpath
(add-to-list'load-path "/usr/share/emacs/site-lisp/ecb-2.40")
(load-file "/usr/share/emacs/site-lisp/cedet-1.0pre7/common/cedet.el")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/company-mode.el")
(autoload 'company-mode "company" nil t)
(semantic-load-enable-excessive-code-helpers)
(require 'ecb)
(require 'cedet)
(require 'xcscope)
(setq ecb-auto-activate t)
(setq ecb-tip-of-the-day nil)
(setq ecb-windows-width 0.2)
(define-key global-map "\C-cb" 'windmove-left)
(define-key global-map "\C-cf" 'windmove-right)
(define-key global-map "\C-cp" 'windmove-up)
(define-key global-map "\C-cn" 'windmove-down)
(define-key global-map [(control f1)] 'ecb-hide-ecb-windows)
(define-key global-map [(control f2)] 'ecb-show-ecb-windows)
(define-key global-map "\C-c1" 'ecb-maximize-window-directories)
(define-key global-map "\C-c2" 'ecb-maximize-window-sources)

 

(define-key global-map "\C-c3" 'ecb-maximize-window-methods)
(define-key global-map "\C-c4" 'ecb-maximize-window-history)
(define-key global-map "\C-c`" 'ecb-restore-default-window-sizes)

 


(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(display-time-mode t)
 '(ecb-layout-window-sizes nil)
 '(ecb-options-version "2.40")
 '(inhibit-startup-screen t)
 '(show-paren-mode t))


 ;; 全屏
 (defun my-fullscreen ()
 (interactive)
 (x-send-client-message
  nil 0 nil "_NET_WM_STATE" 32
    '(2 "_NET_WM_STATE_FULLSCREEN" 0)))

  31. ;; 水平最大化
  32. (defun my-maximized-horz ()
  33. (interactive)
  34. (x-send-client-message
  35.    nil 0 nil "_NET_WM_STATE" 32
  36.    '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
  37.

  38. ;; 垂直最大化
  39. (defun my-maximized-vert ()
  40. (interactive)
  41. (x-send-client-message
  42.    nil 0 nil "_NET_WM_STATE" 32
  43.    '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
  44.

  45. ;; 最大化
  46. (defun my-maximized ()
  47. (my-maximized-vert)
  48. (my-maximized-horz))
  49.

 

  57. ;;设置C语言编译命令
  58. (set 'compile-command' "make ")
  59.

  63. ;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线
  64. (mouse-avoidance-mode 'animate)
  65.

  66. ;;支持emacs和外部程序的粘贴
  67. (setq x-select-enable-clipboard t)
  68.

  69. ;;设置背景色和字体色
  70. (set-foreground-color "grey")
  71. (set-background-color "black")
  72.

  73. ;;显示列号
  74. (setq column-number-mode t)
  75.

  76. ;;关闭启动画面
  77. (setq inhibit-startup-message t)
  78.

  79. ;;设置 sentence-end 可以识别中文标点
  80. (setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
  81. (setq sentence-end-double-space nil)
  82.

  83. ;;括号匹配时显示另外一边的括号,而不是烦人的跳到另一个括号
  84. (show-paren-mode t)
  85. (setq show-paren-style 'parentheses)
  86.

  87.

  90. ;;让 Emacs 可以直接打开和显示图片
  91. ;;(auto-image-file-mode)
  92.

  93. ;; 高亮显示要拷贝的区域
  94. (transient-mark-mode t)
  95.

  96. ;;光标显示为一竖线
  97. (setq-default cursor-type 'bar)
  98.

  99. ;;进行语法加亮
 100. (global-font-lock-mode t)
 101.

 102. ;;不产生备份文件
 103. (setq make-backup-files nil)          
 104.

 105. ;;临时文件放到同一个目录下
 106. (setq backup-directory-alist '(("." . "/tmp")))
 107.

 108. ;;用空格代替tab
 109. (setq-default indent-tabs-mode nil)
 110.

 111. ;; 解决emacs shell显示问题
 112. (setq ansi-color-for-comint-mode t)
 113. (customize-group 'ansi-colors)
 114. (kill-this-buffer) ; 关闭设置所产生的定制窗口      
 115.

 116. ;;不显示ecbTip
 117. (setq ecb-tip-of-the-day nil)
 118.

 119. ;; CC-mode配置 http://cc-mode.sourceforge.net/
 120. (require 'cc-mode)
 121. (require 'xcscope)
 122. (c-set-offset 'inline-open 0)
 123. (c-set-offset 'friend '-)
 124. (c-set-offset 'substatement-open 0)
 125.

 126. ;;C/C++语言编辑策略
 127. (setq tab-width 4 indent-tabs-mode nil)
 128. ;; hungry-delete and auto-newline
 129. (c-toggle-auto-hungry-state 1)
 130. ;;按键定义
 131. (define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
 132. (define-key c-mode-base-map [(return)] 'newline-and-indent)
 133. (define-key c-mode-base-map [(f9)] 'compile)
 134. (define-key c-mode-base-map [(meta \`)] 'c-indent-command)
 135. ;;(define-key c-mode-base-map [(tab)] 'hippie-expand)
 136. (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
 137. (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
 138. (define-key c-mode-base-map [(f5)] 'gdb)


 172. ;;多窗口gdb
 (setq gdb-many-windows t)
 (load-library "multi-gud.el")
 (load-library "multi-gdb-ui.el")

 177. ;;shell,gdb退出后,自动关闭该buffer
 178. ;;(defun kill-buffer-on-exit (process state)
 179. ;;(message "%s" state)
 180. ;;(if (or
 181. ;;       (string-match "exited abnormally with code.*" state)
 182. ;;       (string-match "finished" state))
 183. ;;      (kill-buffer (current-buffer))))

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

(add-to-list 'load-path
             "~/.emacs.d/plusins")
(require 'yasnippet-bundle)

(add-to-list 'load-path
                  "~/.emacs.d/plusins/yasnippet-x.y.z")
    (require 'yasnippet) ;; not yasnippet-bundle
    (yas/initialize)
    (yas/load-directory "~/.emacs.d/plusins/yasnippet-x.y.z/snippets")

posted @ 2010-09-29 14:33  游吟男孩  阅读(2263)  评论(0编辑  收藏  举报