Mac下安装emacs+cscopse+auto-complete

转:http://blog.csdn.net/u010164190/article/details/60867803

1.下载cscope和auto-complete

   地址:http://download.csdn.net/detail/u010164190/9892170  

2.安装:
     # tar -zxf cscope-xx.x.tar.gz
     # cd cscope-xx.x
     # ./configure

     # make

     # make install 

     //然后把contrib/xcscope/目录下的cscope-indexer复制到PATH目录比如/usr/local/bin 

    # cp contrib/xcscope/cscope-indexer /usr/local/bin //或者/usr/bin

    # chmod 777 /usr/local/bin/cscope-indexer

   <1>禁止每次重新加载索引

    //将/usr/local/bin/cscope-indexer 159行修改

    cscope -b -i $LIST_FILE -f $DATABASE_FILE

   替换为:

cscope -q -b -i $LIST_FILE -f $DATABASE_FILE

<2>添加Java/aidl文件

cscope-indexer 默认只会扫描 C/C++ 的源码

    egrep -i '\.([chly](xx|pp*|cc|hh$' | \

    改成:

    egrep -i '\.([chly](xx|pp*|cc|hh|java|aidl$' | \

    然后在Emacs 中创建索引

3.配置
    接着whereis emacs 看下emacs安装在哪里,
    把cscope-xx.x目录下的 contrib/xcscope/xcscope.el文件拷贝到~/emacs.d/site-lisp/目录下面.
     # cp contrib/xcscope/xcscope.el ~/emacs.d/site-lisp/

     # chmod 777 ~/emacs.d/site-lisp/xcscope.el

4、在.emacs文件中添加

      (require 'cc-mode)
      (add-to-list 'load-path "~/.emacs.d/site-lisp")

      (require 'xcscope)

   (setq cscope-do-not-update-database t)

   (global-set-key (kbd "M-3") 'cscope-index-files)

   (global-set-key (kbd "M-4") 'cscope-find-this-symbol)

   (global-set-key (kbd "M-5") 'cscope-find-global-definition)

   (global-set-key (kbd "M-6") 'cscope-pop-mark)

5、安装autocomplete自动补全工具

<1>配置环境

# tar -xjf autocomplete.tar.bz2 

# cd autocomplete/rope

# sudo Python setup.py install 

# cd ../ropemacs

# sudo python setup.py install 

# cd ../Pymacs-0.23 

# sudo python setup.py install 

# cp pymacs.el ~/.emacs.d

# cp ../auto-complete.el ../auto-complete-config.el ~/.emacs.d/site-lisp

<2>配置.emacs

add-to-list 'load-path "~/.emacs.d/site-lisp”)

(require 'auto-complete)

(global-auto-complete-mode t) 

(require 'auto-complete-config)

(ac-ropemacs-initialize)

(global-auto-complete-mode t)

(define-key ac-complete-mode-map "\t" 'ac-expand)

(define-key ac-complete-mode-map "\r" 'ac-complete)

(define-key ac-complete-mode-map "\M-n" 'ac-next)

(define-key ac-complete-mode-map "\M-p" 'ac-previous)

(setq ac-auto-start 3)

(setq ac-dwim t)

(set-default 'ac-sources '(ac-source-abbrev ac-source-words-in-buffer))

(setq ac-modes

         (append ac-modes

                 '(eshell-mode

                         )))



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值