打造vim成类source insight——contiki源码阅读工具

一、Ubuntu14.04下配置

1、配置vimrc文件

输入:version课查看vimrc文件及位置:

system vimrc file: "$VIM/vimrc"

user vimrc file: "$HOME/.vimrc“(建议放置位置)

2nd user vimrc file: "~/.vim/vimrc"

user exrc file: "$HOME/.exrc"

system gvimrc file: "$VIM/gvimrc"

user gvimrc file: "$HOME/.gvimrc"

2nd user gvimrc file: "~/.vim/gvimrc"

system menu file: "$VIMRUNTIME/menu.vim"

在$HOME/.vimrc更改设置,据说史上最强配置文件:http://amix.dk/vim/vimrc.html,将最强配置文件复制到上述vimrc文件。

2、ctags安装和配置

1) 安装

sudo apt-get install ctags

2) ~/.vimrc配置

"F5 在当前目录下生成tags

nnoremap <F5> :!ctags -R .<CR>

"告诉vim在当前目录找不到tags文件时请到上层目录查找

set tags=tags;/

注:要先执行到当前项目目录再执行

3、cscope安装及配置

1) 安装

sudo apt-get install cscope

2) ~/.vimrc配置

"cscope

"打开vim之前,先cd到项目目录

"并且执行命令cscope -Rbq

"使用quickfix窗口来显示cscope结果

":cw打开QuickFix窗口

set cscopequickfix=s-,c-,d-,i-,t-,e-

if has("cscope")

 "优先查看cscope数据库

 set csto=0

 "同时查看ctags和cscope数据库

 set cst

 "显示提示信息

 set csverb

 if filereadable("cscope.out")

   cs add cscope.out

 elseif $CSCOPE_DB != ""

   cs add $CSCOPE_DB

 endif

 set csverb

endif

"命令映射

"查找调用当前函数的函数

nmap <F3> :cs find 3 <C-R>=expand("<cword>")<CR><CR>

"查找定义

nmap <F4> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
注:"打开vim之前,先cd到项目目录

   "并且执行命令cscope -Rbq

4、taglist插件安装及配置

1)查找插件

官网http://www.vim.org中查找taglist插件

http://www.vim.org/scripts/script.php?script_id=273

2) 安装:

官方说明(加黑部分为我放置的位置):

  1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the
        $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should
        have the following two files (the directory structure should be preserved):

    plugin/taglist.vim - main taglist plugin file
             doc/taglist.txt    - documentation (help) file

    Refer to the |add-plugin|, |add-global-plugin| and |runtimepath| Vim
       help pages for more details about installing Vim plugins.
    2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc
        directory, start Vim and run the ":helptags ." command to process the
        taglist help file. Without this step, you cannot jump to the taglist help
        topics.
    3. If the exuberant ctags utility is not present in your PATH, then set the
        Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags
        utility (not to the directory) in the .vimrc file.
    4. If you are running a terminal/console version of Vim and the terminal
        doesn‘t support changing the window width then set the
        ‘Tlist_Inc_Winwidth‘ variable to 0 in the .vimrc file.
    5. Restart Vim.
    6. You can now use the ":TlistToggle" command to open/close the taglist
        window. You can use the ":help taglist" command to get more information
        about using the taglist plugin.

3) ~/.vimrc配置

"F8打开或者关闭taglist

nnoremap <silent> <F8> :TlistToggle<CR> F8 

let Tlist_Exit_OnlyWindow=1 "关闭文件时自动关闭taglist

let Tlist_File_Fold_Auto_Close=1 "taglist window中折叠非当前文件

let Tlist_Process_File_Always=1 "taglist始终解析文件

注:快捷键是可以改变的

F8打开或者关闭taglist

装了winmanager之后可以用wm快捷键打开winmanager

winmanager包含taglist和NERDTree两个插件

5、NERDTree插件安装及配置

1) 查找插件

在官网http://www.vim.org中查找NERDTree插件

http://www.vim.org/scripts/script.php?script_id=1658

2) 安装:

Unzip the archive into your ~/.vim directory.
That should put NERD_tree.vim in ~/.vim/plugin and NERD_tree.txt in ~/.vim/doc.

其余的也要一起复制到~/.vim目录下,不然会出错

Run :helptags  $HOME/.vim/doc
run vim and :help NERD_tree.txt for the help page.

3) ~/.vimrc配置

为了让winmanager顺利打开NERDTree窗口,在.vimrc中增加下面代码,

