当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 集成winmanager 和 NERDTree
帖子发表于 : 2009-10-29 10:12 

注册: 2008-08-23 12:54
帖子: 3
送出感谢: 0 次
接收感谢: 0 次
NERDTree是个好插件 但如果同时使用它 又使用taglist的话 就不方便 所以想集成winmanager 和 NERDTree

winmanager的doc说是可以放入其他的插件的,但要提供一个全局变量名

In addition to registering, the plugin itself initializes a variable called
the "title" which starts with the name, such as: >

" this line goes in your script file.
let g:YourPlugin_title = "[My Plugin Title]"

还要提供几个方法
The following is a list of hooks which should be provided. A few of them are
optional. Consider the case where you want to add a plugin which you have
named "YourPlugin". In the following discussion, a "hook" simply refers to a
globally visible function which is formed according to the rule that it start
with the string "YourPlugin_", where "YourPlugin" is the name of your plugin.

*winmanager-hook-start*
YourPlugin_Start() This function is called during initialization. It
{Mandatory} can be assumed (and _should_ be) that the focus is
already in the buffer where stuff needs to be
displayed. i.e, the plugin shouldnt open some other
buffer during this function. (i.e, commands such as
":e", ":vsplit", ":wincmd h" etc in this stage are
bad. If however, you absolutely need to switch
buffers or something which will cause |BufEnter| or
|BufDelete| events, then you need to temporarily
switch winmanager off by using
|WinManagerSuspendAUs|)

*winmanager-hook-isvalid*
YourPlugin_IsValid() winmanager is dynamic in the sense that it allows the
{Mandatory} plugins to change their displays when a BufEnter event
occurs. At each BufEnter event, winmanager will cycle
through all the visible explorers asking them if
their display is "valid". If it isn't, then they will
be redrawn by calling the next function.

For plugins such as bufexplorer which change with
every BufEnter, it is sufficient to make this always
return 1. For plugins such as fileexplorer, the
display never changes with the BufEnter even. hence
in its case, it will always return 0

我看了他自己的filebrowser,是这么写的

" -- stuff used by winmanager
let g:FileExplorer_title = "[File List]"
function! FileExplorer_Start()
let b:displayMode = "winmanager"
if exists('s:lastDirectoryDisplayed')
call s:EditDir(s:lastDirectoryDisplayed)
else
call s:EditDir(expand("%:p:h"))
end
if exists('s:lastCursorRow')
exe s:lastCursorRow
exe 'normal! '.s:lastCursorColumn.'|'
end
endfunction

function! FileExplorer_IsValid()
return 1
endfunction


所以我在配置文件中做了如下定义
let g:NERDTree_title = "[NERDTree]"
function! NERDTree_Start()
call g:NERDTree()
endfunction

function! NERDTree_IsValid()
return 1
endfunction

let g:winManagerWindowLayout='NERDTree|TagList'

但提示我
NERDTree() 是 unknown function 这里主要应该是我语法不对 我刚接触vim 那么帮我看下start里应该怎么写去调用NERDTree


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 集成winmanager 和 NERDTree
帖子发表于 : 2009-11-09 9:43 

注册: 2008-08-23 12:54
帖子: 3
送出感谢: 0 次
接收感谢: 0 次
ding


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译