Ⅰ. 插件描述
Extremely simple Vim plugin for working with Angular projects.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'sindrenm/angular-vim-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'sindrenm/angular-vim-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'sindrenm/angular-vim-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/sindrenm/angular.vim
Ⅳ. 文档说明
# angular.vim
Extremely simple Vim plugin for working with Angular projects.
This plugin makes available the following commands:
:Acontrollername-of-controller:Adirectivename-of-directive:Afiltername-of-filter:Aservicename-of-service
These commands basically opens files at predefined locations. Wanna know what
these locations are? Read on.
(Oh, and by the way, it autocompletes your filenames too!)
Default file lookup paths
If the plugin is not configured, it assumes that your files are located in the
following directories:
- Controllers: src/javascripts/angular/controllers
- Directives: src/javascripts/angular/directives
- Filters: src/javascripts/angular/filters
- Services: src/javascripts/angular/services
This is probably not what you want, so read on.
Configuration
To be honest, this plugin doesn't do much more than create/open files for you at
predefined locations, but at least those locations can be configured!
First off, you can configure the base lookup path, which is determined by theg:angular_src_path variable. To set it, put the following somewhere in your
.vimrc or whatever:
let g:angular_src_path = "path/to/your/angular/stuff"
Furthermore, the plugin allows you to specify where your controllers,
directives, filters and services are located, by setting these variables,
respectively:
g:angular_controller_src_dirg:angular_directive_src_dirg:angular_filter_src_dirg:angular_service_src_dir
Whichever you do not specify will be resolved asg:angular_src_path_/{controllers,directives,filters,services}_.
Very good example
If your .vimrc file looks like this:
let g:angular_src_path = "app/assets/javascripts/angular"
let g:angular_controller_src_dir = "ctrl"
let g:angular_filter_src_dir = "pipers"
Now angular.vim will check the following directories:
- Controllers: app/assets/javascripts/angular/ctrl (modified above)
- Directives: app/assets/javascripts/angular/directives (default directory)
- Filters: app/assets/javascripts/angular/pipers (modified above)
- Services: app/assets/javascripts/angular/services (default directory)
A note about Riml
VimL scares me. Really. I would probably never have made this thing if it wasn't
for the much more relaxing [Riml], which you should definitely check out!
Hate it?
- Fork the project
- Make it better (using [Riml])
- Throw me a pull request
- Wait in excitement
As this is my very first Vim plugin, it should have some obvious flaws or
- If you think you can do better, I'd love to see how. I'll probably
- with you!