我的emacs配置

來源:互聯網
上載者:User

.emacs檔案

--------------------------------------------------------------------------------

(add-to-list 'load-path "~/.emacs.d")
(add-to-list 'load-path "~/.emacs.d/ecb-2.40")
(add-to-list 'load-path "~/.emacs.d/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/ac-dict")
(ac-config-default)
(load "my_emacs_conf_1.el")
(load "my_emacs_cedet.el")
(load "my_emacs_ecb.el")
(load "my_emacs_auto_complete.el")

========================================================

.emacs.d目錄下

my_emacs_auto_complete.el檔案

;;auto_complete的設定檔,該外掛程式的只需放到.emacs.d目錄下即可

--------------------------------------------------------------------------

;; auto-complete key bindings
(global-set-key [(control tab)] 'auto-complete)

=============================================================

my_emacs_cedet.el檔案

;;cedet的安裝按官方網站上的就可以了,可以在windows上安裝

-----------------------------------------------------

(load-file "~/.emacs.d/cedet-1.0.1/common/cedet.el")
;設定工作目錄
(setq semanticdb-project-roots
      (list
      (expand-file-name "~/work")))
(require 'semanticdb)
(setq semanticdb-default-save-directory
(expand-file-name "~/.semanticdb"))

; Enable the Project management system
(global-ede-mode t)
(global-set-key [(f4)] 'speedbar-get-focus)
; Enable prototype help and smart completion  
(semantic-load-enable-code-helpers)    
; Enable template insertion menu
(global-srecode-minor-mode 1)           
(defun my-c-mode-cedet-hook ()
  (local-set-key "." 'semantic-complete-self-insert)
  (local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
;菜單自動提示
(global-set-key [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;代碼跳轉
(global-set-key [f12] 'semantic-ia-fast-jump)
;程式碼摺疊功能
(global-semantic-tag-folding-mode 1)
(define-key semantic-tag-folding-mode-map (kbd "C--") 'semantic-tag-folding-fold-block)
(define-key semantic-tag-folding-mode-map (kbd "C-=") 'semantic-tag-folding-show-block)

==============================================================================

my_emacs_conf_1.el檔案

---------------------------------------------------------------------------------

;;顯示行號
(require 'linum)
(global-linum-mode t)
;;不要產生臨時檔案  
(setq-default make-backup-files nil)
;;禁用啟動資訊  
(setq inhibit-startup-message t)
;;去掉功能表列,否則alt鍵會衝突
;(menu-bar-mode nil)

(add-hook 'c-mode-hook 'linux-c-mode)
(add-hook 'java-mode-hook 'linux-c-mode)
(defun linux-c-mode()
;; 將斷行符號代替C-j的功能,換行的同時對齊
(define-key c-mode-map [return] 'newline-and-indent)
(interactive)
;; 設定C程式的對齊風格
(c-set-style "K&R")
;; 自動模式,在此種模式下當你鍵入{時,會自動根據你設定的對齊風格對齊
(c-toggle-auto-state)
)

;;多個視窗間移動,S-方向鍵
(windmove-default-keybindings)

==============================================================================

my_emacs_ecb.el檔案

;;ecb直接複製到.emacs.d

-----------------------------------------------------------------

(require 'ecb)
(require 'ecb-autoloads)
;;不要每日提示
(setq ecb-tip-of-the-day nil)
;;版本檢測
(setq ecb-version-check nil)
;; 啟用
(global-set-key [(f2)] 'ecb-activate)
;; 禁止
(global-set-key [(f3)] 'ecb-deactivate)
;;視窗移動
(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)
;;軟體自己添加
(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.
 '(ecb-options-version "2.40"))
(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.
 )

=====================================================

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.