目的: 配置emacs 24 适合编程开发

主要参考JerryZhang的配置(Emacs 简易教程)

http://www.perfect-is-shit.com/emacs-simple-tutorial.html#tocAnchor-1-16-5

https://gitcafe.com/JerryZhang/Emacs-Config

优点: 插件少 基本功能都比较全,emacs 配置后启动比较快速

安装过程如下:

  • git clone https://gitcafe.com/JerryZhang/emacs-config.git ~/.emacs.d (后面的地址可更换,下载后复制到~/.emacs.d目录下)
  • cd ~/.emacs.d/lisp/helm && make

安装完成后

init.el更改内容

  • 显示行号.去掉(global-linum-mode 1)前的分号(;)
  • 增加切换buffer的快捷键
;;------------------------------------------------------------------------------
;; 快速切换至上个buffer
;; Shift+TAB切换至上个buffer
;;------------------------------------------------------------------------------
(global-set-key (kbd "<backtab>") #'(lambda ()
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1))))

  

  • 增加 speedbar

下载 sr-speedbar.el 至.emacs.d/lisp目录下

init.el 添加代码

;;------------------------------------------------------------------------------
;; 使用speedbar <F6>切换speedbar的开启状态
;; s键在speedbar中搜索 u键回到上一个目录
;;------------------------------------------------------------------------------
(require 'sr-speedbar)
(global-set-key (kbd "<f6>") (lambda()
(interactive)
(sr-speedbar-refresh)
(sr-speedbar-toggle)
(unless (sr-speedbar-exist-p)
(kill-buffer "*SPEEDBAR*"))))
(require 'speedbar)
(define-key speedbar-mode-map (kbd "s")
#'(lambda ()
(interactive)
(beginning-of-buffer)
(isearch-forward)))
(define-key speedbar-mode-map (kbd "u")
#'(lambda ()
(interactive)
(speedbar-up-directory)))

 开启ido支持

;;------------------------------------------------------------------------------
;; 开启ido 支持
;;------------------------------------------------------------------------------
(require 'ido)
(ido-mode t)
;;ido模式中不保存目录列表,解决退出Emacs时ido要询问编码的问题。
(setq ido-save-directory-list-file nil)

  tabbar设置 参考http://blog.csdn.net/CherylNatsu/article/details/6204737

代码折叠 参考 Distopico Vegan / Distopico .emacs.d · Files

下载 hideshow.el 至.emacs.d/lisp目录下

;;------------------------------------------------------------------------------
;;代码折叠
;;------------------------------------------------------------------------------ ;(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")
;(autoload 'hideshowvis-symbols "hideshowvis" "Highlight foldable regions") (require 'hideshowvis)
(hideshowvis-symbols) (autoload 'hideshowvis-minor-mode
"hideshowvis"
"Will indicate regions foldable with hideshow in the fringe."
'interactive) (add-to-list 'hs-special-modes-alist
'(ruby-mode
"\\(def\\|do\\|{\\)" "\\(end\\|end\\|}\\)" "#"
(lambda (arg) (ruby-end-of-block)) nil)) (dolist (hook (list 'emacs-lisp-mode-hook
'lisp-mode-hook
'ruby-mode-hook
'perl-mode-hook
'php-mode-hook
'html-mode-hook
;'web-mode-hook
'sh-mode-hook
'multi-web-mode-hook
'python-mode-hook
'lua-mode-hook
'c-mode-hook
'java-mode-hook
'js-mode-hook
'css-mode-hook
'c++-mode-hook))
(add-hook hook 'hideshowvis-enable)) ;change -/+ to ▼/▶
;(define-fringe-bitmap 'hideshowvis-hideable-marker [0 0 254 124 56 16 0 0])
;(define-fringe-bitmap 'hs-marker [0 32 48 56 60 56 48 32]) (custom-set-faces
'(hs-fringe-face ((t (:foreground "#afeeee" :box (:line-width 2 :color "grey75" :style released-button)))))
'(hs-face ((t (:background "#444" :box t))))
'(hideshowvis-hidable-face ((t (:foreground "#2f4f4f"))))
) (provide 'conf-hideshowvis)

提供的F*快捷键 

F2 grep

F3 eshell

F4 插入当前时间

F5 compile

F6 speedbar

安装cscope

sudo apt-get install cscope

xcscope.el 使用:

  • cscope-indexer -r : 在根目录下递归生成数据库
  • C-c s a : Set initial directory;
  • C-c s A : Unset initial directory;
  • C-c s I : create list of files to index;
  • C-c s s : Find symbol;
  • C-c s d : Find global definition;
  • C-c s c : Find functions calling a function;
  • C-c s C : Find called functions (list functions called from a function);
  • C-c s t : Find text string;
  • C-c s e : Find egrep pattern;
  • C-c s f : Find a file;
  • C-c s i : Find files #including a file;
  • C-c s b : Display cscope buffer;
  • C-c s u : back

其他可供参考的配置:

C/C++ Development Environment for Emacs 

http://tuhdo.github.io/c-ide.html

一年成为Emacs高手(像神一样使用编辑器)

http://blog.csdn.net/redguardtoo/article/details/7222501

在使用gdb调试程序时

  先M-x gdb 打开gdb调试

  然后M-x gdb-many-windows 使用多窗口查看调试过程

最新文章

  1. SharePoint 2013 图文开发系列之事件接收器
  2. Codeforces Round #389 Div.2 E. Santa Claus and Tangerines
  3. sshd_conf AllowUsers参数
  4. Hibernate的基本查询语句
  5. Android Studio SDK Manager无法正常下载如何设置
  6. qt info.plist 添加
  7. Linux了解进程的地址空间
  8. IIS Express总结
  9. django模版中配置和使用静态文件方法
  10. JAVA进阶7
  11. out对象
  12. AIX 批量更改密码
  13. 使用 idea 的Bookmarks(书签)功能
  14. Docker(二十六)-Docker Compose编排容器
  15. Python之路----迭代器与生成器
  16. NBUT 1219 Time 2010辽宁省赛
  17. vuex、redux、mobx 对比
  18. try语句...
  19. python process,queue
  20. centos6.x升级glibc-2.17

热门文章

  1. 160个crackme-之Afkayas.1
  2. 工作中用到的oracle字符串分割整理
  3. MySQL主主复制
  4. CentOS 7 64位的安装流程
  5. Emacs 常用快捷键
  6. linux操作命令
  7. 正则匹配中文 UTF-8 &amp; GBK
  8. RHEL7修改swappiness
  9. 线程的Abort方法有感
  10. mac上spacemacs体验小记