let g:NERDTree_title=‘[NERD Tree]‘

function! NERDTree_Start()

  exec ‘NERDTree‘

endfunction

function! NERDTree_IsValid()

  return 1

endfunction

6、winmanager插件安装及配置

1) 查找插件

在官网中http://www.vim.org查找插件

http://www.vim.org/scripts/script.php?script_id=95

2) 安装

官网说明(加黑部分为我放置的位置):

1. copy the file to your $HOME/.vim or $HOME\vimfiles directory
2. unzip it (its a zip file) at that location. this should create the files
   - plugin/
       winmanager.vim
       winfileexplorer.vim
       wintagexplorer.vim
   - doc/
       winmanager.txt
   IMPORTANT NOTE:
   i  . This version of winmanager ONLY works if you have the latest version
        bufexplorer.vim. (vimscript #42).
        The idea is that winmanager will no longer contain a duplicate copy
        of bufexplorer.vim. This reduces script bloat, makes updates easier
        and in genral makes the world a better place.
3. vim -c "helptags ~/.vim/doc" -c "q"  (unix)
   or
   vim -c "helptags ~/vimfiles/doc" -c "q"  (windows)
   (this step should install winmanager.txt as a local help file on your
   system. if this doesnt work, see ":he add-local-help" to see how to do
   it).
You will also need to change the mappings you might have used with
winmanager-1.x to
    map <c-w><c-f> :FirstExplorerWindow<cr>
    map <c-w><c-b> :BottomExplorerWindow<cr>
    map <c-w><c-t> :WMToggle<cr>
and the variable name g:bufExplorerWidth has been changed to
g:winManagerWidth just to be more consistent.

3) 配置

"显示NERDTree和taglist窗口,默认在左边

let g:winManagerWindowLayout=‘NERDTree|TagList‘

"wm 打开关闭winmanager

nmap wm :WMToggle<cr>

"跳到上面窗口(NERDTree)

map wf :FirstExplorerWindow<cr>

"跳到下边窗口(taglist)

map wb :BottomExplorerWindow<cr>

因为winmanager总会打开一个没有用的空窗口,不知道为什么,需要最后加q关闭它。如果是用WMToggle打开winmanager的话,要关闭这个空窗口就需要在winmanager.vim的ToggleWindowsManager函数中增加q。

function! <SID>ToggleWindowsManager()  

  if IsWinManagerVisible()  

    call s:CloseWindowsManager()  

  else  

    call s:StartWindowsManager()  

    "close empty window
   exe ‘q‘  

  end
endfunction  

问题:

  1. 还没实现Ctags在Vim打开一个文件之后,当前目录相应更改为这个文件的目录,然后再生成tags
  2. 还没实现NERD_Tree在Vim打开一个文件之后,当前目录相应更改为这个文件的目录,而是还是$HOME。
  3. 退出要:q好多次

二、Windows10下配置

1、配置vimrc文件

输入:version课查看vimrc文件及位置:

在$HOME/_vimrc更改设置,据说史上最强配置文件:http://amix.dk/vim/vimrc.html,将最强配置文件复制到上述vimrc文件。

2、ctags安装和配置

1) 安装

http://ctags.sourceforge.net/ 下载ctags58

将压缩包解压到$VIM/vimfiles/plugin

在系统变量Path中添加$VIM/vimfiles/plugin

2) ~/.vimrc配置

在$HOME/_vimrc中插入相同的代码

3、Cscope安装和配置

未安装

4、taglist插件安装及配置

与Ubuntu设置类似,只是插件放置在$VIM/vimfiles目录下的plugin和doc文件下

配置代码,在$HOME/_vimrc中插入

5、NERDTree插件安装及配置

与Ubuntu设置类似,只是插件放置在$VIM/vimfiles目录下的plugin和doc文件下

配置代码,在$HOME/_vimrc中插入

6、winmanager插件安装及配置

与Ubuntu设置类似,只是插件放置在$VIM/vimfiles目录下的plugin和doc文件下

配置代码,在$HOME/_vimrc中插入

三、最终界面

四、参考资料

http://amix.dk/vim/vimrc.html

https://github.com/amix/vimrc

http://www.cnblogs.com/coderkian/p/3823366.html

时间: 2024-08-09 10:44:07

打造vim成类source insight——contiki源码阅读工具的相关文章

ubuntu下linux内核源码阅读工具和调试方法总结

