Ⅰ. 插件描述
(WIP) Lightweight bag of utilities for neovim JavaScript developersⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'vimlab/neojs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'vimlab/neojs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'vimlab/neojs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vimlab/neojs
Ⅳ. 文档说明
<h1 align="center">
<img width="360" src="./resources/neojs.png" alt="neojs">
<br>
<br></h1>
Lightweight bag of utilities for NeoVim JavaScript developers
- A carefully crafted set of plugins for JavaScript development with [nvim][]
- [Sensible][] defaults and Syntax files for ES5 / ES6
- Awesome JS completion using [deoplete][] and [Tern][]
- Super fast asynchronous linting with [neomake][]
- Shortcut commands to interact with npm & node
- Ability to hit
Ctrl+Rto launch current file with node - Wrappers to popular JavaScript task runners like [Grunt] or [Gulp]
- Same goodies for popular JavaScript test runners such as [Mocha] or [Ava]
- A good amount of [UltiSnips][] snippets for ES6 & React
- A bunch of templates (init new buffers with arbitrary content)
Install
Install [vim-plug][] and put this line into your .vimrc
Plug 'vimlab/neojs'On first launch, it will install the list of plugins defined in plugin/plugins.md.
- Close vim and reopen
- Run
:PlugStatusto check your install and list of bundles - Run
:Unite menuor hit<space><space>to open the top Unite menu - Profit
Plugins
The file plugin/plugins.vim uses vim-plug API to dynamically load the following plugins:
- [vim-sensible][] A universal set of defaults that (hopefully) everyone can agree on.
- [unite][] Unite is used to provide fuzzy finder like feature for various source
- [neomake][] Neovim's Syntasic equivalent. Asynchronous linting using Neovim's job-control functionality
- [deoplete][] Provides an asynchronous keyword completion system in the current buffer
- [ternjs][] Tern based JavaScript editing support
- [deoplete-ternjs][] deoplete source for javascript using Tern
- [vim-javascript][] JavaScript bundle for vim, this bundle provides syntax and indent plugins
- [yajs.vim][] Yet Another JavaScript Syntax file
- [es.next.syntax.vim][] Syntax file is for ES7 and future syntax
- [mdn.vim][] Query http://mdn.io and see the Markdown result in a vertical buffer
- [jscs.vim][]
jscs -xcommand::Formatcan take range or operate on the whole file - [split-term.vim][] Utilites around neovim's
:terminal - [vim-node][] Tools to make Vim superb for developing with Node
- [node-host][] [Neovim's remote
plugin](https://neovim.io/doc/user/remote_plugin.html) feature is kinda cool.
It is now possible to author neovim plugins using JavaScript and node only.
See this page for more informations on how to
create your own node plugin, or browse
mdown.vim code which is an experiment
on using neovim's and [node-host][] remote API.
When necessary, configuration for a given plugin can be found inplugin/<plugin>.vim (ex. plugin/neomake.vim).
Unite Menus
[Unite][] is an awesome plugin for advanced VIM users. It offers a rich API to
compose and design UI, in a simple way.
[oh-my-vim] and [joedicastro's
dotfiles](https://github.com/joedicastro/dotfiles/tree/master/vim) had the
briliant idea of using Unite to define a list of Menus with available commands
and mappings, which inspired the following:
- lint - Linter with neomake
- node - Node & npm menu
- task - Task helpers (Grunt & Gulp)
- tern - Tern commands (https://github.com/ternjs/tern_for_vim)
- test - Test helpers (Mocha & Ava)
Ex.
Node
[vim-node][] already provides excellent support for node developement.
plugin/node.vim adds a few more goodies:
:NodeRuncommand to open a vertical:terminalbuffer withnodecommand.
The current buffer is executed and the result displayed.Ctrl+Ris the default mapping to run:NodeRun:Node <args>opens a 2-lines horizontal buffer with node prompt:Require <args>helper to quickly add new require statements
npm
:Npm <command> [options]Wrapper on top ofnpm.:Npmi packages...alias for:Npm install <args> --save, except that it opens
an horizontal buffer with only two lines displayed.
Snippets
A list of [UltiSnips][] snippets can be found in the snippets
directory.
- Common snippets like
f),()()to create IIFE,#!to expand node
shebang,okforObject.keys(),e,lto expandconsole. - ES6 snippets from https://github.com/isRuslan/vim-es6/tree/master/UltiSnips
- React snippets from https://github.com/bentayloruk/vim-react-es6-snippets
Run :UltiSnipsEdit to edit them or add additional ones.
Templates
[t.vim][] is a small "template" or scaffolding tool.
It takes a list of template files from ~/.vim/templates and use them to
initialize new buffer from predefined content.
Mustache like placeholders can be used to quickly jump from one item to
- With a little more work, [t.vim][] will ask the user for values to
- replace
{{ var }}.
See templates/ directory to see the list of available
templates.
You can add more templates in ~/.vim/templates. The filename is important:
Use <language>.<ext> for a generic template to use for a particular filetype.
Any other name can be used for a more specific template. package.json is a
good example.
Configuration
g:neojs_bundlesPath to vim-plug plugin directories (~/.vim/bundles)g:neojs_unite_delimiterChange the prefix value used in Unite Menusg:neojs_pluginfilePath to the file listing plugins to install and load
(~/.vim/bundles/neojs/docs/plugins.md)