├── .gitignore ├── UltiSnips └── javascript.snippets ├── autoload ├── neojs.vim └── neojs │ ├── node.vim │ ├── plug.vim │ └── unite.vim ├── docs └── plugins.md ├── plugin ├── neomake.vim ├── node.vim ├── plugins.vim ├── tasks.vim ├── test.vim └── unite.vim ├── readme.md ├── resources ├── menus.gif └── neojs.png └── templates └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | installed 2 | -------------------------------------------------------------------------------- /UltiSnips/javascript.snippets: -------------------------------------------------------------------------------- 1 | # Common 2 | snippet ()() 3 | (function $1() { 4 | $2 5 | })(); 6 | endsnippet 7 | 8 | snippet f) 9 | function (err) { 10 | $1 11 | }); 12 | endsnippet 13 | 14 | snippet #! 15 | #!/usr/bin/env node 16 | endsnippet 17 | 18 | snippet ok 19 | Object.keys($1); 20 | endsnippet 21 | 22 | snippet l 23 | console.log($1); 24 | endsnippet 25 | 26 | snippet e 27 | console.error($1); 28 | endsnippet 29 | 30 | # ES6: Coming from https://github.com/isRuslan/vim-es6/tree/master/UltiSnips 31 | snippet gfn 32 | function* ${1:name}(${2}) { 33 | yield ${3}; 34 | } 35 | endsnippet 36 | 37 | snippet => "Arrow function" i 38 | (${1}) => { 39 | ${2} 40 | } 41 | endsnippet 42 | 43 | snippet class 44 | class ${1:name} { 45 | constructor(${2:arg}) { 46 | ${3:// init} 47 | } 48 | ${4} 49 | } 50 | endsnippet 51 | 52 | snippet forof 53 | for (let ${1:s} of ${2:sequence}) { 54 | ${3} 55 | } 56 | endsnippet 57 | 58 | snippet im 59 | import ${1:foo} from '${2:bar}' 60 | endsnippet 61 | 62 | # Coming from https://github.com/bentayloruk/vim-react-es6-snippets 63 | 64 | 65 | # 66 | # React snippets 67 | # 68 | 69 | snippet cs "React.addons.classSet" b 70 | var cx = React.addons.classSet; 71 | endsnippet 72 | 73 | snippet cdm "component did mount" b 74 | componentDidMount: function() { 75 | ${1} 76 | },$0 77 | endsnippet 78 | 79 | snippet cdup "component did update" b 80 | componentDidUpdate: function(prevProps, prevState) { 81 | ${1} 82 | },$0 83 | endsnippet 84 | 85 | snippet cwm "component will mount" b 86 | componentWillMount: function() { 87 | ${1} 88 | },$0 89 | endsnippet 90 | 91 | snippet cwr "component will receive props" b 92 | componentWillReceiveProps: function(nextProps) { 93 | ${1} 94 | },$0 95 | endsnippet 96 | 97 | snippet cwun "component will unmount" b 98 | componentWillUnmount: function() { 99 | ${1} 100 | },$0 101 | endsnippet 102 | 103 | snippet cwu "component will update" b 104 | componentWillUpdate: function(nextProps, nextState) { 105 | ${1} 106 | },$0 107 | endsnippet 108 | 109 | snippet cx 110 | cx({ 111 | ${1}: ${2} 112 | }); 113 | endsnippet 114 | 115 | snippet fup 116 | forceUpdate(${1:callback}); 117 | endsnippet 118 | 119 | snippet gdp "get default props" b 120 | getDefaultProps: function() { 121 | return { 122 | ${1} 123 | }; 124 | },$0 125 | endsnippet 126 | 127 | snippet gis "get initial state" b 128 | getInitialState: function() { 129 | return { 130 | ${1}: ${2} 131 | }; 132 | },$0 133 | endsnippet 134 | 135 | snippet ism "is mounted" 136 | isMounted() 137 | endsnippet 138 | 139 | snippet jsx "define jsx dom" b 140 | /** 141 | * @jsx React.DOM 142 | */ 143 | endsnippet 144 | 145 | snippet pt "propTypes" b 146 | propTypes: { 147 | ${1}: React.PropTypes.${2:string} 148 | }, 149 | endsnippet 150 | 151 | snippet rcc "create class/component" b 152 | ${1:/** 153 | * @jsx React.DOM 154 | */ 155 | 156 | var React = require('React'); 157 | } 158 | var ${2:ClassName} = React.createClass({ 159 | 160 | render: function() { 161 | return ( 162 | ${VISUAL}$4 163 | ); 164 | } 165 | 166 | }); 167 | $0 168 | ${3:module.exports = $2;} 169 | endsnippet 170 | 171 | snippet ren 172 | render: function() { 173 | return ( 174 | ${1:
} 175 | ); 176 | }$0 177 | endsnippet 178 | 179 | snippet sst "set state" b 180 | this.setState({ 181 | ${1}: ${2} 182 | });$0 183 | endsnippet 184 | 185 | snippet scu "should component update" 186 | shouldComponentUpdate: function(nextProps, nextState) { 187 | ${1} 188 | },$0 189 | endsnippet 190 | 191 | snippet props "get property" i 192 | this.props.${1} 193 | endsnippet 194 | 195 | snippet state "get state" i 196 | this.state.${1} 197 | endsnippet 198 | 199 | snippet trp 200 | this.transferPropsTo(${VISUAL}$0); 201 | endsnippet 202 | -------------------------------------------------------------------------------- /autoload/neojs.vim: -------------------------------------------------------------------------------- 1 | 2 | " Takes any number of String arguments, and append for each of them the 3 | " correspoding `var stuff = require('stuff');` statement. In addition, if 4 | " tabular is installed, it tries to align `=` in each of these added lines. 5 | " 6 | " Example: 7 | " 8 | " :call s:require('fs', 'path', 'util', 'nopt') 9 | " 10 | " should append the following lines 11 | " 12 | " var fs = require('fs'); 13 | " var path = require('path'); 14 | " var util = require('util'); 15 | " var nopt = require('nopt'); 16 | let s:modules = [] 17 | 18 | " sindreshorus/builtin-modules 19 | let s:script = 'var blacklist = [' 20 | let s:script .= '"freelist",' 21 | let s:script .= '"sys"' 22 | let s:script .= '];' 23 | 24 | let s:script .= 'console.log(Object.keys(process.binding("natives")).filter(function (el) {' 25 | let s:script .= ' return !/^_|^internal|\//.test(el) && blacklist.indexOf(el) === -1;' 26 | let s:script .= '}).sort().join(" "));' 27 | 28 | function! s:filterModule(value, modules) 29 | return index(a:modules, a:value) == -1 30 | endfunction 31 | 32 | function! neojs#require(command) 33 | let args = split(a:command) 34 | 35 | if len(s:modules) == 0 36 | let s:modules = split(system("node -pe '" . s:script . "'"), ' ') 37 | endif 38 | 39 | let reqlist = map(copy(args), '"var " . v:val . " = require(''" . v:val . "'');"') 40 | 41 | let toinstall = filter(args, 's:filterModule(v:val, s:modules)') 42 | 43 | if(exists('*tabular#TabularizeStrings')) 44 | call tabular#TabularizeStrings(reqlist, '=') 45 | endif 46 | 47 | call append(line('.'), reqlist) 48 | 49 | if len(toinstall) != 0 50 | exe "Npmi " . join(toinstall, ' ') 51 | endif 52 | 53 | exe "wincmd j" 54 | endfunction 55 | 56 | " Completion function for npm 57 | " 58 | " Delegates to `npm completion`. 59 | function! neojs#npmcomplete(lead, line, pos) 60 | " code 61 | let cmd = 'COMP_CWORD="0" COMP_LINE="' . a:lead . '" COMP_POINT="' . a:pos . '" npm completion -- "' . a:line . '"' 62 | return system(cmd) 63 | endfunction 64 | -------------------------------------------------------------------------------- /autoload/neojs/node.vim: -------------------------------------------------------------------------------- 1 | 2 | " Run current file with node 3 | function! neojs#node#run() 4 | let bufnr = expand('') 5 | let file = expand('%:p') 6 | 7 | exe 'Term node ' . file 8 | endf 9 | 10 | -------------------------------------------------------------------------------- /autoload/neojs/plug.vim: -------------------------------------------------------------------------------- 1 | function! neojs#plug#init() 2 | PlugUpdate 3 | UpdateRemotePlugins 4 | endfunction 5 | -------------------------------------------------------------------------------- /autoload/neojs/unite.vim: -------------------------------------------------------------------------------- 1 | let s:leaderKey = exists('&mapleader') ? &mapleader : ',' 2 | let s:localKey = exists('&maplocalleader') ? &maplocalleader : '' 3 | let s:delimiter = exists('g:neojs_unite_delimiter') ? g:neojs_unite_delimiter : ' ❯ ' 4 | 5 | let s:padding = ' ' 6 | let s:padding .= ' ' 7 | let s:padding .= ' ' 8 | let s:padding .= ' ' 9 | 10 | " Unite integration menu 11 | 12 | " Creates a new source 13 | " 14 | " - name: menu name 15 | " - description: menu description 16 | " - mapping: mapping right padded 17 | " - candidates: a list of candidates 18 | function! neojs#unite#source_menu(name, description, mapping, candidates) 19 | let source = {} 20 | let source.name = a:name 21 | let source.description = a:description 22 | let source.description .= s:padding[len(a:description):] 23 | let source.description .= s:leaderKey . a:mapping 24 | let source.command_candidates = copy(a:candidates) 25 | 26 | return source 27 | endfunction 28 | 29 | " Creates a new candidate for a menu 30 | " 31 | " - name 32 | " - mapping 33 | " - command 34 | function! neojs#unite#create_candidate(name, mapping, command) 35 | return [s:delimiter . a:name . s:padding[len(a:name) + 3:] . s:leaderKey . a:mapping, a:command] 36 | endfunction 37 | 38 | 39 | function! neojs#unite#candidates(unite_menu, empty_list) 40 | let l:empty_list = a:empty_list 41 | 42 | if empty(a:unite_menu) 43 | return l:empty_list 44 | endif 45 | 46 | for entry in a:unite_menu 47 | if type(entry) == 1 48 | let entry = substitute(entry, '\V\c', '\1'.s:leaderKey, 'g') 49 | elseif type(entry) == 3 50 | let entry = neojs#unite#candidates(entry, []) 51 | endif 52 | 53 | call add(l:empty_list, entry) 54 | endfor 55 | 56 | return l:empty_list 57 | endfunction 58 | -------------------------------------------------------------------------------- /docs/plugins.md: -------------------------------------------------------------------------------- 1 | ## Plugins 2 | 3 | The file `plugin/plugins.vim` uses vim-plug API to dynamically load the following plugins: 4 | 5 | - **[vim-sensible][]** A universal set of defaults that (hopefully) everyone can agree on. 6 | - **[unite][]** Unite is used to provide fuzzy finder like feature for various source 7 | - **[neomake][]** Neovim's Syntasic equivalent. Asynchronous linting using Neovim's job-control functionality 8 | - **[deoplete][]** Provides an asynchronous keyword completion system in the current buffer 9 | - **[ternjs][]** Tern based JavaScript editing support 10 | - **[deoplete-ternjs][]** deoplete source for javascript using Tern 11 | - **[vim-javascript][]** JavaScript bundle for vim, this bundle provides syntax and indent plugins 12 | - **[yajs.vim][]** Yet Another JavaScript Syntax file 13 | - **[es.next.syntax.vim][]** Syntax file is for ES7 and future syntax 14 | - **[mdn.vim][]** Query http://mdn.io and see the Markdown result in a vertical buffer 15 | - **[jscs.vim][]** `jscs -x` command: `:Format` can take range or operate on the whole file 16 | - **[split-term.vim][]** Utilites around neovim's `:terminal` 17 | - **[vim-node][]** Tools to make Vim superb for developing with Node 18 | - **[node-host][]** [Neovim's remote 19 | plugin](https://neovim.io/doc/user/remote_plugin.html) feature is kinda cool. 20 | It is now possible to author neovim plugins using JavaScript and node only. 21 | See [this page](./docs/remote-plugin.md) for more informations on how to 22 | create your own node plugin, or browse 23 | [mdown.vim](https://github.com/vimlab/mdown.vim) code which is an experiment 24 | on using neovim's and [node-host][] remote API. 25 | 26 | [vim-sensible]: https://github.com/tpope/vim-sensible 27 | [Unite]: https://github.com/Shougo/unite.vim 28 | [UltiSnips]: https://github.com/SirVer/ultisnips 29 | [Neomake]: https://github.com/benekastah/neomake 30 | [deoplete]: https://github.com/Shougo/deoplete.nvim 31 | [ternjs]: https://github.com/ternjs/tern_for_vim 32 | [deoplete-ternjs]: https://github.com/carlitux/deoplete-ternjs 33 | [es.next.syntax.vim]: https://github.com/othree/es.next.syntax.vim 34 | [mdn.vim]: https://github.com/vimlab/mdn.vim 35 | [jscs.vim]: https://github.com/vimlab/jscs.vim 36 | [split-term.vim]: https://github.com/vimlab/split-term.vim 37 | [vim-node]: https://github.com/moll/vim-node 38 | [t.vim]: https://github.com/vimlab/t.vim 39 | [node-host]: https://github.com/neovim/node-host 40 | [Fugitive]: https://github.com/tpope/vim-fugitive 41 | -------------------------------------------------------------------------------- /plugin/neomake.vim: -------------------------------------------------------------------------------- 1 | let g:unite_source_menu_menus = exists('g:unite_source_menu_menus') ? g:unite_source_menu_menus : {} 2 | 3 | let g:neomake_javascript_eslint_maker = { 4 | \ 'args': ['--env', 'es6', '-f', 'compact'], 5 | \ 'errorformat': '%E%f: line %l\, col %c\, Error - %m,%W%f: line %l\, col %c\, Warning - %m' 6 | \ } 7 | 8 | let g:neomake_javascript_enabled_makers = ['eslint'] 9 | let g:neomake_json_enabled_makers = ['jsonlint'] 10 | 11 | " Run neomake on save for js/json files 12 | autocmd! BufWritePost *.js Neomake 13 | autocmd! BufWritePost *.json Neomake 14 | 15 | " Build Unite Menu 16 | function! s:dirpath(val) 17 | return fnamemodify(a:val, ':t:r') 18 | endfunction 19 | 20 | let s:candidates = [] 21 | let s:filetypes = ['javascript', 'json'] 22 | 23 | for ft in s:filetypes 24 | call add(s:candidates, neojs#unite#create_candidate(ft, 'm' . ft[:1], 'Neomake')) 25 | endfor 26 | 27 | let g:unite_source_menu_menus.lint = neojs#unite#source_menu('lint', 'Linter with neomake', 'm', s:candidates) 28 | let g:unite_source_menu_menus.lint.command_candidates = neojs#unite#candidates(s:candidates, []) 29 | 30 | nnoremap [menu]l :Unite -silent -start-insert menu:lint 31 | -------------------------------------------------------------------------------- /plugin/node.vim: -------------------------------------------------------------------------------- 1 | let g:unite_source_menu_menus = exists('g:unite_source_menu_menus') ? g:unite_source_menu_menus : {} 2 | 3 | " ### Require fs path 4 | command! -complete=file -nargs=+ Require call neojs#require() 5 | 6 | " ### Npm install qs 7 | command! -complete=custom,neojs#npmcomplete -nargs=* Npm :Term npm 8 | 9 | " ### Npmi qs request 10 | command! -complete=file -nargs=* Npmi :3Term npm install --save 11 | 12 | " ### Node app.js 13 | command! -complete=file -count=2 -nargs=* Node :Term node 14 | 15 | " ### NodeRun 16 | command! -nargs=* NodeRun call neojs#node#run() 17 | 18 | " ### Ctrl+R to run the curent file with node 19 | " au BufEnter *.js nmap :call neojs#node#run 20 | 21 | let s:candidates = [] 22 | 23 | call add(s:candidates, neojs#unite#create_candidate('require', 'r', 'Require fs')) 24 | call add(s:candidates, neojs#unite#create_candidate('npm', 'n', 'Npm')) 25 | call add(s:candidates, neojs#unite#create_candidate('npmi', 'ni', 'Npmi')) 26 | call add(s:candidates, neojs#unite#create_candidate('node run', 'nr Ctrl+R', 'NodeRun')) 27 | call add(s:candidates, neojs#unite#create_candidate('node', 'nn', 'Node')) 28 | 29 | let g:unite_source_menu_menus.node = neojs#unite#source_menu('node', 'Node & npm menu', 'n', s:candidates) 30 | let g:unite_source_menu_menus.node.command_candidates = neojs#unite#candidates(s:candidates, []) 31 | 32 | nnoremap [menu]n :Unite -silent -start-insert menu:node 33 | -------------------------------------------------------------------------------- /plugin/plugins.vim: -------------------------------------------------------------------------------- 1 | Plug 'tpope/vim-sensible' 2 | Plug 'Shougo/unite.vim' 3 | Plug 'Shougo/deoplete.nvim' 4 | Plug 'sirver/ultisnips' 5 | Plug 'honza/vim-snippets' 6 | Plug 'vimlab/split-term.vim' 7 | Plug 'moll/vim-node' 8 | Plug 'othree/yajs.vim' 9 | Plug 'pangloss/vim-javascript' 10 | Plug 'nono/vim-handlebars' 11 | 12 | Plug 'neomake/neomake', { 'do': 'npm install --cache-min Infinity --loglevel http -g eslint jsonlint' } 13 | Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install --cache-min Infinity --loglevel http -g tern' } 14 | Plug 'ternjs/tern_for_vim', { 'do': 'npm install --cache-min Infinity --loglevel http' } 15 | Plug 'neovim/node-host', { 'do': 'npm install --cache-min Infinity --loglevel http' } 16 | -------------------------------------------------------------------------------- /plugin/tasks.vim: -------------------------------------------------------------------------------- 1 | " Task runner helpers 2 | let s:candidates = [] 3 | 4 | " Grunt 5 | call add(s:candidates, neojs#unite#create_candidate('grunt', 'bgr', 'Term grunt')) 6 | call add(s:candidates, neojs#unite#create_candidate('grunt --help', 'bgrh', 'Term grunt --help')) 7 | call add(s:candidates, neojs#unite#create_candidate('grunt --list', 'bgrl', 'Term grunt --list')) 8 | 9 | " Gulp 10 | call add(s:candidates, neojs#unite#create_candidate('gulp', 'bgul', 'Term ava')) 11 | call add(s:candidates, neojs#unite#create_candidate('gulp help', 'bguh', 'Term ava --help')) 12 | 13 | let g:unite_source_menu_menus.task = neojs#unite#source_menu('task', 'Task helpers (Grunt & Gulp)', 'b', s:candidates) 14 | let g:unite_source_menu_menus.task.command_candidates = neojs#unite#candidates(s:candidates, []) 15 | 16 | nnoremap [menu]t :Unite -silent -start-insert menu:task 17 | -------------------------------------------------------------------------------- /plugin/test.vim: -------------------------------------------------------------------------------- 1 | 2 | " Test runner helpers 3 | 4 | let s:candidates = [] 5 | 6 | " Mocha 7 | call add(s:candidates, neojs#unite#create_candidate('mocha --ui bdd', 'tm', 'Term mocha --ui bdd')) 8 | call add(s:candidates, neojs#unite#create_candidate('mocha --ui tdd', 'tmt', 'Term mocha --ui tdd')) 9 | call add(s:candidates, neojs#unite#create_candidate('mocha --ui exports', 'tmx', 'Term mocha --ui exports')) 10 | call add(s:candidates, neojs#unite#create_candidate('mocha --help', 'tmh', 'Term mocha --help')) 11 | call add(s:candidates, neojs#unite#create_candidate('mocha --interfaces', 'tmi', 'Term mocha --interfaces')) 12 | call add(s:candidates, neojs#unite#create_candidate('mocha --reporters', 'tmr', 'Term mocha --reporters')) 13 | 14 | " Ava 15 | call add(s:candidates, neojs#unite#create_candidate('ava', 'ta', 'Term ava')) 16 | call add(s:candidates, neojs#unite#create_candidate('ava --help', 'tap', 'Term ava --help')) 17 | call add(s:candidates, neojs#unite#create_candidate('ava --init', 'tai', 'Term ava --init')) 18 | 19 | let g:unite_source_menu_menus.test = neojs#unite#source_menu('test', 'Test helpers (Mocha & Ava)', 't', s:candidates) 20 | let g:unite_source_menu_menus.test.command_candidates = neojs#unite#candidates(s:candidates, []) 21 | 22 | nnoremap [menu]t :Unite -silent -start-insert menu:test 23 | -------------------------------------------------------------------------------- /plugin/unite.vim: -------------------------------------------------------------------------------- 1 | let g:unite_source_menu_menus = exists('g:unite_source_menu_menus') ? g:unite_source_menu_menus : {} 2 | 3 | nnoremap [menu] 4 | nmap m [menu] 5 | nmap [menu] 6 | nmap [menu] 7 | 8 | if !exists('g:unite_menu_prefix') 9 | let g:unite_menu_prefix = '' 10 | let g:unite_menu_prefix_value = g:mapleader 11 | endif 12 | 13 | call unite#custom#profile('default', 'context', { 14 | \ 'no-start_insert': 1, 15 | \ 'winheight': 7 16 | \ }) 17 | 18 | 19 | " nnoremap [menu]g :Unite -silent -start-insert menu:git 20 | " nnoremap [menu]t :Unite -silent -start-insert menu:vim 21 | 22 | nnoremap [menu]m :Unite -silent -winheight=3 -no-start-insert menu 23 | nnoremap [menu] :Unite -silent -no-start-insert menu 24 | nnoremap [menu], :Unite -silent -no-start-insert menu 25 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |

