Vim

neovim配置js的开发环境

nvim for JavaScript development

Posted by yellowDog on 2018-09-29

安装neovim

1
brew install neovim

安装vim-plug

1
2
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

配置init.vim

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
call plug#begin('~/.vim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'wokalski/autocomplete-flow'
" For func argument completion
Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets'
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
call plug#end()
" deoplete

let g:deoplete#enable_at_startup = 1

" neosnippet

let g:neosnippet#enable_completed_snippet = 1

退出编辑模式并:PlugInstall

PS: Wiki地址


尝试一下

1
2
3
4
5
6
7
8
9
10
11
12
var index = 0;
function foo() {
foo = () => {
index++;
return index;
};
return index;
}
for (let i = 0; i < 5; i++) {
foo();
}
console.log(index);

之前和仙女在扬州回来的动车上看到了这题,主要就是闭包呀

1
:w | !node check.js