NERDTree插件API小记

左手 posted @ 2015年12月25日 19:01 in Vim with tags vim vim tfs tfs checkout , 6238 阅读

之前因为vim上的TFS插件一直不好使,自己写了一个简单的插件在vim上签出TFS源文件。为了在NERDTree上面集成了菜单功能,研究了下NERDTree插件。年底忙里偷闲整理了一些关于NERDTree的知识点,分享出来。

1. 添加NERDTree文件菜单
在vim插件目录创建一个nerdtree_plugin文件夹,在其中新建vim脚本文件,使用NERDTreeAddMenuItem函数添加一项按钮项。参数格式:
{'text': 'menu text', 'shortcut': 'short key', 'callback':'callback function name'}
示例:
call NERDTreeAddMenuItem({ 'text': 'TFS Check (o)ut', 'shortcut': 'o', callback': 'TFSCheckoutCallback' })

2. 获取当前文件节点
let currentNode = g:NERDTreeFileNode.GetSelected()

3.获取文件路径
let currentFile = currentNode.path._strForGlob()

4.更新文件状态
cal currentNode.path.refresh()
cal NERDTreeRender()
# 当我们通过currentNode.path.refresh() 可以刷新文件节点,之后通过NERDTreeRender重绘获得更新。当通过操作修改了文件的属性后需要通过此操作更新文件状态。

附插件git地址:https://github.com/thinkjs/TFSCheckout
NERDTree FileNode参考:https://github.com/scrooloose/nerdtree/blob/5.0.0/lib/nerdtree/tree_file_node.vim
NERDTree Pathp参考:https://github.com/scrooloose/nerdtree/blob/5.0.0/lib/nerdtree/path.vim
NERDTree Public API参考:https://github.com/scrooloose/nerdtree/blob/5.0.0/plugin/NERD_tree.vim#L164

 
Avatar_small
ICICI Lombard claim 说:
2022年7月31日 13:44

ICICI Lombard Health Insurance Claim Form, If you are already a part of their Health insurance scheme and might have taken hospitalization for your medical necessities or may if you are just considering this scheme for future health benefits. Then you should read our article below because we will instruct you on the steps of how you can claim your health insurance in the prescribed form, ICICI Lombard claim form we will simply be explaining to you the steps required to use the ICICI Lombard health insurance claim form at their partnered hospitals to avail the health benefits you have subscribed to, and if having any queries, you may contact health insurance customer care over phone for clarification


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter