歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 9.10下Emacs配置文件

Ubuntu 9.10下Emacs配置文件

日期:2017/2/28 16:39:40   编辑:Linux教程

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配置 http://cc-mode.sourceforge.net/
(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")))

;;;;我的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")))))

;;;;我的Java語言編輯策略
(defun my-java-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
)

(add-hook 'java-mode-hook 'my-java-mode-hook)

;;;;光標靠近鼠標指針時讓鼠標指針自己閃開
(mouse-avoidance-mode 'animate)

;;;;修改標題欄,顯示buffer的名字
(setq frame-title-format "%b")

;;;;啟動Emacs Server
;;(server-start)

;;;;每次進入Emacs即顯式Plan
;;;;(plan)(color-theme-dark-blue)

;;;;高亮當前行
(require 'hl-line)
(global-hl-line-mode t)

;;;;向左右滾動的命令激活:C-x < 和 C-x >
(put 'scroll-left 'disabled nil)

;;配置一下shell的顏色
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(setq ansi-color-for-comint-mode t)

;;;;退出Emacs時保存所有正在編輯的文檔
;;(load "desktop")
;;(desktop-save-mode)
;;(desktop-read)

Copyright © Linux教程網 All Rights Reserved