http://blog.chinaunix.net/uid-20940095-id-66148.html 一 linux内核源码阅读工具 windows下当然首选source insight, 但是linux下就没有source insight这么优秀的工具了,但是也有不少的替代品,但觉绝对部分人会选择vim+ctags+cscope的组合,还有部分人或选择wine中的source insight或选择navigatror,当然对于代码阅读来说vim+ctags+cscope的组合还是比较好的一

&lt;Flume&gt;&lt;Source Code&gt;&lt;Flume源码阅读笔记&gt;

Overview source采集的日志首先会传入ChannelProcessor, 在其内首先会通过Interceptors进行过滤加工,然后通过ChannelSelector选择channel. Source和Sink之间是异步的,sink只需要监听自己关系的Channel的变化即可. sink存在写失败的情况,flume提供了如下策略: 默认是一个sink,若写入失败,则该事务失败,稍后重试. 故障转移策略:给多个sink定义优先级,失败时会路由到下一个优先级的sink.sink只要抛出一

OpenJDK 源码阅读之 Java 字节流输入类的实现

Java 的输入输出总是给人一种很混乱的感觉,要想把这个问题搞清楚,必须对各种与输入输出相关的类之间的关系有所了解.只有你了解了他们之间的关系,知道设计这个类的目的是什么,才能更从容的使用他们. 我们先对 Java I/O 的总体结构进行一个总结,再通过分析源代码,给出把每个类的关键功能是如何实现的. Java I/O 的主要结构 Java 的输入输出,主要分为以下几个部分: 字节流 字符流 Socket 新 I/O 每个部分,都包含了输入和输出两部分. 实现概要 这里只给出每个类的实现概要,具

OpenJDK 源码阅读之 Java 字节流输出类的实现

Java 的输入输出总是给人一种很混乱的感觉,要想把这个问题搞清楚,必须对各种与输入输出相关的类之间的关系有所了解.只有你了解了他们之间的关系,知道设计这个类的目的是什么,才能更从容的使用他们. 这是这个系列的第二篇,描述字节输出类的实现,第一篇见:OpenJDK 源码阅读之 Java 字节流输入类的实现 字节流输出 图1 Java 字节输出类 OutputStream OutputStream是所有字节输出类的超类,这是个抽象类,需要实现其中定义的 write 函数,才能有实用的功能. pub

Contiki源码结构

Contiki源码结构 apps目录下,用于存放Application,也就是我们的应用程序放在这个目录下.如webserver,webrowser等,如下图所示. core目录是contiki操作系统的内核所在. 其中cfs是contiki file system interface 模块,provide a lightweight flash system,called Coffee. 也就是文件系统. 其中ctk是contiki的图形界面模块,提供了graphical user inter

Flume-NG源码阅读之SourceRunner,及选择器selector和拦截器interceptor的执行

在AbstractConfigurationProvider类中loadSources方法会将所有的source进行封装成SourceRunner放到了Map<String, SourceRunner> sourceRunnerMap之中.相关代码如下: 1 Map<String, String> selectorConfig = context.getSubProperties( 2 BasicConfigurationConstants.CONFIG_SOURCE_CHANNE

Flume-NG源码阅读之AvroSink

org.apache.flume.sink.AvroSink是用来通过网络来传输数据的,可以将event发送到RPC服务器(比如AvroSource),使用AvroSink和AvroSource可以组成分层结构.它继承自AbstractRpcSink  extends AbstractSink implements Configurable这跟其他的sink一样都得extends AbstractSink implements Configurable,所以重点也在confgure.start.

【Java】【Flume】Flume-NG源码阅读之AvroSink

org.apache.flume.sink.AvroSink是用来通过网络来传输数据的,可以将event发送到RPC服务器(比如AvroSource),使用AvroSink和AvroSource可以组成分层结构.它继承自AbstractRpcSink  extends AbstractSink implements Configurable这跟其他的sink一样都得extends AbstractSink implements Configurable,所以重点也在confgure.start.

Android 源码分析工具

标 题: [原创]Android源码分析工具及方法作 者: MindMac时 间: 2014-01-02,09:32:35链 接: http://bbs.pediy.com/showthread.php?t=183278 在对 Android 源码进行分析时,如果有得力的工具辅助,会达到事半功倍的效果.本文介绍了一些在分析 Android 源码时使用的一些工具和方法,希望能够帮助到有需要的同学. Eclipse 在 Android 应用程序开发过程中,一般会使用 Eclipse,当然 Googl