在Emacs Prelude配置下安装neotree插件,实现文件导航树

来源:互联网 发布:数据精灵使用教程 编辑:程序博客网 时间:2024/05/04 04:38

适用人群:

我们这个插件的添加是Emacs Prelude配置环境下实现的,是针对已经在Emacs下安装了Prelude的用户。
Prelude是一个针对emacs的一个配置:

Prelude is an enhanced Emacs 24 distribution that should make your experience with Emacs both more pleasant and more powerful.

Prelude is an Emacs distribution that aims to enhance the default Emacs experience. Prelude alters a lot of the default settings, bundles a plethora of additional packages and adds its own core library to the mix. The final product offers an easy to use Emacs configuration for Emacs newcomers and lots of additional power for Emacs power users.

Prelude会在.emacs.d文件下创建文件结构,像使用emacs elpa下载的插件、个人配置文件等都会存放对应的文件夹下。
注意一下这个配置只能支持emacs24及以上版本,低版本的emacs是不行的

具体的文档大家可以看其项目主页:
Emacs Prelude


neotree介绍

简单的说:neotree是emacs的一个插件,这个插件实现的功能是在emacs左侧显示文件导航树,效果如下图所示:
neotree效果图
这个项目也是放着在github上的:
[emacs-neotree(https://github.com/jaypei/emacs-neotree)


安装

介绍完了背景知识,你们也就大体知道这篇博客是否对自己有用了,下面咱们来说一下安装过程:

  1. 使用emacs自带的包管理器下载neotree插件:
    在emacs中键入
    M-x package-list-packages 然后定位到neotree包的位置,然后按键盘上的i键,然后再键入x键,
    这是emacs会提示是否下载这个包?
    键入y(表示同意的意思)即可。
    这时neotree包就安装到了emacs下。
  2. 此时我们应该修改emacs的配置文件,让emacs在开启后加载neotree插件:定位到
    ~/.emacs.d/personal/preload
    文件夹下,使用记事本打开custom.el文件
    然后再其中加入以下代码:
(add-to-list 'load-path "/some/path/neotree")(require 'neotree)(global-set-key [f8] 'neotree-toggle)

这里注意,路径要换成自己的,比如我自己的neotree插件路径为:

/home/yums/.emacs.d/elpa/neotree-20151101.607/

那么我的custom.el中添加的代码是:

add-to-list 'load-path "/home/yums/.emacs.d/elpa/neotree-20151101.607/")(require 'neotree)(global-set-key [f8] 'neotree-toggle)

好了 到这,重启emacs,然后按F8就可以显示文件导航树了。

0 0
原创粉丝点击