我的Emacs配置文件

;;;;;;;;;;;;;;global;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(setq visible-bell t);关闭出错时的蜂鸣提示声
(mouse-avoidance-mode'animate);当鼠标箭头与光标相近时,使鼠标箭头自动移开
;(blink-cursor-mode nil);光标不闪烁
(setq-default cursor-type 'bar);光标显示为一竖线
;(tool-bar-mode -1);; 不显示emcas的工具栏
;(menu-bar-mode -1);; 不显示emcas的菜单栏,按ctrl+鼠标右键仍能调出该菜单
;;;;;;;;;;;;;;;;;最大化;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq default-frame-alist '((height . 38) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0)))
(setq x-select-enable-clipboard t);; 支持emacs和外部程序之间进行粘贴
(fset 'yes-or-no-p 'y-or-n-p);以 'y/n'字样代替原默认的'yes/no'字样
(setq frame-title-format "%b@xgd-emacs");在最上方的标题栏显示当前buffer的名字
;(setq make-backup-files nil);关闭自动备份功能
;(setq auto-save-mode nil);关闭自动保存模式
;(setq auto-save-default nil);不生成名为#filename# 的临时文件
(setq require-final-newline t);; 自动的在当前的buffer文件的最后加一个空行
(global-set-key "\r" 'align-newline-and-indent);;自动缩进变为
(set-scroll-bar-mode 'right);滚动条在右侧
(set-scroll-bar-mode nil)   ; 不显示滚动条, even in x-window system (recommended)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;cc-mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;http://cc-mode.sourceforge.net/
;http://www.kklinux.com/html/linuxwangluojishu/linuxxitongguanliyuan/200902/28-3728.html
;(add-to-list 'load-path "/home/xgdxiao/.emacsLoadpath/cc-mode-5.31.3")
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)


(defun my-c-mode-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  (c-set-style "stroustrup")
  );;
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c-mode-hook)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.Emacs");load-path
;;;;;;;;;;;;;;;;color-theme;;;;;;;;;;;;;;;;;;;;;
(require 'color-theme)
(color-theme-classic)


;;;;;;;;;;;;;;;;web方式显示行号;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;下载wb-line-number.el并放置在中
;http://homepage1.nifty.com/blankspace/emacs/elisp.html
;(require 'wb-line-number)
;(wb-line-number-toggle)


;;;;;;;;;;;;;;;;;启动时最大化;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(require 'maxframe)
;(add-hook 'window-setup-hook 'maximize-frame t)
;下载maxframe.el并放置在中
;http://emacsblog.org/2007/02/22/maximize-on-startup-part-2/


;;;;;;;;;;;;;;;;;session;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.Emacs/session/lisp")
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
;;记录和恢复屏幕
(load "desktop") 
;(desktop-load-default) 
;(desktop-read)
;;desktop自动存盘模式,23需要加
(desktop-save-mode)


;;;;;;;;;;;;;;;;;cscope;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'xcscope)
(global-set-key "\C-xg" 'cscope-find-global-definition-no-prompting) ;; 跳转到全局定义
(setq cscope-database-file "cscope.db")


;;;;;;;;;;;;;;;;;cedet;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
(load-file "~/.Emacs/cedet-1.0/common/cedet.el")
(semantic-load-enable-code-helpers)
(autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
(autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
(define-key-after (lookup-key global-map [menu-bar tools])
  [speedbar]
  '("Speedbar".
    speedbar-frame-mode)
  [calendar])
;; 读取子目录中的特别的.el 文件
(global-ede-mode 1); Enable the Project management system
(semantic-load-enable-code-helpers); Enable prototype help and smart completion 
(global-srecode-minor-mode 1); Enable template insertion menu
(global-set-key [(f4)] 'speedbar-get-focus);speedbar
;(define-key c-mode-base-map "." 'semantic-complete-self-insert);
(define-key c-mode-base-map [(control tab)] 'semantic-ia-complete-symbol-menu);自动补全Ctrl+tab  ;(control tab)(meta ?/)
(require 'semantic-gcc);system header files within GCC


;;;;;;;;;;;;;;;;;ecb;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.Emacs/ecb-2.40")
(load-file "~/.Emacs/ecb-2.40/ecb.el")
(require 'ecb)
(setq ecb-auto-activate t  ;自动启动ecb
      ecb-tip-of-the-day nil  ;不显示每日提醒
      ecb-tree-indent 4
      ecb-windows-height 0.5
      ecb-windows-width 0.20
      ecb-auto-compatibility-check nil
      ecb-version-check nil
      inhibit-startup-message t)
(global-set-key [f8] 'ecb-activate) ;;定义F8键为激活ecb
(global-set-key [f7] 'ecb-deactivate) ;;定义F7为停止ecb
;;;; 各窗口间切换
(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)
;;;; 使某一ecb窗口最大化
(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)
(define-key global-map "\C-c5" 'ecb-show-ecb-windows)
(define-key global-map "\C-c6" 'ecb-hide-ecb-windows)
;;;;;;;;;;;;;;;;;;;end ecb;;;;;;;;;;;;;;;;;;;;;;;;


(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-layout-window-sizes nil)
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)))
(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.
 )


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


;; project root path
(setq semanticdb-project-roots
      (list
       (expand-file-name "/")))
;; 避免semantic占用CPU过多
(setq-default semantic-idle-scheduler-idle-time 432000)


(defun my-indent-or-complete ()
  (interactive)
  (if (looking-at "\\>")
      (hippie-expand nil)
    (indent-for-tab-command)))
(autoload 'senator-try-expand-semantic "senator")


(setq hippie-expand-try-functions-list
      '(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
;;;;;;;;##GDB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key [(f5)] 'gdb-many-windows);gdb-many-windows快捷键[F5]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;##compile;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-key c-mode-base-map [(f9)] 'compile);emacs的compile命令快捷键F9
(setq compile-command "make -k")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值