Ubuntu 9.10下Emacs配置文件

 

 

首页Linux教程

背景:

阅读新闻

Ubuntu 9.10下Emacs配置文件

[日期:2010-01-30]   来源:hi.baidu.com/pigbeard  作者:pigbeard   [字体:]  

Ubuntu 9.10下Emacs配置文件

;;------------------颜色主题---------------------------
(setq load-path (cons "~/.emacs.d" load-path))
(require 'color-theme)
(color-theme-initialize)
(color-theme-dark-blue)

;;----------------------以下是我的快捷键设置---------------------
;; ----------------------- Short Cut -------------------------
(global-set-key [(meta g)] 'goto-line)
;;(global-set-key [(meta ?/)] 'hippie-expand)

;; F12 t 从当前缓冲区建立任务
(global-set-key (kbd "<f12> t") 'planner-create-task-from-buffer)
;; F12 g 切换到当日的任务
;;(global-set-key (kbd "<f12> g") 'planner-goto-today)
(global-set-key (kbd "<f12> g") 'planner-goto-today)
(global-set-key (kbd "<f12> p") 'plan)
;; F12 r 添加当前备忘录
(global-set-key (kbd "<f12> r") 'remember)
;; F12 c 切换到日历
(global-set-key (kbd "<f12> c") 'calendar)

;;;F2:进入wiki-mode模式
(global-set-key [(f2)] 'emacs-wiki-find-file)

;;;F3:切换到dired模式
(global-set-key [(f3)] 'dired)

;;;F4:切换到shell模式
(global-set-key [(f4)] 'ansi-term)


;;;F5:打开speedbar
(global-set-key [(f5)] 'speedbar)

;;;;F7:调用compile
(global-set-key (kbd "<f7>") 'compile)

;;;Alt+s : 让speedbar获得焦点
(global-set-key (kbd "M-s") 'speedbar-get-focus)

;;;F9:列举我的书签
(global-set-key (kbd "<f9>") 'list-bookmarks)

;;;F10:添加当前页到书签中
(global-set-key [(f10)] 'bookmark-set)

;;;F12 u 更新当前版本
(global-set-key (kbd "<f12> u") 'vc-next-action)

;;------------------------End of Short Cut ---------------------

;;-------------------------关闭启动时的`开机画面'------------
(setq inhibit-startup-message t)

;;-------------------------显示列号--------------------------
;;(setq column-number-mode t)
;;display the column number and line number
(setq column-number-mode t)
(setq line-number-mode t)
(global-linum-mode t)

;;-------------------------使用Win下的选择习惯---------------
;;用shift+方向键进行选择
(pc-selection-mode)
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq default-fill-column 80);默认显示 80列就换行

;;-------------------------设置默认Tab宽度---------------
;;set default tab-width as 4, not 2
(setq-default indent-tabs-mode nil)
(setq default-tab-width 8)

;;;; 显示时间
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

;;;;设置大的kill ring
(setq kill-ring-max 150)

;;;;导入CEDET的各个插件
;; ---------------------------------------
;; Load CEDET
(load-file "~/.emacs.d/cedet-1.0pre6/common/cedet.el")

;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
;; Select one of the following
(semantic-load-enable-code-helpers)
;; (semantic-load-enable-guady-code-helpers)
;; (semantic-load-enable-excessive-code-helpers)

;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)
;; ---------------------------------------

;;;; 配置 Emacs Code Browser
(add-to-list 'load-path
"~/.emacs.d/ecb-2.40")
(require 'ecb)

;;;;配置Sementic的检索范围

(setq semanticdb-project-roots
(list
(expand-file-name "/")))

;;;; CC-mode配置 
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

;;;;根据后缀判断所用的mode
;;;;注意:我在这里把.h关联到了c++-mode
(setq auto-mode-alist
(append '(("\\.h$" . c++-mode)) auto-mode-alist))


;;;;我的C/C++语言编辑策略

(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;按键定义
(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)
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "Stroustrup")))

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27569.html