2 | neojs 3 |
4 |
5 |

6 | 7 | --- 8 | 9 | > Lightweight bag of utilities for NeoVim JavaScript developers 10 | 11 | --- 12 | 13 | - A carefully crafted set of [plugins](./docs/plugins.md) for JavaScript development with [nvim][] 14 | - [Sensible][] defaults and Syntax files for ES5 / ES6 15 | - Awesome JS completion using [deoplete][] and [Tern][] 16 | - Super fast asynchronous linting with [neomake][] 17 | - Shortcut commands to interact with npm & node 18 | - Ability to hit `Ctrl+R` to launch current file with node 19 | - Wrappers to popular JavaScript task runners like [Grunt] or [Gulp] 20 | - Same goodies for popular JavaScript test runners such as [Mocha] or [Ava] 21 | - A good amount of [UltiSnips][] snippets for ES6 & React 22 | - A bunch of templates (init new buffers with arbitrary content) 23 | 24 | ## Install 25 | 26 | Install [vim-plug][] and put this line into your `.vimrc` 27 | 28 | ``` 29 | Plug 'vimlab/neojs' 30 | ``` 31 | 32 | On first launch, it will install the list of plugins defined in [plugin/plugins.md](./plugin/plugins.vim). 33 | 34 | 1. Close vim and reopen 35 | 2. Run `:PlugStatus` to check your install and list of bundles 36 | 4. Run `:Unite menu` or hit `` to open the top Unite menu 37 | 5. Profit 38 | 39 | ## Plugins 40 | 41 | The file `plugin/plugins.vim` uses vim-plug API to dynamically load the following plugins: 42 | 43 | - **[vim-sensible][]** A universal set of defaults that (hopefully) everyone can agree on. 44 | - **[unite][]** Unite is used to provide fuzzy finder like feature for various source 45 | - **[neomake][]** Neovim's Syntasic equivalent. Asynchronous linting using Neovim's job-control functionality 46 | - **[deoplete][]** Provides an asynchronous keyword completion system in the current buffer 47 | - **[ternjs][]** Tern based JavaScript editing support 48 | - **[deoplete-ternjs][]** deoplete source for javascript using Tern 49 | - **[vim-javascript][]** JavaScript bundle for vim, this bundle provides syntax and indent plugins 50 | - **[yajs.vim][]** Yet Another JavaScript Syntax file 51 | - **[es.next.syntax.vim][]** Syntax file is for ES7 and future syntax 52 | - **[mdn.vim][]** Query http://mdn.io and see the Markdown result in a vertical buffer 53 | - **[jscs.vim][]** `jscs -x` command: `:Format` can take range or operate on the whole file 54 | - **[split-term.vim][]** Utilites around neovim's `:terminal` 55 | - **[vim-node][]** Tools to make Vim superb for developing with Node 56 | - **[node-host][]** [Neovim's remote 57 | plugin](https://neovim.io/doc/user/remote_plugin.html) feature is kinda cool. 58 | It is now possible to author neovim plugins using JavaScript and node only. 59 | See [this page](./docs/remote-plugin.md) for more informations on how to 60 | create your own node plugin, or browse 61 | [mdown.vim](https://github.com/vimlab/mdown.vim) code which is an experiment 62 | on using neovim's and [node-host][] remote API. 63 | 64 | [vim-sensible]: https://github.com/tpope/vim-sensible 65 | [Unite]: https://github.com/Shougo/unite.vim 66 | [UltiSnips]: https://github.com/SirVer/ultisnips 67 | [Neomake]: https://github.com/benekastah/neomake 68 | [deoplete]: https://github.com/Shougo/deoplete.nvim 69 | [ternjs]: https://github.com/ternjs/tern_for_vim 70 | [deoplete-ternjs]: https://github.com/carlitux/deoplete-ternjs 71 | [es.next.syntax.vim]: https://github.com/othree/es.next.syntax.vim 72 | [mdn.vim]: https://github.com/vimlab/mdn.vim 73 | [jscs.vim]: https://github.com/vimlab/jscs.vim 74 | [split-term.vim]: https://github.com/vimlab/split-term.vim 75 | [vim-node]: https://github.com/moll/vim-node 76 | [t.vim]: https://github.com/vimlab/t.vim 77 | [node-host]: https://github.com/neovim/node-host 78 | [Fugitive]: https://github.com/tpope/vim-fugitive 79 | 80 | When necessary, configuration for a given plugin can be found in 81 | `plugin/.vim` (ex. [plugin/neomake.vim](./plugin/neomake.vim)). 82 | 83 | ## Unite Menus 84 | 85 | [Unite][] is an awesome plugin for advanced VIM users. It offers a rich API to 86 | compose and design UI, in a simple way. 87 | 88 | [oh-my-vim] and [joedicastro's 89 | dotfiles](https://github.com/joedicastro/dotfiles/tree/master/vim) had the 90 | briliant idea of using Unite to define a list of Menus with available commands 91 | and mappings, which inspired the following: 92 | 93 | - lint - Linter with neomake 94 | - node - Node & npm menu 95 | - task - Task helpers (Grunt & Gulp) 96 | - tern - Tern commands (https://github.com/ternjs/tern_for_vim) 97 | - test - Test helpers (Mocha & Ava) 98 | 99 | **Ex.** 100 | Unite menus 101 | 102 | --- 103 | 104 | ### Node 105 | 106 | [vim-node][] already provides excellent support for node developement. 107 | 108 | [plugin/node.vim](./plugin/node.vim) adds a few more goodies: 109 | 110 | - `:NodeRun` command to open a vertical `:terminal` buffer with `node` command. 111 | The current buffer is executed and the result displayed. 112 | 113 | - `Ctrl+R` is the default mapping to run `:NodeRun` 114 | 115 | - `:Node ` opens a 2-lines horizontal buffer with node prompt 116 | 117 | - `:Require ` helper to quickly add new require statements 118 | 119 | ### npm 120 | 121 | - `:Npm [options]` Wrapper on top of `npm`. 122 | 123 | - `:Npmi packages...` alias for `:Npm install --save`, except that it opens 124 | an horizontal buffer with only two lines displayed. 125 | 126 | ### Snippets 127 | 128 | A list of [UltiSnips][] snippets can be found in the [snippets](./snippets) 129 | directory. 130 | 131 | - Common snippets like `f)`, `()()` to create IIFE, `#!` to expand node 132 | shebang, `ok` for `Object.keys()`, `e`, `l` to expand `console.` 133 | 134 | - ES6 snippets from https://github.com/isRuslan/vim-es6/tree/master/UltiSnips 135 | 136 | - React snippets from https://github.com/bentayloruk/vim-react-es6-snippets 137 | 138 | Run `:UltiSnipsEdit` to edit them or add additional ones. 139 | 140 | ### Templates 141 | 142 | [t.vim][] is a small "template" or scaffolding tool. 143 | 144 | It takes a list of template files from `~/.vim/templates` and use them to 145 | initialize new buffer from predefined content. 146 | 147 | Mustache like placeholders can be used to quickly jump from one item to 148 | another. With a little more work, [t.vim][] will ask the user for values to 149 | quickly replace `{{ var }}`. 150 | 151 | See [templates/](./templates) directory to see the list of available 152 | templates. 153 | 154 | You can add more templates in `~/.vim/templates`. The filename is important: 155 | Use `.` for a generic template to use for a particular filetype. 156 | Any other name can be used for a more specific template. `package.json` is a 157 | good example. 158 | 159 | 160 | ## Configuration 161 | 162 | - `g:neojs_bundles` Path to vim-plug plugin directories (`~/.vim/bundles`) 163 | - `g:neojs_unite_delimiter` Change the prefix value used in Unite Menus 164 | - `g:neojs_pluginfile` Path to the file listing plugins to install and load 165 | (`~/.vim/bundles/neojs/docs/plugins.md`) 166 | 167 | --- 168 | 169 | [vim-plug]: https://github.com/junegunn/vim-plug 170 | [Unite]: https://github.com/Shougo/unite.vim 171 | [UltiSnips]: https://github.com/SirVer/ultisnips 172 | [Neomake]: https://github.com/benekastah/neomake 173 | [deoplete]: https://github.com/Shougo/deoplete.nvim 174 | [Tern]: https://ternjs.net 175 | [ternjs]: https://github.com/ternjs/tern_for_vim 176 | [deoplete-ternjs]: https://github.com/carlitux/deoplete-ternjs 177 | [vim-javascript]: https://github.com/pangloss/vim-javascript 178 | [yajs.vim]: https://github.com/othree/yajs.vim 179 | [es.next.syntax.vim]: https://github.com/othree/es.next.syntax.vim 180 | [mdn.vim]: https://github.com/vimlab/mdn.vim 181 | [jscs.vim]: https://github.com/vimlab/jscs.vim 182 | [split-term.vim]: https://github.com/vimlab/split-term.vim 183 | [vim-node]: https://github.com/moll/vim-node 184 | [t.vim]: https://github.com/vimlab/t.vim 185 | [node-host]: https://github.com/neovim/node-host 186 | [Fugitive]: https://github.com/tpope/vim-fugitive 187 | [neovim]: https://github.com/neovim/neovim 188 | [nvim]: https://github.com/neovim/neovim 189 | [ava]: https://github.com/sindresorhus/ava 190 | [Mocha]: https://mochajs.org/ 191 | [Grunt]: http://gruntjs.com/ 192 | [Gulp]: http://gulpjs.com/ 193 | [vim-sensible]: https://github.com/tpope/vim-sensible 194 | [Sensible]: https://github.com/tpope/vim-sensible 195 | [oh-my-vim]: https://github.com/liangxianzhe/oh-my-vim 196 | -------------------------------------------------------------------------------- /resources/menus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimlab/neojs/3e28e3d5c9ea764714118cce10ebb20b63c383da/resources/menus.gif -------------------------------------------------------------------------------- /resources/neojs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimlab/neojs/3e28e3d5c9ea764714118cce10ebb20b63c383da/resources/neojs.png -------------------------------------------------------------------------------- /templates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ name }}", 3 | "author": "{{ ghUser }}", 4 | "version": "0.1.0", 5 | "description": "{{ description }}", 6 | "bin": "bin/{{ name }}", 7 | "repository": "github:{{ ghName }}/{{ name }}", 8 | "license": "ISC", 9 | "scripts": { 10 | "test": "mocha && npm run lint", 11 | "lint": "eslint . && jscs ." 12 | }, 13 | "devDependencies": { 14 | "eslint": "^2.7.0", 15 | "jscs": "^2.11.0", 16 | "mocha": "^2.4.5" 17 | }, 18 | "dependencies": { 19 | "chalk": "^1.1.3", 20 | "minimist": "^1.2.0" 21 | } 22 | } 23 | --------------------------------------------------------------------------------