编辑器emacs配置

引用请注明出处:http://blog.csdn.net/int64ago/article/details/6992791

对于fedora 15、16(其它发行版也差不多,我没试过)

#sudo yum install emacs

然后去软件中心,安装 emacs-ecb 、emacs-common、emacs-global、emacs-goodies 插件

复制下面代码:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;我到代码缩进方案;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'c-mode-hook 'my-c-mode)
(add-hook 'c++-mode-hook 'my-c++-mode)
(add-hook 'c-mode-common-hook 'my-c-common-mode)
(defun my-c-common-mode ()
  (c-toggle-auto-newline 1)
  ;; 此模式下,当按Backspace时会删除最多的空格
  (c-toggle-hungry-state))
(defun my-c-mode ()
  ;; K&R 风格的缩进方案
  (c-set-style "k&r")
  (kid-set-my-c-style))
(defun my-c++-mode ()
    (c-set-style "stroustrup")
    (kid-set-my-c-style))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;代码缩进方案结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;显示行号配置(会影响缩进配置);;;;;;;;;;;;;;;;;;;;;;;;;
;(add-to-list 'load-path' "~/.lisp")
;(require 'display-line-number.el)
;(setq display-line-number-format "%3d ")
;(add-hook 'c-mode-hook 'display-line-number-mode)
;(add-hook 'c-mode-common-hook 'display-line-number-mode)
;(add-hook 'c++-mode-hook 'display-line-number-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;显示行号配置结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;  设置窗口界面 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")

;;;;;设置默认字体
;(set-default-font "-unknown-Tlwg Typo-bold-normal-normal-*-16-*-*-*-m-0-iso10646-1")
;(set-default-font " -urw-URW Gothic L-semi-bold-oblique-normal-*-19-*-*-*-*-0-iso10646-1")
(set-default-font " -bitstream-Waree-bold-oblique-normal-*-17-*-*-*-*-0-iso10646-1")
;(set-default-font "-urw-URW Gothic L-semi-light-oblique-normal-*-17-*-*-*-*-0-iso10646-1")
;(require 'color-theme)  
;(color-theme-initialize)  
;(color-theme-Black)  
;(set-scroll-bar-moXSXCde nil)
;;取消滚动栏

(customize-set-variable 'scroll-bar-mode 'right)
;;设置滚动栏在窗口右侧,而默认是在左侧

;(tool-bar-mode nil)
;;取消工具栏

(setq default-frame-alist
             '((vertical-scroll-bars)  
               (top . 0)
               (left . 0)                               
               (width . 165)
               (height . 4Array)           
               (background-color . "black")
               (foreground-color . "grey")
               (cursor-color     . "gold1")
               (mouse-color      . "gold1")
               (tool-bar-lines . 0)
               (menu-bar-lines . 1)
               (right-fringe)
               (left-fringe)))

;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;  设置界面结束  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;======================= cscope 设置 =======================
;;使用 cscope 浏览源代码,这个xcscope是个改进版,为每一次查找的结果使用不同 buffer ,
;;这样就可以保存以前的结果。

;(add-to-list 'load-path  "~/.lisp/cscope-15.7/contrib/xcscope") ;; 将软件包所在的路径加到 EMACS 的 load-path
;(require 'xcscope) ;; 加载相应的软件

;; C-c s a             设定初始化的目录,一般是你代码的根目录
;; C-s s I             对目录中的相关文件建立列表并进行索引
;; C-c s s             序找符号
;; C-c s g             寻找全局的定义
;; C-c s c             看看指定函数被哪些函数所调用
;; C-c s C             看看指定函数调用了哪些函数
;; C-c s e             寻找正则表达式
;; C-c s f             寻找文件
;; C-c s i             看看指定的文件被哪些文件include

;===================== cscope 设置结束 ======================

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cedet设置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
;   (load-file "~/.lisp/cedet-1.0pre7/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])
(global-set-key [(f4)] 'speedbar-get-focus) 
;;使用 n 和 p 可以上下移动,
;; + 展开目录或文件进行浏览,- 收缩,RET 访问目录或文件,g 更新 speedbar。
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cedet设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ecb设置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(setq  ecb-tip-of-the-day nil)
;(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
;(load-file "/usr/share/emacs/site-lisp/ecb/ecb.el")
(require 'ecb)
(setq ecb-auto-activate t
         ecb-tip-of-the-day nil
          ecb-tree-indent 4
          ecb-windows-height 0.5
          ecb-windows-width 0.15
          ecb-auto-compatibility-check nil
          ecb-version-check nil
          inhibit-startup-message t
 )
;; Ecb的操作:
;; C-c . g d 目录列表窗口
;; C-c . g s 源码窗口
;; C-c . g m 方法和变量窗口
;; C-c . g h 历史窗口
;; C-c . g l 最后选择过的编辑窗口
;; C-c . g 1 编辑窗口1
;; C-c . g n 编辑窗口n
;; C-c . l c 选择版面
;; C-c . l r 重画版面
;; C-c . l t 拴牢版面(锁定版面)
;; C-c . l w 拴牢可见的ecb窗口
;; C-c . /   拴牢编绎窗口
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ecb设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;自动补全设置(工作不理想);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;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
 ;       )
;)

;(global-set-key [M-/] 'hippie-expand)
;右Ctrl+\ 自动补全menu

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;自动补全设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;补全扩弧配置(没什么用);;;;;;;;;;;;;;;;;;;;;;;;;;
;(defun my-c-mode-auto-pair ()
;  (interactive)
;  (make-local-variable 'skeleton-pair-alist)
;  (setq skeleton-pair-alist  '(
;    (?` ?` _ "''")
;    (?\( ?  _ " )")
;    (?\[ ?  _ " ]")
;    (?{ \n > _ \n ?} >)))
;  (setq skeleton-pair t)
;  (local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
;  (local-set-key (kbd "{") 'skeleton-pair-insert-maybe)
;  (local-set-key (kbd "`") 'skeleton-pair-insert-maybe)
;  (local-set-key (kbd "[") 'skeleton-pair-insert-maybe))
;(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
;(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;补全扩弧配置结束;;;;;;;;;;;;;;;;;;;;;;;;;;
;(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.
; '(scroll-bar-mode (quote right))
; '(tool-bar-mode nil))
;(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.
; '(default ((t (:inherit nil :stipple nil :background "black" :foreground "grey" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :height 120 :width normal :foundry "unknown" :family "Tlwg Typo")))))
(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-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.
; )


;===================== 文件头header设置 ===========================
;;当我们保存文件的时候,有很多信息可以自动更新.如何自动更新信息, 更新那些信息,
;也是可以完全自己配置. 包括文件名称,最后一次修改时间,文件保存次数,最后一次修改的作者等等.
;;可以用 M-x make-header 自动生成文件头信息. 
;(add-to-list 'load-path  "~/lisp/header")
;(require 'header)
;(setq make-header-hooks '(header-mode-line

;                            header-blank
;                            header-file-name
;                            header-blank
;                            header-copyright
;                            header-blank
;                            header-author
;                            header-creation-date
;                            header-modification-author
;                            header-modification-date
;                            header-update-count
;                            header-blank
;                            header-history
;                            header-blank
;                            ))
;(setq header-copyright-notice "  源成工作室 作品" )
;(make-local-variable 'user-full-name)
;(make-local-variable 'user-mail-address)

;===================== 文件头header设置结束 ==========================


;(load-library "hideshow") 
;(add-hook 'c-mode-hook 'hs-minor-mode)
;(add-hook 'c++-mode-hook 'hs-minor-mode)
;(add-hook 'java-mode-hook 'hs-minor-mode)
;(add-hook 'perl-mode-hook 'hs-minor-mode)
;(add-hook 'php-mode-hook 'hs-minor-mode)
;(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;能把一个代码块缩起来,需要的时候再展开
;;  M-x              hs-minor-mode
;;  C-c @ ESC C-s    show all
;;  C-c @ ESC C-h    hide all
;;  C-c @ C-s        show block
;;  C-c @ C-h        hide block
;;  C-c @ C-c toggle hide/show


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;定制操作习惯;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;设置打开文件的缺省路径
(setq default-directory "/") 

;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;这里是直接打开了ido的支持,在emacs23中这个是自带的.
(ido-mode t) 

(setq visible-bell t)
;;关闭烦人的出错时的提示声
(setq inhibit-startup-message t)
;;关闭emacs启动时的画面

(setq gnus-inhibit-startup-message t)
;;关闭gnus启动时的画面

(fset 'yes-or-no-p 'y-or-n-p)
;; 改变 Emacs 固执的要你回答 yes 的行为。按 y 或空格键表示 yes,n 表示 no。

;(setq font-lock-maximum-decoration t)
;(setq font-lock-global-modes '(not shell-mode text-mode))
;(setq font-lock-verbose t)
;(setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
;; 语法高亮。除 shell-mode 和 text-mode 之外的模式中使用语法高亮。

(setq column-number-mode t) 
(setq line-number-mode t)
;;显示行列号

(setq mouse-yank-at-point t)
;;不要在鼠标点击的那个地方插入剪贴板内容。我不喜欢那样,经常把我的文档搞的一团糟。我觉得先用光标定位,然后鼠标中键点击要好的多。不管你的光标在文档的那个位置,或是在 minibuffer,鼠标中键一点击,X selection 的内容就被插入到那个位置。

(setq kill-ring-max 200)
;;设置粘贴缓冲条目数量.用一个很大的kill ring(最多的记录个数). 这样防止我不小心删掉重要的东西

(setq-default auto-fill-function 'do-auto-fill) 
 ; Autofill in all modes;;
(setq default-fill-column 80)
;;把 fill-column 设为 60. 这样的文字更好读

;(setq-default indent-tabs-mode nil)
;(setq default-tab-width 8)
;(setq tab-stop-list ())
;;不用 TAB 字符来indent, 这会引起很多奇怪的错误。编辑 Makefile 的时候也不用担心,因为 makefile-mode 会把 TAB 键设置成真正的 TAB 字符,并且加亮显示的。

;(setq sentence-end "//([。!?]//|……//|[.?!][]/"')}]*//($//|[ /t]//)//)[ /t/n]*")
;(setq sentence-end-double-space nil)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。

(setq enable-recursive-minibuffers t)
;;可以递归的使用 minibuffer

(setq scroll-margin 3  scroll-conservatively 10000)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。

;(setq default-major-mode 'text-mode)
;(add-hook 'text-mode-hook 'turn-on-auto-fill) 
;;设置缺省主模式是text,,并进入auto-fill次模式.而不是基本模式fundamental-mode

(setq show-paren-mode t) ;;打开括号匹配显示模式
(setq show-paren-style 'parenthesis)
;;括号匹配时可以高亮显示另外一边的括号,但光标不会烦人的跳到另一个括号处。

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

(setq frame-title-format "emacs@%b")
;;在标题栏显示buffer的名字,而不是 emacs@wangyin.com 这样没用的提示。

;(setq uniquify-buffer-name-style 'forward);;好像没起作用
;; 当有两个文件名相同的缓冲时,使用前缀的目录名做 buffer 名字,不用原来的foobar<?> 形式。

(setq auto-image-file-mode t)
;;让 Emacs 可以直接打开和显示图片。

;(auto-compression-mode 1)   
;打开压缩文件时自动解压缩。 

(setq global-font-lock-mode t)
;;进行语法加亮。

(setq-default kill-whole-line t)
;; 在行首 C-k 时,同时删除该行。

;(add-hook 'comint-output-filter-functions
;      'comint-watch-for-password-prompt)
;;当你在shell、telnet、w3m等模式下时,必然碰到过要输入密码的情况,此时加密显出你的密码

; (setq version-control t);;启用版本控制,即可以备份多次
; (setq kept-old-versions 2);;备份最原始的版本两次,及第一次编辑前的文档,和第二次编辑前的文档
; (setq kept-new-versions 1);;备份最新的版本1次,理解同上
;; (setq delete-old-versions t);;删掉不属于以上3中版本的版本
;; (setq backup-directory-alist '(("." . "~/backups")));;设置备份文件的路径
;; (setq backup-by-copying t);;备份设置方法,直接拷贝
;; Emacs 中,改变文件时,默认都会产生备份文件(以 ~ 结尾的文件)。可以完全去掉
;; (并不可取),也可以制定备份的方式。这里采用的是,把所有的文件备份都放在一
;; 个固定的地方("~/backups")。对于每个备份文件,保留最原始的两个版本和最新的
;; 1个版本。并且备份的时候,备份文件是复本,而不是原件。

;(setq make-backup-files nil) 
;; 设定不产生备份文件

;(setq auto-save-mode nil) 
;;自动保存模式

;(setq-default make-backup-files nil)
;; 不生成临时文件

(put 'scroll-left 'disabled nil)     ;允许屏幕左移
(put 'scroll-right 'disabled nil)    ;允许屏幕右移
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil) 
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
;;把这些缺省禁用的功能打开。

;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)

(setq mouse-yank-at-point t)
;;使用鼠标中键可以粘贴

(setq user-full-name "highspeed")
(setq user-mail-address "woshihighspeed@163.com")
;;设置有用的个人信息,这在很多地方有用。

(setq require-final-newline t)
;; 自动的在文件末增加一新行

;(setq-default transient-mark-mode t)
;;Non-nil if Transient-Mark mode is enabled.

(setq track-eol t)
;; 当光标在行尾上下移动的时候,始终保持在行尾。

(setq Man-notify-method 'pushy)
;; 当浏览 man page 时,直接跳转到 man buffer。

;(setq next-line-add-newlines nil)
;;Emacs 21 中已经是缺省设置。按 C-n 或向下键时不添加新行。
  
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;设置home键指向buffer开头,end键指向buffer结尾


(global-set-key (kbd "C-,") 'scroll-left)
;; "C-,"设为屏幕左移命令
(global-set-key (kbd "C-.") 'scroll-right)
;; "C-."设为屏幕右移命令

;(global-set-key [f1] 'manual-entry)
;(global-set-key [C-f1] 'info )

;(global-set-key [f3] 'repeat-complex-command)

;(global-set-key [f4] 'other-window)
;; 跳转到 Emacs 的另一个buffer窗口


(defun du-onekey-compile ()
  "Save buffers and start compile"
  (interactive)
  (save-some-buffers t)
  (switch-to-buffer-other-window "*compilation*")
  (compile compile-command))
  (global-set-key [C-f5] 'compile)
  (global-set-key [f5] 'du-onekey-compile)
;;  C-f5, 设置编译命令; f5, 保存所有文件然后编译当前窗口文件 

(global-set-key [f6] 'gdb)             
;;F6设置为在Emacs中调用gdb

;(global-set-key [C-f7] 'previous-error)
;(global-set-key [f7] 'next-error)

(defun open-eshell-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (eshell))
(global-set-key [(f8)] 'open-eshell-other-buffer)
(global-set-key [C-f8] 'eshell)
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f8就是另开一个buffer然后打开shell,C-f8则是在当前的buffer打开shell

(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
(setq dframe-update-speed nil);;不自动刷新,手动 g 刷新
(setq speedbar-update-flag nil)
(setq speedbar-use-images nil);;不使用 image 的方式
(setq speedbar-verbosity-level 0) 

;(global-set-key [f9] 'speedbar)
;;设置f9调用speedbar命令
;;使用 n 和 p 可以上下移动,
;; + 展开目录或文件进行浏览,- 收缩,RET 访问目录或文件,g 更新 speedbar。

(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;;让 dired 可以递归的拷贝和删除目录。
(global-set-key [C-f9] 'dired)
;;设置[C-f9]为调用dired命令

(global-set-key [f10] 'undo)             
;;设置F10为撤销

;(global-set-key [f11] 'calendar) 
;;设置F11快捷键指定Emacs 的日历系统

(global-set-key [f12] 'list-bookmarks)
;;设置F12 快速察看日程安排

(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S chunyu")
;; 设置时间戳,标识出最后一次保存文件的时间。

;(global-set-key (kbd "M-g") 'goto-line)
;;设置M-g为goto-line

;(global-set-key (kbd "C-SPC") 'nil)
;;取消control+space键设为mark

(global-set-key (kbd "M-<SPC>") 'set-mark-command)
;;这样 我就不用按 C-@ 来 setmark 了, C-@ 很不好按。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;定制操作习惯结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;格式化整个文件函数
(defun indent-whole ()
  (interactive)
  (indent-region (point-min) (point-max))
  (message "format successfully"))
;;绑定到F7键
(global-set-key [f7] 'indent-whole)
(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.
 )




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;=========================================================================
(setq semantic-load-turn-everything-on t) 
;(add-hook 'semantic-init-hooks 'semantic-idle-completions-mode)

(setq semanticdb-project-roots 
        (list
        (expand-file-name "/")))
;;配置Semantic的检索范围

(setq semanticdb-default-save-directory "~/")
;;设置semantic.cache路径

(global-set-key [(meta ?/)] 'hippie-expand)
;;M-/ 绑定到 hippie-expand

(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list 
      '(senator-try-expand-semantic  ;优先调用了senator的分析结果
        try-expand-dabbrev     ;当前的buffer补全
    try-expand-dabbrev-visible   ;别的可见的窗口里寻找补全
    try-expand-dabbrev-all-buffers  ;所有打开的buffer
    try-expand-dabbrev-from-kill
    try-complete-file-name-partially
    try-complete-file-name
    try-expand-all-abbrevs
    try-expand-list
    try-expand-line
    try-complete-lisp-symbol-partially
    try-complete-lisp-symbol))
;设置 hippie-expand 的补全方式。它是一个优先列表, hippie-expand 会优先使用表最前面的函数来补全。

;=========================================================================


;=====================GDB调试多窗口====================
;(setq gdb-many-windows t)

;(load-library "multi-gud.el")
;(load-library "multi-gdb-ui.el")
;====================================================

;========================================================================

;(load-library "hideshow") 
;(add-hook 'c-mode-hook 'hs-minor-mode)
;(add-hook 'c++-mode-hook 'hs-minor-mode)
;(add-hook 'java-mode-hook 'hs-minor-mode)
;(add-hook 'perl-mode-hook 'hs-minor-mode)
;(add-hook 'php-mode-hook 'hs-minor-mode)
;(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;能把一个代码块缩起来,需要的时候再展开
;;  M-x              hs-minor-mode
;;  C-c @ ESC C-s    show all
;;  C-c @ ESC C-h    hide all
;;  C-c @ C-s        show block
;;  C-c @ C-h        hide block
;;  C-c @ C-c toggle hide/show

;========================================================================

保存到一个文件里,将文件拷贝到~/ 目录,并且把文件名改成.emacs(注意前面有个点),终端执行#emacs  .emacs,就可以看到下面的效果:


注:因为只启动了部分功能,其它功能自己想用的可以安装插件后启用,这里就不多说了哈~~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值