Ⅰ. 插件描述
Simple vim plugin that allows 'gt' in javascript files that include dependencies with require.jsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'nyanhan/requirejs-vim-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'nyanhan/requirejs-vim-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'nyanhan/requirejs-vim-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/nyanhan/requirejs.vim
Ⅳ. 文档说明
requirejs.vim
Simple vim plugin that allows 'gt' in javascript files that include dependencies with require.js
This the first vim plugin i created. Recommendations for improvements most welcome.
Install and Use
To install, copy the javascript file into vim's ftplugin folder.
To use it, open a file with require.js define/require instructions, move the
cursor either over the filename-string or the name of a module and press gt and
the module's file will be opened in a new tab.
How it works
The script scans your current workingdirectory recursively for a
requirejs.config statement, gets the baseUrl and paths configs.
When you perform a gt, the module will be found using the baseUrl and paths (if
exist).
Todos
- make sure that we are in a file with require.js instructions (define,
require) - save map for each buffer
- update map after creating new dependency