emacs之配置自动安装脚本

emacsConfig下建立install目录,结构大概这样

.
├── auto-complete-etags-setting.el
├── auto-complete-setting.el
├── auto-complete-yasnippet-setting.el
├── autopair-setting.el
├── buffer-setting.el
├── clang-complete-async-setting.el
├── code-style-setting.el
├── dir-setting.el
├── etags
│   ├── kernel
│   ├── muduo
│   └── qt
├── etags-select-setting.el
├── evil-setting.el
├── gdb-setting.el
├── gtags
│   └── muduo
│       ├── GPATH
│       ├── GRTAGS
│       ├── GSYMS
│       └── GTAGS
├── gtags-setting.el
├── imenu-tree-setting.el
├── install
│   ├── imenu-tree-install
│   │   ├── install.sh
│   │   ├── patch
│   │   │   └── imenu-tree.el
│   │   └── readme
│   ├── _init.el_
│   ├── install.sh
│   ├── readme
│   ├── recipes
│   │   └── clang-complete-async.rcp
│   └── remove.sh
├── kbd-mouse-setting.el
├── monokai-theme.el
├── original-tags.el
├── php-setting.el
├── snippets
│   ├── custom
│   └── yas-git
├── speedbar-setting.el
├── switch-file-setting.el
├── tabbar-setting.el
├── ui-setting.el
└── window-setting.el

 

 

_init.el_

 1 (add-to-list 'load-path "~/.emacs.d/el-get/el-get")
 2 
 3 (unless (require 'el-get nil 'noerror)
 4   (with-current-buffer
 5       (url-retrieve-synchronously
 6        "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
 7     (goto-char (point-max))
 8     (eval-print-last-sexp)))
 9 
10 (add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
11 (el-get 'sync)
12 
13 ;不知道为什么,按照文档的设置无效,那么,就用我自己的吧
14 ;(setq el-get-user-package-directory "~/.emacs.d/el-get-init-files/")
15 
16 ;------------------------------------------------------------------------------
17 ;设置扩展文件所在目录
18 (add-to-list 'load-path "~/emacsConfig")
19  
20 ;逐个装载上面目录下所有的配置文件
21 (mapc 'load (directory-files "~/emacsConfig" t "^[a-zA-Z0-9].*.el$"))

 

install.sh

1 mkdir -p ~/.emacs.d/el-get-user/recipes
2 cp ./recipes/* ~/.emacs.d/el-get-user/recipes
3 cp ./_init.el_  ~/.emacs.d/init.el
4 
5 echo "Install success!";

 

remove.sh

1 rm -rf ~/.emacs.d
2 
3 echo "remove success!";

 

~/emacsConfig/install/recipes/clang-complete-async.rcp

 1 (:name clang-complete-async
 2        :website "https://github.com/Golevka/emacs-clang-complete-async"
 3        :description "An emacs extension to complete C and C++ code using libclang."
 4        :type github
 5        :pkgname "Golevka/emacs-clang-complete-async"
 6        :build '(("make"))
 7        :depends auto-complete
 8        :features auto-complete-clang-async
 9        :prepare (setq ac-clang-complete-executable
10                       (expand-file-name
11                        (concat (el-get-package-directory "clang-complete-async") "clang-complete"))))

 

imenu-tree注意

~/emacsConfig/install/imenu-tree-install/patch/imenu-tree.el为修改过的imenu-tree.el

~/emacsConfig/install/imenu-tree-install/install.sh

cp patch/imenu-tree.el ~/.emacs.d/el-get/imenu-tree/imenu-tree.el

echo "imenu-tree installed with position on right!";

 

 

readme

第一次安装,需要alt+x执行安装命令
el-get-install以下几个

evil
php-mode-improved
tabbar
auto-complete
auto-complete-etags(我这边没有补全效果)
etags-select(这个比较准确,比自带的好)
auto-complete-emacs-lisp
autopair
cc-mode+
sr-speedbar
yasnippet
auto-complete-yasnippet
imenu-tree(用来显示文件内symbol的插件,下面几个都是imenu-tree需要的插件)
    imenu+
    tree-mode
    windata


gtags(安装之前需要下面的命令)
    debian:
    sudo apt-get install global
    mac:
        brew install global
    同时,需要ln -s做几个软连接
        /usr/local/bin/global连接到/usr/bin
        /usr/local/bin/gtags连接到/usr/bin

clang-complete-async(安装之前需要下面的命令)
    debian:
        sudo apt-get install llvm-dev
    sudo apt-get install libclang-dev

    mac:
        brew install --with-clang --all-targets --rtti --universal --jit llvm,多点耐心,需要很久

-----------------------------------------------------------------------------
ecb:
    由于method buffer的东西无法更新,因此放弃此库
-----------------------------------------------------------------------------

imenu-tree
-----------------------------------------------------------------------------
安装查看install目录的imenu-tree-install子目录
-----------------------------------------------------------------------------

安装配置
auto-complete-etags

etags:
    生成tag:
        自定义函数:generate-etags
    加载tag:
        自定义命令:load-etags
        插件命令:visit-tags-table
    查找定义:
        快捷键:alt+o,d
        命令:etags-select-find-tag-at-point
    list-tags:
        显示某个h文件内所有的tag

gtags
    生成tag:
        自定义函数:generate-gtags
    加载tag:
        自定义命令:load-gtags
        插件命令:gtag-visit-rootdir
    查找变量引用:
        快捷键:c-x,v
        命令:gtags-find-symbol
    查找函数引用:
        快捷键:c-x,f
        命令:gtags-find-rtag


tag跳转:alt+enter
前进后退的快捷键为alt加方向键
F11切换h和cpp文件
ctrl+enter,打开include的头文件
F2打开speed-bar
F12打开imenu-tree

在启动就需要加载的tag需要在original-tags.el里面手工修改

 

 

你可能感兴趣的:(emacs)