From 2bb6be0f92bf7dcff9daa8da57044354083fd769 Mon Sep 17 00:00:00 2001 From: sherlynn <352281674@qq.com> Date: Mon, 21 Mar 2016 18:29:12 +0800 Subject: [PATCH 001/171] me --- .vimrc | 81 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/.vimrc b/.vimrc index 1262ad2..cf46857 100644 --- a/.vimrc +++ b/.vimrc @@ -20,7 +20,7 @@ Plug 'L9' Plug 'FuzzyFinder' "快速浏览文件,FuzzyFinder 也能快速浏览文件, 但是如果项目文件多会很慢 "如果系统升级可以需要运行 gem update --system, do中的命令可能需要手动运行 -"Plug 'Command-T',{'do': 'cd ./ruby/command-t/; ruby extconf.rb ; make'} +"Plug 'Command-T',{'do': 'cd ./ruby/command-t/; ruby extconf.rb ; make','on':'CommandT'} " Plugin outside ~/.vim/plugged with post-update hook @@ -70,7 +70,7 @@ Plug 'phpunit' "快速跳转到字符 Plug 'EasyMotion' -Plug 'https://github.com/bling/vim-airline.git' +"Plug 'https://github.com/bling/vim-airline.git' Plug 'https://github.com/luofei614/vim-golang.git' @@ -79,13 +79,27 @@ Plug 'https://github.com/burnettk/vim-angular.git' "检查程序语法错误 Plug 'https://github.com/scrooloose/syntastic.git' -Plug 'https://github.com/vim-scripts/cab.vim.git' - +"jsx插件 +Plug 'mxw/vim-jsx' +"括号改变 +"Plug 'surround.vim' +"css color +"Plug 'ap/vim-css-color' +" {} +"Plug 'jiangmiao/auto-pairs' +" +"Plug 'docunext/closetag.vim' +"Plug 'alvan/vim-closetag' +"highlight tag +"Plug 'gregsexton/matchtag' +"beauty +Plug 'vim-airline/vim-airline' +Plug 'vim-scripts/matchit.zip' call plug#end() "vimgrep查询时排除composer的vendor目录,排除前端bower和node的包文件目录,CommandT也不会查到他们 -set wildignore=vendor/** +set wildignore=vendor/**,bower_components/**,node_modules/** let g:used_javascript_libs = 'jQuery,AngularJS,AngularUI,RequireJS' @@ -167,8 +181,8 @@ map! :! tab vim "删除不剪切, rd -nnoremap r "_d -vnoremap r "_d +"nnoremap r "_d +"noremap r "_d "快速生成tag文件 @@ -226,11 +240,10 @@ vnoremap g "映射复制、粘贴、剪贴ctrl+c ctrl+v ctrl+x -map "+pa - - +"还原了C-V的多行编辑模式 +"map "+pa -map! "+pa +"map! "+pa map "+y @@ -244,8 +257,8 @@ map! ggVG "ctrl+s为保存 -map :w -inoremap :w +"map :w +"inoremap :w "ctrl+z撤销 @@ -316,37 +329,20 @@ vnoremap > vnoremap < -"用数字切换tab页面 -noremap 1 1gt -noremap 2 2gt -noremap 3 3gt -noremap 4 4gt -noremap 5 5gt -noremap 6 6gt -noremap 7 7gt -noremap 8 8gt -noremap 9 9gt -noremap 0 :tablast -"MAC 下 C-left 和 C-Right是切换屏幕, 所以可能下面两句不会生效 -"nnoremap :tabprevious -"nnoremap :tabnext - - "语法高亮 syntax enable syntax on set autoindent set number set smartindent -set tabstop=4 -set shiftwidth=4 +set tabstop=2 +set shiftwidth=2 set expandtab "加快速度 "set synmaxcol=200 set ttyfast " u got a fast terminal set ttyscroll=3 set lazyredraw " to avoid scrolling problems -set scrolljump=5 "删除键 set backspace=eol,start,indent @@ -368,3 +364,24 @@ set nobackup set nowritebackup +"vim-closetag +let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js" + +set cursorcolumn " highlight current column +set cursorline " highlight current line + +"设置jsx插件对js也解析 +let g:jsx_ext_required = 0 + +" 代码折叠 +set foldenable +"set foldmarker={,} +" 缩进折叠 +"set foldmethod=indent +" 语法折叠 +"set foldmethod=syntax +"标记折叠 +set foldmethod=marker +" 折叠栏 太丑了我都瞎了 +"set foldcolumn=4 +set foldlevel=0 From 6a74084d264e1243551c1437a72705994d36a081 Mon Sep 17 00:00:00 2001 From: sherlynn <352281674@qq.com> Date: Mon, 21 Mar 2016 18:32:31 +0800 Subject: [PATCH 002/171] me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e965a56..1357bab 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # curl -fLo ~/.vim/autoload/plug.vim \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim # curl -fLo ~/.vimrc \ - https://raw.githubusercontent.com/luofei614/vim-plug/master/.vimrc + https://raw.githubusercontent.com/sherylynn/vim-plug/master/.vimrc 然后打开vim 运行 :PlugInstall 就能安装上所有插件(共43个插件) From 106ebcd178ac2236771ddef4155ba9134a65fe06 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 01:46:32 +0800 Subject: [PATCH 003/171] eslint --- .vimrc | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/.vimrc b/.vimrc index cf46857..65fce70 100644 --- a/.vimrc +++ b/.vimrc @@ -70,7 +70,7 @@ Plug 'phpunit' "快速跳转到字符 Plug 'EasyMotion' -"Plug 'https://github.com/bling/vim-airline.git' +Plug 'https://github.com/bling/vim-airline.git' Plug 'https://github.com/luofei614/vim-golang.git' @@ -84,16 +84,15 @@ Plug 'mxw/vim-jsx' "括号改变 "Plug 'surround.vim' "css color -"Plug 'ap/vim-css-color' +Plug 'ap/vim-css-color' " {} -"Plug 'jiangmiao/auto-pairs' +Plug 'jiangmiao/auto-pairs' " "Plug 'docunext/closetag.vim' -"Plug 'alvan/vim-closetag' +Plug 'alvan/vim-closetag' "highlight tag "Plug 'gregsexton/matchtag' "beauty -Plug 'vim-airline/vim-airline' Plug 'vim-scripts/matchit.zip' call plug#end() @@ -211,9 +210,9 @@ let g:CommandTAcceptSelectionTabMap = '' " 用FZF 查找文件 " 设置查找时排除的目录 -:let $FZF_DEFAULT_COMMAND = 'find . -type f ! -path "./node_modules/*" ! -path "./bower_components/*" ! -path "./.git/*" ! -path "*.swp"' -map :tabnew:FZF -map! :w :tabnew:FZF +":let $FZF_DEFAULT_COMMAND = 'find . -type f ! -path "./node_modules/*" ! -path "./bower_components/*" ! -path "./.git/*" ! -path "*.swp"' +"map :tabnew:FZF +"map! :w :tabnew:FZF @@ -333,7 +332,6 @@ vnoremap < syntax enable syntax on set autoindent -set number set smartindent set tabstop=2 set shiftwidth=2 @@ -366,7 +364,7 @@ set nowritebackup "vim-closetag let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js" - +"十字线高亮 set cursorcolumn " highlight current column set cursorline " highlight current line @@ -377,11 +375,29 @@ let g:jsx_ext_required = 0 set foldenable "set foldmarker={,} " 缩进折叠 -"set foldmethod=indent +set foldmethod=indent " 语法折叠 "set foldmethod=syntax "标记折叠 -set foldmethod=marker +"set foldmethod=marker " 折叠栏 太丑了我都瞎了 "set foldcolumn=4 -set foldlevel=0 +set foldlevel=99 +"退出后不清空 +"set t_ti= t_te= +set relativenumber " show relative line number +set ruler " show the current line number and column number +set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k" +"代码提示 配合scrooloose/syntastic +"npm i -g eslint@es6jsx eslint-config-airbnb babel-eslint eslint-plugin-react +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_javascript_checkers = ['eslint'] +let g:syntastic_javascript_eslint_exec = 'eslint' + +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 From 5c78aac620be65ce0a643d25da22e5ed35bc12e8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 01:51:09 +0800 Subject: [PATCH 004/171] all --- .bash_profile | 6 ++++++ .bashrc | 15 +++++++++++++++ .gitconfig | 13 +++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .gitconfig diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..6505352 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,6 @@ +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi +alias nw="/Applications/node-webkit.app/Contents/MacOS/node-webkit" +alias subl="/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text" +export PATH=/usr/local/bin:$PATH diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..2650318 --- /dev/null +++ b/.bashrc @@ -0,0 +1,15 @@ +export NODE_PATH="/usr/local/lib/node_modules" +alias ls="ls -G" +export ANDROID_HOME='/Users/lynn/Library/Android/sdk/platform-tools' +export PATH=/Applications/VirtualBox.app/Contents/MacOS:/Users/lynn/Library/Android/sdk/platform-tools:$PATH +export PATH=/Users/lynn/Library/Android/sdk/tools:$PATH +export PATH=/usr/local/sbin:$PATH +#alias cnpm="npm --registry=https://registry.npm.taobao.org \ +# --cache=$HOME/.npm/.cache/cnpm \ +# --disturl=https://npm.taobao.org/dist \ +# --userconfig=$HOME/.cnpmrc" +#export http_proxy=http://127.0.0.1:8787/ +#export https_proxy=http://127.0.0.1:8787/ +[ -f ~/.fzf.bash ] && source ~/.fzf.bash +export LANG=zh_CN.UTF-8 +eval "$(thefuck --alias)" diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..1d6077b --- /dev/null +++ b/.gitconfig @@ -0,0 +1,13 @@ +[filter "media"] + required = true + clean = git media clean %f + smudge = git media smudge %f +[user] + name = sherylynn + email = 352281674@qq.com +#[http] +# proxy = http://127.0.0.1:8787/ +#[https] +# proxy = http://127.0.0.1:8787/ +[push] + default = simple From db1a15bd8199c2484c6f31bdeb4c37b3296595bb Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 01:57:39 +0800 Subject: [PATCH 005/171] readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1357bab..ffaa1f7 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,13 @@ # curl -fLo ~/.vimrc \ https://raw.githubusercontent.com/sherylynn/vim-plug/master/.vimrc - 然后打开vim 运行 :PlugInstall 就能安装上所有插件(共43个插件) + 然后打开vim 运行 :PlugInstall 就能安装上所有插件 - 这些VIM配置我已经用了快两年了,用着非常爽。 所以特意整理出来分享给大家,大家只需要简单的执行上面三条命令就能获得我的配置。 + 使用了原主人的配置2年了...终于今天自己定制化了一下 + 删除了一些配置,增加了eshint等等,更时候react jsx开发 安装好后效果如下: -![enter image description here](https://github.com/luofei614/vim-plug/raw/master/screenshot.png) +![enter image description here](https://github.com/sherylynn/vim-plug/raw/master/screenshot.png) 内置两种流行主题,默认是sublime风格的主题。 @@ -26,7 +27,7 @@ * F2: 可以快速查函数手册, 如果当前VIM的光标在php的file_put_contents函数上,按一下F2 会自动打开PHP手册的网页。 * ctrl+p : 快速查找文件 , 此功能基于ruby, 如果您环境没有ruby 请先安装ruby: - +这个功能我给去了 * ctrl+f : 快速查找当前文件中的函数 * ctrl+] : 跳到函数声明出(自己定义的函数,非系统函数),会在当前界面打开函数声明文件,如果想新建个tab页再跳到函数声明处,可以用 `ctrl+\` From 79a4b1de9b05b9c0374182ea78c3198f2ca3a2d3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 02:18:37 +0800 Subject: [PATCH 006/171] install.sh --- install.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..7d30d93 --- /dev/null +++ b/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash +BASEDIR=$(dirname $0) +cd $BASEDIR +CURRENT_DIR=`pwd` + +lnif() { + if [ -e "$1" ]; then + ln -sf "$1" "$2" + fi + +} + + +echo "Step1: backing up current vim config" +today=`date +%Y%m%d` +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done + + +echo "Step2: setting up symlinks" +lnif $CURRENT_DIR/.vimrc $HOME/.vimrc +lnif "$CURRENT_DIR/" "$HOME/.vim" + + +echo "Step3: update/install plugins using vim-plug" +system_shell=$SHELL +export SHELL="/bin/sh" +vim -u $HOME/.vimrc+PlugInstall! +PlugClean! +qall +export SHELL=$system_shell + + +echo "Step4: install eshint" +echo "It will take a long time, just be patient!" +echo "npm i -g eslint@es6jsx --registry=http://registry.npm.taobao.org" +npm i -g eshint@es6jsx --registry=http://registry.npm.taobao.org +echo "Install Done!" From 0e2db8e0da2be3d798481ec39d301759ec7da3dd Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 02:31:31 +0800 Subject: [PATCH 007/171] test --- .vimrc | 14 +- autoload/plug.vim | 2018 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2024 insertions(+), 8 deletions(-) create mode 100644 autoload/plug.vim diff --git a/.vimrc b/.vimrc index 65fce70..cf9f8ea 100644 --- a/.vimrc +++ b/.vimrc @@ -5,8 +5,6 @@ Plug 'junegunn/vim-easy-align' " Plugin options Plug 'nsf/gocode', { 'rtp': 'vim' } -Plug 'https://github.com/luofei614/vim-plug', { 'dir':'~/.vim/my'} - Plug 'AutoComplPop' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'Tagbar' @@ -152,19 +150,19 @@ let javascript_enable_domhtmlcss=1 "php函数自动提示 -autocmd FileType php set complete+=k | set dictionary=~/.vim/my/extend/phpclist.txt +autocmd FileType php set complete+=k | set dictionary=~/.vim/extend/phpclist.txt "javascript自动提示,包括了jquery -autocmd FileType javascript set dictionary=~/.vim/my/extend/javascript.dict -autocmd FileType html set dictionary=~/.vim/my/extend/html.dict +autocmd FileType javascript set dictionary=~/.vim/extend/javascript.dict +autocmd FileType html set dictionary=~/.vim/extend/html.dict "查找手册 -autocmd FileType php set keywordprg=~/.vim/my/extend/phpman +autocmd FileType php set keywordprg=~/.vim/extend/phpman -autocmd FileType javascript,html set keywordprg=~/.vim/my/extend/man +autocmd FileType javascript,html set keywordprg=~/.vim/extend/man -autocmd FileType css set keywordprg=~/.vim/my/extend/cssman +autocmd FileType css set keywordprg=~/.vim/extend/cssman inoremap :call PhpDocSingle()i nnoremap :call PhpDocSingle() diff --git a/autoload/plug.vim b/autoload/plug.vim new file mode 100644 index 0000000..cabeb4f --- /dev/null +++ b/autoload/plug.vim @@ -0,0 +1,2018 @@ +" vim-plug: Vim plugin manager +" ============================ +" +" Download plug.vim and put it in ~/.vim/autoload +" +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" +" Edit your .vimrc +" +" call plug#begin('~/.vim/plugged') +" +" " Make sure you use single quotes +" Plug 'junegunn/seoul256.vim' +" Plug 'junegunn/vim-easy-align' +" +" " Group dependencies, vim-snippets depends on ultisnips +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" +" " On-demand loading +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } +" +" " Using git URL +" Plug 'https://github.com/junegunn/vim-github-dashboard.git' +" +" " Plugin options +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } +" +" " Plugin outside ~/.vim/plugged with post-update hook +" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } +" +" " Unmanaged plugin (manually installed and updated) +" Plug '~/my-prototype-plugin' +" +" call plug#end() +" +" Then reload .vimrc and :PlugInstall to install plugins. +" Visit https://github.com/junegunn/vim-plug for more information. +" +" +" Copyright (c) 2015 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') || has('win64') +let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win +let s:me = resolve(expand(':p')) +let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(fnamemodify(expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call s:add() + if !executable('git') + return s:err('`git` executable not found. vim-plug requires git.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('' == '!', []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('' == '!', []) + command! -nargs=0 -bar -bang PlugClean call s:clean('' == '!') + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar PlugSnapshot call s:snapshot() +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:source(from, ...) + for pattern in a:000 + for vim in s:lines(globpath(a:from, pattern)) + execute 'source' s:esc(vim) + endfor + endfor +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('Call plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + filetype off + for name in g:plugs_order + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~ '^[A-Z]' + if exists(':'.cmd) != 2 + call s:assoc(lod.cmd, cmd, name) + endif + call add(s:triggers[name].cmd, cmd) + endif + endfor + endif + + if has_key(plug, 'for') + let types = s:to_a(plug.for) + if !empty(types) + call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') + endif + for type in types + call s:assoc(lod.ft, type, name) + endfor + endif + endfor + + for [cmd, names] in items(lod.cmd) + execute printf( + \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "", , , , %s)', + \ cmd, string(cmd), string(names)) + endfor + + for [map, names] in items(lod.map) + for [mode, map_prefix, key_prefix] in + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + execute printf( + \ '%snoremap %s %s:call lod_map(%s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), key_prefix) + endfor + endfor + + for [ft, names] in items(lod.ft) + augroup PlugLOD + execute printf('autocmd FileType %s call lod_ft(%s, %s)', + \ ft, string(ft), string(names)) + augroup END + endfor + + call s:reorg_rtp() + filetype plugin indent on + if has('vim_starting') + syntax enable + else + call s:reload() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:reload() + for name in s:loaded_names() + call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') + endfor +endfunction + +function! s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function! s:version_requirement(val, min) + for idx in range(0, len(a:min) - 1) + let v = get(a:val, idx, 0) + if v < a:min[idx] | return 0 + elseif v > a:min[idx] | return 1 + endif + endfor + return 1 +endfunction + +function! s:git_version_requirement(...) + let s:git_version = get(s:, 'git_version', + \ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)')) + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom a:msg + echohl None + return 0 +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! plug#load(...) + if a:0 == 0 + return s:err('Argument missing: plugin name(s) required') + endif + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)') + if !empty(unknowns) + let s = len(unknowns) > 1 ? 's' : '' + return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) + end + for name in a:000 + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + if exists('#BufRead') + doautocmd BufRead + endif + return 1 +endfunction + +function! s:remove_triggers(name) + if !has_key(s:triggers, a:name) + return + endif + for cmd in s:triggers[a:name].cmd + execute 'silent! delc' cmd + endfor + for map in s:triggers[a:name].map + execute 'silent! unmap' map + execute 'silent! iunmap' map + endfor + call remove(s:triggers, a:name) +endfunction + +function! s:lod(names, types) + for name in a:names + call s:remove_triggers(name) + let s:loaded[name] = 1 + endfor + call s:reorg_rtp() + + for name in a:names + let rtp = s:rtp(g:plugs[name]) + for dir in a:types + call s:source(rtp, dir.'/**/*.vim') + endfor + if exists('#User#'.name) + execute 'doautocmd User' name + endif + endfor +endfunction + +function! s:lod_ft(pat, names) + call s:lod(a:names, ['plugin', 'after/plugin']) + execute 'autocmd! PlugLOD FileType' a:pat + if exists('#filetypeplugin#FileType') + doautocmd filetypeplugin FileType + endif + if exists('#filetypeindent#FileType') + doautocmd filetypeindent FileType + endif +endfunction + +function! s:lod_cmd(cmd, bang, l1, l2, args, names) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) +endfunction + +function! s:lod_map(map, names, prefix) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + let extra = '' + while 1 + let c = getchar(0) + if c == 0 + break + endif + let extra .= nr2char(c) + endwhile + call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) +endfunction + +function! s:add(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let name = fnamemodify(repo, ':t:s?\.git$??') + let spec = extend(s:infer_properties(name, repo), + \ a:0 == 1 ? s:parse_options(a:1) : s:base_spec) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == s:TYPE.string + let opts.tag = a:arg + elseif type == s:TYPE.dict + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + let repo = 'vim-scripts/'. repo + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) + return { 'dir': dir, 'uri': uri } + endif +endfunction + +function! s:install(force, names) + call s:update_impl(0, a:force, a:names) +endfunction + +function! s:update(force, names) + call s:update_impl(1, a:force, a:names) +endfunction + +function! plug#helptags() + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + for spec in values(g:plugs) + let docd = join([spec.dir, 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-/ + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha + syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugRelDate Comment + hi def link plugSha Identifier + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:prepare() + call s:job_abort() + if s:switch_in() + silent %d _ + else + call s:new_window() + nnoremap q :if b:plug_preview==1pcendifechoq + nnoremap R :silent! call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') + let b:plug_preview = -1 + let s:plug_tab = tabpagenr() + let s:plug_buf = winbufnr(0) + call s:assign_name() + endif + silent! unmap + silent! unmap L + silent! unmap o + silent! unmap X + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable + setf vim-plug + call s:syntax() +endfunction + +function! s:assign_name() + " Assign buffer name + let prefix = '[Plugins]' + let name = prefix + let idx = 2 + while bufexists(name) + let name = printf('%s (%s)', prefix, idx) + let idx = idx + 1 + endwhile + silent! execute 'f' fnameescape(name) +endfunction + +function! s:do(pull, force, todo) + for [name, spec] in items(a:todo) + if !isdirectory(spec.dir) + continue + endif + let installed = has_key(s:update.new, name) + let updated = installed ? 0 : + \ (a:pull && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) + if a:force || installed || updated + execute 'cd' s:esc(spec.dir) + call append(3, '- Post-update hook for '. name .' ... ') + let type = type(spec.do) + if type == s:TYPE.string + try + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let g:_plug_do = '!'.escape(spec.do, '#!%') + execute "normal! :execute g:_plug_do\\" + finally + let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' + unlet g:_plug_do + endtry + elseif type == s:TYPE.funcref + try + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + let result = 'Done!' + catch + let result = 'Error: ' . v:exception + endtry + else + let result = 'Error: Invalid type!' + endif + call setline(4, getline(4) . result) + cd - + endif + endfor +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) + call add(msgs, "Press 'D' to see the updated changes.") + endif + echo join(msgs, ' ') +endfunction + +function! s:retry() + if empty(s:update.errors) + return + endif + call s:update_impl(s:update.pull, s:update.force, + \ extend(copy(s:update.errors), [s:update.threads])) +endfunction + +function! s:is_managed(name) + return has_key(g:plugs[a:name], 'uri') +endfunction + +function! s:names(...) + return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) +endfunction + +function! s:update_impl(pull, force, args) abort + let args = copy(a:args) + let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? + \ remove(args, -1) : get(g:, 'plug_threads', s:is_win ? 1 : 16) + + let managed = filter(copy(g:plugs), 's:is_managed(v:key)') + let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : + \ filter(managed, 'index(args, v:key) >= 0') + + if empty(todo) + echohl WarningMsg + echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' + echohl None + return + endif + + if !s:is_win && s:git_version_requirement(2, 3) + let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' + let $GIT_TERMINAL_PROMPT = 0 + for plug in values(todo) + let plug.uri = substitute(plug.uri, + \ '^https://git::@github\.com', 'https://github.com', '') + endfor + endif + + if !isdirectory(g:plug_home) + try + call mkdir(g:plug_home, 'p') + catch + return s:err(printf('Invalid plug directory: %s. '. + \ 'Try to call plug#begin with a valid directory', g:plug_home)) + endtry + endif + + if has('nvim') && !exists('*jobwait') && threads > 1 + echohl WarningMsg + echomsg 'vim-plug: update Neovim for parallel installer' + echohl None + endif + + let python = (has('python') || has('python3')) && !s:is_win && !has('win32unix') + \ && (!s:nvim || has('vim_starting')) + let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare() + call append(0, ['', '']) + normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1 + redir => pyv + silent python import platform; print(platform.python_version()) + redir END + let python = s:version_requirement( + \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) + endif + + if (python || ruby) && s:update.threads > 1 + try + let imd = &imd + if s:mac_gui + set noimd + endif + if ruby + call s:update_ruby() + else + call s:update_python() + endif + catch + let lines = getline(4, '$') + let printed = {} + silent! 4,$d _ + for line in lines + let name = s:extract_name(line, '.', '') + if empty(name) || !has_key(printed, name) + call append('$', line) + if !empty(name) + let printed[name] = 1 + if line[0] == 'x' && index(s:update.errors, name) < 0 + call add(s:update.errors, name) + end + endif + endif + endfor + finally + let &imd = imd + call s:update_finish() + endtry + else + call s:update_vim() + endif +endfunction + +function! s:update_finish() + if exists('s:git_terminal_prompt') + let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt + endif + if s:switch_in() + call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) + call s:finish(s:update.pull) + call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') + call s:switch_out('normal! gg') + endif +endfunction + +function! s:job_abort() + if !s:nvim || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + silent! call jobstop(j.jobid) + if j.new + call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) + endif + endfor + let s:jobs = {} +endfunction + +" When a:event == 'stdout', data = list of strings +" When a:event == 'exit', data = returncode +function! s:job_handler(job_id, data, event) abort + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + + if a:event == 'stdout' + let self.result .= substitute(s:to_s(a:data), '[\r\n]', '', 'g') . "\n" + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if self.tick % len(s:jobs) == 0 + call s:log(self.new ? '+' : '*', self.name, self.result) + endif + elseif a:event == 'exit' + let self.running = 0 + if a:data != 0 + let self.error = 1 + endif + call s:reap(self.name) + call s:tick() + endif +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'result': '', + \ 'new': get(a:opts, 'new', 0), + \ 'on_stdout': function('s:job_handler'), + \ 'on_exit' : function('s:job_handler'), + \ } + let s:jobs[a:name] = job + + if s:nvim + let argv = [ 'sh', '-c', + \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) ] + let jid = jobstart(argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.result = jid < 0 ? 'sh is not executable' : + \ 'Invalid arguments (or job table is full)' + endif + else + let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] + let job.result = call('s:system', params) + let job.error = v:shell_error != 0 + let job.running = 0 + endif +endfunction + +function! s:reap(name) + let job = s:jobs[a:name] + if job.error + call add(s:update.errors, a:name) + elseif get(job, 'new', 0) + let s:update.new[a:name] = 1 + endif + let s:update.bar .= job.error ? 'x' : '=' + + call s:log(job.error ? 'x' : '-', a:name, job.result) + call s:bar() + + call remove(s:jobs, a:name) +endfunction + +function! s:bar() + if s:switch_in() + let total = len(s:update.all) + call setline(1, (s:update.pull ? 'Updating' : 'Installing'). + \ ' plugins ('.len(s:update.bar).'/'.total.')') + call s:progress_bar(2, s:update.bar, total) + call s:switch_out() + endif +endfunction + +function! s:logpos(name) + for i in range(1, line('$')) + if getline(i) =~# '^[-+x*] '.a:name.':' + return i + endif + endfor + return 0 +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let pos = s:logpos(a:name) + if pos > 0 + execute pos 'd _' + if pos > winheight('.') + let pos = 4 + endif + else + let pos = 4 + endif + call append(pos - 1, s:format_message(a:bullet, a:name, a:lines)) + call s:switch_out() + endif +endfunction + +function! s:update_vim() + let s:jobs = {} + + call s:bar() + call s:tick() +endfunction + +function! s:tick() + let pull = s:update.pull + let prog = s:progress_opt(s:nvim) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + let s:update.fin = 1 + call s:update_finish() + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = !isdirectory(spec.dir) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + let checkout = s:shellesc(has_tag ? spec.tag : spec.branch) + let merge = s:shellesc(has_tag ? spec.tag : 'origin/'.spec.branch) + + if !new + let [valid, msg] = s:git_valid(spec, 0) + if valid + if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' + call s:spawn(name, + \ printf('(git fetch %s %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', + \ fetch_opt, prog, checkout, merge), { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'result': msg, 'error': 1 } + endif + else + call s:spawn(name, + \ printf('git clone %s %s --recursive %s -b %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, + \ prog, + \ s:shellesc(spec.uri), + \ checkout, + \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python3') ? 'python3' : 'python' +execute py_exe "<< EOF" +""" Due to use of signals this function is POSIX only. """ +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_THREADS = {} + +class BaseExc(Exception): + def __init__(self, msg): + self._msg = msg + @property + def msg(self): + return self._msg +class CmdTimedOut(BaseExc): + pass +class CmdFailed(BaseExc): + pass +class InvalidURI(BaseExc): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull, is_win): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.is_win = is_win + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def _where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + if not self.is_win: + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + padded_rest = [' ' + line for line in rest] + msg.extend(padded_rest) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self._where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + def __init__(self, cmd, cmd_dir=None, timeout=60, ntries=3, cb=None, clean=None): + self.cmd = cmd + self.cmd_dir = cmd_dir + self.timeout = timeout + self.ntries = ntries + self.callback = cb if cb else (lambda msg: None) + self.clean = clean + + def attempt_cmd(self): + """ Tries to run the command, returns result if no exceptions. """ + attempt = 0 + finished = False + limit = self.timeout + + while not finished: + try: + attempt += 1 + result = self.timeout_cmd() + finished = True + except CmdTimedOut: + if attempt != self.ntries: + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.timeout += limit + self.callback(['Retrying ...']) + else: + raise + + return result + + def timeout_cmd(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + proc = None + first_line = True + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b', delete=False) + proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile, + stderr=subprocess.STDOUT, shell=True, preexec_fn=os.setsid) + while proc.poll() is None: + # Yield this thread + time.sleep(0.2) + + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + tfile.seek(0) + result = [line.decode().rstrip() for line in tfile] + + if proc.returncode != 0: + msg = [''] + msg.extend(result) + raise CmdFailed(msg) + except: + if proc and proc.poll() is None: + os.killpg(proc.pid, signal.SIGTERM) + if self.clean: + self.clean() + raise + finally: + os.remove(tfile.name) + + return result + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + tag = args.get('tag', 0) + self.checkout = esc(tag if tag else args['branch']) + self.merge = esc(tag if tag else 'origin/' + args['branch']) + self.tag = tag + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except (CmdTimedOut, CmdFailed, InvalidURI) as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} --recursive {2} -b {3} {4} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], self.checkout, esc(target)) + com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target)) + result = com.attempt_cmd() + self.write(Action.DONE, self.name, result[-1:]) + + def update(self): + match = re.compile(r'git::?@') + actual_uri = re.sub(match, '', self.repo_uri()) + expect_uri = re.sub(match, '', self.args['uri']) + if actual_uri != expect_uri: + msg = ['', + 'Invalid URI: {0}'.format(actual_uri), + 'Expected {0}'.format(expect_uri), + 'PlugClean required.'] + raise InvalidURI(msg) + + if G_PULL: + self.write(Action.UPDATE, self.name, ['Updating ...']) + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmds = ['git fetch {0} {1}'.format(fetch_opt, G_PROGRESS), + 'git checkout -q {0}'.format(self.checkout), + 'git merge --ff-only {0}'.format(self.merge), + 'git submodule update --init --recursive'] + cmd = ' 2>&1 && '.join(cmds) + com = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES, callback) + result = com.attempt_cmd() + self.write(Action.DONE, self.name, result[-1:]) + else: + self.write(Action.DONE, self.name, ['Already installed']) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES) + result = command.attempt_cmd() + return result[-1] + + def write(self, action, name, msg): + self.buf_q.put((action, name, msg)) + +class PlugThread(thr.Thread): + def __init__(self, tname, args): + super(PlugThread, self).__init__() + self.tname = tname + self.args = args + + def run(self): + thr.current_thread().name = self.tname + buf_q, work_q, lock = self.args + + try: + while not G_STOP.is_set(): + name, args = work_q.get_nowait() + plug = Plugin(name, args, buf_q, lock) + plug.manage() + work_q.task_done() + except queue.Empty: + pass + finally: + global G_THREADS + with lock: + del G_THREADS[thr.current_thread().name] + +class RefreshThread(thr.Thread): + def __init__(self, lock): + super(RefreshThread, self).__init__() + self.lock = lock + self.running = True + + def run(self): + while self.running: + with self.lock: + thread_vim_command('noautocmd normal! a') + time.sleep(0.2) + + def stop(self): + self.running = False + +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + +def esc(name): + return '"' + name.replace('"', '\"') + '"' + +def nonblock_read(fname): + """ Read a file with nonblock flag. Return the last line. """ + fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) + buf = os.read(fread, 100000).decode() + os.close(fread) + + line = buf.rstrip('\r\n') + left = max(line.rfind('\r'), line.rfind('\n')) + if left != -1: + left += 1 + line = line[left:] + + return line + +def main(): + thr.current_thread().name = 'main' + nthreads = int(vim.eval('s:update.threads')) + plugs = vim.eval('s:update.todo') + mac_gui = vim.eval('s:mac_gui') == '1' + is_win = vim.eval('s:is_win') == '1' + + lock = thr.Lock() + buf = Buffer(lock, len(plugs), G_PULL, is_win) + buf_q, work_q = queue.Queue(), queue.Queue() + for work in plugs.items(): + work_q.put(work) + + global G_THREADS + for num in range(nthreads): + tname = 'PlugT-{0:02}'.format(num) + thread = PlugThread(tname, (buf_q, work_q, lock)) + thread.start() + G_THREADS[tname] = thread + if mac_gui: + rthread = RefreshThread(lock) + rthread.start() + + while not buf_q.empty() or len(G_THREADS) != 0: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + + if mac_gui: + rthread.stop() + rthread.join() + +main() +EOF +endfunction + +function! s:update_ruby() + ruby << EOF + module PlugStream + SEP = ["\r", "\n", nil] + def get_line + buffer = '' + loop do + char = readchar rescue return + if SEP.include? char.chr + buffer << $/ + break + else + buffer << char + end + end + buffer + end + end unless defined?(PlugStream) + + def esc arg + %["#{arg.gsub('"', '\"')}"] + end + + def killall pid + pids = [pid] + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + + require 'thread' + require 'fileutils' + require 'timeout' + running = true + iswin = VIM::evaluate('s:is_win').to_i == 1 + pull = VIM::evaluate('s:update.pull').to_i == 1 + base = VIM::evaluate('g:plug_home') + all = VIM::evaluate('s:update.todo') + limit = VIM::evaluate('get(g:, "plug_timeout", 60)') + tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 + nthr = VIM::evaluate('s:update.threads').to_i + maxy = VIM::evaluate('winheight(".")').to_i + cd = iswin ? 'cd /d' : 'cd' + tot = VIM::evaluate('len(s:update.todo)') || 0 + bar = '' + skip = 'Already installed' + mtx = Mutex.new + take1 = proc { mtx.synchronize { running && all.shift } } + logh = proc { + cnt = bar.length + $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" + $curbuf[2] = '[' + bar.ljust(tot) + ']' + VIM::command('normal! 2G') + VIM::command('redraw') unless iswin + } + where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } + log = proc { |name, result, type| + mtx.synchronize do + ing = ![true, false].include?(type) + bar += type ? '=' : 'x' unless ing + b = case type + when :install then '+' when :update then '*' + when true, nil then '-' else + VIM::command("call add(s:update.errors, '#{name}')") + 'x' + end + result = + if type || type.nil? + ["#{b} #{name}: #{result.lines.to_a.last}"] + elsif result =~ /^Interrupted|^Timeout/ + ["#{b} #{name}: #{result}"] + else + ["#{b} #{name}"] + result.lines.map { |l| " " << l } + end + if lnum = where.call(name) + $curbuf.delete lnum + lnum = 4 if ing && lnum > maxy + end + result.each_with_index do |line, offset| + $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) + end + logh.call + end + } + bt = proc { |cmd, name, type, cleanup| + tried = timeout = 0 + begin + tried += 1 + timeout += limit + fd = nil + data = '' + if iswin + Timeout::timeout(timeout) do + tmp = VIM::evaluate('tempname()') + system("(#{cmd}) > #{tmp}") + data = File.read(tmp).chomp + File.unlink tmp rescue nil + end + else + fd = IO.popen(cmd).extend(PlugStream) + first_line = true + log_prob = 1.0 / nthr + while line = Timeout::timeout(timeout) { fd.get_line } + data << line + log.call name, line.chomp, type if name && (first_line || rand < log_prob) + first_line = false + end + fd.close + end + [$? == 0, data.chomp] + rescue Timeout::Error, Interrupt => e + if fd && !fd.closed? + killall fd.pid + fd.close + end + cleanup.call if cleanup + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end + [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] + end + } + main = Thread.current + threads = [] + watcher = Thread.new { + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, branch, tag = pair.last.values_at *%w[dir uri branch tag] + checkout = esc(tag ? tag : branch) + merge = esc(tag ? tag : "origin/#{branch}") + subm = "git submodule update --init --recursive 2>&1" + exists = File.directory? dir + ok, result = + if exists + dir = iswin ? dir : esc(dir) + ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') + [false, ["Invalid URI: #{current_uri}", + "Expected: #{uri}", + "PlugClean required."].join($/)] + else + if pull + log.call name, 'Updating ...', :update + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{cd} #{dir} && git fetch #{fetch_opt} #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil + else + [true, skip] + end + end + else + d = esc dir.sub(%r{[\\/]+$}, '') + log.call name, 'Installing ...', :install + bt.call "git clone #{clone_opt unless tag} #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { + FileUtils.rm_rf dir + } + end + mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok + log.call name, result, ok + end + } if running + end + end + threads.each { |t| t.join rescue nil } + logh.call + refresh.kill if refresh + watcher.kill +EOF +endfunction + +function! s:shellesc(arg) + return '"'.escape(a:arg, '"').'"' +endfunction + +function! s:glob_dir(path) + return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)') +endfunction + +function! s:progress_bar(line, bar, total) + call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') +endfunction + +function! s:compare_git_uri(a, b) + let a = substitute(a:a, 'git:\{1,2}@', '', '') + let b = substitute(a:b, 'git:\{1,2}@', '', '') + return a ==# b +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) +endfunction + +function! s:system(cmd, ...) + try + let [sh, shrd] = [&shell, &shellredir] + if !s:is_win + set shell=sh shellredir=>%s\ 2>&1 + endif + let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd + return system(s:is_win ? '('.cmd.')' : cmd) + finally + let [&shell, &shellredir] = [sh, shrd] + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_valid(spec, check_branch) + let ret = 1 + let msg = 'OK' + if isdirectory(a:spec.dir) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url', a:spec.dir)) + let remote = result[-1] + if v:shell_error + let msg = join([remote, 'PlugClean required.'], "\n") + let ret = 0 + elseif !s:compare_git_uri(remote, a:spec.uri) + let msg = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + let ret = 0 + elseif a:check_branch + let branch = result[0] + " Check tag + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag + let msg = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + let ret = 0 + endif + " Check branch + elseif a:spec.branch !=# branch + let msg = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ branch, a:spec.branch) + let ret = 0 + endif + endif + else + let msg = 'Not found' + let ret = 0 + endif + return [ret, msg] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for unused plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) || s:git_valid(spec, 0)[0] + call add(dirs, spec.dir) + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + normal! G + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + call inputsave() + let yes = a:force || (input('Proceed? (y/N) ') =~? '^y') + call inputrestore() + if yes + for dir in todo + call s:rm_rf(dir) + endfor + call append(line('$'), 'Removed.') + else + call append(line('$'), 'Cancelled.') + endif + endif + normal! G +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if has_key(spec, 'uri') + if isdirectory(spec.dir) + let [valid, msg] = s:git_valid(spec, 1) + else + let [valid, msg] = [0, 'Not found. Try PlugInstall.'] + endif + else + if isdirectory(spec.dir) + let [valid, msg] = [1, 'OK'] + else + let [valid, msg] = [0, 'Not found.'] + endif + endif + let cnt += 1 + let ecnt += !valid + " `s:loaded` entry can be missing if PlugUpgraded + if valid && get(s:loaded, name, -1) == 0 + let unloaded = 1 + let msg .= ' (not loaded)' + endif + call s:progress_bar(2, repeat('=', cnt), total) + call append(3, s:format_message(valid ? '-' : 'x', name, msg)) + normal! 2G + redraw + endfor + call setline(1, 'Finished. '.ecnt.' error(s).') + normal! gg + setlocal nomodifiable + if unloaded + echo "Press 'L' on each line to load plugin, or 'U' to update" + nnoremap L :call status_load(line('.')) + xnoremap L :call status_load(line('.')) + end +endfunction + +function! s:extract_name(str, prefix, suffix) + return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') +endfunction + +function! s:status_load(lnum) + let line = getline(a:lnum) + let name = s:extract_name(line, '-', '(not loaded)') + if !empty(name) + call plug#load(name) + setlocal modifiable + call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) + setlocal nomodifiable + endif +endfunction + +function! s:status_update() range + let lines = getline(a:firstline, a:lastline) + let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') + if !empty(names) + echo + execute 'PlugUpdate' join(names) + endif +endfunction + +function! s:is_preview_window_open() + silent! wincmd P + if &previewwindow + wincmd p + return 1 + endif + return 0 +endfunction + +function! s:find_name(lnum) + for lnum in reverse(range(1, a:lnum)) + let line = getline(lnum) + if empty(line) + return '' + endif + let name = s:extract_name(line, '-', '') + if !empty(name) + return name + endif + endfor + return '' +endfunction + +function! s:preview_commit() + if b:plug_preview < 0 + let b:plug_preview = !s:is_preview_window_open() + endif + + let sha = matchstr(getline('.'), '\(^ \)\@<=[0-9a-z]\{7}') + if empty(sha) + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) + return + endif + + execute 'pedit' sha + wincmd P + setlocal filetype=git buftype=nofile nobuflisted modifiable + execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --pretty=medium' sha + normal! gg"_dd + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:diff() + call s:prepare() + call append(0, 'Collecting updated changes ...') + normal! gg + redraw + + let cnt = 0 + for [k, v] in items(g:plugs) + if !isdirectory(v.dir) || !s:is_managed(k) + continue + endif + + let diff = s:system_chomp('git log --pretty=format:"%h %s (%cr)" "HEAD...HEAD@{1}"', v.dir) + if !empty(diff) + call append(1, '') + call append(2, '- '.k.':') + call append(3, map(s:lines(diff), '" ". v:val')) + let cnt += 1 + normal! gg + redraw + endif + endfor + + call setline(1, cnt == 0 ? 'No updates.' : 'Last update:') + nnoremap :silent! call preview_commit() + nnoremap o :silent! call preview_commit() + nnoremap X :call revert() + normal! gg + setlocal nomodifiable + if cnt > 0 + echo "Press 'X' on each block to revert the update" + endif +endfunction + +function! s:revert() + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted.' +endfunction + +function! s:snapshot(...) abort + let home = get(s:, 'plug_home_org', g:plug_home) + let [type, var, header] = s:is_win ? + \ ['dosbatch', '%PLUG_HOME%', + \ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '', + \ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.home]] : + \ ['sh', '$PLUG_HOME', + \ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '', + \ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]] + + call s:prepare() + execute 'setf' type + call append(0, header) + call append('$', '') + 1 + redraw + + let dirs = sort(map(values(filter(copy(g:plugs), + \'has_key(v:val, "uri") && isdirectory(v:val.dir)')), 'v:val.dir')) + let anchor = line('$') - 1 + for dir in reverse(dirs) + let sha = s:system_chomp('git rev-parse --short HEAD', dir) + if !empty(sha) + call append(anchor, printf('cd %s && git reset --hard %s', + \ substitute(dir, '^\V'.escape(g:plug_home, '\'), var, ''), sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = expand(a:1) + let fne = s:esc(fn) + call writefile(getline(1, '$'), fn) + if !s:is_win | call s:system('chmod +x ' . fne) | endif + echo 'Saved to '.a:1 + silent execute 'e' fne + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@ Date: Tue, 22 Mar 2016 02:42:08 +0800 Subject: [PATCH 008/171] install --- .gitignore | 1 + install.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .gitignore mode change 100644 => 100755 install.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..060f79b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +plugged/ diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 7d30d93..539524f --- a/install.sh +++ b/install.sh @@ -25,7 +25,7 @@ lnif "$CURRENT_DIR/" "$HOME/.vim" echo "Step3: update/install plugins using vim-plug" system_shell=$SHELL export SHELL="/bin/sh" -vim -u $HOME/.vimrc+PlugInstall! +PlugClean! +qall +vim -u $HOME/.vimrc +PlugInstall! +PlugClean! +qall export SHELL=$system_shell From e530ec719312fb4e26506a2c5d679d8eead6e767 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 02:56:16 +0800 Subject: [PATCH 009/171] install all --- .vimrc | 2 +- install.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.vimrc b/.vimrc index cf9f8ea..43ac35d 100644 --- a/.vimrc +++ b/.vimrc @@ -23,7 +23,7 @@ Plug 'FuzzyFinder' " Plugin outside ~/.vim/plugged with post-update hook " 下面这个插件可取代Command-T 但是现在暂时不支持目录忽略,所以先暂时不用 -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } +"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } Plug 'WebAPI.vim' Plug 'Gist.vim' diff --git a/install.sh b/install.sh index 539524f..adbde03 100755 --- a/install.sh +++ b/install.sh @@ -29,8 +29,8 @@ vim -u $HOME/.vimrc +PlugInstall! +PlugClean! +qall export SHELL=$system_shell -echo "Step4: install eshint" +echo "Step4: install eslint" echo "It will take a long time, just be patient!" echo "npm i -g eslint@es6jsx --registry=http://registry.npm.taobao.org" -npm i -g eshint@es6jsx --registry=http://registry.npm.taobao.org +npm i -g eslint@es6jsx --registry=http://registry.npm.taobao.org echo "Install Done!" From 2d130ee2ca21070e03858b9a438ae1b2cc6e5885 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 02:57:46 +0800 Subject: [PATCH 010/171] all --- .bashrc | 1 - 1 file changed, 1 deletion(-) diff --git a/.bashrc b/.bashrc index 2650318..33a9350 100644 --- a/.bashrc +++ b/.bashrc @@ -10,6 +10,5 @@ export PATH=/usr/local/sbin:$PATH # --userconfig=$HOME/.cnpmrc" #export http_proxy=http://127.0.0.1:8787/ #export https_proxy=http://127.0.0.1:8787/ -[ -f ~/.fzf.bash ] && source ~/.fzf.bash export LANG=zh_CN.UTF-8 eval "$(thefuck --alias)" From b8e59bcbd96c25cf39e26ed4be2e04fa4edf048b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 13:01:06 +0800 Subject: [PATCH 011/171] new --- .vimrc | 3 ++- install.sh | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index 43ac35d..51d8528 100644 --- a/.vimrc +++ b/.vimrc @@ -387,7 +387,8 @@ set relativenumber " show relative line number set ruler " show the current line number and column number set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k" "代码提示 配合scrooloose/syntastic -"npm i -g eslint@es6jsx eslint-config-airbnb babel-eslint eslint-plugin-react +"npm i -g eslint eslint-config-airbnb babel-eslint eslint-plugin-react +"eslint-plugin-react-native set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* diff --git a/install.sh b/install.sh index adbde03..00617d3 100755 --- a/install.sh +++ b/install.sh @@ -13,8 +13,8 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +#for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +#for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" @@ -25,12 +25,12 @@ lnif "$CURRENT_DIR/" "$HOME/.vim" echo "Step3: update/install plugins using vim-plug" system_shell=$SHELL export SHELL="/bin/sh" -vim -u $HOME/.vimrc +PlugInstall! +PlugClean! +qall +vim +PlugInstall! +PlugClean! +qall export SHELL=$system_shell echo "Step4: install eslint" echo "It will take a long time, just be patient!" -echo "npm i -g eslint@es6jsx --registry=http://registry.npm.taobao.org" -npm i -g eslint@es6jsx --registry=http://registry.npm.taobao.org +echo "npm i -g eslint --registry=http://registry.npm.taobao.org" +npm i -g eslint eslint-plugin-react eslint-plugin-react-native babel-eslint --registry=http://registry.npm.taobao.org echo "Install Done!" From e1375a0a21264c916c4521b1286554ee6a6c13c3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 20:11:38 +0800 Subject: [PATCH 012/171] eslint react babel jsx --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 00617d3..7785add 100755 --- a/install.sh +++ b/install.sh @@ -32,5 +32,5 @@ export SHELL=$system_shell echo "Step4: install eslint" echo "It will take a long time, just be patient!" echo "npm i -g eslint --registry=http://registry.npm.taobao.org" -npm i -g eslint eslint-plugin-react eslint-plugin-react-native babel-eslint --registry=http://registry.npm.taobao.org +npm i -g eslint eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint --registry=http://registry.npm.taobao.org echo "Install Done!" From 4236e4ba7c080e0f22f1a5df708dbfb2205274d0 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 20:15:33 +0800 Subject: [PATCH 013/171] eslint react babel jsx --- README.md | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ffaa1f7..2b7679b 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ -运行三个命令配置一个强大的VIM编辑器。 +运行2个命令配置一个强大的VIM编辑器。 - # mkdir -p ~/.vim/autoload - # curl -fLo ~/.vim/autoload/plug.vim \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - # curl -fLo ~/.vimrc \ - https://raw.githubusercontent.com/sherylynn/vim-plug/master/.vimrc + # git clone https://github.com/sherylynn/vim-plug.git + # cd vim-plug && sh install.sh - 然后打开vim 运行 :PlugInstall 就能安装上所有插件 + 就能安装上所有插件 使用了原主人的配置2年了...终于今天自己定制化了一下 - 删除了一些配置,增加了eshint等等,更时候react jsx开发 + 删除了一些配置,增加了eshint等等,更适合react jsx开发 安装好后效果如下: ![enter image description here](https://github.com/sherylynn/vim-plug/raw/master/screenshot.png) @@ -26,18 +23,11 @@ * F2: 可以快速查函数手册, 如果当前VIM的光标在php的file_put_contents函数上,按一下F2 会自动打开PHP手册的网页。 -* ctrl+p : 快速查找文件 , 此功能基于ruby, 如果您环境没有ruby 请先安装ruby: -这个功能我给去了 * ctrl+f : 快速查找当前文件中的函数 * ctrl+] : 跳到函数声明出(自己定义的函数,非系统函数),会在当前界面打开函数声明文件,如果想新建个tab页再跳到函数声明处,可以用 `ctrl+\` -* 支持ctrl+a 全选 ctrl+c 复制 ctrl+v 粘贴 ctrl+x 剪切。ctrl+s 保存, ctrl+z撤销。 ctrl+c 复制和默认的y复制不一样, 它会复制到系统剪切板, 因此可以在其他软件上面粘贴。 同理 ctrl+v 粘贴的内容是系统剪切板的。 - * shift+q: 快速退出VIM。 如果vim同时打开多个文件是,不用挨着一个一个关闭。 -建议大家在看看.vimrc 配置文件 了解更多用法。 - -据说练好VIM就能找个好工作,现在优秀的人才找工作都用竟鹿:http://www.jobdeer.com/ From 39c6ee8752c11149185979883587bbfb64f6573c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 20:20:21 +0800 Subject: [PATCH 014/171] eslint --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7785add..d6ebfe5 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ today=`date +%Y%m%d` echo "Step2: setting up symlinks" lnif $CURRENT_DIR/.vimrc $HOME/.vimrc lnif "$CURRENT_DIR/" "$HOME/.vim" - +lnif $CURRENT_DIR/.eslintrc.json $HOME/.eslintrc.json echo "Step3: update/install plugins using vim-plug" system_shell=$SHELL From 7d9840b6836437a2e867b28135fa5abf8e1f2c15 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 20:32:47 +0800 Subject: [PATCH 015/171] new --- .eslintrc.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..5161985 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,47 @@ +{ + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": ["eslint:recommended", "plugin:react/recommended"], + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "jsx": true + }, + "sourceType": "module" + }, + "plugins": [ + "babel", + "react", + "react-native" + ], + "rules": { + "babel/generator-star-spacing": 1, + "babel/new-cap": 1, + "babel/array-bracket-spacing": 1, + "babel/object-curly-spacing": 1, + "babel/object-shorthand": 1, + "babel/arrow-parens": 1, + "babel/no-await-in-loop": 1, + "react-native/no-unused-styles": 2, + "react-native/split-platform-components": 2, + "indent": [ + "error", + 2 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/install.sh b/install.sh index d6ebfe5..441a428 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,7 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` #for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done -#for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" From 84130fa4e015702673933b5c462ca7a4f56cb327 Mon Sep 17 00:00:00 2001 From: for lynn Date: Tue, 22 Mar 2016 21:25:52 +0800 Subject: [PATCH 016/171] config --- .bash_profile => config/bash_profile | 0 .bashrc => config/bashrc | 0 .eslintrc.json => config/eslintrc.json | 2 +- .gitconfig => config/gitconfig | 0 config/tern-config | 24 ++++++++++++++++++++++++ .vimrc => config/vimrc | 2 ++ install.sh | 9 +++++---- 7 files changed, 32 insertions(+), 5 deletions(-) rename .bash_profile => config/bash_profile (100%) rename .bashrc => config/bashrc (100%) rename .eslintrc.json => config/eslintrc.json (91%) rename .gitconfig => config/gitconfig (100%) create mode 100644 config/tern-config rename .vimrc => config/vimrc (99%) diff --git a/.bash_profile b/config/bash_profile similarity index 100% rename from .bash_profile rename to config/bash_profile diff --git a/.bashrc b/config/bashrc similarity index 100% rename from .bashrc rename to config/bashrc diff --git a/.eslintrc.json b/config/eslintrc.json similarity index 91% rename from .eslintrc.json rename to config/eslintrc.json index 5161985..09d3331 100644 --- a/.eslintrc.json +++ b/config/eslintrc.json @@ -4,7 +4,7 @@ "es6": true, "node": true }, - "extends": ["eslint:recommended", "plugin:react/recommended"], + "extends": ["airbnb","eslint:recommended", "plugin:react/recommended"], "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, diff --git a/.gitconfig b/config/gitconfig similarity index 100% rename from .gitconfig rename to config/gitconfig diff --git a/config/tern-config b/config/tern-config new file mode 100644 index 0000000..bd0fb39 --- /dev/null +++ b/config/tern-config @@ -0,0 +1,24 @@ +{ + "libs": [ + "browser", + "jquery", + "ecma6" + + ], + "loadEagerly": [ + "importantfile.js" + + ], + "plugins": { + "requirejs": { + "baseURL": "./", + "paths": {} + + }, + "node": { + + } + + } + +} diff --git a/.vimrc b/config/vimrc similarity index 99% rename from .vimrc rename to config/vimrc index 51d8528..9c18ac9 100644 --- a/.vimrc +++ b/config/vimrc @@ -92,6 +92,8 @@ Plug 'alvan/vim-closetag' "Plug 'gregsexton/matchtag' "beauty Plug 'vim-scripts/matchit.zip' +"tern js 补全 +Plug 'ternjs/tern_for_vim' call plug#end() diff --git a/install.sh b/install.sh index 441a428..1297790 100755 --- a/install.sh +++ b/install.sh @@ -14,13 +14,14 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` #for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" -lnif $CURRENT_DIR/.vimrc $HOME/.vimrc +lnif $CURRENT_DIR/config/vimrc $HOME/.vimrc lnif "$CURRENT_DIR/" "$HOME/.vim" -lnif $CURRENT_DIR/.eslintrc.json $HOME/.eslintrc.json +lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json +lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config echo "Step3: update/install plugins using vim-plug" system_shell=$SHELL @@ -32,5 +33,5 @@ export SHELL=$system_shell echo "Step4: install eslint" echo "It will take a long time, just be patient!" echo "npm i -g eslint --registry=http://registry.npm.taobao.org" -npm i -g eslint eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint --registry=http://registry.npm.taobao.org +npm i -g eslint eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org echo "Install Done!" From 14ae1ed0a50d2f5a6f44edfc7853ce67d9432f17 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 21:44:26 +0800 Subject: [PATCH 017/171] eslint_d speed up --- config/vimrc | 2 +- install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 9c18ac9..f9153f6 100644 --- a/config/vimrc +++ b/config/vimrc @@ -396,7 +396,7 @@ set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_javascript_checkers = ['eslint'] -let g:syntastic_javascript_eslint_exec = 'eslint' +let g:syntastic_javascript_eslint_exec = 'eslint_d' let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 diff --git a/install.sh b/install.sh index 1297790..0318a5a 100755 --- a/install.sh +++ b/install.sh @@ -33,5 +33,5 @@ export SHELL=$system_shell echo "Step4: install eslint" echo "It will take a long time, just be patient!" echo "npm i -g eslint --registry=http://registry.npm.taobao.org" -npm i -g eslint eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org +npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org echo "Install Done!" From c6773cb6ff76c1d907a5691a573da3913b7b8208 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 22 Mar 2016 22:47:25 +0800 Subject: [PATCH 018/171] tern npm install --- config/tern-config | 38 +++++++++++++++++++------------------- config/vimrc | 21 ++++++++++++++++----- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/config/tern-config b/config/tern-config index bd0fb39..36e0b78 100644 --- a/config/tern-config +++ b/config/tern-config @@ -1,24 +1,24 @@ { "libs": [ - "browser", - "jquery", - "ecma6" - - ], - "loadEagerly": [ - "importantfile.js" - - ], - "plugins": { - "requirejs": { - "baseURL": "./", - "paths": {} - - }, - "node": { - - } - + "browser", + "jquery", + "ecma6" + + ], + "loadEagerly": [ + "importantfile.js" + + ], + "plugins": { + "requirejs": { + "baseURL": "./", + "paths": {} + + }, + "node": { + } + } + } diff --git a/config/vimrc b/config/vimrc index f9153f6..f181ad7 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,5 +1,6 @@ call plug#begin('~/.vim/plugged') - +let mapleader = ',' +let g:mapleader = ',' " Make sure you use single quotes Plug 'junegunn/vim-easy-align' " Plugin options @@ -93,7 +94,7 @@ Plug 'alvan/vim-closetag' "beauty Plug 'vim-scripts/matchit.zip' "tern js 补全 -Plug 'ternjs/tern_for_vim' +Plug 'marijnh/tern_for_vim', {'do': 'npm install'} call plug#end() @@ -246,10 +247,9 @@ vnoremap g map "+y -map "+x +"map "+x " 映射全选 ctrl+a - map ggVG map! ggVG @@ -397,8 +397,19 @@ set statusline+=%* let g:syntastic_javascript_checkers = ['eslint'] let g:syntastic_javascript_eslint_exec = 'eslint_d' - +let g:syntastic_error_symbol='✘' +let g:syntastic_warning_symbol='❗' +let g:syntastic_style_error_symbol='»' +let g:syntastic_style_warning_symbol='•' +let g:syntastic_enable_highlighting = 0 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 +" ---------------------------------------------------------------------------- +" tern_for_vim +" ---------------------------------------------------------------------------- +let tern_show_signature_in_pum = 1 +let tern_show_argument_hints = 'on_hold' +autocmd FileType javascript setlocal omnifunc=tern#Complete +autocmd FileType javascript nnoremap d :TernDef From 9d3a8e35cfb668e84f240a50ef4cbf10f11eaf9f Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 23 Mar 2016 01:09:51 +0800 Subject: [PATCH 019/171] =?UTF-8?q?=E4=B8=8D=E6=99=93=E5=BE=97=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E6=9B=B4=E6=96=B0=E4=BA=86=E5=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/eslintrc.json | 2 +- config/vimrc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/eslintrc.json b/config/eslintrc.json index 09d3331..001c748 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -25,7 +25,7 @@ "babel/object-shorthand": 1, "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, - "react-native/no-unused-styles": 2, +// "react-native/no-unused-styles": 2, "react-native/split-platform-components": 2, "indent": [ "error", diff --git a/config/vimrc b/config/vimrc index f181ad7..b78728d 100644 --- a/config/vimrc +++ b/config/vimrc @@ -132,7 +132,8 @@ set t_Co=256 let g:solarized_termcolors=16 "两种流行风格的主题 colorscheme molokai -set background=dark +let g:rehash256 = 1 +"set background=dark "colorscheme solarized "set background=light From 9b9a7a648953c0fbe14048cadf56b577de5bf1b8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 23 Mar 2016 01:19:08 +0800 Subject: [PATCH 020/171] shit --- config/eslintrc.json | 2 +- config/vimrc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/eslintrc.json b/config/eslintrc.json index 001c748..09d3331 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -25,7 +25,7 @@ "babel/object-shorthand": 1, "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, -// "react-native/no-unused-styles": 2, + "react-native/no-unused-styles": 2, "react-native/split-platform-components": 2, "indent": [ "error", diff --git a/config/vimrc b/config/vimrc index b78728d..45ea01e 100644 --- a/config/vimrc +++ b/config/vimrc @@ -132,8 +132,8 @@ set t_Co=256 let g:solarized_termcolors=16 "两种流行风格的主题 colorscheme molokai -let g:rehash256 = 1 -"set background=dark +"let g:rehash256 = 1 +set background=dark "colorscheme solarized "set background=light From a5d7aa34c36cde594b7ad2b547cce00b3cfe248b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 23 Mar 2016 15:54:08 +0800 Subject: [PATCH 021/171] windows --- config/vimrc | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/config/vimrc b/config/vimrc index 45ea01e..ad12dc6 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,4 +1,33 @@ -call plug#begin('~/.vim/plugged') +" Basics { + set nocompatible " Must be first line + set background=dark " Assume a dark background + " } + + " Windows Compatible { + " On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization + " across (heterogeneous) systems easier. + if has('win32') || has('win64') + set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after + + " Be nice and check for multi_byte even if the config requires + " multi_byte support most of the time + if has("multi_byte") + " Windows cmd.exe still uses cp850. If Windows ever moved to + " Powershell as the primary terminal, this would be utf-8 + set termencoding=cp850 + " Let Vim use utf-8 internally, because many scripts require this + set encoding=utf-8 + setglobal fileencoding=utf-8 + " Windows has traditionally used cp1252, so it's probably wise to + " fallback into cp1252 instead of eg. iso-8859-15. + " Newer Windows files might contain utf-8 or utf-16 LE so we might + " want to try them first. + set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15 + endif + endif + " } + +call plug#begin('$HOME/.vim/plugged') let mapleader = ',' let g:mapleader = ',' " Make sure you use single quotes @@ -154,19 +183,19 @@ let javascript_enable_domhtmlcss=1 "php函数自动提示 -autocmd FileType php set complete+=k | set dictionary=~/.vim/extend/phpclist.txt +autocmd FileType php set complete+=k | set dictionary=$HOME/.vim/extend/phpclist.txt "javascript自动提示,包括了jquery -autocmd FileType javascript set dictionary=~/.vim/extend/javascript.dict -autocmd FileType html set dictionary=~/.vim/extend/html.dict +autocmd FileType javascript set dictionary=$HOME/.vim/extend/javascript.dict +autocmd FileType html set dictionary=$HOME/.vim/extend/html.dict "查找手册 -autocmd FileType php set keywordprg=~/.vim/extend/phpman +autocmd FileType php set keywordprg=$HOME/.vim/extend/phpman -autocmd FileType javascript,html set keywordprg=~/.vim/extend/man +autocmd FileType javascript,html set keywordprg=$HOME/.vim/extend/man -autocmd FileType css set keywordprg=~/.vim/extend/cssman +autocmd FileType css set keywordprg=$HOME/.vim/extend/cssman inoremap :call PhpDocSingle()i nnoremap :call PhpDocSingle() From 080c9f19c53100698e6dbb41b9d77c73679199cc Mon Sep 17 00:00:00 2001 From: unknown <林增> Date: Wed, 23 Mar 2016 17:10:54 +0800 Subject: [PATCH 022/171] windows --- config/vimrc | 88 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/config/vimrc b/config/vimrc index ad12dc6..9e0303f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,31 +1,47 @@ " Basics { - set nocompatible " Must be first line - set background=dark " Assume a dark background - " } - - " Windows Compatible { - " On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization - " across (heterogeneous) systems easier. - if has('win32') || has('win64') - set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after - - " Be nice and check for multi_byte even if the config requires - " multi_byte support most of the time - if has("multi_byte") - " Windows cmd.exe still uses cp850. If Windows ever moved to - " Powershell as the primary terminal, this would be utf-8 - set termencoding=cp850 - " Let Vim use utf-8 internally, because many scripts require this - set encoding=utf-8 - setglobal fileencoding=utf-8 - " Windows has traditionally used cp1252, so it's probably wise to - " fallback into cp1252 instead of eg. iso-8859-15. - " Newer Windows files might contain utf-8 or utf-16 LE so we might - " want to try them first. - set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15 - endif - endif - " } +set nocompatible " Must be first line +set background=dark " Assume a dark background +" Allow to trigger background + function! ToggleBG() + let s:tbg = &background + " Inversion + if s:tbg == "dark" + set background=light + else + set background=dark + endif + endfunction +" } + +" Windows Compatible { +" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization +" across (heterogeneous) systems easier. +if has('win32') || has('win64') + set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after + + " Be nice and check for multi_byte even if the config requires + " multi_byte support most of the time + if has("multi_byte") + " Windows cmd.exe still uses cp850. If Windows ever moved to + " Powershell as the primary terminal, this would be utf-8 + set termencoding=cp850 + " Let Vim use utf-8 internally, because many scripts require this + set encoding=utf-8 + setglobal fileencoding=utf-8 + " Windows has traditionally used cp1252, so it's probably wise to + " fallback into cp1252 instead of eg. iso-8859-15. + " Newer Windows files might contain utf-8 or utf-16 LE so we might + " want to try them first. + set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15,chines +set guifont=Consolas:h12 +"解决菜单乱码 +source $VIMRUNTIME/delmenu.vim +source $VIMRUNTIME/menu.vim +"解决consle输出乱码 +language messages zh_CN.utf-8 + endif +endif +" } call plug#begin('$HOME/.vim/plugged') let mapleader = ',' @@ -160,10 +176,10 @@ set t_Co=256 let g:solarized_termcolors=16 "两种流行风格的主题 -colorscheme molokai +"colorscheme molokai "let g:rehash256 = 1 set background=dark -"colorscheme solarized +colorscheme solarized "set background=light "emmet 设置 @@ -318,21 +334,21 @@ map map! - + function! InsertTabWrapper() -let col=col('.')-1 + let col=col('.')-1 -if !col || getline('.')[col-1] !~ '\k' + if !col || getline('.')[col-1] !~ '\k' -return "\" + return "\" -else + else -return "\\" + return "\\" -endif + endif endfunction From d9e8617253bfb6402a3fb958b5aedc615e1a8055 Mon Sep 17 00:00:00 2001 From: unknown <林增> Date: Wed, 23 Mar 2016 17:11:25 +0800 Subject: [PATCH 023/171] windows install --- install.cmd | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 install.cmd diff --git a/install.cmd b/install.cmd new file mode 100644 index 0000000..775ecb1 --- /dev/null +++ b/install.cmd @@ -0,0 +1,41 @@ +@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% +@if not exist "%HOME%" @set HOME=%USERPROFILE% + +@set APP_PATH=%HOME%\vim-plug +IF NOT EXIST "%APP_PATH%" ( + call git clone https://github.com/sherylynn/vim-plug.git "%APP_PATH%" +) ELSE ( + @set ORIGINAL_DIR=%CD% + echo updating vim-plug + chdir /d "%APP_PATH%" + call git pull + chdir /d "%ORIGINAL_DIR%" + call cd "%APP_PATH%" +) +call rmlink "%HOME%\.vimrc" +call rmlink "%HOME%\_vimrc" +call rmlink "%HOME%\.eslintrc.json" +call rmlink "%HOME%\.tern-config" +call rmdir "%HOME%\.vim" + +call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" +call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" +call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" +call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" +call mklink /J "%HOME%\.vim" "%APP_PATH%\" + +IF NOT EXIST "%APP_PATH%\plugged" ( + call mkdir "%APP_PATH%\plugged" +) + +::IF NOT EXIST "%HOME%/.vim/bundle/vundle" ( +:: call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" +::) ELSE ( +:: call cd "%HOME%/.vim/bundle/vundle" +:: call git pull +:: call cd %HOME% +::) + +call vim +PlugInstall! +PlugClean! +qall + +call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org From 119a65f59c6cd489f2114fbda31933302707fcb9 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 23 Mar 2016 20:03:57 +0800 Subject: [PATCH 024/171] molokai --- config/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 9e0303f..cfbbad1 100644 --- a/config/vimrc +++ b/config/vimrc @@ -176,10 +176,10 @@ set t_Co=256 let g:solarized_termcolors=16 "两种流行风格的主题 -"colorscheme molokai +colorscheme molokai "let g:rehash256 = 1 set background=dark -colorscheme solarized +"colorscheme solarized "set background=light "emmet 设置 From 611a2c111ff23942c28acdb99ee2b624ae2a2b0b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 27 Mar 2016 13:41:37 +0800 Subject: [PATCH 025/171] npm --- .gitignore | 1 + config/eslintrc.js | 36 ++++++++++++++++++++++++++++++++++++ config/eslintrc.json | 8 ++++---- config/eslintrc.yml | 3 +++ package.json | 28 ++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 config/eslintrc.js create mode 100644 config/eslintrc.yml create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 060f79b..ea9b58b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ plugged/ +node_modules/ diff --git a/config/eslintrc.js b/config/eslintrc.js new file mode 100644 index 0000000..3feaee3 --- /dev/null +++ b/config/eslintrc.js @@ -0,0 +1,36 @@ +module.exports = { + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "jsx": true + }, + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "never" + ] + } +}; \ No newline at end of file diff --git a/config/eslintrc.json b/config/eslintrc.json index 09d3331..32026ea 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -25,7 +25,7 @@ "babel/object-shorthand": 1, "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, - "react-native/no-unused-styles": 2, +// "react-native/no-unused-styles": 2, "react-native/split-platform-components": 2, "indent": [ "error", @@ -39,9 +39,9 @@ "error", "single" ], - "semi": [ - "error", - "always" +// "semi": [ +// "error", +// "always" ] } } diff --git a/config/eslintrc.yml b/config/eslintrc.yml new file mode 100644 index 0000000..c687bde --- /dev/null +++ b/config/eslintrc.yml @@ -0,0 +1,3 @@ +extends: airbnb +plugins: + - react diff --git a/package.json b/package.json new file mode 100644 index 0000000..e3d4af0 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "vim-plug", + "version": "1.0.0", + "description": "sherylynn", + "main": "index.js", + "scripts": { + "test": "node index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sherylynn/vim-plug.git" + }, + "keywords": [ + "sherylynn", + "vim", + "vim-plug" + ], + "author": "sherylynn", + "license": "ISC", + "bugs": { + "url": "https://github.com/sherylynn/vim-plug/issues" + }, + "homepage": "https://github.com/sherylynn/vim-plug#readme", + "devDependencies": { + "eslint-config-airbnb": "^6.2.0", + "eslint-plugin-react": "^4.2.3" + } +} From 6ae491a4752131480774eac2ec27acdd71319815 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 27 Mar 2016 14:33:24 +0800 Subject: [PATCH 026/171] npm ok --- config/eslintrc.js | 51 +++++++++++++++++++++++++++----------------- config/eslintrc.json | 2 +- install.sh | 5 +++-- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/config/eslintrc.js b/config/eslintrc.js index 3feaee3..b556a3f 100644 --- a/config/eslintrc.js +++ b/config/eslintrc.js @@ -4,7 +4,7 @@ module.exports = { "es6": true, "node": true }, - "extends": "eslint:recommended", + "extends": ["airbnb","eslint:recommended", "plugin:react/recommended"], "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, @@ -13,24 +13,35 @@ module.exports = { "sourceType": "module" }, "plugins": [ - "react" - ], + "babel", + "react", + "react-native" + ], "rules": { - "indent": [ - "error", - 4 - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "never" - ] - } + "babel/generator-star-spacing": 1, + "babel/new-cap": 1, + "babel/array-bracket-spacing": 1, + "babel/object-curly-spacing": 1, + "babel/object-shorthand": 1, + "babel/arrow-parens": 1, + "babel/no-await-in-loop": 1, +// "react-native/no-unused-styles": 2, + "react-native/split-platform-components": 2, + "indent": [ + "error", + 2 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], +// "semi": [ +// "error", +// "always" +// ] + } }; \ No newline at end of file diff --git a/config/eslintrc.json b/config/eslintrc.json index 32026ea..cdafbc7 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -42,6 +42,6 @@ // "semi": [ // "error", // "always" - ] +// ] } } diff --git a/install.sh b/install.sh index 0318a5a..8f68bb2 100755 --- a/install.sh +++ b/install.sh @@ -14,13 +14,14 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` #for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" lnif $CURRENT_DIR/config/vimrc $HOME/.vimrc lnif "$CURRENT_DIR/" "$HOME/.vim" -lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json +#lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json +lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config echo "Step3: update/install plugins using vim-plug" From b970d61f32023ceef0c10e86d478a51f84437da5 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 27 Mar 2016 14:44:33 +0800 Subject: [PATCH 027/171] errpr --- config/eslintrc.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/config/eslintrc.js b/config/eslintrc.js index b556a3f..0c41205 100644 --- a/config/eslintrc.js +++ b/config/eslintrc.js @@ -2,20 +2,20 @@ module.exports = { "env": { "browser": true, "es6": true, - "node": true + "node": true, }, "extends": ["airbnb","eslint:recommended", "plugin:react/recommended"], "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, - "jsx": true + "jsx": true, }, - "sourceType": "module" + "sourceType": "module", }, "plugins": [ "babel", "react", - "react-native" + "react-native", ], "rules": { "babel/generator-star-spacing": 1, @@ -27,21 +27,22 @@ module.exports = { "babel/no-await-in-loop": 1, // "react-native/no-unused-styles": 2, "react-native/split-platform-components": 2, - "indent": [ - "error", - 2 - ], + + //"indent": [ + // "error", + // 2 + //], "linebreak-style": [ "error", - "unix" - ], - "quotes": [ - "error", - "single" + "unix", ], + // "quotes": [ + // "error", + // "single" + //], // "semi": [ // "error", // "always" // ] - } -}; \ No newline at end of file + }, +}; From 77f3c22e51bf12840aaff84a8dae4104ed64b350 Mon Sep 17 00:00:00 2001 From: unknown <林增> Date: Mon, 28 Mar 2016 08:19:26 +0800 Subject: [PATCH 028/171] windows npm --- config/vimrc | 2 +- install.cmd | 11 +++++++---- install.sh | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/vimrc b/config/vimrc index cfbbad1..69b7bb3 100644 --- a/config/vimrc +++ b/config/vimrc @@ -139,7 +139,7 @@ Plug 'alvan/vim-closetag' "beauty Plug 'vim-scripts/matchit.zip' "tern js 补全 -Plug 'marijnh/tern_for_vim', {'do': 'npm install'} +"Plug 'marijnh/tern_for_vim', {'do': 'npm install'} call plug#end() diff --git a/install.cmd b/install.cmd index 775ecb1..e532cdb 100644 --- a/install.cmd +++ b/install.cmd @@ -12,16 +12,19 @@ IF NOT EXIST "%APP_PATH%" ( chdir /d "%ORIGINAL_DIR%" call cd "%APP_PATH%" ) -call rmlink "%HOME%\.vimrc" -call rmlink "%HOME%\_vimrc" -call rmlink "%HOME%\.eslintrc.json" -call rmlink "%HOME%\.tern-config" +call rm "%HOME%\.vimrc" +call rm "%HOME%\_vimrc" +call rm "%HOME%\.eslintrc.json" +call rm "%HOME%\.eslintrc.js" +call rm "%HOME%\.npmrc" +call rm "%HOME%\.tern-config" call rmdir "%HOME%\.vim" call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" +call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" call mklink /J "%HOME%\.vim" "%APP_PATH%\" IF NOT EXIST "%APP_PATH%\plugged" ( diff --git a/install.sh b/install.sh index 8f68bb2..6eaccea 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,7 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` #for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.npmrc $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" @@ -23,6 +23,7 @@ lnif "$CURRENT_DIR/" "$HOME/.vim" #lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config +lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc echo "Step3: update/install plugins using vim-plug" system_shell=$SHELL From f67dcea7ff8dd1a855719bca59dd7dac6efa96a2 Mon Sep 17 00:00:00 2001 From: unknown <林增> Date: Mon, 28 Mar 2016 08:19:42 +0800 Subject: [PATCH 029/171] windows npm --- config/npmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 config/npmrc diff --git a/config/npmrc b/config/npmrc new file mode 100644 index 0000000..fb1ee18 --- /dev/null +++ b/config/npmrc @@ -0,0 +1 @@ +registry=http://registry.npm.taobao.org From 8db20843c54465142650ff16afa542ffbcf8156d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 2 Mar 2018 18:16:51 +0800 Subject: [PATCH 030/171] add vim-go --- README.md | 1 + config/vimrc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 2b7679b..ea800a5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ +(一些插件如node和vim-go依赖相应的node和go环境支持) 运行2个命令配置一个强大的VIM编辑器。 diff --git a/config/vimrc b/config/vimrc index 69b7bb3..9d5c80c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -140,6 +140,9 @@ Plug 'alvan/vim-closetag' Plug 'vim-scripts/matchit.zip' "tern js 补全 "Plug 'marijnh/tern_for_vim', {'do': 'npm install'} +"Go 插件 +Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } + call plug#end() @@ -437,6 +440,12 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "代码提示 配合scrooloose/syntastic "npm i -g eslint eslint-config-airbnb babel-eslint eslint-plugin-react "eslint-plugin-react-native + +" +autocmd FileType go nmap t (go-test) +autocmd FileType go nmap b (go-build) +autocmd FileType go nmap r (go-run) + set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* From 8599d51ea6e44dcf07e39c34677de8f4c4a28297 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 2 Mar 2018 18:35:18 +0800 Subject: [PATCH 031/171] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=8F=92=E4=BB=B6=E9=93=BE=E6=8E=A5=EF=BC=8C=E6=8D=A2?= =?UTF-8?q?=E4=BA=86=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 9d5c80c..5cc3e70 100644 --- a/config/vimrc +++ b/config/vimrc @@ -74,9 +74,13 @@ Plug 'WebAPI.vim' Plug 'Gist.vim' -Plug 'molokai' +Plug 'tomasr/molokai' -Plug 'Solarized' +Plug 'altercation/solarized' + +Plug 'altercation/vim-colors-solarized' + +"Plug 'Solarized' Plug 'PDV--phpDocumentor-for-Vim' @@ -179,10 +183,10 @@ set t_Co=256 let g:solarized_termcolors=16 "两种流行风格的主题 -colorscheme molokai +"colorscheme molokai "let g:rehash256 = 1 set background=dark -"colorscheme solarized +colorscheme solarized "set background=light "emmet 设置 From b074a3dcd68b4530aed512bcafaa7aa5e4c7ec5f Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 4 Mar 2018 14:25:37 +0800 Subject: [PATCH 032/171] =?UTF-8?q?=E6=80=BB=E6=98=AF=E8=BF=9E=E4=B8=8D?= =?UTF-8?q?=E4=B8=8Ago=E5=AE=89=E8=A3=85=E6=9C=8D=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=94=BE=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 install.bat diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..16bdaf9 --- /dev/null +++ b/install.bat @@ -0,0 +1,55 @@ +@echo off +%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit +cd /d "%~dp0" +@echo off +cls +setlocal EnableDelayedExpansion + +set http_proxy=http://127.0.0.1:8087 +set https_proxy=http://127.0.0.1:8087 +rem git config http.proxy http://127.0.0.1:8087 +git config --global http.proxy http://127.0.0.1:8087 +@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% +@if not exist "%HOME%" @set HOME=%USERPROFILE% + +@set APP_PATH=%HOME%\vim-plug +IF NOT EXIST "%APP_PATH%" ( + call git clone https://github.com/sherylynn/vim-plug.git "%APP_PATH%" +) ELSE ( + @set ORIGINAL_DIR=%CD% + echo updating vim-plug + chdir /d "%APP_PATH%" + call git pull + chdir /d "%ORIGINAL_DIR%" + call cd "%APP_PATH%" +) +call rm "%HOME%\.vimrc" +call rm "%HOME%\_vimrc" +call rm "%HOME%\.eslintrc.json" +call rm "%HOME%\.eslintrc.js" +call rm "%HOME%\.npmrc" +call rm "%HOME%\.tern-config" +call rmdir "%HOME%\.vim" + +call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" +call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" +call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" +call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" +call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" +call mklink /J "%HOME%\.vim" "%APP_PATH%\" + +IF NOT EXIST "%APP_PATH%\plugged" ( + call mkdir "%APP_PATH%\plugged" +) + +::IF NOT EXIST "%HOME%/.vim/bundle/vundle" ( +:: call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" +::) ELSE ( +:: call cd "%HOME%/.vim/bundle/vundle" +:: call git pull +:: call cd %HOME% +::) + +call vim +PlugInstall! +PlugClean! +qall +call vim -c "GoInstallBinaries" -c "qa" +call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org From 1edb2b69a1f6f52202f57d227657da85750b0c60 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 4 Mar 2018 14:48:42 +0800 Subject: [PATCH 033/171] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=BF=98=E8=AE=B0?= =?UTF-8?q?=E4=B8=BA=E5=95=A5=E8=A6=81=E5=88=87=E6=8D=A2shell=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=BA=86=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=9C=A8termux?= =?UTF-8?q?=E4=B8=ADsh=E8=B7=AF=E5=BE=84=E4=B8=8D=E6=98=AF=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=B7=AF=E5=BE=84=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?vim-go=E7=8E=AF=E5=A2=83=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 6eaccea..14a72c7 100755 --- a/install.sh +++ b/install.sh @@ -26,11 +26,12 @@ lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc echo "Step3: update/install plugins using vim-plug" -system_shell=$SHELL -export SHELL="/bin/sh" -vim +PlugInstall! +PlugClean! +qall -export SHELL=$system_shell - +#system_shell=$SHELL +#export SHELL="/bin/sh" +#vim +PlugInstall! +PlugClean! +qall +#export SHELL=$system_shell +#完全忘记自己代码在写啥了 +vim +PlugInstall! +PlugClean! +GoInstallBinaries! +qall echo "Step4: install eslint" echo "It will take a long time, just be patient!" From c04703226d3d3379c603ad0553e9c7e70b773c5a Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 01:17:48 +0800 Subject: [PATCH 034/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=8D=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=8F=82=E6=95=B0=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 14a72c7..0952798 100755 --- a/install.sh +++ b/install.sh @@ -28,10 +28,10 @@ lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc echo "Step3: update/install plugins using vim-plug" #system_shell=$SHELL #export SHELL="/bin/sh" -#vim +PlugInstall! +PlugClean! +qall +vim +PlugInstall! +PlugClean! +qall #export SHELL=$system_shell #完全忘记自己代码在写啥了 -vim +PlugInstall! +PlugClean! +GoInstallBinaries! +qall +vim -c "GoInstallBinaries" -c "qa" echo "Step4: install eslint" echo "It will take a long time, just be patient!" From 1b66e6c8dff68875c0c688667d8a4d8009d89d1d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 09:58:47 +0800 Subject: [PATCH 035/171] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E8=BF=87=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 7 +++---- install.cmd | 44 -------------------------------------------- install.sh | 3 ++- proxy.bat | 20 ++++++++++++++++++++ proxy.sh | 20 ++++++++++++++++++++ test.bat | 9 +++++++++ 6 files changed, 54 insertions(+), 49 deletions(-) delete mode 100644 install.cmd create mode 100644 proxy.bat create mode 100644 proxy.sh create mode 100644 test.bat diff --git a/install.bat b/install.bat index 16bdaf9..025b7f6 100644 --- a/install.bat +++ b/install.bat @@ -5,10 +5,6 @@ cd /d "%~dp0" cls setlocal EnableDelayedExpansion -set http_proxy=http://127.0.0.1:8087 -set https_proxy=http://127.0.0.1:8087 -rem git config http.proxy http://127.0.0.1:8087 -git config --global http.proxy http://127.0.0.1:8087 @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% @if not exist "%HOME%" @set HOME=%USERPROFILE% @@ -51,5 +47,8 @@ IF NOT EXIST "%APP_PATH%\plugged" ( ::) call vim +PlugInstall! +PlugClean! +qall +:: call proxy.bat +:: 似乎提权后不能用call,但是新建等待却是无忧的 +start /WAIT proxy.bat call vim -c "GoInstallBinaries" -c "qa" call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org diff --git a/install.cmd b/install.cmd deleted file mode 100644 index e532cdb..0000000 --- a/install.cmd +++ /dev/null @@ -1,44 +0,0 @@ -@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% -@if not exist "%HOME%" @set HOME=%USERPROFILE% - -@set APP_PATH=%HOME%\vim-plug -IF NOT EXIST "%APP_PATH%" ( - call git clone https://github.com/sherylynn/vim-plug.git "%APP_PATH%" -) ELSE ( - @set ORIGINAL_DIR=%CD% - echo updating vim-plug - chdir /d "%APP_PATH%" - call git pull - chdir /d "%ORIGINAL_DIR%" - call cd "%APP_PATH%" -) -call rm "%HOME%\.vimrc" -call rm "%HOME%\_vimrc" -call rm "%HOME%\.eslintrc.json" -call rm "%HOME%\.eslintrc.js" -call rm "%HOME%\.npmrc" -call rm "%HOME%\.tern-config" -call rmdir "%HOME%\.vim" - -call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" -call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" -call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" -call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" -call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" -call mklink /J "%HOME%\.vim" "%APP_PATH%\" - -IF NOT EXIST "%APP_PATH%\plugged" ( - call mkdir "%APP_PATH%\plugged" -) - -::IF NOT EXIST "%HOME%/.vim/bundle/vundle" ( -:: call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" -::) ELSE ( -:: call cd "%HOME%/.vim/bundle/vundle" -:: call git pull -:: call cd %HOME% -::) - -call vim +PlugInstall! +PlugClean! +qall - -call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org diff --git a/install.sh b/install.sh index 0952798..2e5c3bd 100755 --- a/install.sh +++ b/install.sh @@ -30,7 +30,8 @@ echo "Step3: update/install plugins using vim-plug" #export SHELL="/bin/sh" vim +PlugInstall! +PlugClean! +qall #export SHELL=$system_shell -#完全忘记自己代码在写啥了 +#完全忘记上面自己切换shell的环境的代码在写啥了 +sh ./proxy.sh vim -c "GoInstallBinaries" -c "qa" echo "Step4: install eslint" diff --git a/proxy.bat b/proxy.bat new file mode 100644 index 0000000..a8febe0 --- /dev/null +++ b/proxy.bat @@ -0,0 +1,20 @@ +set http_proxy=http://127.0.0.1:8087 +set https_proxy=http://127.0.0.1:8087 +git config http.proxy http://127.0.0.1:8087 +go get -u github.com/klauspost/asmfmt/cmd/asmfmt +go get -u github.com/derekparker/delve/cmd/dlv +go get -u github.com/kisielk/errcheck +go get -u github.com/davidrjenni/reftools/cmd/fillstruct +go get -u -ldflags -H=windowsgui github.com/nsf/gocode +go get -u github.com/rogpeppe/godef +go get -u github.com/zmb3/gogetdoc +go get -u golang.org/x/tools/cmd/goimports +go get -u github.com/golang/lint/golint +go get -u github.com/alecthomas/gometalinter +go get -u github.com/fatih/gomodifytags +go get -u golang.org/x/tools/cmd/gorename +go get -u github.com/jstemmer/gotags +go get -u golang.org/x/tools/cmd/guru +go get -u github.com/josharian/impl +go get -u github.com/dominikh/go-tools/cmd/keyify +go get -u github.com/fatih/motion \ No newline at end of file diff --git a/proxy.sh b/proxy.sh new file mode 100644 index 0000000..42795d3 --- /dev/null +++ b/proxy.sh @@ -0,0 +1,20 @@ +export http_proxy=http://127.0.0.1:8087/ +export https_proxy=http://127.0.0.1:8087/ +git config http.proxy http://127.0.0.1:8087 +go get -u github.com/klauspost/asmfmt/cmd/asmfmt +go get -u github.com/derekparker/delve/cmd/dlv +go get -u github.com/kisielk/errcheck +go get -u github.com/davidrjenni/reftools/cmd/fillstruct +go get -u github.com/nsf/gocode +go get -u github.com/rogpeppe/godef +go get -u github.com/zmb3/gogetdoc +go get -u golang.org/x/tools/cmd/goimports +go get -u github.com/golang/lint/golint +go get -u github.com/alecthomas/gometalinter +go get -u github.com/fatih/gomodifytags +go get -u golang.org/x/tools/cmd/gorename +go get -u github.com/jstemmer/gotags +go get -u golang.org/x/tools/cmd/guru +go get -u github.com/josharian/impl +go get -u github.com/dominikh/go-tools/cmd/keyify +go get -u github.com/fatih/motion \ No newline at end of file diff --git a/test.bat b/test.bat new file mode 100644 index 0000000..8853c58 --- /dev/null +++ b/test.bat @@ -0,0 +1,9 @@ +@echo off +%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit +cd /d "%~dp0" +@echo off +cls +setlocal EnableDelayedExpansion +start proxy.bat +dir +pause From a316fec6dd8f93f96050893f389e6b937e7f964c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 10:20:32 +0800 Subject: [PATCH 036/171] add exit --- proxy.bat | 4 +++- test.bat | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 test.bat diff --git a/proxy.bat b/proxy.bat index a8febe0..34d5884 100644 --- a/proxy.bat +++ b/proxy.bat @@ -17,4 +17,6 @@ go get -u github.com/jstemmer/gotags go get -u golang.org/x/tools/cmd/guru go get -u github.com/josharian/impl go get -u github.com/dominikh/go-tools/cmd/keyify -go get -u github.com/fatih/motion \ No newline at end of file +go get -u github.com/fatih/motion +::用了start命令 所以需要增加一个退出命令 +exit \ No newline at end of file diff --git a/test.bat b/test.bat deleted file mode 100644 index 8853c58..0000000 --- a/test.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit -cd /d "%~dp0" -@echo off -cls -setlocal EnableDelayedExpansion -start proxy.bat -dir -pause From d4f46f9383d649b6b42f2d3ce4adc8197aa18ebc Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 10:57:23 +0800 Subject: [PATCH 037/171] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 2 +- proxy.bat | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/install.bat b/install.bat index 025b7f6..b9df074 100644 --- a/install.bat +++ b/install.bat @@ -49,6 +49,6 @@ IF NOT EXIST "%APP_PATH%\plugged" ( call vim +PlugInstall! +PlugClean! +qall :: call proxy.bat :: 似乎提权后不能用call,但是新建等待却是无忧的 -start /WAIT proxy.bat +call proxy.bat call vim -c "GoInstallBinaries" -c "qa" call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org diff --git a/proxy.bat b/proxy.bat index 34d5884..edbe061 100644 --- a/proxy.bat +++ b/proxy.bat @@ -1,3 +1,4 @@ +@echo off set http_proxy=http://127.0.0.1:8087 set https_proxy=http://127.0.0.1:8087 git config http.proxy http://127.0.0.1:8087 @@ -18,5 +19,5 @@ go get -u golang.org/x/tools/cmd/guru go get -u github.com/josharian/impl go get -u github.com/dominikh/go-tools/cmd/keyify go get -u github.com/fatih/motion -::用了start命令 所以需要增加一个退出命令 -exit \ No newline at end of file +EXIT /B +::goto :eof和 EXIT /B 都能返回到之前的call里 但是是不会返回到start里 \ No newline at end of file From 79d6634b002407d2a42d8365c5ab2e7e2b189c75 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 11:00:53 +0800 Subject: [PATCH 038/171] =?UTF-8?q?=E5=8F=96=E6=B6=88=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E4=BB=A5=E5=89=8D=E7=9A=84=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.bat b/install.bat index b9df074..e6718ec 100644 --- a/install.bat +++ b/install.bat @@ -31,7 +31,7 @@ call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" -call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" +::不再覆盖npmrc call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" call mklink /J "%HOME%\.vim" "%APP_PATH%\" IF NOT EXIST "%APP_PATH%\plugged" ( From 572ee62c1febd7baef7a4ce45ea380d0668106a7 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 11:01:34 +0800 Subject: [PATCH 039/171] =?UTF-8?q?=E4=BC=BC=E4=B9=8E=E5=8F=AF=E4=BB=A5cal?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 2 -- 1 file changed, 2 deletions(-) diff --git a/install.bat b/install.bat index e6718ec..5dbdf1e 100644 --- a/install.bat +++ b/install.bat @@ -47,8 +47,6 @@ IF NOT EXIST "%APP_PATH%\plugged" ( ::) call vim +PlugInstall! +PlugClean! +qall -:: call proxy.bat -:: 似乎提权后不能用call,但是新建等待却是无忧的 call proxy.bat call vim -c "GoInstallBinaries" -c "qa" call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org From 49ac37dde872aca202621c813dc37c3b2ee68bba Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 14:09:31 +0800 Subject: [PATCH 040/171] add fugitive for git support --- config/vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/vimrc b/config/vimrc index 5cc3e70..18ae7d2 100644 --- a/config/vimrc +++ b/config/vimrc @@ -146,7 +146,7 @@ Plug 'vim-scripts/matchit.zip' "Plug 'marijnh/tern_for_vim', {'do': 'npm install'} "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } - +Plug 'tpope/vim-fugitive' call plug#end() @@ -294,13 +294,13 @@ vnoremap g "映射复制、粘贴、剪贴ctrl+c ctrl+v ctrl+x "还原了C-V的多行编辑模式 -"map "+pa +map "+pa -"map! "+pa +map! "+pa map "+y -"map "+x +map "+x " 映射全选 ctrl+a map ggVG @@ -309,8 +309,8 @@ map! ggVG "ctrl+s为保存 -"map :w -"inoremap :w +map :w +inoremap :w "ctrl+z撤销 From 819e8361d238019df4ac2d484ab4b5c378df5b36 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 5 Mar 2018 23:16:24 +0800 Subject: [PATCH 041/171] =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=8D=A2=E5=9B=9E?= =?UTF-8?q?=E5=8F=A6=E4=B8=80=E4=B8=AAdiff=E4=BA=86,=E6=B2=A1=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/vimrc b/config/vimrc index 18ae7d2..fb5779a 100644 --- a/config/vimrc +++ b/config/vimrc @@ -147,6 +147,8 @@ Plug 'vim-scripts/matchit.zip' "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } Plug 'tpope/vim-fugitive' +Plug 'mhinz/vim-signify' +"Plug 'airblade/vim-gitgutter' call plug#end() @@ -446,6 +448,8 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "eslint-plugin-react-native " +"快捷提交 +nmap c (Gcommit) autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) From b86123e54663d74dd11ba64b1e9e060c7924e8ca Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 00:48:32 +0800 Subject: [PATCH 042/171] add F5 feature --- config/vimrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index fb5779a..5e54c36 100644 --- a/config/vimrc +++ b/config/vimrc @@ -147,7 +147,7 @@ Plug 'vim-scripts/matchit.zip' "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } Plug 'tpope/vim-fugitive' -Plug 'mhinz/vim-signify' +"Plug 'mhinz/vim-signify' "Plug 'airblade/vim-gitgutter' call plug#end() @@ -449,7 +449,10 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k " "快捷提交 -nmap c (Gcommit) +nmap p (Gpush) +"F5 刷新编辑器 +nmap :source% + autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) From 3e025eb88931d9af72b9206a45bdbc300bb93d84 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 01:11:12 +0800 Subject: [PATCH 043/171] npmrc --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 2e5c3bd..61c7308 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,8 @@ lnif "$CURRENT_DIR/" "$HOME/.vim" #lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config -lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc +#不能乱动.npmrc +#lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc echo "Step3: update/install plugins using vim-plug" #system_shell=$SHELL From fa4266980175c6c8088714c4a422ab5de5032b56 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 01:12:45 +0800 Subject: [PATCH 044/171] =?UTF-8?q?=E6=97=A0=E5=A5=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/npmrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/npmrc b/config/npmrc index fb1ee18..e6ae008 100644 --- a/config/npmrc +++ b/config/npmrc @@ -1 +1,3 @@ -registry=http://registry.npm.taobao.org +registry=http://registry.npm.taobao.org/ +prefix=/home/lynn/node-global +cache=~/node-cache From 0d6bd86c20e35653bb0951d928425c22d54b76b8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 01:55:51 +0800 Subject: [PATCH 045/171] just --- install.sh | 5 +++-- proxy.bat | 3 ++- proxy.sh | 2 ++ test.sh | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 proxy.sh create mode 100755 test.sh diff --git a/install.sh b/install.sh index 61c7308..996854b 100755 --- a/install.sh +++ b/install.sh @@ -32,8 +32,9 @@ echo "Step3: update/install plugins using vim-plug" vim +PlugInstall! +PlugClean! +qall #export SHELL=$system_shell #完全忘记上面自己切换shell的环境的代码在写啥了 -sh ./proxy.sh -vim -c "GoInstallBinaries" -c "qa" +source ./proxy.sh +#vim -c "GoInstallBinaries" -c "qa" +vim +GoInstallBinaries! +qall echo "Step4: install eslint" echo "It will take a long time, just be patient!" diff --git a/proxy.bat b/proxy.bat index edbe061..1bda307 100644 --- a/proxy.bat +++ b/proxy.bat @@ -1,4 +1,5 @@ -@echo off +@echo +echo 开始安装依赖 set http_proxy=http://127.0.0.1:8087 set https_proxy=http://127.0.0.1:8087 git config http.proxy http://127.0.0.1:8087 diff --git a/proxy.sh b/proxy.sh old mode 100644 new mode 100755 index 42795d3..6959e0e --- a/proxy.sh +++ b/proxy.sh @@ -1,3 +1,5 @@ +#!/bin/bash +echo 开始安装依赖 export http_proxy=http://127.0.0.1:8087/ export https_proxy=http://127.0.0.1:8087/ git config http.proxy http://127.0.0.1:8087 diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..f63b8bc --- /dev/null +++ b/test.sh @@ -0,0 +1 @@ +source ./install.sh From 394ec9881faea5cb39908511120643d3994eb7cc Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 13:53:34 +0800 Subject: [PATCH 046/171] add incsearch --- config/vimrc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 5e54c36..17d1ed4 100644 --- a/config/vimrc +++ b/config/vimrc @@ -147,8 +147,11 @@ Plug 'vim-scripts/matchit.zip' "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } Plug 'tpope/vim-fugitive' -"Plug 'mhinz/vim-signify' +Plug 'mhinz/vim-signify' +"上面的比起下面的更美观且快捷 "Plug 'airblade/vim-gitgutter' +"增强了搜索,需要映射键位 +Plug 'haya14busa/incsearch.vim' call plug#end() @@ -472,6 +475,12 @@ let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 +"-------------------------------------------------- +"incsearch +"-------------------------------------------------- +map / (incsearch-forward) +map ? (incsearch-backward) +map g/ (incsearch-stay) " ---------------------------------------------------------------------------- " tern_for_vim " ---------------------------------------------------------------------------- From dc0efa776893b410dfb615e31058bfb0edf78888 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:05:05 +0800 Subject: [PATCH 047/171] =?UTF-8?q?=E5=BC=95=E5=85=A5=E4=BA=86emacs?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E6=93=8D=E4=BD=9C=EF=BC=8C=E6=99=AE?= =?UTF-8?q?=E9=80=9A=E6=A8=A1=E5=BC=8F=E4=B8=8Bgca=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=20gp=E5=BF=AB=E6=8D=B7push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/config/vimrc b/config/vimrc index 17d1ed4..4a80796 100644 --- a/config/vimrc +++ b/config/vimrc @@ -308,12 +308,20 @@ map "+y map "+x " 映射全选 ctrl+a -map ggVG - -map! ggVG - +"map ggVG +"map! ggVG + +" import emacs map +imap ^i +imap $a +imap d$i +map ^ +map $ +map d$ +" git Command +nnoremap gca :Gcommit -a -v +nnoremap gp :Gpush "ctrl+s为保存 - map :w inoremap :w From 650bdd129e8066233ea6456f0ea5bcdd3e9ec26e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:08:31 +0800 Subject: [PATCH 048/171] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 4a80796..2d1a952 100644 --- a/config/vimrc +++ b/config/vimrc @@ -318,7 +318,7 @@ imap d$i map ^ map $ map d$ -" git Command +" git Command git使用 nnoremap gca :Gcommit -a -v nnoremap gp :Gpush "ctrl+s为保存 From ad379548efb154a3dafa91d0abeaabaea1a9b91a Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:12:14 +0800 Subject: [PATCH 049/171] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/vimrc b/config/vimrc index 2d1a952..3a6155f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -52,7 +52,10 @@ Plug 'junegunn/vim-easy-align' Plug 'nsf/gocode', { 'rtp': 'vim' } Plug 'AutoComplPop' +"浏览树 Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +"浏览树显示git状态插件 +Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'Tagbar' "Bundle 'minibufexpl.vim' From c33cb4d5b464da6de11bcc46ae8582b6474126e8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:20:24 +0800 Subject: [PATCH 050/171] =?UTF-8?q?=E8=BF=87=E6=BB=A4swp=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ea9b58b..2229bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ plugged/ node_modules/ +*.swp \ No newline at end of file From f2e8a9a75dd2f30e5787cb1f74c898281e0e3785 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:27:39 +0800 Subject: [PATCH 051/171] auto_nohlsearch --- config/vimrc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 3a6155f..083dd47 100644 --- a/config/vimrc +++ b/config/vimrc @@ -176,10 +176,6 @@ set ignorecase let g:acp_behaviorKeywordCommand="\" -"搜索高亮 - -set hlsearch - "设置NERDTreetagbar的宽度 let g:NERDTreeWinSize = 20 @@ -492,6 +488,16 @@ let g:syntastic_check_on_wq = 0 map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) +"搜索后自动关闭高亮 +" :h g:incsearch#auto_nohlsearch +set hlsearch +let g:incsearch#auto_nohlsearch = 1 +map n (incsearch-nohl-n) +map N (incsearch-nohl-N) +map * (incsearch-nohl-*) +map # (incsearch-nohl-#) +map g* (incsearch-nohl-g*) +map g# (incsearch-nohl-g#) " ---------------------------------------------------------------------------- " tern_for_vim " ---------------------------------------------------------------------------- From 94b4b6fc9a272f1ba094f1831e94206dec8b7da3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 15:58:43 +0800 Subject: [PATCH 052/171] =?UTF-8?q?=E6=89=A9=E5=B1=95=E9=80=89=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index 083dd47..767ac11 100644 --- a/config/vimrc +++ b/config/vimrc @@ -155,6 +155,8 @@ Plug 'mhinz/vim-signify' "Plug 'airblade/vim-gitgutter' "增强了搜索,需要映射键位 Plug 'haya14busa/incsearch.vim' +"v模式下选词 +键扩展 -键缩减 +Plug 'terryma/vim-expand-region' call plug#end() From cd8c15752885b9723e34c57a39898c2f3681cac3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 6 Mar 2018 16:06:43 +0800 Subject: [PATCH 053/171] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 767ac11..34e1e9f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -311,7 +311,11 @@ map "+x " 映射全选 ctrl+a "map ggVG "map! ggVG - +"多窗口切换 +map +map +map +map " import emacs map imap ^i imap $a From 745c4c8079662abf0517c687b6f652ec9348f300 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 7 Mar 2018 13:27:05 +0800 Subject: [PATCH 054/171] =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8F=92=E4=BB=B6=E8=87=B3ALE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 53 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/config/vimrc b/config/vimrc index 34e1e9f..ff3280f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -123,13 +123,12 @@ Plug 'EasyMotion' Plug 'https://github.com/bling/vim-airline.git' -Plug 'https://github.com/luofei614/vim-golang.git' - Plug 'https://github.com/burnettk/vim-angular.git' "检查程序语法错误 -Plug 'https://github.com/scrooloose/syntastic.git' - +"Plug 'https://github.com/scrooloose/syntastic.git' +"切换到 ale +Plug 'w0rp/ale' "jsx插件 Plug 'mxw/vim-jsx' "括号改变 @@ -149,6 +148,7 @@ Plug 'vim-scripts/matchit.zip' "Plug 'marijnh/tern_for_vim', {'do': 'npm install'} "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } +"git 插件 Plug 'tpope/vim-fugitive' Plug 'mhinz/vim-signify' "上面的比起下面的更美观且快捷 @@ -157,6 +157,7 @@ Plug 'mhinz/vim-signify' Plug 'haya14busa/incsearch.vim' "v模式下选词 +键扩展 -键缩减 Plug 'terryma/vim-expand-region' + call plug#end() @@ -168,7 +169,7 @@ let g:used_javascript_libs = 'jQuery,AngularJS,AngularUI,RequireJS' "let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] "php只做语法检查 -let g:syntastic_php_checkers = ['php'] +"let g:syntastic_php_checkers = ['php'] "autocomplpop 设置 @@ -473,21 +474,33 @@ autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - -let g:syntastic_javascript_checkers = ['eslint'] -let g:syntastic_javascript_eslint_exec = 'eslint_d' -let g:syntastic_error_symbol='✘' -let g:syntastic_warning_symbol='❗' -let g:syntastic_style_error_symbol='»' -let g:syntastic_style_warning_symbol='•' -let g:syntastic_enable_highlighting = 0 -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 +"状态栏改变 +"set statusline+=%#warningmsg# +"set statusline+=%{SyntasticStatuslineFlag()} +"set statusline+=%* +"let g:syntastic_javascript_checkers = ['eslint'] +"let g:syntastic_javascript_eslint_exec = 'eslint_d' +"let g:syntastic_error_symbol='✘' +"let g:syntastic_warning_symbol='❗' +"let g:syntastic_style_error_symbol='»' +"let g:syntastic_style_warning_symbol='•' +"let g:syntastic_enable_highlighting = 0 +"let g:syntastic_always_populate_loc_list = 1 +"let g:syntastic_auto_loc_list = 1 +"let g:syntastic_check_on_open = 1 +"let g:syntastic_check_on_wq = 0 + +"显示 +let g:airline#extensions#ale#enabled = 1 +"自动完成 +let g:ale_completion_enabled = 1 +let g:ale_fixers = { +\ 'javascript': ['eslint'], +\} +"自动纠正 +let g:ale_fix_on_save = 1 +"保持打开栏目 +let g:ale_sign_column_always = 1 "-------------------------------------------------- "incsearch "-------------------------------------------------- From 3ffa31902ebf19e2e904397d3f99cd04f3342759 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 7 Mar 2018 14:23:07 +0800 Subject: [PATCH 055/171] =?UTF-8?q?=E5=A4=9A=E5=85=89=E6=A0=87=E7=9A=84?= =?UTF-8?q?=E7=86=9F=E6=82=89=E5=92=8Cemacs=E9=94=AE=E4=BD=8D=E7=9A=84?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/config/vimrc b/config/vimrc index ff3280f..1fac844 100644 --- a/config/vimrc +++ b/config/vimrc @@ -108,7 +108,7 @@ Plug 'xml.vim' "安装此插件解决macvim下没有加号寄存器的问题。 Plug 'https://github.com/kana/vim-fakeclip.git' -Plug 'https://github.com/terryma/vim-multiple-cursors.git' +Plug 'terryma/vim-multiple-cursors' "snippets Plug 'MarcWeber/vim-addon-mw-utils' @@ -227,9 +227,10 @@ autocmd FileType javascript,html set keywordprg=$HOME/.vim/extend/man autocmd FileType css set keywordprg=$HOME/.vim/extend/cssman -inoremap :call PhpDocSingle()i -nnoremap :call PhpDocSingle() -vnoremap :call PhpDocRange() +"php的注释,没什么用还占了我的c-d +"inoremap :call PhpDocSingle()i +"nnoremap :call PhpDocSingle() +"vnoremap :call PhpDocRange() map @@ -308,6 +309,15 @@ map! "+pa map "+y map "+x +"多行光标键位解绑 +let g:multi_cursor_use_default_mapping=0 +" Default mapping +let g:multi_cursor_next_key='' +let g:multi_cursor_prev_key='' +"let g:multi_cursor_skip_key='' +let g:multi_cursor_quit_key='' + + " 映射全选 ctrl+a "map ggVG @@ -318,12 +328,18 @@ map map map " import emacs map -imap ^i -imap $a -imap d$i -map ^ -map $ -map d$ +imap +imap +cmap +cmap +nmap +nmap +"imap ^i +"imap $a +"imap d$i +"map ^ +"map $ +"map d$ " git Command git使用 nnoremap gca :Gcommit -a -v nnoremap gp :Gpush From e50086a65dd719c39977ac232918ba1dbe699e50 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 7 Mar 2018 21:00:52 +0800 Subject: [PATCH 056/171] =?UTF-8?q?=E6=94=B9=E5=8F=98=E4=BA=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=A0=8F=E7=9A=84=E5=91=BC=E5=87=BA=E4=B8=BAF3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/vimrc b/config/vimrc index 1fac844..cd8072f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,6 +1,6 @@ " Basics { set nocompatible " Must be first line -set background=dark " Assume a dark background +set background=dark " Assume a dark background " Allow to trigger background function! ToggleBG() let s:tbg = &background @@ -253,9 +253,9 @@ map! :! ctags -R "快捷键设置 -map :NERDTreeToggle +map :NERDTreeToggle -map! :NERDTreeToggle +map! :NERDTreeToggle map :TagbarToggle From 3707cf09d8e7e3851546c29d2d7fef71dbe1e573 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 7 Mar 2018 21:06:15 +0800 Subject: [PATCH 057/171] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E5=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index cd8072f..d15bb69 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,6 +1,6 @@ " Basics { set nocompatible " Must be first line -set background=dark " Assume a dark background +"set background=dark " Assume a dark background " Allow to trigger background function! ToggleBG() let s:tbg = &background From a74fd19ffebff0c7a89399cf562e15d3a7efe23b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 7 Mar 2018 22:42:41 +0800 Subject: [PATCH 058/171] add a map for change background color --- config/vimrc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/config/vimrc b/config/vimrc index d15bb69..9468b9b 100644 --- a/config/vimrc +++ b/config/vimrc @@ -1,16 +1,5 @@ " Basics { set nocompatible " Must be first line -"set background=dark " Assume a dark background -" Allow to trigger background - function! ToggleBG() - let s:tbg = &background - " Inversion - if s:tbg == "dark" - set background=light - else - set background=dark - endif - endfunction " } " Windows Compatible { @@ -194,8 +183,7 @@ let g:solarized_termcolors=16 "let g:rehash256 = 1 set background=dark colorscheme solarized -"set background=light - +map cbg :call ToggleBG() "emmet 设置 let g:user_emmet_expandabbr_key = '' From 8453acdc6e4e348e916817cf8b1a51e7e27182e1 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 01:14:16 +0800 Subject: [PATCH 059/171] =?UTF-8?q?=E8=B0=83=E5=A5=BD=E4=BA=86linux?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E9=85=8D=E8=89=B2=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E4=BA=86=E8=A7=A3=E7=9C=9F=E5=BD=A9=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/config/vimrc b/config/vimrc index 9468b9b..dfe98f0 100644 --- a/config/vimrc +++ b/config/vimrc @@ -67,12 +67,12 @@ Plug 'WebAPI.vim' Plug 'Gist.vim' Plug 'tomasr/molokai' - -Plug 'altercation/solarized' - -Plug 'altercation/vim-colors-solarized' - +"七年没更新的配色能用个鬼 +"Plug 'altercation/solarized' +"Plug 'altercation/vim-colors-solarized' "Plug 'Solarized' +"找来个支持truecolor的 +Plug 'lifepillar/vim-solarized8' Plug 'PDV--phpDocumentor-for-Vim' @@ -177,12 +177,30 @@ let g:tagbar_width=20 set t_Co=256 -let g:solarized_termcolors=16 +"let g:solarized_termcolors=16 "两种流行风格的主题 "colorscheme molokai "let g:rehash256 = 1 set background=dark -colorscheme solarized +" Allow to trigger background + function! ToggleBG() + let s:tbg = &background + " Inversion + if s:tbg == "dark" + set background=light + else + set background=dark + endif + endfunction +"设置终端真彩色 +"set termguicolors +colorscheme solarized8 +"high low normal +let g:solarized_visibility='high' +"high low normal bold +let g:solarized_diffmode='bold' +"老版光标 +let g:solarized_old_cursor_style=1 map cbg :call ToggleBG() "emmet 设置 From abbce7537658169259a290b39a2567037cfcb1d6 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 02:32:37 +0800 Subject: [PATCH 060/171] =?UTF-8?q?cmd=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index dfe98f0..4350eaa 100644 --- a/config/vimrc +++ b/config/vimrc @@ -194,6 +194,8 @@ set background=dark endfunction "设置终端真彩色 "set termguicolors +"旧cmd兼容性待定 +"let g:solarized_use16 = 1 colorscheme solarized8 "high low normal let g:solarized_visibility='high' From 9855ad2d78f00fbc903f9e5aab950df9e8888ede Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 03:46:48 +0800 Subject: [PATCH 061/171] =?UTF-8?q?=E6=89=BE=E5=88=B0apprentice=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E4=B8=80=E6=AC=BE=E8=83=BD=E7=94=A8=E7=9A=84windows?= =?UTF-8?q?=20cmd=E4=B8=8B=E9=85=8D=E8=89=B2=EF=BC=8C=E5=A5=BD=E8=89=B0?= =?UTF-8?q?=E9=9A=BE=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/config/vimrc b/config/vimrc index 4350eaa..0f0d6a0 100644 --- a/config/vimrc +++ b/config/vimrc @@ -147,6 +147,8 @@ Plug 'haya14busa/incsearch.vim' "v模式下选词 +键扩展 -键缩减 Plug 'terryma/vim-expand-region' +Plug 'liuchengxu/space-vim-dark' +Plug 'basilgood/Apprentice/' call plug#end() @@ -175,7 +177,7 @@ let g:tagbar_width=20 "颜色主题设置 -set t_Co=256 +"set t_Co=256 "let g:solarized_termcolors=16 "两种流行风格的主题 @@ -195,15 +197,18 @@ set background=dark "设置终端真彩色 "set termguicolors "旧cmd兼容性待定 -"let g:solarized_use16 = 1 -colorscheme solarized8 +let g:solarized_use16 = 1 +"colorscheme solarized8 +colorscheme apprentice "high low normal -let g:solarized_visibility='high' +"let g:solarized_visibility='high' "high low normal bold -let g:solarized_diffmode='bold' +"let g:solarized_diffmode='bold' "老版光标 -let g:solarized_old_cursor_style=1 +"let g:solarized_old_cursor_style=1 map cbg :call ToggleBG() +"colorscheme space-vim-dark + "emmet 设置 let g:user_emmet_expandabbr_key = '' From 3facdfb6745c884cc24fd00f0eb671ed9613e75b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:00:15 +0800 Subject: [PATCH 062/171] =?UTF-8?q?=E6=8A=8Agit=E6=8F=90=E7=A4=BA=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=8D=A2=E6=88=90=E6=8D=AE=E8=AF=B4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 0f0d6a0..82eb5c3 100644 --- a/config/vimrc +++ b/config/vimrc @@ -139,9 +139,9 @@ Plug 'vim-scripts/matchit.zip' Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } "git 插件 Plug 'tpope/vim-fugitive' -Plug 'mhinz/vim-signify' +"Plug 'mhinz/vim-signify' "上面的比起下面的更美观且快捷 -"Plug 'airblade/vim-gitgutter' +Plug 'airblade/vim-gitgutter' "增强了搜索,需要映射键位 Plug 'haya14busa/incsearch.vim' "v模式下选词 +键扩展 -键缩减 From 7e5480e2b332d0edd195d4027c9551eaa113bd42 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:03:19 +0800 Subject: [PATCH 063/171] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E7=82=B9=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 82eb5c3..06f7005 100644 --- a/config/vimrc +++ b/config/vimrc @@ -146,8 +146,9 @@ Plug 'airblade/vim-gitgutter' Plug 'haya14busa/incsearch.vim' "v模式下选词 +键扩展 -键缩减 Plug 'terryma/vim-expand-region' - -Plug 'liuchengxu/space-vim-dark' +"多个配色多条路,不过在cmd下都不行 +"Plug 'liuchengxu/space-vim-dark' +"终于见到支持cmd的英豪了,也就能用的地步,丑,需要进一步根据环境判断切换 Plug 'basilgood/Apprentice/' call plug#end() From fafa003a91dab71e3576f902b02da3b70b20ca24 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:10:43 +0800 Subject: [PATCH 064/171] =?UTF-8?q?=E6=8A=8Agit=E6=8D=A2=E6=88=90=E4=BA=86?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 06f7005..d5d889c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -150,6 +150,7 @@ Plug 'terryma/vim-expand-region' "Plug 'liuchengxu/space-vim-dark' "终于见到支持cmd的英豪了,也就能用的地步,丑,需要进一步根据环境判断切换 Plug 'basilgood/Apprentice/' +Plug 'skywind3000/asyncrun.vim' call plug#end() @@ -356,7 +357,10 @@ nmap "map d$ " git Command git使用 nnoremap gca :Gcommit -a -v -nnoremap gp :Gpush +"nnoremap gp :Gpush +"git push 这步阻塞太痛苦了,改成异步的 +nnoremap gp :AsyncRun git push origin master + "ctrl+s为保存 map :w inoremap :w From 27455c3f326b0b045d51cfc2ab640c9a55d29d1c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:29:53 +0800 Subject: [PATCH 065/171] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8D=A2=E9=85=8D=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index d5d889c..039e5f1 100644 --- a/config/vimrc +++ b/config/vimrc @@ -198,10 +198,16 @@ set background=dark endfunction "设置终端真彩色 "set termguicolors -"旧cmd兼容性待定 -let g:solarized_use16 = 1 -"colorscheme solarized8 -colorscheme apprentice +"let g:solarized_use16 = 1 +if has('gui_running') + colorscheme solarized8 +else + if has('win32') || has('win64') + colorscheme apprentice + else + colorscheme solarized8 + endif +endif "high low normal "let g:solarized_visibility='high' "high low normal bold From 2f0590ea0c0c99b9a0688f7c05519aa6b9da98a0 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:37:39 +0800 Subject: [PATCH 066/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=89=A7=E8=A1=8C=E7=9A=84=E7=AA=97=E5=8F=A3=E8=A1=A8?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 039e5f1..bcd0ff7 100644 --- a/config/vimrc +++ b/config/vimrc @@ -150,7 +150,10 @@ Plug 'terryma/vim-expand-region' "Plug 'liuchengxu/space-vim-dark' "终于见到支持cmd的英豪了,也就能用的地步,丑,需要进一步根据环境判断切换 Plug 'basilgood/Apprentice/' +"异步执行命令 Plug 'skywind3000/asyncrun.vim' +"编译任务插件 +Plug 'skywind3000/vimmake' call plug#end() @@ -362,11 +365,18 @@ nmap "map $ "map d$ " git Command git使用 +" gca 开启提交 :wq保存提交 +" gp 推送 nnoremap gca :Gcommit -a -v "nnoremap gp :Gpush "git push 这步阻塞太痛苦了,改成异步的 nnoremap gp :AsyncRun git push origin master - +"当有消息时自动弹出消息窗 +augroup vimrc + autocmd QuickFixCmdPost * botright copen 8 +augroup END +"F4 操控quickfixc窗口 +noremap :call asyncrun#quickfix_toggle(8) "ctrl+s为保存 map :w inoremap :w From ead2449f17088a99cc62db083fbdb50c10f23dc4 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 09:47:38 +0800 Subject: [PATCH 067/171] =?UTF-8?q?=E4=BF=AE=E4=BA=86=E4=B8=8Bwindows?= =?UTF-8?q?=E4=B8=8B=E5=85=B6=E4=BB=96=E5=91=BD=E4=BB=A4=E8=A1=8C=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=9A=84=E5=88=A4=E5=AE=9A=EF=BC=8C=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E5=AE=9A=E6=9C=89=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index bcd0ff7..81e1883 100644 --- a/config/vimrc +++ b/config/vimrc @@ -206,7 +206,11 @@ if has('gui_running') colorscheme solarized8 else if has('win32') || has('win64') - colorscheme apprentice + if $COLORTERM == 'truecolor' + colorscheme solarized8 + else + colorscheme apprentice + endif else colorscheme solarized8 endif From 631eee8b4d4c88e3d84b3ba9742ca1474a7694d8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 10:56:55 +0800 Subject: [PATCH 068/171] =?UTF-8?q?=E4=BF=AE=E5=A5=BD=E4=BA=86xshell?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E8=89=B2=EF=BC=8C=E6=84=9F=E8=A7=89solarized?= =?UTF-8?q?8=E7=9A=84=E9=85=8D=E8=89=B2=E5=88=87=E6=8D=A2=E4=B9=9F?= =?UTF-8?q?=E4=B8=8D=E7=81=B5=EF=BC=8C=E4=B8=8D=E7=9F=A5=E9=81=93=E6=98=AF?= =?UTF-8?q?=E6=88=91=E8=87=AA=E5=B7=B1=E4=B8=8D=E4=BC=9A=E7=94=A8=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E7=9C=9F=E7=9A=84=E5=A6=82=E6=AD=A4=EF=BC=8C=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E6=98=AF=E6=89=8B=E5=8A=A8=E5=88=87=E6=8D=A2=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 81e1883..724981a 100644 --- a/config/vimrc +++ b/config/vimrc @@ -182,7 +182,6 @@ let g:tagbar_width=20 "颜色主题设置 -"set t_Co=256 "let g:solarized_termcolors=16 "两种流行风格的主题 @@ -199,8 +198,6 @@ set background=dark set background=dark endif endfunction -"设置终端真彩色 -"set termguicolors "let g:solarized_use16 = 1 if has('gui_running') colorscheme solarized8 @@ -211,7 +208,15 @@ else else colorscheme apprentice endif - else + else + "是否支持真彩色 + if $COLORTERM == 'truecolor' + "设置终端真彩色 + set termguicolors + else + "设置256色 + set t_Co=256 + endif colorscheme solarized8 endif endif From 35ff325f680c8bd0f8caed50bfc69fb5069c2ef8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 8 Mar 2018 18:22:25 +0800 Subject: [PATCH 069/171] =?UTF-8?q?termux=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy.sh b/proxy.sh index 6959e0e..03dbb75 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#删掉bash指定,因为termux是prefix格式的 +#/bin/bash echo 开始安装依赖 export http_proxy=http://127.0.0.1:8087/ export https_proxy=http://127.0.0.1:8087/ @@ -19,4 +20,4 @@ go get -u github.com/jstemmer/gotags go get -u golang.org/x/tools/cmd/guru go get -u github.com/josharian/impl go get -u github.com/dominikh/go-tools/cmd/keyify -go get -u github.com/fatih/motion \ No newline at end of file +go get -u github.com/fatih/motion From ceee11d352e77ec7c352cfa64145be759baf01ca Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 9 Mar 2018 00:11:54 +0800 Subject: [PATCH 070/171] =?UTF-8?q?=E5=B0=86=E7=AA=97=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E5=91=BC=E5=94=A4=E5=85=A8=E9=83=A8=E7=94=A8leader=E9=94=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=EF=BC=8C=E6=AF=94=E5=A6=82leader+3=20?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=96=87=E4=BB=B6=E6=A0=8F=20Leader+4?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=91=BD=E4=BB=A4=E6=B6=88=E6=81=AF=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 724981a..70907a5 100644 --- a/config/vimrc +++ b/config/vimrc @@ -228,7 +228,7 @@ endif "let g:solarized_old_cursor_style=1 map cbg :call ToggleBG() "colorscheme space-vim-dark - +inoremap jk "emmet 设置 let g:user_emmet_expandabbr_key = '' @@ -286,9 +286,9 @@ map! :! ctags -R "快捷键设置 -map :NERDTreeToggle +map 3 :NERDTreeToggle -map! :NERDTreeToggle +map! 3 :NERDTreeToggle map :TagbarToggle @@ -385,7 +385,7 @@ augroup vimrc autocmd QuickFixCmdPost * botright copen 8 augroup END "F4 操控quickfixc窗口 -noremap :call asyncrun#quickfix_toggle(8) +noremap 4 :call asyncrun#quickfix_toggle(8) "ctrl+s为保存 map :w inoremap :w From d5a660a7bb448a244cb3f8b782fc428ff4bb322d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 9 Mar 2018 13:47:52 +0800 Subject: [PATCH 071/171] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E4=B8=BA=E4=BB=80=E4=B9=88=E4=BB=A5=E5=89=8D=E5=88=A0=E6=8E=89?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E6=AE=B5=E5=A4=87=E4=BB=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 996854b..3cea917 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,8 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` -#for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +#原有配置还是要删除或者备份的不然会影响到后续的安装 for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.npmrc $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done From 823db662b362a8e74f03b3ff58d7e002a0a1fb97 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:27:20 +0800 Subject: [PATCH 072/171] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=85=BC=E5=AE=B9neo?= =?UTF-8?q?vim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 4 ++++ install.sh | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/install.bat b/install.bat index 5dbdf1e..db0318f 100644 --- a/install.bat +++ b/install.bat @@ -21,14 +21,18 @@ IF NOT EXIST "%APP_PATH%" ( ) call rm "%HOME%\.vimrc" call rm "%HOME%\_vimrc" +call rm "%HOME%\AppData\Local\nvim\init.vim" call rm "%HOME%\.eslintrc.json" call rm "%HOME%\.eslintrc.js" call rm "%HOME%\.npmrc" call rm "%HOME%\.tern-config" +call rmdir "%HOME%\AppData\Local\nvim" call rmdir "%HOME%\.vim" call mklink "%HOME%\.vimrc" "%APP_PATH%\config\vimrc" call mklink "%HOME%\_vimrc" "%APP_PATH%\config\vimrc" +call mklink /J "%HOME%\AppData\Local\nvim" "%APP_PATH%\" +call mklink "%HOME%\AppData\Local\nvim\init.vim" "%APP_PATH%\config\vimrc" call mklink "%HOME%\.eslintrc.json" "%APP_PATH%\config\eslintrc.json" call mklink "%HOME%\.tern-config" "%APP_PATH%\config\tern-config" ::不再覆盖npmrc call mklink "%HOME%\.npmrc" "%APP_PATH%\config\npmrc" diff --git a/install.sh b/install.sh index 3cea917..c1ca932 100755 --- a/install.sh +++ b/install.sh @@ -13,13 +13,15 @@ lnif() { echo "Step1: backing up current vim config" today=`date +%Y%m%d` -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles $HOME/.config/nvim/init.vim $HOME/.config/nvim; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done #原有配置还是要删除或者备份的不然会影响到后续的安装 -for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.npmrc $HOME/.tern-config $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i ; done +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.npmrc $HOME/.tern-config $HOME/.vimrc.bundles $HOME/.config/nvim/init.vim $HOME/.config/nvim; do [ -L $i ] && unlink $i ; done echo "Step2: setting up symlinks" lnif $CURRENT_DIR/config/vimrc $HOME/.vimrc +lnif "$CURRENT_DIR/" "$HOME/.config/nvim" +lnif $CURRENT_DIR/cinfig/vimrc $HOME/.config/nvim/init.vim lnif "$CURRENT_DIR/" "$HOME/.vim" #lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js From 2867658ac2379ab5b7183e96f9c90021c3770404 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:31:30 +0800 Subject: [PATCH 073/171] fix config --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c1ca932..3cca078 100755 --- a/install.sh +++ b/install.sh @@ -21,7 +21,7 @@ for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/ echo "Step2: setting up symlinks" lnif $CURRENT_DIR/config/vimrc $HOME/.vimrc lnif "$CURRENT_DIR/" "$HOME/.config/nvim" -lnif $CURRENT_DIR/cinfig/vimrc $HOME/.config/nvim/init.vim +lnif $CURRENT_DIR/config/vimrc $HOME/.config/nvim/init.vim lnif "$CURRENT_DIR/" "$HOME/.vim" #lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js From 0ea3a62eb3dcaa4b7cb16ed41b973ea773253f46 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:34:20 +0800 Subject: [PATCH 074/171] ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2229bf3..9e0e4ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ plugged/ node_modules/ -*.swp \ No newline at end of file +*.swp +init.vim From f4c046de9e14a9960abe47112fc904cfce6eca88 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:36:24 +0800 Subject: [PATCH 075/171] suit for nvim --- config/vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 70907a5..61d0f2f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -470,7 +470,10 @@ set expandtab "加快速度 "set synmaxcol=200 set ttyfast " u got a fast terminal -set ttyscroll=3 +if has('nvim') +else + set ttyscroll=3 +endif set lazyredraw " to avoid scrolling problems "删除键 set backspace=eol,start,indent From 4270e66e9a9275f2a5dfad62e62cae503b65d624 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:43:38 +0800 Subject: [PATCH 076/171] =?UTF-8?q?=E4=B8=BB=E9=A2=98=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E4=B8=BA=E5=BD=A9?= =?UTF-8?q?=E8=89=B2=EF=BC=9F=E5=8F=AF=E8=83=BD=E5=BF=98=E8=AE=B0=E5=85=BC?= =?UTF-8?q?=E9=A1=BE=E7=BB=88=E7=AB=AF=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index 61d0f2f..7aa94ea 100644 --- a/config/vimrc +++ b/config/vimrc @@ -471,6 +471,8 @@ set expandtab "set synmaxcol=200 set ttyfast " u got a fast terminal if has('nvim') + set termguicolors + colorscheme solarized8 else set ttyscroll=3 endif From 76d734b4a70206db4b58ff061de41c3aee1d403e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 03:52:54 +0800 Subject: [PATCH 077/171] =?UTF-8?q?=E5=AF=B9linux=E5=92=8Cwindows=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E8=A1=8C=E4=B8=8Bnvim=E7=9A=84=E8=A1=A8=E7=8E=B0?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E9=87=8D=E6=96=B0=E5=8C=B9=E9=85=8D=EF=BC=8C?= =?UTF-8?q?=E5=8D=95=E8=AF=B4=E7=BB=88=E7=AB=AF=E6=95=88=E6=9E=9C=EF=BC=8C?= =?UTF-8?q?nvim=E6=AF=94vim=E5=9C=A8win=E4=B8=8B=E5=A5=BD=E5=BE=97?= =?UTF-8?q?=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 7aa94ea..1598ee9 100644 --- a/config/vimrc +++ b/config/vimrc @@ -471,7 +471,11 @@ set expandtab "set synmaxcol=200 set ttyfast " u got a fast terminal if has('nvim') - set termguicolors + if has('win32') || has('win64') + "windows命令行时候必须有termguicolor色彩,但同时在xshellssh中开启这个色彩就不对了 + set termguicolors + else + endif colorscheme solarized8 else set ttyscroll=3 From 7ca98d02dbc53eaf98b792e69412118c591d70c8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 04:01:11 +0800 Subject: [PATCH 078/171] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=A2=9C=E8=89=B2=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=92=8C=E6=98=AF=E5=90=A6windows=E5=AE=89=E8=A3=85linux?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E6=9C=89=E5=85=B3=EF=BC=8C=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=90=8E=E8=89=B2=E5=85=A8=E4=BA=86=EF=BC=8C=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=89=8D=E4=BC=BC=E4=B9=8E=E4=B8=8D=E5=85=A8=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=B2=A1=E6=9C=89=E5=AF=B9=E6=AF=94=E8=BF=87=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=89=8D=E6=98=AF=E5=90=A6=E8=83=BD=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E5=8C=BA=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index 1598ee9..11e9473 100644 --- a/config/vimrc +++ b/config/vimrc @@ -206,6 +206,7 @@ else if $COLORTERM == 'truecolor' colorscheme solarized8 else + "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 colorscheme apprentice endif else @@ -215,6 +216,7 @@ else set termguicolors else "设置256色 + "似乎windows不安装ubuntu前是色不全,安装后色全了 set t_Co=256 endif colorscheme solarized8 From 15e6888da8872dafb64da7889ebc40eb5feb7295 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 04:09:09 +0800 Subject: [PATCH 079/171] =?UTF-8?q?=E5=A4=A7=E4=BF=AE=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=E6=9D=A5=E5=AF=B9windows=E4=B8=8B=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E7=9A=84=E7=90=86=E8=A7=A3=E6=9C=89=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E9=99=8D=E7=BA=A7=E9=85=8D=E8=89=B2=E7=8E=B0=E5=9C=A8=E7=9C=8B?= =?UTF-8?q?=E6=9D=A5=E9=99=A4=E9=9D=9E=E6=98=AFxp=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=98=AF=E7=99=BD=E6=89=BE=E4=BA=86=EF=BC=8C=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E7=BB=8F=E8=BF=87=E5=AF=B9=E6=AF=94=EF=BC=8Ccmd=E4=B8=8Bvim?= =?UTF-8?q?=E4=BC=9A=E5=AF=B9bat=E9=AB=98=E4=BA=AE=EF=BC=8Cnvim=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/config/vimrc b/config/vimrc index 11e9473..733cafe 100644 --- a/config/vimrc +++ b/config/vimrc @@ -202,25 +202,28 @@ set background=dark if has('gui_running') colorscheme solarized8 else - if has('win32') || has('win64') - if $COLORTERM == 'truecolor' - colorscheme solarized8 - else + "if has('win32') || has('win64') + "if $COLORTERM == 'truecolor' + " colorscheme solarized8 + "else "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 - colorscheme apprentice - endif - else + "发现都不是,只要设置win下都真彩色就行,不用丑的次级配色了,可能支持更早的系统 + " colorscheme apprentice + "endif + "else "是否支持真彩色 if $COLORTERM == 'truecolor' "设置终端真彩色 set termguicolors - else + elseif has('win32') || has('win64') + set termguicolors "设置256色 "似乎windows不安装ubuntu前是色不全,安装后色全了 + else set t_Co=256 endif colorscheme solarized8 - endif + "endif endif "high low normal "let g:solarized_visibility='high' From 858f3d9f5c3a3b652727242762aaaf01a0b2705b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 15:14:22 +0800 Subject: [PATCH 080/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/proxy.sh b/proxy.sh index 03dbb75..4346c59 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,9 +1,21 @@ #删掉bash指定,因为termux是prefix格式的 -#/bin/bash +#!/bin/bash +PORT=8087 +while getopts 'p:c' OPT; do + case $OPT in + p) + PORT="$OPTARG";; + c) + Client="y";; + ?) + echo "Usage: `basename $0` [options] filename" + esac +done +shift $(($OPTIND - 1)) echo 开始安装依赖 -export http_proxy=http://127.0.0.1:8087/ -export https_proxy=http://127.0.0.1:8087/ -git config http.proxy http://127.0.0.1:8087 +export http_proxy=http://127.0.0.1:${PORT} +export https_proxy=http://127.0.0.1:/${PORT} +git config http.proxy http://127.0.0.1:${PORT} go get -u github.com/klauspost/asmfmt/cmd/asmfmt go get -u github.com/derekparker/delve/cmd/dlv go get -u github.com/kisielk/errcheck From a09107f9360540662cc3f72287c9c21941de45f2 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 15:22:56 +0800 Subject: [PATCH 081/171] echo port --- proxy.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxy.sh b/proxy.sh index 4346c59..d0468d1 100755 --- a/proxy.sh +++ b/proxy.sh @@ -13,9 +13,10 @@ while getopts 'p:c' OPT; do done shift $(($OPTIND - 1)) echo 开始安装依赖 -export http_proxy=http://127.0.0.1:${PORT} -export https_proxy=http://127.0.0.1:/${PORT} -git config http.proxy http://127.0.0.1:${PORT} +echo ${PORT} +export http_proxy=http://127.0.0.1:${PORT}/ +export https_proxy=http://127.0.0.1:${PORT}/ +git config http.proxy http://127.0.0.1:${PORT}/ go get -u github.com/klauspost/asmfmt/cmd/asmfmt go get -u github.com/derekparker/delve/cmd/dlv go get -u github.com/kisielk/errcheck From 03d2886c66fe201009916cdefbb7c233a1ef1603 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 15:47:23 +0800 Subject: [PATCH 082/171] show host --- proxy.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/proxy.sh b/proxy.sh index d0468d1..b1a3155 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,10 +1,13 @@ #删掉bash指定,因为termux是prefix格式的 #!/bin/bash PORT=8087 -while getopts 'p:c' OPT; do +HOST=127.0.0.1 +while getopts 'p:h:c' OPT; do case $OPT in p) PORT="$OPTARG";; + h) + HOST="$OPTARG";; c) Client="y";; ?) @@ -13,10 +16,11 @@ while getopts 'p:c' OPT; do done shift $(($OPTIND - 1)) echo 开始安装依赖 +echo ${HOST} echo ${PORT} -export http_proxy=http://127.0.0.1:${PORT}/ -export https_proxy=http://127.0.0.1:${PORT}/ -git config http.proxy http://127.0.0.1:${PORT}/ +export http_proxy=http://${HOST}:${PORT}/ +export https_proxy=http://${HOST}:${PORT}/ +git config http.proxy http://${HOST}:${PORT}/ go get -u github.com/klauspost/asmfmt/cmd/asmfmt go get -u github.com/derekparker/delve/cmd/dlv go get -u github.com/kisielk/errcheck From 34e761bd39b7f34b58212eb791ff626217e37056 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 17:24:59 +0800 Subject: [PATCH 083/171] fix port 10808 & sh for termux --- install.sh | 1 - proxy.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 3cca078..dee2ec3 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,3 @@ -#!/bin/bash BASEDIR=$(dirname $0) cd $BASEDIR CURRENT_DIR=`pwd` diff --git a/proxy.sh b/proxy.sh index b1a3155..2d91a7c 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,6 +1,6 @@ #删掉bash指定,因为termux是prefix格式的 #!/bin/bash -PORT=8087 +PORT=10808 HOST=127.0.0.1 while getopts 'p:h:c' OPT; do case $OPT in From 45b5171657ef9b9df64701f0e9a264accc0a65ef Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 11 Mar 2018 23:41:38 +0800 Subject: [PATCH 084/171] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8B=89=E5=8F=96=E7=9A=84=E4=BA=8B=E4=BB=B6,?= =?UTF-8?q?=E8=80=83=E8=99=91=E4=B8=8B=E6=AC=A1=E5=A6=82=E4=BD=95=E5=81=9A?= =?UTF-8?q?=E6=88=90autocmd=EF=BC=8C=E5=9C=A8=E9=9D=9Egit=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=A6=82=E4=BD=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 733cafe..d4198cc 100644 --- a/config/vimrc +++ b/config/vimrc @@ -379,12 +379,13 @@ nmap "map $ "map d$ " git Command git使用 -" gca 开启提交 :wq保存提交 +" gca 开启提交 cc进入commit :wq保存提交 " gp 推送 nnoremap gca :Gcommit -a -v "nnoremap gp :Gpush "git push 这步阻塞太痛苦了,改成异步的 -nnoremap gp :AsyncRun git push origin master +nnoremap gpl :AsyncRun git pull +nnoremap gp :AsyncRun git push "当有消息时自动弹出消息窗 augroup vimrc autocmd QuickFixCmdPost * botright copen 8 From 65b92989a4561a2da9fb079a73847c52e9497397 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 12 Mar 2018 23:18:29 +0800 Subject: [PATCH 085/171] change leader to space --- config/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index d4198cc..161ccf4 100644 --- a/config/vimrc +++ b/config/vimrc @@ -33,8 +33,8 @@ endif " } call plug#begin('$HOME/.vim/plugged') -let mapleader = ',' -let g:mapleader = ',' +let mapleader = ' ' +let g:mapleader = ' ' " Make sure you use single quotes Plug 'junegunn/vim-easy-align' " Plugin options From c0fe9cb0c22d83c825b3c93d00a0e15b9171be16 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 12 Mar 2018 23:46:04 +0800 Subject: [PATCH 086/171] =?UTF-8?q?=E6=8A=8A=E7=AA=97=E5=8F=A3=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B9=9F=E6=8D=A2=E6=88=90=E4=BA=86leader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 161ccf4..93e5c08 100644 --- a/config/vimrc +++ b/config/vimrc @@ -361,10 +361,10 @@ let g:multi_cursor_quit_key='' "map ggVG "map! ggVG "多窗口切换 -map -map -map -map +map h +map j +map k +map l " import emacs map imap imap From 32959cb8be7a72b96379cef45db9d6757a760e59 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 00:57:02 +0800 Subject: [PATCH 087/171] =?UTF-8?q?=E6=80=9D=E8=80=83=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E9=94=AE=E5=92=8C=E4=BF=AE=E9=A5=B0=E9=94=AE=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=AE=E5=88=AB=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=98=AF?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8C=89=E4=B8=8B=E7=9A=84=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E9=A5=B0=E9=94=AE=E6=9B=B4=E5=90=88=E9=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/vimrc b/config/vimrc index 93e5c08..1b5df2b 100644 --- a/config/vimrc +++ b/config/vimrc @@ -154,6 +154,7 @@ Plug 'basilgood/Apprentice/' Plug 'skywind3000/asyncrun.vim' "编译任务插件 Plug 'skywind3000/vimmake' +Plug 'hsanson/vim-android' call plug#end() @@ -361,6 +362,8 @@ let g:multi_cursor_quit_key='' "map ggVG "map! ggVG "多窗口切换 +"ctrl是修饰键可以按住不动的使用 +"leader只生效一次,需要不断重新敲击 map h map j map k From d093864eeafbfd9c11d8cad72be9b544a6af0002 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 16:23:37 +0800 Subject: [PATCH 088/171] =?UTF-8?q?=E5=B0=86autocmd=E5=8C=85=E8=A3=B9?= =?UTF-8?q?=E4=BA=86=E8=B5=B7=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/config/vimrc b/config/vimrc index 1b5df2b..c949d08 100644 --- a/config/vimrc +++ b/config/vimrc @@ -259,12 +259,11 @@ autocmd FileType javascript set dictionary=$HOME/.vim/extend/javascript.dict autocmd FileType html set dictionary=$HOME/.vim/extend/html.dict "查找手册 - -autocmd FileType php set keywordprg=$HOME/.vim/extend/phpman - -autocmd FileType javascript,html set keywordprg=$HOME/.vim/extend/man - -autocmd FileType css set keywordprg=$HOME/.vim/extend/cssman +augroup man + autocmd FileType php set keywordprg=$HOME/.vim/extend/phpman + autocmd FileType javascript,html set keywordprg=$HOME/.vim/extend/man + autocmd FileType css set keywordprg=$HOME/.vim/extend/cssman +augroup END "php的注释,没什么用还占了我的c-d "inoremap :call PhpDocSingle()i @@ -547,9 +546,11 @@ nmap p (Gpush) "F5 刷新编辑器 nmap :source% -autocmd FileType go nmap t (go-test) -autocmd FileType go nmap b (go-build) -autocmd FileType go nmap r (go-run) +augroup gocmd + autocmd FileType go nmap t (go-test) + autocmd FileType go nmap b (go-build) + autocmd FileType go nmap r (go-run) +augroup END "状态栏改变 "set statusline+=%#warningmsg# From 99cc93e30f10023e8ff6a2aaaf8ad6b0d787d351 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 16:50:37 +0800 Subject: [PATCH 089/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uninstall.bat | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 uninstall.bat diff --git a/uninstall.bat b/uninstall.bat new file mode 100644 index 0000000..46461be --- /dev/null +++ b/uninstall.bat @@ -0,0 +1,22 @@ +@echo off +%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit +cd /d "%~dp0" +@echo off +cls +setlocal EnableDelayedExpansion + +@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% +@if not exist "%HOME%" @set HOME=%USERPROFILE% + +@set APP_PATH=%HOME%\vim-plug + +call rm "%HOME%\.vimrc" +call rm "%HOME%\_vimrc" +call rm "%HOME%\AppData\Local\nvim\init.vim" +call rm "%HOME%\.eslintrc.json" +call rm "%HOME%\.eslintrc.js" +call rm "%HOME%\.npmrc" +call rm "%HOME%\.tern-config" +call rmdir "%HOME%\AppData\Local\nvim" +call rmdir "%HOME%\.vim" +call rmdir "%APP_PATH%"" \ No newline at end of file From 49d0b4724ec854043184232dd18298410f9c56a3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 17:27:45 +0800 Subject: [PATCH 090/171] =?UTF-8?q?=E5=88=A0=E6=8E=89=E4=BA=86=E4=BA=9B?= =?UTF-8?q?=E8=8E=AB=E5=90=8D=E5=85=B6=E5=A6=99=E7=9A=84=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/config/vimrc b/config/vimrc index c949d08..90fb26d 100644 --- a/config/vimrc +++ b/config/vimrc @@ -51,16 +51,6 @@ Plug 'Tagbar' "zencoding 改名为了 Emmet Plug 'https://github.com/luofei614/Emmet.vim' -Plug 'L9' - -Plug 'FuzzyFinder' -"快速浏览文件,FuzzyFinder 也能快速浏览文件, 但是如果项目文件多会很慢 -"如果系统升级可以需要运行 gem update --system, do中的命令可能需要手动运行 -"Plug 'Command-T',{'do': 'cd ./ruby/command-t/; ruby extconf.rb ; make','on':'CommandT'} - - -" Plugin outside ~/.vim/plugged with post-update hook -" 下面这个插件可取代Command-T 但是现在暂时不支持目录忽略,所以先暂时不用 "Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } Plug 'WebAPI.vim' @@ -74,7 +64,7 @@ Plug 'tomasr/molokai' "找来个支持truecolor的 Plug 'lifepillar/vim-solarized8' -Plug 'PDV--phpDocumentor-for-Vim' +"Plug 'PDV--phpDocumentor-for-Vim' Plug 'https://github.com/luofei614/html5css3.git' @@ -105,10 +95,7 @@ Plug 'tomtom/tlib_vim' Plug 'garbas/vim-snipmate' Plug 'https://github.com/bonsaiben/bootstrap-snippets.git' -Plug 'phpunit' - -"快速跳转到字符 -Plug 'EasyMotion' +"Plug 'phpunit' Plug 'https://github.com/bling/vim-airline.git' @@ -149,7 +136,7 @@ Plug 'terryma/vim-expand-region' "多个配色多条路,不过在cmd下都不行 "Plug 'liuchengxu/space-vim-dark' "终于见到支持cmd的英豪了,也就能用的地步,丑,需要进一步根据环境判断切换 -Plug 'basilgood/Apprentice/' +"Plug 'basilgood/Apprentice/' "异步执行命令 Plug 'skywind3000/asyncrun.vim' "编译任务插件 @@ -235,6 +222,8 @@ endif map cbg :call ToggleBG() "colorscheme space-vim-dark inoremap jk +map jk +cmap jk "emmet 设置 let g:user_emmet_expandabbr_key = '' From dcf09699051513fc4b008562012b34d250baf412 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 17:48:14 +0800 Subject: [PATCH 091/171] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uninstall.bat => remove.bat | 0 remove.sh | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) rename uninstall.bat => remove.bat (100%) create mode 100644 remove.sh diff --git a/uninstall.bat b/remove.bat similarity index 100% rename from uninstall.bat rename to remove.bat diff --git a/remove.sh b/remove.sh new file mode 100644 index 0000000..14eeff2 --- /dev/null +++ b/remove.sh @@ -0,0 +1,18 @@ +BASEDIR=$(dirname $0) +cd $BASEDIR +CURRENT_DIR=`pwd` + +echo "Step1: backing up current vim config" +today=`date +%Y%m%d` +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.vimrc.bundles $HOME/.config/nvim/init.vim $HOME/.config/nvim; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done +#原有配置还是要删除或者备份的不然会影响到后续的安装 +for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc $HOME/.eslintrc.json /Users/lynn/.eslintrc.js $HOME/.npmrc $HOME/.tern-config $HOME/.vimrc.bundles $HOME/.config/nvim/init.vim $HOME/.config/nvim; do [ -L $i ] && unlink $i ; done + + +echo "Step2: setting up symlinks" +unlink $HOME/.vimrc +unlink "$HOME/.config/nvim" +unlink $HOME/.config/nvim/init.vim +unlink "$HOME/.vim" +unlink $HOME/.eslintrc.js +unlink $HOME/.tern-config From 0b06f1553fc981c65e751a81b4e9906739756b88 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 18:52:47 +0800 Subject: [PATCH 092/171] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=B8=8D=E5=A4=9F?= =?UTF-8?q?=E6=88=90=E7=86=9F=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 7 +++++++ remove.sh | 0 2 files changed, 7 insertions(+) mode change 100644 => 100755 remove.sh diff --git a/config/vimrc b/config/vimrc index 90fb26d..643a629 100644 --- a/config/vimrc +++ b/config/vimrc @@ -535,6 +535,13 @@ nmap p (Gpush) "F5 刷新编辑器 nmap :source% +augroup autoupdate + autocmd VimEnter * :AsyncRun -post=source\ $HOME/.vimrc cd $HOME/vim-plug && git pull + "没法在async中用vim自己的source + "没法autocmd响应事件 + autocmd User AsyncRunStop *:source $HOME/.vimrc +augroup END + augroup gocmd autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) diff --git a/remove.sh b/remove.sh old mode 100644 new mode 100755 From 4405d27b126548f0822641eb1f695c17862c2970 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 21:00:12 +0800 Subject: [PATCH 093/171] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E4=BA=86=E6=89=80?= =?UTF-8?q?=E8=B0=93=E5=8D=A1=E9=A1=BF=E7=9A=84=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 643a629..3c35e48 100644 --- a/config/vimrc +++ b/config/vimrc @@ -222,7 +222,10 @@ endif map cbg :call ToggleBG() "colorscheme space-vim-dark inoremap jk -map jk +"删除了半天的插件后得出的结论 +"普通模式会对j进行一个判断,判断后面没跟k才会输出j,结果就造成了看上去往下走的时候最后一个键卡顿的效果 +"map jk +"命令模式还是可以用 cmap jk "emmet 设置 From c83d4f7ce34807fcbb3d96e68b85c0f86671baca Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 13 Mar 2018 22:05:59 +0800 Subject: [PATCH 094/171] still need to write by self --- config/vimrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 3c35e48..0a828a3 100644 --- a/config/vimrc +++ b/config/vimrc @@ -539,10 +539,13 @@ nmap p (Gpush) nmap :source% augroup autoupdate - autocmd VimEnter * :AsyncRun -post=source\ $HOME/.vimrc cd $HOME/vim-plug && git pull +"-post still can't run source +" autocmd VimEnter * :AsyncRun -post=source\ ~/.vimrc cd $HOME/vim-plug && git pull + autocmd VimEnter * :AsyncRun -post=echom\ 'ok' cd $HOME/vim-plug && git pull + "没法在async中用vim自己的source "没法autocmd响应事件 - autocmd User AsyncRunStop *:source $HOME/.vimrc + "autocmd User AsyncRunStop *:source $HOME/.vimrc augroup END augroup gocmd From 2ad0feb04d3f2684387ab3717294880d88f38d83 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 01:21:30 +0800 Subject: [PATCH 095/171] =?UTF-8?q?=E5=A4=AA=E5=A4=9A=E9=94=99=E4=B9=B1?= =?UTF-8?q?=E7=9A=84=E5=9C=B0=E6=96=B9=E4=BA=86=EF=BC=8C=E6=94=BE=E5=9C=A8?= =?UTF-8?q?async=E9=87=8C=E5=8C=85=E5=90=AB=E4=BA=86source=E5=B0=B1?= =?UTF-8?q?=E4=BC=9A=E9=81=87=E5=88=B0=E9=87=8D=E5=AE=9A=E4=B9=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=8F=AA=E6=9C=89=E8=87=AA=E5=B7=B1=E8=BF=99?= =?UTF-8?q?=E6=A0=B7=E6=89=8D=E4=B8=8D=E4=BC=9A=E9=81=87=E4=B8=8A=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E8=BF=98=E6=98=AF=E6=98=AF=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E7=9A=84=EF=BC=8C=E4=B8=8B=E4=B8=80=E6=AD=A5=E6=94=B9=E6=88=90?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 0a828a3..bd4631d 100644 --- a/config/vimrc +++ b/config/vimrc @@ -537,15 +537,26 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k nmap p (Gpush) "F5 刷新编辑器 nmap :source% - +"source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 +if !exists("*Fuck") +function! Fuck() + :cd $HOME/vim-plug + :!git pull + source $MYVIMRC +endfunction +endif augroup autoupdate "-post still can't run source " autocmd VimEnter * :AsyncRun -post=source\ ~/.vimrc cd $HOME/vim-plug && git pull - autocmd VimEnter * :AsyncRun -post=echom\ 'ok' cd $HOME/vim-plug && git pull + "autocmd VimEnter * :AsyncRun -post=echom\ 'ok' cd $HOME/vim-plug && git pull + "nested 代表嵌套后面的命令 + "autocmd VimEnter * :AsyncRun -post=call\ Fuck() cd $HOME/vim-plug && git pull + autocmd VimEnter * nested call Fuck() "没法在async中用vim自己的source "没法autocmd响应事件 "autocmd User AsyncRunStop *:source $HOME/.vimrc + "autocmd User AsyncRunStop call s:fuck() augroup END augroup gocmd From fb46a983d29746ad6bbe33823265e2d9f81dd7f3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 01:29:30 +0800 Subject: [PATCH 096/171] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=9A=E5=9C=A8cd=20vim-plug=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2=E4=BA=86=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=EF=BC=8C=E5=8F=98=E5=BE=97=E4=B8=8D=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E6=96=87=E4=BB=B6=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/config/vimrc b/config/vimrc index bd4631d..d43ebb8 100644 --- a/config/vimrc +++ b/config/vimrc @@ -543,6 +543,7 @@ function! Fuck() :cd $HOME/vim-plug :!git pull source $MYVIMRC + echom "已更新" endfunction endif augroup autoupdate From 1579f4e372b50fa84559e5cf9398242d28961e6e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 01:37:42 +0800 Subject: [PATCH 097/171] =?UTF-8?q?=E4=B8=8D=E7=9F=A5=E9=81=93=E5=88=B0?= =?UTF-8?q?=E5=BA=95=E5=85=B6=E4=BB=96=E5=B9=B3=E5=8F=B0=E4=BC=9A=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E6=8F=90=E7=A4=BA=E5=B7=B2=E7=BB=8F=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E5=8F=A6=E5=A4=96=E5=90=8C=E6=AD=A5=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=BE=97=E6=8C=89=E5=87=A0=E6=AC=A1=E5=9B=9E=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index d43ebb8..7242d4c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -541,10 +541,13 @@ nmap :source% if !exists("*Fuck") function! Fuck() :cd $HOME/vim-plug - :!git pull + :!git pull + "上面的回车是没用的,还是得进回车 source $MYVIMRC echom "已更新" endfunction +else + echom "updated" endif augroup autoupdate "-post still can't run source From 6892a9d3b7840da6a158bd7033e001b9b4a7da7a Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 01:51:29 +0800 Subject: [PATCH 098/171] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/config/vimrc b/config/vimrc index 7242d4c..5fb2d88 100644 --- a/config/vimrc +++ b/config/vimrc @@ -541,6 +541,7 @@ nmap :source% if !exists("*Fuck") function! Fuck() :cd $HOME/vim-plug + "想尝试通过--git-dir 或者 -C的方式直接pull,似乎不行 :!git pull "上面的回车是没用的,还是得进回车 source $MYVIMRC From 7faa4c10cae71591be1fafcce8d77da8e32b41d0 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 01:54:09 +0800 Subject: [PATCH 099/171] test --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 5fb2d88..62dc8c8 100644 --- a/config/vimrc +++ b/config/vimrc @@ -542,7 +542,7 @@ if !exists("*Fuck") function! Fuck() :cd $HOME/vim-plug "想尝试通过--git-dir 或者 -C的方式直接pull,似乎不行 - :!git pull + :!git pull "上面的回车是没用的,还是得进回车 source $MYVIMRC echom "已更新" From fa8a76d30c454fa422f5ee805f58e21b97010079 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 02:04:30 +0800 Subject: [PATCH 100/171] test --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 62dc8c8..67d8bde 100644 --- a/config/vimrc +++ b/config/vimrc @@ -532,7 +532,7 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "npm i -g eslint eslint-config-airbnb babel-eslint eslint-plugin-react "eslint-plugin-react-native -" +"test "快捷提交 nmap p (Gpush) "F5 刷新编辑器 From 7252af7d71012081de2a72bbb1f3697414b757ca Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 02:06:55 +0800 Subject: [PATCH 101/171] test2 --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 67d8bde..d1e6660 100644 --- a/config/vimrc +++ b/config/vimrc @@ -532,7 +532,7 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "npm i -g eslint eslint-config-airbnb babel-eslint eslint-plugin-react "eslint-plugin-react-native -"test +"test2 "快捷提交 nmap p (Gpush) "F5 刷新编辑器 From 78eaed0042fe31ee807bb0bea3beebc2284acce9 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 02:22:15 +0800 Subject: [PATCH 102/171] set back to before dir --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index d1e6660..2b202ce 100644 --- a/config/vimrc +++ b/config/vimrc @@ -541,6 +541,8 @@ nmap :source% if !exists("*Fuck") function! Fuck() :cd $HOME/vim-plug + "back to before dir + :cd - "想尝试通过--git-dir 或者 -C的方式直接pull,似乎不行 :!git pull "上面的回车是没用的,还是得进回车 From ceee1d81d126905a7e93ac23995f2375f7157fea Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 08:18:50 +0800 Subject: [PATCH 103/171] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9B=B4=E6=96=B0=E7=AE=80=E7=9B=B4=E8=87=AA?= =?UTF-8?q?=E5=BA=9F=E6=AD=A6=E5=8A=9F=EF=BC=8C=E5=A4=AA=E6=97=A9=E5=88=87?= =?UTF-8?q?=E5=9B=9E=E5=8E=9F=E8=B7=AF=E5=BE=84=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 2b202ce..8cc9dd8 100644 --- a/config/vimrc +++ b/config/vimrc @@ -541,10 +541,10 @@ nmap :source% if !exists("*Fuck") function! Fuck() :cd $HOME/vim-plug - "back to before dir - :cd - "想尝试通过--git-dir 或者 -C的方式直接pull,似乎不行 :!git pull + "back to before dir + :cd - "上面的回车是没用的,还是得进回车 source $MYVIMRC echom "已更新" From 8503d61181f9a16daf6bde895c9085612d4d12a8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 08:29:16 +0800 Subject: [PATCH 104/171] =?UTF-8?q?leader+q=20=E5=BF=AB=E9=80=9F=E9=80=80?= =?UTF-8?q?=E5=87=BA=E5=BD=93=E5=89=8D=E5=B0=8F=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index 8cc9dd8..2d887c5 100644 --- a/config/vimrc +++ b/config/vimrc @@ -352,6 +352,8 @@ let g:multi_cursor_quit_key='' " 映射全选 ctrl+a "map ggVG "map! ggVG +"快速关闭单个窗口 +map q q "多窗口切换 "ctrl是修饰键可以按住不动的使用 "leader只生效一次,需要不断重新敲击 From 2c5d2a88b9cda6e9061cb28c36598560c1544a56 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 10:56:32 +0800 Subject: [PATCH 105/171] =?UTF-8?q?=E5=BC=95=E5=85=A5=E4=BA=86=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E7=9A=84=E5=87=BD=E6=95=B0=EF=BC=8C=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E4=BA=86=E6=96=B9=E6=B3=95=EF=BC=8C=E8=80=83=E8=99=91=E4=BA=86?= =?UTF-8?q?source=E8=BF=87=E7=A8=8B=E7=9A=84=E9=87=8D=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=BA=86git=E8=B7=AF=E5=BE=84=E7=9A=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 2d887c5..78eb26e 100644 --- a/config/vimrc +++ b/config/vimrc @@ -561,13 +561,35 @@ augroup autoupdate "nested 代表嵌套后面的命令 "autocmd VimEnter * :AsyncRun -post=call\ Fuck() cd $HOME/vim-plug && git pull - autocmd VimEnter * nested call Fuck() + "目前唯一可以用的 + "------------------------------------------------------- + "autocmd VimEnter * nested call Fuck() + autocmd VimEnter * nested call Update() + "------------------------------------------------------------------------- "没法在async中用vim自己的source "没法autocmd响应事件 "autocmd User AsyncRunStop *:source $HOME/.vimrc "autocmd User AsyncRunStop call s:fuck() augroup END - +"vimscript中用.而不是+链接字符串 +if !exists("*Update") + func Update() + let job=job_start("git -C " . $HOME . "/vim-plug pull",{"out_cb":"MyHandler","err_cb":"ErrHandler"}) + endfunc +else + echom "updated" +endif +if !exists("*ErrHandler") +func ErrHandler(channel,msg) + echo "Err" . a:msg +endfunc +endif +if !exists("*MyHandler") +func MyHandler(channel,msg) + echo "Suc" . a:msg + source $MYVIMRC +endfunc +endif augroup gocmd autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) From c775b1a8c6bf65d768f899a0e1dabc9b949f0b13 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 11:00:31 +0800 Subject: [PATCH 106/171] update name --- config/vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/vimrc b/config/vimrc index 78eb26e..48b5969 100644 --- a/config/vimrc +++ b/config/vimrc @@ -574,7 +574,7 @@ augroup END "vimscript中用.而不是+链接字符串 if !exists("*Update") func Update() - let job=job_start("git -C " . $HOME . "/vim-plug pull",{"out_cb":"MyHandler","err_cb":"ErrHandler"}) + let git_pull_job=job_start("git -C " . $HOME . "/vim-plug pull",{"out_cb":"SourceHandler","err_cb":"ErrHandler"}) endfunc else echom "updated" @@ -584,8 +584,8 @@ func ErrHandler(channel,msg) echo "Err" . a:msg endfunc endif -if !exists("*MyHandler") -func MyHandler(channel,msg) +if !exists("*SourceHandler") +func SourceHandler(channel,msg) echo "Suc" . a:msg source $MYVIMRC endfunc From fa59556f5061964c8272e00bbc52703783d9bf44 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 11:10:12 +0800 Subject: [PATCH 107/171] =?UTF-8?q?=E6=8A=8Aleader=E7=9A=84=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=BF=AB=E6=8D=B7=E9=94=AE=E6=94=BE=E5=88=B0normal?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=EF=BC=88=E8=B5=B7=E7=A0=81=E4=B8=8D=E6=94=BE?= =?UTF-8?q?=E5=9C=A8insert=E6=A8=A1=E5=BC=8F=E6=89=93=E6=89=B0=E8=BE=93?= =?UTF-8?q?=E5=85=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/vimrc b/config/vimrc index 48b5969..1cc192a 100644 --- a/config/vimrc +++ b/config/vimrc @@ -283,9 +283,9 @@ map! :! ctags -R "快捷键设置 -map 3 :NERDTreeToggle +nnoremap 3 :NERDTreeToggle -map! 3 :NERDTreeToggle +nnoremap! 3 :NERDTreeToggle map :TagbarToggle @@ -353,14 +353,14 @@ let g:multi_cursor_quit_key='' "map ggVG "map! ggVG "快速关闭单个窗口 -map q q +nmap q q "多窗口切换 "ctrl是修饰键可以按住不动的使用 "leader只生效一次,需要不断重新敲击 -map h -map j -map k -map l +nmap h +nmap j +nmap k +nmap l " import emacs map imap imap From ccdef5107fb5229566de6858fb639af3a10e1077 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 14 Mar 2018 16:39:40 +0800 Subject: [PATCH 108/171] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E7=A7=8D=E7=9C=8B=E4=B8=8A=E5=8E=BB=E5=83=8F=E6=98=AF=E5=8D=A1?= =?UTF-8?q?=E9=A1=BF=E7=9A=84=E5=81=87=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/vimrc b/config/vimrc index 1cc192a..4606494 100644 --- a/config/vimrc +++ b/config/vimrc @@ -283,9 +283,11 @@ map! :! ctags -R "快捷键设置 -nnoremap 3 :NERDTreeToggle - -nnoremap! 3 :NERDTreeToggle +nmap 3 :NERDTreeToggle +"vim中的map中的!代表了插入模式和命令模式 +"而在后两者的模式的输入中对空格本身的判断延时会影响使用 +"所以去掉 +"nmap! 3 :NERDTreeToggle map :TagbarToggle From cf3bdf760595cd6077eb6fbcab9ff77f28173706 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 08:22:02 +0800 Subject: [PATCH 109/171] =?UTF-8?q?=E5=AF=B9=E4=B8=8D=E6=94=AF=E6=8C=81job?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=BE=91=E5=99=A8=E5=81=9A=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=9B=BF=E4=BB=A3=E5=85=BC=E5=AE=B9(=E5=8C=85?= =?UTF-8?q?=E6=8B=ACnvim=E5=92=8C=E6=97=A7=E7=89=88vim),=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E4=B8=AAleader5=E7=9A=84=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E7=9B=B4=E6=8E=A5=E7=BC=96=E8=BE=91=E4=BF=AE=E6=94=B9?= =?UTF-8?q?vimrc=EF=BC=8C=E9=85=8D=E5=90=88F5=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 4606494..bc8dfa3 100644 --- a/config/vimrc +++ b/config/vimrc @@ -541,6 +541,8 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k nmap p (Gpush) "F5 刷新编辑器 nmap :source% +"leader+5 编辑vimrc +map 5 :edit $MYVIMRC "source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 if !exists("*Fuck") function! Fuck() @@ -565,8 +567,11 @@ augroup autoupdate "autocmd VimEnter * :AsyncRun -post=call\ Fuck() cd $HOME/vim-plug && git pull "目前唯一可以用的 "------------------------------------------------------- - "autocmd VimEnter * nested call Fuck() - autocmd VimEnter * nested call Update() + if has("job") + autocmd VimEnter * nested call Update() + else + autocmd VimEnter * nested call Fuck() + endif "------------------------------------------------------------------------- "没法在async中用vim自己的source "没法autocmd响应事件 From 0b9e509a82bb696a7be3d2cd4d17ed6ae4425553 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 16:02:04 +0800 Subject: [PATCH 110/171] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86proxy?= =?UTF-8?q?=E4=B8=ADgo=E5=B7=A5=E5=85=B7=E7=9A=84fzf=E7=9A=84=E5=AE=89?= =?UTF-8?q?=E8=A3=85=EF=BC=8C=E9=87=8D=E6=96=B0=E5=BC=95=E5=85=A5=E4=BA=86?= =?UTF-8?q?fzf=E7=9A=84=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/eslintrc.json | 7 +++++++ config/vimrc | 13 +++++++++---- proxy.bat | 41 +++++++++++++++++++++++------------------ 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/config/eslintrc.json b/config/eslintrc.json index cdafbc7..0716cf6 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -1,4 +1,11 @@ { + "globals":{ + "App":true, + "Page":true, + "getApp":true, + "wx":true, + "getCurrentPages":true + }, "env": { "browser": true, "es6": true, diff --git a/config/vimrc b/config/vimrc index bc8dfa3..edb1a0e 100644 --- a/config/vimrc +++ b/config/vimrc @@ -50,8 +50,9 @@ Plug 'Tagbar' "zencoding 改名为了 Emmet Plug 'https://github.com/luofei614/Emmet.vim' - -"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } +"模糊搜索软件 +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +Plug 'junegunn/fzf.vim' Plug 'WebAPI.vim' Plug 'Gist.vim' @@ -121,7 +122,7 @@ Plug 'alvan/vim-closetag' "beauty Plug 'vim-scripts/matchit.zip' "tern js 补全 -"Plug 'marijnh/tern_for_vim', {'do': 'npm install'} +Plug 'marijnh/tern_for_vim', {'do': 'npm install'} "Go 插件 Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } "git 插件 @@ -142,6 +143,8 @@ Plug 'skywind3000/asyncrun.vim' "编译任务插件 Plug 'skywind3000/vimmake' Plug 'hsanson/vim-android' +Plug 'chemzqm/wxapp.vim' +Plug 'ctrlpvim/ctrlp.vim' call plug#end() @@ -304,7 +307,9 @@ let g:CommandTAcceptSelectionTabMap = '' " 用FZF 查找文件 " 设置查找时排除的目录 -":let $FZF_DEFAULT_COMMAND = 'find . -type f ! -path "./node_modules/*" ! -path "./bower_components/*" ! -path "./.git/*" ! -path "*.swp"' +let $FZF_DEFAULT_COMMAND = 'find . -type f ! -path "./node_modules/*" ! -path "./bower_components/*" ! -path "./.git/*" ! -path "*.swp"' + +nnoremap f :Files "map :tabnew:FZF "map! :w :tabnew:FZF diff --git a/proxy.bat b/proxy.bat index 1bda307..91dfd38 100644 --- a/proxy.bat +++ b/proxy.bat @@ -3,22 +3,27 @@ echo 开始安装依赖 set http_proxy=http://127.0.0.1:8087 set https_proxy=http://127.0.0.1:8087 git config http.proxy http://127.0.0.1:8087 -go get -u github.com/klauspost/asmfmt/cmd/asmfmt -go get -u github.com/derekparker/delve/cmd/dlv -go get -u github.com/kisielk/errcheck -go get -u github.com/davidrjenni/reftools/cmd/fillstruct -go get -u -ldflags -H=windowsgui github.com/nsf/gocode -go get -u github.com/rogpeppe/godef -go get -u github.com/zmb3/gogetdoc -go get -u golang.org/x/tools/cmd/goimports -go get -u github.com/golang/lint/golint -go get -u github.com/alecthomas/gometalinter -go get -u github.com/fatih/gomodifytags -go get -u golang.org/x/tools/cmd/gorename -go get -u github.com/jstemmer/gotags -go get -u golang.org/x/tools/cmd/guru -go get -u github.com/josharian/impl -go get -u github.com/dominikh/go-tools/cmd/keyify -go get -u github.com/fatih/motion +:: update=-u就是强制更新 +set update= +go get %update% github.com/klauspost/asmfmt/cmd/asmfmt +go get %update% github.com/derekparker/delve/cmd/dlv +go get %update% github.com/kisielk/errcheck +go get %update% github.com/davidrjenni/reftools/cmd/fillstruct +go get %update% -ldflags -H=windowsgui github.com/nsf/gocode +go get %update% github.com/rogpeppe/godef +go get %update% github.com/zmb3/gogetdoc +go get %update% golang.org/x/tools/cmd/goimports +go get %update% github.com/golang/lint/golint +go get %update% github.com/alecthomas/gometalinter +go get %update% github.com/fatih/gomodifytags +go get %update% golang.org/x/tools/cmd/gorename +go get %update% github.com/jstemmer/gotags +go get %update% golang.org/x/tools/cmd/guru +go get %update% github.com/josharian/impl +go get %update% github.com/dominikh/go-tools/cmd/keyify +go get %update% github.com/fatih/motion + +:: fzf 依赖 +go get %update% github.com/junegunn/fzf EXIT /B -::goto :eof和 EXIT /B 都能返回到之前的call里 但是是不会返回到start里 \ No newline at end of file +::goto :eof和 EXIT /B 都能返回到之前的call里 但是是不会返回到start里 From dd6809ebd20cacd30c317fc751d06cb07109686b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 16:25:26 +0800 Subject: [PATCH 111/171] =?UTF-8?q?=E5=85=89=E5=85=A8=E5=B1=80=E5=AE=89?= =?UTF-8?q?=E8=A3=85fzf=E4=B8=8D=E7=9F=A5=E9=81=93=E4=B8=BA=E4=BB=80?= =?UTF-8?q?=E4=B9=88=E6=B2=A1=E7=94=A8=EF=BC=8C=E5=90=8E=E6=9D=A5=E5=9C=A8?= =?UTF-8?q?proxy=E4=B8=AD=E7=9B=B4=E6=8E=A5=E5=A2=9E=E5=8A=A0=E4=BA=86.fzf?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 +++++- proxy.bat | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index edb1a0e..dcaf7e8 100644 --- a/config/vimrc +++ b/config/vimrc @@ -51,7 +51,11 @@ Plug 'Tagbar' "zencoding 改名为了 Emmet Plug 'https://github.com/luofei614/Emmet.vim' "模糊搜索软件 -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +if has('win32') || has('win64') + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'go build && mv ./main.exe ./bin/fzf.exe' } +else + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +endif Plug 'junegunn/fzf.vim' Plug 'WebAPI.vim' diff --git a/proxy.bat b/proxy.bat index 91dfd38..d66cf88 100644 --- a/proxy.bat +++ b/proxy.bat @@ -25,5 +25,8 @@ go get %update% github.com/fatih/motion :: fzf 依赖 go get %update% github.com/junegunn/fzf +cd %USERPROFILE%/.fzf/ +go build +mv .fzf.exe %USERPROFILE%/.fzf/bin/fzf.exe EXIT /B ::goto :eof和 EXIT /B 都能返回到之前的call里 但是是不会返回到start里 From bcf897c9440816a080784433697edfeb2e224055 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 16:33:18 +0800 Subject: [PATCH 112/171] =?UTF-8?q?=E5=AF=B9fzf=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index dcaf7e8..00d49b3 100644 --- a/config/vimrc +++ b/config/vimrc @@ -309,11 +309,10 @@ map! :TagbarToggle let g:CommandTAcceptSelectionMap = '' let g:CommandTAcceptSelectionTabMap = '' -" 用FZF 查找文件 -" 设置查找时排除的目录 -let $FZF_DEFAULT_COMMAND = 'find . -type f ! -path "./node_modules/*" ! -path "./bower_components/*" ! -path "./.git/*" ! -path "*.swp"' -nnoremap f :Files +"silent是指执行后面的命令时不显示在命令栏 +nnoremap f :Files +nnoremap b :Buffers "map :tabnew:FZF "map! :w :tabnew:FZF From 57510887919d516cf949fb90a07ce5600ba16704 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 18:48:18 +0800 Subject: [PATCH 113/171] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86=E4=B9=85?= =?UTF-8?q?=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84plugvim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + autoload/plug.vim | 2018 --------------------------------------------- config/vimrc | 5 +- 3 files changed, 5 insertions(+), 2019 deletions(-) delete mode 100644 autoload/plug.vim diff --git a/.gitignore b/.gitignore index 9e0e4ea..26ff605 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ plugged/ node_modules/ *.swp init.vim +autoload \ No newline at end of file diff --git a/autoload/plug.vim b/autoload/plug.vim deleted file mode 100644 index cabeb4f..0000000 --- a/autoload/plug.vim +++ /dev/null @@ -1,2018 +0,0 @@ -" vim-plug: Vim plugin manager -" ============================ -" -" Download plug.vim and put it in ~/.vim/autoload -" -" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ -" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -" -" Edit your .vimrc -" -" call plug#begin('~/.vim/plugged') -" -" " Make sure you use single quotes -" Plug 'junegunn/seoul256.vim' -" Plug 'junegunn/vim-easy-align' -" -" " Group dependencies, vim-snippets depends on ultisnips -" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' -" -" " On-demand loading -" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } -" -" " Using git URL -" Plug 'https://github.com/junegunn/vim-github-dashboard.git' -" -" " Plugin options -" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } -" -" " Plugin outside ~/.vim/plugged with post-update hook -" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } -" -" " Unmanaged plugin (manually installed and updated) -" Plug '~/my-prototype-plugin' -" -" call plug#end() -" -" Then reload .vimrc and :PlugInstall to install plugins. -" Visit https://github.com/junegunn/vim-plug for more information. -" -" -" Copyright (c) 2015 Junegunn Choi -" -" MIT License -" -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be -" included in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -if exists('g:loaded_plug') - finish -endif -let g:loaded_plug = 1 - -let s:cpo_save = &cpo -set cpo&vim - -let s:plug_src = 'https://github.com/junegunn/vim-plug.git' -let s:plug_tab = get(s:, 'plug_tab', -1) -let s:plug_buf = get(s:, 'plug_buf', -1) -let s:mac_gui = has('gui_macvim') && has('gui_running') -let s:is_win = has('win32') || has('win64') -let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win -let s:me = resolve(expand(':p')) -let s:base_spec = { 'branch': 'master', 'frozen': 0 } -let s:TYPE = { -\ 'string': type(''), -\ 'list': type([]), -\ 'dict': type({}), -\ 'funcref': type(function('call')) -\ } -let s:loaded = get(s:, 'loaded', {}) -let s:triggers = get(s:, 'triggers', {}) - -function! plug#begin(...) - if a:0 > 0 - let s:plug_home_org = a:1 - let home = s:path(fnamemodify(expand(a:1), ':p')) - elseif exists('g:plug_home') - let home = s:path(g:plug_home) - elseif !empty(&rtp) - let home = s:path(split(&rtp, ',')[0]) . '/plugged' - else - return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') - endif - - let g:plug_home = home - let g:plugs = {} - let g:plugs_order = [] - let s:triggers = {} - - call s:define_commands() - return 1 -endfunction - -function! s:define_commands() - command! -nargs=+ -bar Plug call s:add() - if !executable('git') - return s:err('`git` executable not found. vim-plug requires git.') - endif - command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('' == '!', []) - command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('' == '!', []) - command! -nargs=0 -bar -bang PlugClean call s:clean('' == '!') - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif - command! -nargs=0 -bar PlugStatus call s:status() - command! -nargs=0 -bar PlugDiff call s:diff() - command! -nargs=? -bar PlugSnapshot call s:snapshot() -endfunction - -function! s:to_a(v) - return type(a:v) == s:TYPE.list ? a:v : [a:v] -endfunction - -function! s:to_s(v) - return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" -endfunction - -function! s:source(from, ...) - for pattern in a:000 - for vim in s:lines(globpath(a:from, pattern)) - execute 'source' s:esc(vim) - endfor - endfor -endfunction - -function! s:assoc(dict, key, val) - let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) -endfunction - -function! plug#end() - if !exists('g:plugs') - return s:err('Call plug#begin() first') - endif - - if exists('#PlugLOD') - augroup PlugLOD - autocmd! - augroup END - augroup! PlugLOD - endif - let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - - filetype off - for name in g:plugs_order - let plug = g:plugs[name] - if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') - let s:loaded[name] = 1 - continue - endif - - if has_key(plug, 'on') - let s:triggers[name] = { 'map': [], 'cmd': [] } - for cmd in s:to_a(plug.on) - if cmd =~? '^.\+' - if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) - call s:assoc(lod.map, cmd, name) - endif - call add(s:triggers[name].map, cmd) - elseif cmd =~ '^[A-Z]' - if exists(':'.cmd) != 2 - call s:assoc(lod.cmd, cmd, name) - endif - call add(s:triggers[name].cmd, cmd) - endif - endfor - endif - - if has_key(plug, 'for') - let types = s:to_a(plug.for) - if !empty(types) - call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') - endif - for type in types - call s:assoc(lod.ft, type, name) - endfor - endif - endfor - - for [cmd, names] in items(lod.cmd) - execute printf( - \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "", , , , %s)', - \ cmd, string(cmd), string(names)) - endfor - - for [map, names] in items(lod.map) - for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] - execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), key_prefix) - endfor - endfor - - for [ft, names] in items(lod.ft) - augroup PlugLOD - execute printf('autocmd FileType %s call lod_ft(%s, %s)', - \ ft, string(ft), string(names)) - augroup END - endfor - - call s:reorg_rtp() - filetype plugin indent on - if has('vim_starting') - syntax enable - else - call s:reload() - endif -endfunction - -function! s:loaded_names() - return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') -endfunction - -function! s:reload() - for name in s:loaded_names() - call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') - endfor -endfunction - -function! s:trim(str) - return substitute(a:str, '[\/]\+$', '', '') -endfunction - -function! s:version_requirement(val, min) - for idx in range(0, len(a:min) - 1) - let v = get(a:val, idx, 0) - if v < a:min[idx] | return 0 - elseif v > a:min[idx] | return 1 - endif - endfor - return 1 -endfunction - -function! s:git_version_requirement(...) - let s:git_version = get(s:, 'git_version', - \ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)')) - return s:version_requirement(s:git_version, a:000) -endfunction - -function! s:progress_opt(base) - return a:base && !s:is_win && - \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' -endfunction - -if s:is_win - function! s:rtp(spec) - return s:path(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(substitute(a:path, '/', '\', 'g')) - endfunction - - function! s:dirpath(path) - return s:path(a:path) . '\' - endfunction - - function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:\|^[%~]' - endfunction -else - function! s:rtp(spec) - return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(a:path) - endfunction - - function! s:dirpath(path) - return substitute(a:path, '[/\\]*$', '/', '') - endfunction - - function! s:is_local_plug(repo) - return a:repo[0] =~ '[/$~]' - endfunction -endif - -function! s:err(msg) - echohl ErrorMsg - echom a:msg - echohl None - return 0 -endfunction - -function! s:esc(path) - return escape(a:path, ' ') -endfunction - -function! s:escrtp(path) - return escape(a:path, ' ,') -endfunction - -function! s:remove_rtp() - for name in s:loaded_names() - let rtp = s:rtp(g:plugs[name]) - execute 'set rtp-='.s:escrtp(rtp) - let after = globpath(rtp, 'after') - if isdirectory(after) - execute 'set rtp-='.s:escrtp(after) - endif - endfor -endfunction - -function! s:reorg_rtp() - if !empty(s:first_rtp) - execute 'set rtp-='.s:first_rtp - execute 'set rtp-='.s:last_rtp - endif - - " &rtp is modified from outside - if exists('s:prtp') && s:prtp !=# &rtp - call s:remove_rtp() - unlet! s:middle - endif - - let s:middle = get(s:, 'middle', &rtp) - let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') - let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') - let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') - \ . ','.s:middle.',' - \ . join(map(afters, 'escape(v:val, ",")'), ',') - let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') - let s:prtp = &rtp - - if !empty(s:first_rtp) - execute 'set rtp^='.s:first_rtp - execute 'set rtp+='.s:last_rtp - endif -endfunction - -function! plug#load(...) - if a:0 == 0 - return s:err('Argument missing: plugin name(s) required') - endif - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)') - if !empty(unknowns) - let s = len(unknowns) > 1 ? 's' : '' - return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) - end - for name in a:000 - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - if exists('#BufRead') - doautocmd BufRead - endif - return 1 -endfunction - -function! s:remove_triggers(name) - if !has_key(s:triggers, a:name) - return - endif - for cmd in s:triggers[a:name].cmd - execute 'silent! delc' cmd - endfor - for map in s:triggers[a:name].map - execute 'silent! unmap' map - execute 'silent! iunmap' map - endfor - call remove(s:triggers, a:name) -endfunction - -function! s:lod(names, types) - for name in a:names - call s:remove_triggers(name) - let s:loaded[name] = 1 - endfor - call s:reorg_rtp() - - for name in a:names - let rtp = s:rtp(g:plugs[name]) - for dir in a:types - call s:source(rtp, dir.'/**/*.vim') - endfor - if exists('#User#'.name) - execute 'doautocmd User' name - endif - endfor -endfunction - -function! s:lod_ft(pat, names) - call s:lod(a:names, ['plugin', 'after/plugin']) - execute 'autocmd! PlugLOD FileType' a:pat - if exists('#filetypeplugin#FileType') - doautocmd filetypeplugin FileType - endif - if exists('#filetypeindent#FileType') - doautocmd filetypeindent FileType - endif -endfunction - -function! s:lod_cmd(cmd, bang, l1, l2, args, names) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) -endfunction - -function! s:lod_map(map, names, prefix) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - let extra = '' - while 1 - let c = getchar(0) - if c == 0 - break - endif - let extra .= nr2char(c) - endwhile - call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) -endfunction - -function! s:add(repo, ...) - if a:0 > 1 - return s:err('Invalid number of arguments (1..2)') - endif - - try - let repo = s:trim(a:repo) - let name = fnamemodify(repo, ':t:s?\.git$??') - let spec = extend(s:infer_properties(name, repo), - \ a:0 == 1 ? s:parse_options(a:1) : s:base_spec) - if !has_key(g:plugs, name) - call add(g:plugs_order, name) - endif - let g:plugs[name] = spec - let s:loaded[name] = get(s:loaded, name, 0) - catch - return s:err(v:exception) - endtry -endfunction - -function! s:parse_options(arg) - let opts = copy(s:base_spec) - let type = type(a:arg) - if type == s:TYPE.string - let opts.tag = a:arg - elseif type == s:TYPE.dict - call extend(opts, a:arg) - if has_key(opts, 'dir') - let opts.dir = s:dirpath(expand(opts.dir)) - endif - else - throw 'Invalid argument type (expected: string or dictionary)' - endif - return opts -endfunction - -function! s:infer_properties(name, repo) - let repo = a:repo - if s:is_local_plug(repo) - return { 'dir': s:dirpath(expand(repo)) } - else - if repo =~ ':' - let uri = repo - else - if repo !~ '/' - let repo = 'vim-scripts/'. repo - endif - let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') - let uri = printf(fmt, repo) - endif - let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) - return { 'dir': dir, 'uri': uri } - endif -endfunction - -function! s:install(force, names) - call s:update_impl(0, a:force, a:names) -endfunction - -function! s:update(force, names) - call s:update_impl(1, a:force, a:names) -endfunction - -function! plug#helptags() - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - for spec in values(g:plugs) - let docd = join([spec.dir, 'doc'], '/') - if isdirectory(docd) - silent! execute 'helptags' s:esc(docd) - endif - endfor - return 1 -endfunction - -function! s:syntax() - syntax clear - syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber - syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX - syn match plugNumber /[0-9]\+[0-9.]*/ contained - syn match plugBracket /[[\]]/ contained - syn match plugX /x/ contained - syn match plugDash /^-/ - syn match plugPlus /^+/ - syn match plugStar /^*/ - syn match plugMessage /\(^- \)\@<=.*/ - syn match plugName /\(^- \)\@<=[^ ]*:/ - syn match plugInstall /\(^+ \)\@<=[^:]*/ - syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha - syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained - syn match plugRelDate /([^)]*)$/ contained - syn match plugNotLoaded /(not loaded)$/ - syn match plugError /^x.*/ - syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean - hi def link plug1 Title - hi def link plug2 Repeat - hi def link plugX Exception - hi def link plugBracket Structure - hi def link plugNumber Number - - hi def link plugDash Special - hi def link plugPlus Constant - hi def link plugStar Boolean - - hi def link plugMessage Function - hi def link plugName Label - hi def link plugInstall Function - hi def link plugUpdate Type - - hi def link plugError Error - hi def link plugRelDate Comment - hi def link plugSha Identifier - - hi def link plugNotLoaded Comment -endfunction - -function! s:lpad(str, len) - return a:str . repeat(' ', a:len - len(a:str)) -endfunction - -function! s:lines(msg) - return split(a:msg, "[\r\n]") -endfunction - -function! s:lastline(msg) - return get(s:lines(a:msg), -1, '') -endfunction - -function! s:new_window() - execute get(g:, 'plug_window', 'vertical topleft new') -endfunction - -function! s:plug_window_exists() - let buflist = tabpagebuflist(s:plug_tab) - return !empty(buflist) && index(buflist, s:plug_buf) >= 0 -endfunction - -function! s:switch_in() - if !s:plug_window_exists() - return 0 - endif - - if winbufnr(0) != s:plug_buf - let s:pos = [tabpagenr(), winnr(), winsaveview()] - execute 'normal!' s:plug_tab.'gt' - let winnr = bufwinnr(s:plug_buf) - execute winnr.'wincmd w' - call add(s:pos, winsaveview()) - else - let s:pos = [winsaveview()] - endif - - setlocal modifiable - return 1 -endfunction - -function! s:switch_out(...) - call winrestview(s:pos[-1]) - setlocal nomodifiable - if a:0 > 0 - execute a:1 - endif - - if len(s:pos) > 1 - execute 'normal!' s:pos[0].'gt' - execute s:pos[1] 'wincmd w' - call winrestview(s:pos[2]) - endif -endfunction - -function! s:prepare() - call s:job_abort() - if s:switch_in() - silent %d _ - else - call s:new_window() - nnoremap q :if b:plug_preview==1pcendifechoq - nnoremap R :silent! call retry() - nnoremap D :PlugDiff - nnoremap S :PlugStatus - nnoremap U :call status_update() - xnoremap U :call status_update() - nnoremap ]] :silent! call section('') - nnoremap [[ :silent! call section('b') - let b:plug_preview = -1 - let s:plug_tab = tabpagenr() - let s:plug_buf = winbufnr(0) - call s:assign_name() - endif - silent! unmap - silent! unmap L - silent! unmap o - silent! unmap X - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable - setf vim-plug - call s:syntax() -endfunction - -function! s:assign_name() - " Assign buffer name - let prefix = '[Plugins]' - let name = prefix - let idx = 2 - while bufexists(name) - let name = printf('%s (%s)', prefix, idx) - let idx = idx + 1 - endwhile - silent! execute 'f' fnameescape(name) -endfunction - -function! s:do(pull, force, todo) - for [name, spec] in items(a:todo) - if !isdirectory(spec.dir) - continue - endif - let installed = has_key(s:update.new, name) - let updated = installed ? 0 : - \ (a:pull && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) - if a:force || installed || updated - execute 'cd' s:esc(spec.dir) - call append(3, '- Post-update hook for '. name .' ... ') - let type = type(spec.do) - if type == s:TYPE.string - try - " FIXME: Escaping is incomplete. We could use shellescape with eval, - " but it won't work on Windows. - let g:_plug_do = '!'.escape(spec.do, '#!%') - execute "normal! :execute g:_plug_do\\" - finally - let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' - unlet g:_plug_do - endtry - elseif type == s:TYPE.funcref - try - let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') - call spec.do({ 'name': name, 'status': status, 'force': a:force }) - let result = 'Done!' - catch - let result = 'Error: ' . v:exception - endtry - else - let result = 'Error: Invalid type!' - endif - call setline(4, getline(4) . result) - cd - - endif - endfor -endfunction - -function! s:finish(pull) - let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) - if new_frozen - let s = new_frozen > 1 ? 's' : '' - call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) - endif - call append(3, '- Finishing ... ') - redraw - call plug#helptags() - call plug#end() - call setline(4, getline(4) . 'Done!') - redraw - let msgs = [] - if !empty(s:update.errors) - call add(msgs, "Press 'R' to retry.") - endif - if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) - call add(msgs, "Press 'D' to see the updated changes.") - endif - echo join(msgs, ' ') -endfunction - -function! s:retry() - if empty(s:update.errors) - return - endif - call s:update_impl(s:update.pull, s:update.force, - \ extend(copy(s:update.errors), [s:update.threads])) -endfunction - -function! s:is_managed(name) - return has_key(g:plugs[a:name], 'uri') -endfunction - -function! s:names(...) - return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) -endfunction - -function! s:update_impl(pull, force, args) abort - let args = copy(a:args) - let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? - \ remove(args, -1) : get(g:, 'plug_threads', s:is_win ? 1 : 16) - - let managed = filter(copy(g:plugs), 's:is_managed(v:key)') - let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : - \ filter(managed, 'index(args, v:key) >= 0') - - if empty(todo) - echohl WarningMsg - echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' - echohl None - return - endif - - if !s:is_win && s:git_version_requirement(2, 3) - let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' - let $GIT_TERMINAL_PROMPT = 0 - for plug in values(todo) - let plug.uri = substitute(plug.uri, - \ '^https://git::@github\.com', 'https://github.com', '') - endfor - endif - - if !isdirectory(g:plug_home) - try - call mkdir(g:plug_home, 'p') - catch - return s:err(printf('Invalid plug directory: %s. '. - \ 'Try to call plug#begin with a valid directory', g:plug_home)) - endtry - endif - - if has('nvim') && !exists('*jobwait') && threads > 1 - echohl WarningMsg - echomsg 'vim-plug: update Neovim for parallel installer' - echohl None - endif - - let python = (has('python') || has('python3')) && !s:is_win && !has('win32unix') - \ && (!s:nvim || has('vim_starting')) - let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) - - let s:update = { - \ 'start': reltime(), - \ 'all': todo, - \ 'todo': copy(todo), - \ 'errors': [], - \ 'pull': a:pull, - \ 'force': a:force, - \ 'new': {}, - \ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1, - \ 'bar': '', - \ 'fin': 0 - \ } - - call s:prepare() - call append(0, ['', '']) - normal! 2G - silent! redraw - - let s:clone_opt = get(g:, 'plug_shallow', 1) ? - \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' - - " Python version requirement (>= 2.7) - if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1 - redir => pyv - silent python import platform; print(platform.python_version()) - redir END - let python = s:version_requirement( - \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) - endif - - if (python || ruby) && s:update.threads > 1 - try - let imd = &imd - if s:mac_gui - set noimd - endif - if ruby - call s:update_ruby() - else - call s:update_python() - endif - catch - let lines = getline(4, '$') - let printed = {} - silent! 4,$d _ - for line in lines - let name = s:extract_name(line, '.', '') - if empty(name) || !has_key(printed, name) - call append('$', line) - if !empty(name) - let printed[name] = 1 - if line[0] == 'x' && index(s:update.errors, name) < 0 - call add(s:update.errors, name) - end - endif - endif - endfor - finally - let &imd = imd - call s:update_finish() - endtry - else - call s:update_vim() - endif -endfunction - -function! s:update_finish() - if exists('s:git_terminal_prompt') - let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt - endif - if s:switch_in() - call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) - call s:finish(s:update.pull) - call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') - call s:switch_out('normal! gg') - endif -endfunction - -function! s:job_abort() - if !s:nvim || !exists('s:jobs') - return - endif - - for [name, j] in items(s:jobs) - silent! call jobstop(j.jobid) - if j.new - call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) - endif - endfor - let s:jobs = {} -endfunction - -" When a:event == 'stdout', data = list of strings -" When a:event == 'exit', data = returncode -function! s:job_handler(job_id, data, event) abort - if !s:plug_window_exists() " plug window closed - return s:job_abort() - endif - - if a:event == 'stdout' - let self.result .= substitute(s:to_s(a:data), '[\r\n]', '', 'g') . "\n" - " To reduce the number of buffer updates - let self.tick = get(self, 'tick', -1) + 1 - if self.tick % len(s:jobs) == 0 - call s:log(self.new ? '+' : '*', self.name, self.result) - endif - elseif a:event == 'exit' - let self.running = 0 - if a:data != 0 - let self.error = 1 - endif - call s:reap(self.name) - call s:tick() - endif -endfunction - -function! s:spawn(name, cmd, opts) - let job = { 'name': a:name, 'running': 1, 'error': 0, 'result': '', - \ 'new': get(a:opts, 'new', 0), - \ 'on_stdout': function('s:job_handler'), - \ 'on_exit' : function('s:job_handler'), - \ } - let s:jobs[a:name] = job - - if s:nvim - let argv = [ 'sh', '-c', - \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) ] - let jid = jobstart(argv, job) - if jid > 0 - let job.jobid = jid - else - let job.running = 0 - let job.error = 1 - let job.result = jid < 0 ? 'sh is not executable' : - \ 'Invalid arguments (or job table is full)' - endif - else - let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] - let job.result = call('s:system', params) - let job.error = v:shell_error != 0 - let job.running = 0 - endif -endfunction - -function! s:reap(name) - let job = s:jobs[a:name] - if job.error - call add(s:update.errors, a:name) - elseif get(job, 'new', 0) - let s:update.new[a:name] = 1 - endif - let s:update.bar .= job.error ? 'x' : '=' - - call s:log(job.error ? 'x' : '-', a:name, job.result) - call s:bar() - - call remove(s:jobs, a:name) -endfunction - -function! s:bar() - if s:switch_in() - let total = len(s:update.all) - call setline(1, (s:update.pull ? 'Updating' : 'Installing'). - \ ' plugins ('.len(s:update.bar).'/'.total.')') - call s:progress_bar(2, s:update.bar, total) - call s:switch_out() - endif -endfunction - -function! s:logpos(name) - for i in range(1, line('$')) - if getline(i) =~# '^[-+x*] '.a:name.':' - return i - endif - endfor - return 0 -endfunction - -function! s:log(bullet, name, lines) - if s:switch_in() - let pos = s:logpos(a:name) - if pos > 0 - execute pos 'd _' - if pos > winheight('.') - let pos = 4 - endif - else - let pos = 4 - endif - call append(pos - 1, s:format_message(a:bullet, a:name, a:lines)) - call s:switch_out() - endif -endfunction - -function! s:update_vim() - let s:jobs = {} - - call s:bar() - call s:tick() -endfunction - -function! s:tick() - let pull = s:update.pull - let prog = s:progress_opt(s:nvim) -while 1 " Without TCO, Vim stack is bound to explode - if empty(s:update.todo) - if empty(s:jobs) && !s:update.fin - let s:update.fin = 1 - call s:update_finish() - endif - return - endif - - let name = keys(s:update.todo)[0] - let spec = remove(s:update.todo, name) - let new = !isdirectory(spec.dir) - - call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') - redraw - - let has_tag = has_key(spec, 'tag') - let checkout = s:shellesc(has_tag ? spec.tag : spec.branch) - let merge = s:shellesc(has_tag ? spec.tag : 'origin/'.spec.branch) - - if !new - let [valid, msg] = s:git_valid(spec, 0) - if valid - if pull - let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' - call s:spawn(name, - \ printf('(git fetch %s %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', - \ fetch_opt, prog, checkout, merge), { 'dir': spec.dir }) - else - let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } - endif - else - let s:jobs[name] = { 'running': 0, 'result': msg, 'error': 1 } - endif - else - call s:spawn(name, - \ printf('git clone %s %s --recursive %s -b %s %s 2>&1', - \ has_tag ? '' : s:clone_opt, - \ prog, - \ s:shellesc(spec.uri), - \ checkout, - \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) - endif - - if !s:jobs[name].running - call s:reap(name) - endif - if len(s:jobs) >= s:update.threads - break - endif -endwhile -endfunction - -function! s:update_python() -let py_exe = has('python3') ? 'python3' : 'python' -execute py_exe "<< EOF" -""" Due to use of signals this function is POSIX only. """ -import datetime -import functools -import os -try: - import queue -except ImportError: - import Queue as queue -import random -import re -import shutil -import signal -import subprocess -import tempfile -import threading as thr -import time -import traceback -import vim - -G_NVIM = vim.eval("has('nvim')") == '1' -G_PULL = vim.eval('s:update.pull') == '1' -G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 -G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) -G_CLONE_OPT = vim.eval('s:clone_opt') -G_PROGRESS = vim.eval('s:progress_opt(1)') -G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) -G_STOP = thr.Event() -G_THREADS = {} - -class BaseExc(Exception): - def __init__(self, msg): - self._msg = msg - @property - def msg(self): - return self._msg -class CmdTimedOut(BaseExc): - pass -class CmdFailed(BaseExc): - pass -class InvalidURI(BaseExc): - pass -class Action(object): - INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] - -class Buffer(object): - def __init__(self, lock, num_plugs, is_pull, is_win): - self.bar = '' - self.event = 'Updating' if is_pull else 'Installing' - self.is_win = is_win - self.lock = lock - self.maxy = int(vim.eval('winheight(".")')) - self.num_plugs = num_plugs - - def _where(self, name): - """ Find first line with name in current buffer. Return line num. """ - found, lnum = False, 0 - matcher = re.compile('^[-+x*] {0}:'.format(name)) - for line in vim.current.buffer: - if matcher.search(line) is not None: - found = True - break - lnum += 1 - - if not found: - lnum = -1 - return lnum - - def header(self): - curbuf = vim.current.buffer - curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) - - num_spaces = self.num_plugs - len(self.bar) - curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') - - with self.lock: - vim.command('normal! 2G') - if not self.is_win: - vim.command('redraw') - - def write(self, action, name, lines): - first, rest = lines[0], lines[1:] - msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] - padded_rest = [' ' + line for line in rest] - msg.extend(padded_rest) - - try: - if action == Action.ERROR: - self.bar += 'x' - vim.command("call add(s:update.errors, '{0}')".format(name)) - elif action == Action.DONE: - self.bar += '=' - - curbuf = vim.current.buffer - lnum = self._where(name) - if lnum != -1: # Found matching line num - del curbuf[lnum] - if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): - lnum = 3 - else: - lnum = 3 - curbuf.append(msg, lnum) - - self.header() - except vim.error: - pass - -class Command(object): - def __init__(self, cmd, cmd_dir=None, timeout=60, ntries=3, cb=None, clean=None): - self.cmd = cmd - self.cmd_dir = cmd_dir - self.timeout = timeout - self.ntries = ntries - self.callback = cb if cb else (lambda msg: None) - self.clean = clean - - def attempt_cmd(self): - """ Tries to run the command, returns result if no exceptions. """ - attempt = 0 - finished = False - limit = self.timeout - - while not finished: - try: - attempt += 1 - result = self.timeout_cmd() - finished = True - except CmdTimedOut: - if attempt != self.ntries: - for count in range(3, 0, -1): - if G_STOP.is_set(): - raise KeyboardInterrupt - msg = 'Timeout. Will retry in {0} second{1} ...'.format( - count, 's' if count != 1 else '') - self.callback([msg]) - time.sleep(1) - self.timeout += limit - self.callback(['Retrying ...']) - else: - raise - - return result - - def timeout_cmd(self): - """ Execute a cmd & poll for callback. Returns list of output. - Raises CmdFailed -> return code for Popen isn't 0 - Raises CmdTimedOut -> command exceeded timeout without new output - """ - proc = None - first_line = True - try: - tfile = tempfile.NamedTemporaryFile(mode='w+b', delete=False) - proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile, - stderr=subprocess.STDOUT, shell=True, preexec_fn=os.setsid) - while proc.poll() is None: - # Yield this thread - time.sleep(0.2) - - if G_STOP.is_set(): - raise KeyboardInterrupt - - if first_line or random.random() < G_LOG_PROB: - first_line = False - line = nonblock_read(tfile.name) - if line: - self.callback([line]) - - time_diff = time.time() - os.path.getmtime(tfile.name) - if time_diff > self.timeout: - raise CmdTimedOut(['Timeout!']) - - tfile.seek(0) - result = [line.decode().rstrip() for line in tfile] - - if proc.returncode != 0: - msg = [''] - msg.extend(result) - raise CmdFailed(msg) - except: - if proc and proc.poll() is None: - os.killpg(proc.pid, signal.SIGTERM) - if self.clean: - self.clean() - raise - finally: - os.remove(tfile.name) - - return result - -class Plugin(object): - def __init__(self, name, args, buf_q, lock): - self.name = name - self.args = args - self.buf_q = buf_q - self.lock = lock - tag = args.get('tag', 0) - self.checkout = esc(tag if tag else args['branch']) - self.merge = esc(tag if tag else 'origin/' + args['branch']) - self.tag = tag - - def manage(self): - try: - if os.path.exists(self.args['dir']): - self.update() - else: - self.install() - with self.lock: - thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) - except (CmdTimedOut, CmdFailed, InvalidURI) as exc: - self.write(Action.ERROR, self.name, exc.msg) - except KeyboardInterrupt: - G_STOP.set() - self.write(Action.ERROR, self.name, ['Interrupted!']) - except: - # Any exception except those above print stack trace - msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) - self.write(Action.ERROR, self.name, msg.split('\n')) - raise - - def install(self): - target = self.args['dir'] - - def clean(target): - def _clean(): - try: - shutil.rmtree(target) - except OSError: - pass - return _clean - - self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.write, Action.INSTALL, self.name) - cmd = 'git clone {0} {1} --recursive {2} -b {3} {4} 2>&1'.format( - '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], self.checkout, esc(target)) - com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target)) - result = com.attempt_cmd() - self.write(Action.DONE, self.name, result[-1:]) - - def update(self): - match = re.compile(r'git::?@') - actual_uri = re.sub(match, '', self.repo_uri()) - expect_uri = re.sub(match, '', self.args['uri']) - if actual_uri != expect_uri: - msg = ['', - 'Invalid URI: {0}'.format(actual_uri), - 'Expected {0}'.format(expect_uri), - 'PlugClean required.'] - raise InvalidURI(msg) - - if G_PULL: - self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.write, Action.UPDATE, self.name) - fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' - cmds = ['git fetch {0} {1}'.format(fetch_opt, G_PROGRESS), - 'git checkout -q {0}'.format(self.checkout), - 'git merge --ff-only {0}'.format(self.merge), - 'git submodule update --init --recursive'] - cmd = ' 2>&1 && '.join(cmds) - com = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES, callback) - result = com.attempt_cmd() - self.write(Action.DONE, self.name, result[-1:]) - else: - self.write(Action.DONE, self.name, ['Already installed']) - - def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url' - command = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES) - result = command.attempt_cmd() - return result[-1] - - def write(self, action, name, msg): - self.buf_q.put((action, name, msg)) - -class PlugThread(thr.Thread): - def __init__(self, tname, args): - super(PlugThread, self).__init__() - self.tname = tname - self.args = args - - def run(self): - thr.current_thread().name = self.tname - buf_q, work_q, lock = self.args - - try: - while not G_STOP.is_set(): - name, args = work_q.get_nowait() - plug = Plugin(name, args, buf_q, lock) - plug.manage() - work_q.task_done() - except queue.Empty: - pass - finally: - global G_THREADS - with lock: - del G_THREADS[thr.current_thread().name] - -class RefreshThread(thr.Thread): - def __init__(self, lock): - super(RefreshThread, self).__init__() - self.lock = lock - self.running = True - - def run(self): - while self.running: - with self.lock: - thread_vim_command('noautocmd normal! a') - time.sleep(0.2) - - def stop(self): - self.running = False - -if G_NVIM: - def thread_vim_command(cmd): - vim.session.threadsafe_call(lambda: vim.command(cmd)) -else: - def thread_vim_command(cmd): - vim.command(cmd) - -def esc(name): - return '"' + name.replace('"', '\"') + '"' - -def nonblock_read(fname): - """ Read a file with nonblock flag. Return the last line. """ - fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000).decode() - os.close(fread) - - line = buf.rstrip('\r\n') - left = max(line.rfind('\r'), line.rfind('\n')) - if left != -1: - left += 1 - line = line[left:] - - return line - -def main(): - thr.current_thread().name = 'main' - nthreads = int(vim.eval('s:update.threads')) - plugs = vim.eval('s:update.todo') - mac_gui = vim.eval('s:mac_gui') == '1' - is_win = vim.eval('s:is_win') == '1' - - lock = thr.Lock() - buf = Buffer(lock, len(plugs), G_PULL, is_win) - buf_q, work_q = queue.Queue(), queue.Queue() - for work in plugs.items(): - work_q.put(work) - - global G_THREADS - for num in range(nthreads): - tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (buf_q, work_q, lock)) - thread.start() - G_THREADS[tname] = thread - if mac_gui: - rthread = RefreshThread(lock) - rthread.start() - - while not buf_q.empty() or len(G_THREADS) != 0: - try: - action, name, msg = buf_q.get(True, 0.25) - buf.write(action, name, msg) - buf_q.task_done() - except queue.Empty: - pass - except KeyboardInterrupt: - G_STOP.set() - - if mac_gui: - rthread.stop() - rthread.join() - -main() -EOF -endfunction - -function! s:update_ruby() - ruby << EOF - module PlugStream - SEP = ["\r", "\n", nil] - def get_line - buffer = '' - loop do - char = readchar rescue return - if SEP.include? char.chr - buffer << $/ - break - else - buffer << char - end - end - buffer - end - end unless defined?(PlugStream) - - def esc arg - %["#{arg.gsub('"', '\"')}"] - end - - def killall pid - pids = [pid] - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - - require 'thread' - require 'fileutils' - require 'timeout' - running = true - iswin = VIM::evaluate('s:is_win').to_i == 1 - pull = VIM::evaluate('s:update.pull').to_i == 1 - base = VIM::evaluate('g:plug_home') - all = VIM::evaluate('s:update.todo') - limit = VIM::evaluate('get(g:, "plug_timeout", 60)') - tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 - nthr = VIM::evaluate('s:update.threads').to_i - maxy = VIM::evaluate('winheight(".")').to_i - cd = iswin ? 'cd /d' : 'cd' - tot = VIM::evaluate('len(s:update.todo)') || 0 - bar = '' - skip = 'Already installed' - mtx = Mutex.new - take1 = proc { mtx.synchronize { running && all.shift } } - logh = proc { - cnt = bar.length - $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" - $curbuf[2] = '[' + bar.ljust(tot) + ']' - VIM::command('normal! 2G') - VIM::command('redraw') unless iswin - } - where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } - log = proc { |name, result, type| - mtx.synchronize do - ing = ![true, false].include?(type) - bar += type ? '=' : 'x' unless ing - b = case type - when :install then '+' when :update then '*' - when true, nil then '-' else - VIM::command("call add(s:update.errors, '#{name}')") - 'x' - end - result = - if type || type.nil? - ["#{b} #{name}: #{result.lines.to_a.last}"] - elsif result =~ /^Interrupted|^Timeout/ - ["#{b} #{name}: #{result}"] - else - ["#{b} #{name}"] + result.lines.map { |l| " " << l } - end - if lnum = where.call(name) - $curbuf.delete lnum - lnum = 4 if ing && lnum > maxy - end - result.each_with_index do |line, offset| - $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) - end - logh.call - end - } - bt = proc { |cmd, name, type, cleanup| - tried = timeout = 0 - begin - tried += 1 - timeout += limit - fd = nil - data = '' - if iswin - Timeout::timeout(timeout) do - tmp = VIM::evaluate('tempname()') - system("(#{cmd}) > #{tmp}") - data = File.read(tmp).chomp - File.unlink tmp rescue nil - end - else - fd = IO.popen(cmd).extend(PlugStream) - first_line = true - log_prob = 1.0 / nthr - while line = Timeout::timeout(timeout) { fd.get_line } - data << line - log.call name, line.chomp, type if name && (first_line || rand < log_prob) - first_line = false - end - fd.close - end - [$? == 0, data.chomp] - rescue Timeout::Error, Interrupt => e - if fd && !fd.closed? - killall fd.pid - fd.close - end - cleanup.call if cleanup - if e.is_a?(Timeout::Error) && tried < tries - 3.downto(1) do |countdown| - s = countdown > 1 ? 's' : '' - log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type - sleep 1 - end - log.call name, 'Retrying ...', type - retry - end - [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] - end - } - main = Thread.current - threads = [] - watcher = Thread.new { - while VIM::evaluate('getchar(1)') - sleep 0.1 - end - mtx.synchronize do - running = false - threads.each { |t| t.raise Interrupt } - end - threads.each { |t| t.join rescue nil } - main.kill - } - refresh = Thread.new { - while true - mtx.synchronize do - break unless running - VIM::command('noautocmd normal! a') - end - sleep 0.2 - end - } if VIM::evaluate('s:mac_gui') == 1 - - clone_opt = VIM::evaluate('s:clone_opt') - progress = VIM::evaluate('s:progress_opt(1)') - nthr.times do - mtx.synchronize do - threads << Thread.new { - while pair = take1.call - name = pair.first - dir, uri, branch, tag = pair.last.values_at *%w[dir uri branch tag] - checkout = esc(tag ? tag : branch) - merge = esc(tag ? tag : "origin/#{branch}") - subm = "git submodule update --init --recursive 2>&1" - exists = File.directory? dir - ok, result = - if exists - dir = iswin ? dir : esc(dir) - ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil - current_uri = data.lines.to_a.last - if !ret - if data =~ /^Interrupted|^Timeout/ - [false, data] - else - [false, [data.chomp, "PlugClean required."].join($/)] - end - elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') - [false, ["Invalid URI: #{current_uri}", - "Expected: #{uri}", - "PlugClean required."].join($/)] - else - if pull - log.call name, 'Updating ...', :update - fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' - bt.call "#{cd} #{dir} && git fetch #{fetch_opt} #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil - else - [true, skip] - end - end - else - d = esc dir.sub(%r{[\\/]+$}, '') - log.call name, 'Installing ...', :install - bt.call "git clone #{clone_opt unless tag} #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { - FileUtils.rm_rf dir - } - end - mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok - log.call name, result, ok - end - } if running - end - end - threads.each { |t| t.join rescue nil } - logh.call - refresh.kill if refresh - watcher.kill -EOF -endfunction - -function! s:shellesc(arg) - return '"'.escape(a:arg, '"').'"' -endfunction - -function! s:glob_dir(path) - return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)') -endfunction - -function! s:progress_bar(line, bar, total) - call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') -endfunction - -function! s:compare_git_uri(a, b) - let a = substitute(a:a, 'git:\{1,2}@', '', '') - let b = substitute(a:b, 'git:\{1,2}@', '', '') - return a ==# b -endfunction - -function! s:format_message(bullet, name, message) - if a:bullet != 'x' - return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] - else - let lines = map(s:lines(a:message), '" ".v:val') - return extend([printf('x %s:', a:name)], lines) - endif -endfunction - -function! s:with_cd(cmd, dir) - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) -endfunction - -function! s:system(cmd, ...) - try - let [sh, shrd] = [&shell, &shellredir] - if !s:is_win - set shell=sh shellredir=>%s\ 2>&1 - endif - let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd - return system(s:is_win ? '('.cmd.')' : cmd) - finally - let [&shell, &shellredir] = [sh, shrd] - endtry -endfunction - -function! s:system_chomp(...) - let ret = call('s:system', a:000) - return v:shell_error ? '' : substitute(ret, '\n$', '', '') -endfunction - -function! s:git_valid(spec, check_branch) - let ret = 1 - let msg = 'OK' - if isdirectory(a:spec.dir) - let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url', a:spec.dir)) - let remote = result[-1] - if v:shell_error - let msg = join([remote, 'PlugClean required.'], "\n") - let ret = 0 - elseif !s:compare_git_uri(remote, a:spec.uri) - let msg = join(['Invalid URI: '.remote, - \ 'Expected: '.a:spec.uri, - \ 'PlugClean required.'], "\n") - let ret = 0 - elseif a:check_branch - let branch = result[0] - " Check tag - if has_key(a:spec, 'tag') - let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag - let msg = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', - \ (empty(tag) ? 'N/A' : tag), a:spec.tag) - let ret = 0 - endif - " Check branch - elseif a:spec.branch !=# branch - let msg = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', - \ branch, a:spec.branch) - let ret = 0 - endif - endif - else - let msg = 'Not found' - let ret = 0 - endif - return [ret, msg] -endfunction - -function! s:rm_rf(dir) - if isdirectory(a:dir) - call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) - endif -endfunction - -function! s:clean(force) - call s:prepare() - call append(0, 'Searching for unused plugins in '.g:plug_home) - call append(1, '') - - " List of valid directories - let dirs = [] - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if !s:is_managed(name) || s:git_valid(spec, 0)[0] - call add(dirs, spec.dir) - endif - let cnt += 1 - call s:progress_bar(2, repeat('=', cnt), total) - normal! 2G - redraw - endfor - - let allowed = {} - for dir in dirs - let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 - let allowed[dir] = 1 - for child in s:glob_dir(dir) - let allowed[child] = 1 - endfor - endfor - - let todo = [] - let found = sort(s:glob_dir(g:plug_home)) - while !empty(found) - let f = remove(found, 0) - if !has_key(allowed, f) && isdirectory(f) - call add(todo, f) - call append(line('$'), '- ' . f) - let found = filter(found, 'stridx(v:val, f) != 0') - end - endwhile - - normal! G - redraw - if empty(todo) - call append(line('$'), 'Already clean.') - else - call inputsave() - let yes = a:force || (input('Proceed? (y/N) ') =~? '^y') - call inputrestore() - if yes - for dir in todo - call s:rm_rf(dir) - endfor - call append(line('$'), 'Removed.') - else - call append(line('$'), 'Cancelled.') - endif - endif - normal! G -endfunction - -function! s:upgrade() - echo 'Downloading the latest version of vim-plug' - redraw - let tmp = tempname() - let new = tmp . '/plug.vim' - - try - let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) - if v:shell_error - return s:err('Error upgrading vim-plug: '. out) - endif - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - return 0 - else - call rename(s:me, s:me . '.old') - call rename(new, s:me) - unlet g:loaded_plug - echo 'vim-plug has been upgraded' - return 1 - endif - finally - silent! call s:rm_rf(tmp) - endtry -endfunction - -function! s:upgrade_specs() - for spec in values(g:plugs) - let spec.frozen = get(spec, 'frozen', 0) - endfor -endfunction - -function! s:status() - call s:prepare() - call append(0, 'Checking plugins') - call append(1, '') - - let ecnt = 0 - let unloaded = 0 - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if has_key(spec, 'uri') - if isdirectory(spec.dir) - let [valid, msg] = s:git_valid(spec, 1) - else - let [valid, msg] = [0, 'Not found. Try PlugInstall.'] - endif - else - if isdirectory(spec.dir) - let [valid, msg] = [1, 'OK'] - else - let [valid, msg] = [0, 'Not found.'] - endif - endif - let cnt += 1 - let ecnt += !valid - " `s:loaded` entry can be missing if PlugUpgraded - if valid && get(s:loaded, name, -1) == 0 - let unloaded = 1 - let msg .= ' (not loaded)' - endif - call s:progress_bar(2, repeat('=', cnt), total) - call append(3, s:format_message(valid ? '-' : 'x', name, msg)) - normal! 2G - redraw - endfor - call setline(1, 'Finished. '.ecnt.' error(s).') - normal! gg - setlocal nomodifiable - if unloaded - echo "Press 'L' on each line to load plugin, or 'U' to update" - nnoremap L :call status_load(line('.')) - xnoremap L :call status_load(line('.')) - end -endfunction - -function! s:extract_name(str, prefix, suffix) - return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') -endfunction - -function! s:status_load(lnum) - let line = getline(a:lnum) - let name = s:extract_name(line, '-', '(not loaded)') - if !empty(name) - call plug#load(name) - setlocal modifiable - call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) - setlocal nomodifiable - endif -endfunction - -function! s:status_update() range - let lines = getline(a:firstline, a:lastline) - let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') - if !empty(names) - echo - execute 'PlugUpdate' join(names) - endif -endfunction - -function! s:is_preview_window_open() - silent! wincmd P - if &previewwindow - wincmd p - return 1 - endif - return 0 -endfunction - -function! s:find_name(lnum) - for lnum in reverse(range(1, a:lnum)) - let line = getline(lnum) - if empty(line) - return '' - endif - let name = s:extract_name(line, '-', '') - if !empty(name) - return name - endif - endfor - return '' -endfunction - -function! s:preview_commit() - if b:plug_preview < 0 - let b:plug_preview = !s:is_preview_window_open() - endif - - let sha = matchstr(getline('.'), '\(^ \)\@<=[0-9a-z]\{7}') - if empty(sha) - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) - return - endif - - execute 'pedit' sha - wincmd P - setlocal filetype=git buftype=nofile nobuflisted modifiable - execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --pretty=medium' sha - normal! gg"_dd - setlocal nomodifiable - nnoremap q :q - wincmd p -endfunction - -function! s:section(flags) - call search('\(^[x-] \)\@<=[^:]\+:', a:flags) -endfunction - -function! s:diff() - call s:prepare() - call append(0, 'Collecting updated changes ...') - normal! gg - redraw - - let cnt = 0 - for [k, v] in items(g:plugs) - if !isdirectory(v.dir) || !s:is_managed(k) - continue - endif - - let diff = s:system_chomp('git log --pretty=format:"%h %s (%cr)" "HEAD...HEAD@{1}"', v.dir) - if !empty(diff) - call append(1, '') - call append(2, '- '.k.':') - call append(3, map(s:lines(diff), '" ". v:val')) - let cnt += 1 - normal! gg - redraw - endif - endfor - - call setline(1, cnt == 0 ? 'No updates.' : 'Last update:') - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() - nnoremap X :call revert() - normal! gg - setlocal nomodifiable - if cnt > 0 - echo "Press 'X' on each block to revert the update" - endif -endfunction - -function! s:revert() - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || - \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' - return - endif - - call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) - setlocal modifiable - normal! "_dap - setlocal nomodifiable - echo 'Reverted.' -endfunction - -function! s:snapshot(...) abort - let home = get(s:, 'plug_home_org', g:plug_home) - let [type, var, header] = s:is_win ? - \ ['dosbatch', '%PLUG_HOME%', - \ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '', - \ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.home]] : - \ ['sh', '$PLUG_HOME', - \ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '', - \ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]] - - call s:prepare() - execute 'setf' type - call append(0, header) - call append('$', '') - 1 - redraw - - let dirs = sort(map(values(filter(copy(g:plugs), - \'has_key(v:val, "uri") && isdirectory(v:val.dir)')), 'v:val.dir')) - let anchor = line('$') - 1 - for dir in reverse(dirs) - let sha = s:system_chomp('git rev-parse --short HEAD', dir) - if !empty(sha) - call append(anchor, printf('cd %s && git reset --hard %s', - \ substitute(dir, '^\V'.escape(g:plug_home, '\'), var, ''), sha)) - redraw - endif - endfor - - if a:0 > 0 - let fn = expand(a:1) - let fne = s:esc(fn) - call writefile(getline(1, '$'), fn) - if !s:is_win | call s:system('chmod +x ' . fne) | endif - echo 'Saved to '.a:1 - silent execute 'e' fne - endif -endfunction - -function! s:split_rtp() - return split(&rtp, '\\\@ Date: Thu, 15 Mar 2018 18:49:26 +0800 Subject: [PATCH 114/171] update --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 26ff605..6734b01 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ plugged/ node_modules/ *.swp init.vim -autoload \ No newline at end of file +autoload/ \ No newline at end of file From e052c41834459e2a65ed46de874aff5c80861c72 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 18:57:44 +0800 Subject: [PATCH 115/171] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=9B=B4=E6=96=B0vim?= =?UTF-8?q?-plug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.bat | 2 ++ install.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/install.bat b/install.bat index db0318f..db684cf 100644 --- a/install.bat +++ b/install.bat @@ -41,6 +41,8 @@ call mklink /J "%HOME%\.vim" "%APP_PATH%\" IF NOT EXIST "%APP_PATH%\plugged" ( call mkdir "%APP_PATH%\plugged" ) +::下载vim-plug +call curl -fLo %USERPROFILE%/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ::IF NOT EXIST "%HOME%/.vim/bundle/vundle" ( :: call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" diff --git a/install.sh b/install.sh index dee2ec3..bfdf35f 100755 --- a/install.sh +++ b/install.sh @@ -25,6 +25,8 @@ lnif "$CURRENT_DIR/" "$HOME/.vim" #lnif $CURRENT_DIR/config/eslintrc.json $HOME/.eslintrc.json lnif $CURRENT_DIR/config/eslintrc.js $HOME/.eslintrc.js lnif $CURRENT_DIR/config/tern-config $HOME/.tern-config +#下载vim-plug +call curl -fLo %USERPROFILE%/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim #不能乱动.npmrc #lnif $CURRENT_DIR/config/npmrc $HOME/.npmrc From 9cf2a5827eb0bdbbb4cab17cc4dfca9c6b1739c5 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 19:04:23 +0800 Subject: [PATCH 116/171] =?UTF-8?q?=E5=9B=A0vim-plug=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=8A=E6=89=80=E6=9C=89vim-scrip?= =?UTF-8?q?t=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/vimrc b/config/vimrc index 6c7e594..8355b23 100644 --- a/config/vimrc +++ b/config/vimrc @@ -40,12 +40,12 @@ Plug 'junegunn/vim-easy-align' " Plugin options Plug 'nsf/gocode', { 'rtp': 'vim' } -Plug 'AutoComplPop' +Plug 'vim-scripts/AutoComplPop' "浏览树 Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "浏览树显示git状态插件 Plug 'Xuyuanp/nerdtree-git-plugin' -Plug 'Tagbar' +Plug 'vim-scripts/Tagbar' "Bundle 'minibufexpl.vim' "zencoding 改名为了 Emmet @@ -57,9 +57,9 @@ else Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } endif Plug 'junegunn/fzf.vim' -Plug 'WebAPI.vim' +Plug 'vim-scripts/WebAPI.vim' -Plug 'Gist.vim' +Plug 'vim-scripts/Gist.vim' Plug 'tomasr/molokai' "七年没更新的配色能用个鬼 @@ -84,11 +84,11 @@ Plug 'pangloss/vim-javascript' Plug 'https://github.com/othree/javascript-libraries-syntax.vim.git' -Plug 'Mark' +Plug 'vim-scripts/Mark' "css私有前缀 -Plug 'prefixer.vim' +Plug 'vim-scripts/prefixer.vim' "能缩减HTML代码 -Plug 'xml.vim' +Plug 'vim-scripts/xml.vim' "安装此插件解决macvim下没有加号寄存器的问题。 Plug 'https://github.com/kana/vim-fakeclip.git' From fd23081a8b4363b425cd2722043ae22d048d0617 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 19:31:57 +0800 Subject: [PATCH 117/171] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E6=8C=89?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E6=90=9C=E7=B4=A2=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 +++++++++++++++++++++++++++++++------- config/vimrc | 2 +- proxy.bat | 5 +++++ proxy.sh | 5 +++++ 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ea800a5..827141e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ # git clone https://github.com/sherylynn/vim-plug.git # cd vim-plug && sh install.sh +windows下把install.sh改为 install.bat即可 + 就能安装上所有插件 使用了原主人的配置2年了...终于今天自己定制化了一下 @@ -14,21 +16,43 @@ 安装好后效果如下: ![enter image description here](https://github.com/sherylynn/vim-plug/raw/master/screenshot.png) -内置两种流行主题,默认是sublime风格的主题。 +支持自动更新,默认开启 -设置了很多方便的快捷键 +设置了很多方便的快捷键 -* F11 : 在编辑器左侧打开文件浏览器, 再按一次F11则会关闭文件浏览器。 +默认leader键是空格 -* F12: 在编辑器右侧打开当前文件的函数列表, 再安一次F12关闭函数列表。函数列表是基于ctags的先需要在项目目录下运行 `ctags -R` 在VIM中按快捷键 F3 可以自动执行ctags命令。 +* git命令:gca 提交 gp推送 gpl 拉取 -* F2: 可以快速查函数手册, 如果当前VIM的光标在php的file_put_contents函数上,按一下F2 会自动打开PHP手册的网页。 +* jk: 映射为ESC键 -* ctrl+f : 快速查找当前文件中的函数 +* ctrl+a ctrl+e:与emacs里表现一致 -* ctrl+] : 跳到函数声明出(自己定义的函数,非系统函数),会在当前界面打开函数声明文件,如果想新建个tab页再跳到函数声明处,可以用 `ctrl+\` +* cbg:内置了solarized主题,按cbg可以切换背景色 + +* leader+hjjk:窗口间移动 + +* leader+3 : 在编辑器左侧打开文件浏览器, 再按一次F11则会关闭文件浏览器。 + +* leader+4 :关闭quickfix窗口 + +* leader+5 :快速编辑vimrc + +* leader+q: 快速退出VIM单个窗口 + +* leader+f : 按文件名快速查找当前目录中的文件 + +* leader+g : 按文件内容快速查找当前目录中的文件[需要安装ag] * shift+q: 快速退出VIM。 如果vim同时打开多个文件是,不用挨着一个一个关闭。 +* F5 : 刷新vim更改 + +* F12: 在编辑器右侧打开当前文件的函数列表, 再安一次F12关闭函数列表。函数列表是基于ctags的先需要在项目目录下运行 `ctags -R` 在VIM中按快捷键 F3 可以自动执行ctags命令。 + +* ctrl+] : 跳到函数声明出(自己定义的函数,非系统函数),会在当前界面打开函数声明文件,如果想新建个tab页再跳到函数声明处,可以用 `ctrl+\` + + + diff --git a/config/vimrc b/config/vimrc index 8355b23..a5136ec 100644 --- a/config/vimrc +++ b/config/vimrc @@ -315,7 +315,7 @@ let g:CommandTAcceptSelectionTabMap = '' "silent是指执行后面的命令时不显示在命令栏 nnoremap f :Files -nnoremap b :Buffers +nnoremap g :Ag "map :tabnew:FZF "map! :w :tabnew:FZF diff --git a/proxy.bat b/proxy.bat index d66cf88..e2add79 100644 --- a/proxy.bat +++ b/proxy.bat @@ -28,5 +28,10 @@ go get %update% github.com/junegunn/fzf cd %USERPROFILE%/.fzf/ go build mv .fzf.exe %USERPROFILE%/.fzf/bin/fzf.exe + +::tools +echo 如果这一步不行得手动去下载放在能执行的目录 +call curl -fLo %USERPROFILE%/Downloads/ag.zip https://github.com/k-takata/the_silver_searcher-win32/releases/download/2018-01-25%2F2.1.0-28-g4aa9f05/ag-2018-01-25_2.1.0-28-g4aa9f05-x64.zip +call unzip %USERPROFILE%/Downloads/ag.zip EXIT /B ::goto :eof和 EXIT /B 都能返回到之前的call里 但是是不会返回到start里 diff --git a/proxy.sh b/proxy.sh index 2d91a7c..719f318 100755 --- a/proxy.sh +++ b/proxy.sh @@ -38,3 +38,8 @@ go get -u golang.org/x/tools/cmd/guru go get -u github.com/josharian/impl go get -u github.com/dominikh/go-tools/cmd/keyify go get -u github.com/fatih/motion + +#tools +sudo apt-get install silversearcher-ag +sudo yum install the_silver_searcher +brew install the_silver_searcher \ No newline at end of file From 6378f008da390f48aacc57beba23e87d77265d29 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 19:35:31 +0800 Subject: [PATCH 118/171] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E5=85=A5plu?= =?UTF-8?q?g.vim=20=E4=B8=8D=E7=84=B6=E5=BD=B1=E5=93=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=92=8C=E6=8B=89=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- autoload/plug.vim | 2504 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2505 insertions(+), 2 deletions(-) create mode 100644 autoload/plug.vim diff --git a/.gitignore b/.gitignore index 6734b01..42decf9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ plugged/ node_modules/ *.swp -init.vim -autoload/ \ No newline at end of file +init.vim \ No newline at end of file diff --git a/autoload/plug.vim b/autoload/plug.vim new file mode 100644 index 0000000..9ebcf53 --- /dev/null +++ b/autoload/plug.vim @@ -0,0 +1,2504 @@ +" vim-plug: Vim plugin manager +" ============================ +" +" Download plug.vim and put it in ~/.vim/autoload +" +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" +" Edit your .vimrc +" +" call plug#begin('~/.vim/plugged') +" +" " Make sure you use single quotes +" +" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align +" Plug 'junegunn/vim-easy-align' +" +" " Any valid git URL is allowed +" Plug 'https://github.com/junegunn/vim-github-dashboard.git' +" +" " Multiple Plug commands can be written in a single line using | separators +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" +" " On-demand loading +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } +" +" " Using a non-master branch +" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } +" +" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) +" Plug 'fatih/vim-go', { 'tag': '*' } +" +" " Plugin options +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } +" +" " Plugin outside ~/.vim/plugged with post-update hook +" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +" +" " Unmanaged plugin (manually installed and updated) +" Plug '~/my-prototype-plugin' +" +" " Initialize plugin system +" call plug#end() +" +" Then reload .vimrc and :PlugInstall to install plugins. +" +" Plug options: +" +"| Option | Description | +"| ----------------------- | ------------------------------------------------ | +"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | +"| `rtp` | Subdirectory that contains Vim plugin | +"| `dir` | Custom directory for the plugin | +"| `as` | Use different name for the plugin | +"| `do` | Post-update hook (string or funcref) | +"| `on` | On-demand loading: Commands or ``-mappings | +"| `for` | On-demand loading: File types | +"| `frozen` | Do not update unless explicitly specified | +" +" More information: https://github.com/junegunn/vim-plug +" +" +" Copyright (c) 2017 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') || has('win64') +let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) +let s:vim8 = has('patch-8.0.0039') && exists('*job_start') +let s:me = resolve(expand(':p')) +let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(fnamemodify(expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp + return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call plug#() + if !executable('git') + return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) + command! -nargs=0 -bar -bang PlugClean call s:clean(0) + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:glob(from, pattern) + return s:lines(globpath(a:from, a:pattern)) +endfunction + +function! s:source(from, ...) + let found = 0 + for pattern in a:000 + for vim in s:glob(a:from, pattern) + execute 'source' s:esc(vim) + let found = 1 + endfor + endfor + return found +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! s:ask(message, ...) + call inputsave() + echohl WarningMsg + let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) + echohl None + call inputrestore() + echo "\r" + return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 +endfunction + +function! s:ask_no_interrupt(...) + try + return call('s:ask', a:000) + catch + return 0 + endtry +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('Call plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + if exists('g:did_load_filetypes') + filetype off + endif + for name in g:plugs_order + if !has_key(g:plugs, name) + continue + endif + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~# '^[A-Z]' + let cmd = substitute(cmd, '!*$', '', '') + if exists(':'.cmd) != 2 + call s:assoc(lod.cmd, cmd, name) + endif + call add(s:triggers[name].cmd, cmd) + else + call s:err('Invalid `on` option: '.cmd. + \ '. Should start with an uppercase letter or ``.') + endif + endfor + endif + + if has_key(plug, 'for') + let types = s:to_a(plug.for) + if !empty(types) + augroup filetypedetect + call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') + augroup END + endif + for type in types + call s:assoc(lod.ft, type, name) + endfor + endif + endfor + + for [cmd, names] in items(lod.cmd) + execute printf( + \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', + \ cmd, string(cmd), string(names)) + endfor + + for [map, names] in items(lod.map) + for [mode, map_prefix, key_prefix] in + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + execute printf( + \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) + endfor + endfor + + for [ft, names] in items(lod.ft) + augroup PlugLOD + execute printf('autocmd FileType %s call lod_ft(%s, %s)', + \ ft, string(ft), string(names)) + augroup END + endfor + + call s:reorg_rtp() + filetype plugin indent on + if has('vim_starting') + if has('syntax') && !exists('g:syntax_on') + syntax enable + end + else + call s:reload_plugins() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:load_plugin(spec) + call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') +endfunction + +function! s:reload_plugins() + for name in s:loaded_names() + call s:load_plugin(g:plugs[name]) + endfor +endfunction + +function! s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function! s:version_requirement(val, min) + for idx in range(0, len(a:min) - 1) + let v = get(a:val, idx, 0) + if v < a:min[idx] | return 0 + elseif v > a:min[idx] | return 1 + endif + endfor + return 1 +endfunction + +function! s:git_version_requirement(...) + if !exists('s:git_version') + let s:git_version = map(split(split(s:system('git --version'))[2], '\.'), 'str2nr(v:val)') + endif + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom '[vim-plug] '.a:msg + echohl None +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! s:doautocmd(...) + if exists('#'.join(a:000, '#')) + execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) + endif +endfunction + +function! s:dobufread(names) + for name in a:names + let path = s:rtp(g:plugs[name]).'/**' + for dir in ['ftdetect', 'ftplugin'] + if len(finddir(dir, path)) + if exists('#BufRead') + doautocmd BufRead + endif + return + endif + endfor + endfor +endfunction + +function! plug#load(...) + if a:0 == 0 + return s:err('Argument missing: plugin name(s) required') + endif + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000 + let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)') + if !empty(unknowns) + let s = len(unknowns) > 1 ? 's' : '' + return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) + end + let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)') + if !empty(unloaded) + for name in unloaded + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(unloaded) + return 1 + end + return 0 +endfunction + +function! s:remove_triggers(name) + if !has_key(s:triggers, a:name) + return + endif + for cmd in s:triggers[a:name].cmd + execute 'silent! delc' cmd + endfor + for map in s:triggers[a:name].map + execute 'silent! unmap' map + execute 'silent! iunmap' map + endfor + call remove(s:triggers, a:name) +endfunction + +function! s:lod(names, types, ...) + for name in a:names + call s:remove_triggers(name) + let s:loaded[name] = 1 + endfor + call s:reorg_rtp() + + for name in a:names + let rtp = s:rtp(g:plugs[name]) + for dir in a:types + call s:source(rtp, dir.'/**/*.vim') + endfor + if a:0 + if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) + execute 'runtime' a:1 + endif + call s:source(rtp, a:2) + endif + call s:doautocmd('User', name) + endfor +endfunction + +function! s:lod_ft(pat, names) + let syn = 'syntax/'.a:pat.'.vim' + call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) + execute 'autocmd! PlugLOD FileType' a:pat + call s:doautocmd('filetypeplugin', 'FileType') + call s:doautocmd('filetypeindent', 'FileType') +endfunction + +function! s:lod_cmd(cmd, bang, l1, l2, args, names) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) +endfunction + +function! s:lod_map(map, names, with_prefix, prefix) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + let extra = '' + while 1 + let c = getchar(0) + if c == 0 + break + endif + let extra .= nr2char(c) + endwhile + + if a:with_prefix + let prefix = v:count ? v:count : '' + let prefix .= '"'.v:register.a:prefix + if mode(1) == 'no' + if v:operator == 'c' + let prefix = "\" . prefix + endif + let prefix .= v:operator + endif + call feedkeys(prefix, 'n') + endif + call feedkeys(substitute(a:map, '^', "\", '') . extra) +endfunction + +function! plug#(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo), opts) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == s:TYPE.string + let opts.tag = a:arg + elseif type == s:TYPE.dict + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } + endif +endfunction + +function! s:install(force, names) + call s:update_impl(0, a:force, a:names) +endfunction + +function! s:update(force, names) + call s:update_impl(1, a:force, a:names) +endfunction + +function! plug#helptags() + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + for spec in values(g:plugs) + let docd = join([s:rtp(spec), 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-/ + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ + syn match plugTag /(tag: [^)]\+)/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag + syn match plugEdge /^ \X\+$/ + syn match plugEdge /^ \X*/ contained nextgroup=plugSha + syn match plugSha /[0-9a-f]\{7,9}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ + syn match plugH2 /^.*:\n-\+$/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugH2 Type + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugDeleted Ignore + hi def link plugRelDate Comment + hi def link plugEdge PreProc + hi def link plugSha Identifier + hi def link plugTag Constant + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:finish_bindings() + nnoremap R :call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') +endfunction + +function! s:prepare(...) + if empty(getcwd()) + throw 'Invalid current working directory. Cannot proceed.' + endif + + for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] + if exists(evar) + throw evar.' detected. Cannot proceed.' + endif + endfor + + call s:job_abort() + if s:switch_in() + if b:plug_preview == 1 + pc + endif + enew + else + call s:new_window() + endif + + nnoremap q :if b:plug_preview==1pcendifbd + if a:0 == 0 + call s:finish_bindings() + endif + let b:plug_preview = -1 + let s:plug_tab = tabpagenr() + let s:plug_buf = winbufnr(0) + call s:assign_name() + + for k in ['', 'L', 'o', 'X', 'd', 'dd'] + execute 'silent! unmap ' k + endfor + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell + setf vim-plug + if exists('g:syntax_on') + call s:syntax() + endif +endfunction + +function! s:assign_name() + " Assign buffer name + let prefix = '[Plugins]' + let name = prefix + let idx = 2 + while bufexists(name) + let name = printf('%s (%s)', prefix, idx) + let idx = idx + 1 + endwhile + silent! execute 'f' fnameescape(name) +endfunction + +function! s:chsh(swap) + let prev = [&shell, &shellcmdflag, &shellredir] + if s:is_win + set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1 + elseif a:swap + set shell=sh shellredir=>%s\ 2>&1 + endif + return prev +endfunction + +function! s:bang(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(a:0) + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') + execute "normal! :execute g:_plug_bang\\" + finally + unlet g:_plug_bang + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + return v:shell_error ? 'Exit status: ' . v:shell_error : '' +endfunction + +function! s:regress_bar() + let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') + call s:progress_bar(2, bar, len(bar)) +endfunction + +function! s:is_updated(dir) + return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir)) +endfunction + +function! s:do(pull, force, todo) + for [name, spec] in items(a:todo) + if !isdirectory(spec.dir) + continue + endif + let installed = has_key(s:update.new, name) + let updated = installed ? 0 : + \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) + if a:force || installed || updated + execute 'cd' s:esc(spec.dir) + call append(3, '- Post-update hook for '. name .' ... ') + let error = '' + let type = type(spec.do) + if type == s:TYPE.string + if spec.do[0] == ':' + if !get(s:loaded, name, 0) + let s:loaded[name] = 1 + call s:reorg_rtp() + endif + call s:load_plugin(spec) + try + execute spec.do[1:] + catch + let error = v:exception + endtry + if !s:plug_window_exists() + cd - + throw 'Warning: vim-plug was terminated by the post-update hook of '.name + endif + else + let error = s:bang(spec.do) + endif + elseif type == s:TYPE.funcref + try + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + catch + let error = v:exception + endtry + else + let error = 'Invalid hook type' + endif + call s:switch_in() + call setline(4, empty(error) ? (getline(4) . 'OK') + \ : ('x' . getline(4)[1:] . error)) + if !empty(error) + call add(s:update.errors, name) + call s:regress_bar() + endif + cd - + endif + endfor +endfunction + +function! s:hash_match(a, b) + return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 +endfunction + +function! s:checkout(spec) + let sha = a:spec.commit + let output = s:system('git rev-parse HEAD', a:spec.dir) + if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) + let output = s:system( + \ 'git fetch --depth 999999 && git checkout '.s:esc(sha).' --', a:spec.dir) + endif + return output +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') | 4 + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) + call add(msgs, "Press 'D' to see the updated changes.") + endif + echo join(msgs, ' ') + call s:finish_bindings() +endfunction + +function! s:retry() + if empty(s:update.errors) + return + endif + echo + call s:update_impl(s:update.pull, s:update.force, + \ extend(copy(s:update.errors), [s:update.threads])) +endfunction + +function! s:is_managed(name) + return has_key(g:plugs[a:name], 'uri') +endfunction + +function! s:names(...) + return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) +endfunction + +function! s:check_ruby() + silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") + if !exists('g:plug_ruby') + redraw! + return s:warn('echom', 'Warning: Ruby interface is broken') + endif + let ruby_version = split(g:plug_ruby, '\.') + unlet g:plug_ruby + return s:version_requirement(ruby_version, [1, 8, 7]) +endfunction + +function! s:update_impl(pull, force, args) abort + let sync = index(a:args, '--sync') >= 0 || has('vim_starting') + let args = filter(copy(a:args), 'v:val != "--sync"') + let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? + \ remove(args, -1) : get(g:, 'plug_threads', 16) + + let managed = filter(copy(g:plugs), 's:is_managed(v:key)') + let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : + \ filter(managed, 'index(args, v:key) >= 0') + + if empty(todo) + return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) + endif + + if !s:is_win && s:git_version_requirement(2, 3) + let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' + let $GIT_TERMINAL_PROMPT = 0 + for plug in values(todo) + let plug.uri = substitute(plug.uri, + \ '^https://git::@github\.com', 'https://github.com', '') + endfor + endif + + if !isdirectory(g:plug_home) + try + call mkdir(g:plug_home, 'p') + catch + return s:err(printf('Invalid plug directory: %s. '. + \ 'Try to call plug#begin with a valid directory', g:plug_home)) + endtry + endif + + if has('nvim') && !exists('*jobwait') && threads > 1 + call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') + endif + + let use_job = s:nvim || s:vim8 + let python = (has('python') || has('python3')) && !use_job + let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare(1) + call append(0, ['', '']) + normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + + if has('win32unix') + let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input' + endif + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 + redir => pyv + silent python import platform; print platform.python_version() + redir END + let python = s:version_requirement( + \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) + endif + + if (python || ruby) && s:update.threads > 1 + try + let imd = &imd + if s:mac_gui + set noimd + endif + if ruby + call s:update_ruby() + else + call s:update_python() + endif + catch + let lines = getline(4, '$') + let printed = {} + silent! 4,$d _ + for line in lines + let name = s:extract_name(line, '.', '') + if empty(name) || !has_key(printed, name) + call append('$', line) + if !empty(name) + let printed[name] = 1 + if line[0] == 'x' && index(s:update.errors, name) < 0 + call add(s:update.errors, name) + end + endif + endif + endfor + finally + let &imd = imd + call s:update_finish() + endtry + else + call s:update_vim() + while use_job && sync + sleep 100m + if s:update.fin + break + endif + endwhile + endif +endfunction + +function! s:log4(name, msg) + call setline(4, printf('- %s (%s)', a:msg, a:name)) + redraw +endfunction + +function! s:update_finish() + if exists('s:git_terminal_prompt') + let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt + endif + if s:switch_in() + call append(3, '- Updating ...') | 4 + for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))')) + let [pos, _] = s:logpos(name) + if !pos + continue + endif + if has_key(spec, 'commit') + call s:log4(name, 'Checking out '.spec.commit) + let out = s:checkout(spec) + elseif has_key(spec, 'tag') + let tag = spec.tag + if tag =~ '\*' + let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir)) + if !v:shell_error && !empty(tags) + let tag = tags[0] + call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) + call append(3, '') + endif + endif + call s:log4(name, 'Checking out '.tag) + let out = s:system('git checkout -q '.s:esc(tag).' -- 2>&1', spec.dir) + else + let branch = s:esc(get(spec, 'branch', 'master')) + call s:log4(name, 'Merging origin/'.branch) + let out = s:system('git checkout -q '.branch.' -- 2>&1' + \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) + endif + if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && + \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) + call s:log4(name, 'Updating submodules. This may take a while.') + let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) + endif + let msg = s:format_message(v:shell_error ? 'x': '-', name, out) + if v:shell_error + call add(s:update.errors, name) + call s:regress_bar() + silent execute pos 'd _' + call append(4, msg) | 4 + elseif !empty(out) + call setline(pos, msg[0]) + endif + redraw + endfor + silent 4 d _ + try + call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) + catch + call s:warn('echom', v:exception) + call s:warn('echo', '') + return + endtry + call s:finish(s:update.pull) + call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') + call s:switch_out('normal! gg') + endif +endfunction + +function! s:job_abort() + if (!s:nvim && !s:vim8) || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + if s:nvim + silent! call jobstop(j.jobid) + elseif s:vim8 + silent! call job_stop(j.jobid) + endif + if j.new + call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) + endif + endfor + let s:jobs = {} +endfunction + +function! s:last_non_empty_line(lines) + let len = len(a:lines) + for idx in range(len) + let line = a:lines[len-idx-1] + if !empty(line) + return line + endif + endfor + return '' +endfunction + +function! s:job_out_cb(self, data) abort + let self = a:self + let data = remove(self.lines, -1) . a:data + let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') + call extend(self.lines, lines) + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if !self.running || self.tick % len(s:jobs) == 0 + let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') + let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) + call s:log(bullet, self.name, result) + endif +endfunction + +function! s:job_exit_cb(self, data) abort + let a:self.running = 0 + let a:self.error = a:data != 0 + call s:reap(a:self.name) + call s:tick() +endfunction + +function! s:job_cb(fn, job, ch, data) + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + call call(a:fn, [a:job, a:data]) +endfunction + +function! s:nvim_cb(job_id, data, event) dict abort + return a:event == 'stdout' ? + \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : + \ s:job_cb('s:job_exit_cb', self, 0, a:data) +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], + \ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '', + \ 'new': get(a:opts, 'new', 0) } + let s:jobs[a:name] = job + let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd + if !empty(job.batchfile) + call writefile(['@echo off', cmd], job.batchfile) + let cmd = job.batchfile + endif + let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) + + if s:nvim + call extend(job, { + \ 'on_stdout': function('s:nvim_cb'), + \ 'on_exit': function('s:nvim_cb'), + \ }) + let jid = jobstart(argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = [jid < 0 ? argv[0].' is not executable' : + \ 'Invalid arguments (or job table is full)'] + endif + elseif s:vim8 + let jid = job_start(s:is_win ? join(argv, ' ') : argv, { + \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), + \ 'out_mode': 'raw' + \}) + if job_status(jid) == 'run' + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = ['Failed to start job'] + endif + else + let job.lines = s:lines(call('s:system', [cmd])) + let job.error = v:shell_error != 0 + let job.running = 0 + endif +endfunction + +function! s:reap(name) + let job = s:jobs[a:name] + if job.error + call add(s:update.errors, a:name) + elseif get(job, 'new', 0) + let s:update.new[a:name] = 1 + endif + let s:update.bar .= job.error ? 'x' : '=' + + let bullet = job.error ? 'x' : '-' + let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) + call s:log(bullet, a:name, empty(result) ? 'OK' : result) + call s:bar() + + if has_key(job, 'batchfile') && !empty(job.batchfile) + call delete(job.batchfile) + endif + call remove(s:jobs, a:name) +endfunction + +function! s:bar() + if s:switch_in() + let total = len(s:update.all) + call setline(1, (s:update.pull ? 'Updating' : 'Installing'). + \ ' plugins ('.len(s:update.bar).'/'.total.')') + call s:progress_bar(2, s:update.bar, total) + call s:switch_out() + endif +endfunction + +function! s:logpos(name) + for i in range(4, line('$')) + if getline(i) =~# '^[-+x*] '.a:name.':' + for j in range(i + 1, line('$')) + if getline(j) !~ '^ ' + return [i, j - 1] + endif + endfor + return [i, i] + endif + endfor + return [0, 0] +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let [b, e] = s:logpos(a:name) + if b > 0 + silent execute printf('%d,%d d _', b, e) + if b > winheight('.') + let b = 4 + endif + else + let b = 4 + endif + " FIXME For some reason, nomodifiable is set after :d in vim8 + setlocal modifiable + call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) + call s:switch_out() + endif +endfunction + +function! s:update_vim() + let s:jobs = {} + + call s:bar() + call s:tick() +endfunction + +function! s:tick() + let pull = s:update.pull + let prog = s:progress_opt(s:nvim || s:vim8) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + call s:update_finish() + let s:update.fin = 1 + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = !isdirectory(spec.dir) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + if !new + let [error, _] = s:git_validate(spec, 0) + if empty(error) + if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' + call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } + endif + else + call s:spawn(name, + \ printf('git clone %s %s %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, + \ prog, + \ s:shellesc(spec.uri), + \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python') ? 'python' : 'python3' +execute py_exe "<< EOF" +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_IS_WIN = vim.eval('s:is_win') == '1' + +class PlugError(Exception): + def __init__(self, msg): + self.msg = msg +class CmdTimedOut(PlugError): + pass +class CmdFailed(PlugError): + pass +class InvalidURI(PlugError): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def __where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + msg.extend([' ' + line for line in rest]) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self.__where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + CD = 'cd /d' if G_IS_WIN else 'cd' + + def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): + self.cmd = cmd + if cmd_dir: + self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) + self.timeout = timeout + self.callback = cb if cb else (lambda msg: None) + self.clean = clean if clean else (lambda: None) + self.proc = None + + @property + def alive(self): + """ Returns true only if command still running. """ + return self.proc and self.proc.poll() is None + + def execute(self, ntries=3): + """ Execute the command with ntries if CmdTimedOut. + Returns the output of the command if no Exception. + """ + attempt, finished, limit = 0, False, self.timeout + + while not finished: + try: + attempt += 1 + result = self.try_command() + finished = True + return result + except CmdTimedOut: + if attempt != ntries: + self.notify_retry() + self.timeout += limit + else: + raise + + def notify_retry(self): + """ Retry required for command, notify user. """ + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.callback(['Retrying ...']) + + def try_command(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + first_line = True + + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b') + preexec_fn = not G_IS_WIN and os.setsid or None + self.proc = subprocess.Popen(self.cmd, stdout=tfile, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, shell=True, + preexec_fn=preexec_fn) + thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) + thrd.start() + + thread_not_started = True + while thread_not_started: + try: + thrd.join(0.1) + thread_not_started = False + except RuntimeError: + pass + + while self.alive: + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = '' if G_IS_WIN else nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + thrd.join(0.5) + + tfile.seek(0) + result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] + + if self.proc.returncode != 0: + raise CmdFailed([''] + result) + + return result + except: + self.terminate() + raise + + def terminate(self): + """ Terminate process and cleanup. """ + if self.alive: + if G_IS_WIN: + os.kill(self.proc.pid, signal.SIGINT) + else: + os.killpg(self.proc.pid, signal.SIGTERM) + self.clean() + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + self.tag = args.get('tag', 0) + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except PlugError as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + if target[-1] == '\\': + target = target[0:-1] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], + esc(target)) + com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT,) + result = command.execute(G_RETRIES) + return result[-1] + + def update(self): + actual_uri = self.repo_uri() + expect_uri = self.args['uri'] + regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') + ma = regex.match(actual_uri) + mb = regex.match(expect_uri) + if ma is None or mb is None or ma.groups() != mb.groups(): + msg = ['', + 'Invalid URI: {0}'.format(actual_uri), + 'Expected {0}'.format(expect_uri), + 'PlugClean required.'] + raise InvalidURI(msg) + + if G_PULL: + self.write(Action.UPDATE, self.name, ['Updating ...']) + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) + com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + else: + self.write(Action.DONE, self.name, ['Already installed']) + + def write(self, action, name, msg): + self.buf_q.put((action, name, msg)) + +class PlugThread(thr.Thread): + def __init__(self, tname, args): + super(PlugThread, self).__init__() + self.tname = tname + self.args = args + + def run(self): + thr.current_thread().name = self.tname + buf_q, work_q, lock = self.args + + try: + while not G_STOP.is_set(): + name, args = work_q.get_nowait() + plug = Plugin(name, args, buf_q, lock) + plug.manage() + work_q.task_done() + except queue.Empty: + pass + +class RefreshThread(thr.Thread): + def __init__(self, lock): + super(RefreshThread, self).__init__() + self.lock = lock + self.running = True + + def run(self): + while self.running: + with self.lock: + thread_vim_command('noautocmd normal! a') + time.sleep(0.33) + + def stop(self): + self.running = False + +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + +def esc(name): + return '"' + name.replace('"', '\"') + '"' + +def nonblock_read(fname): + """ Read a file with nonblock flag. Return the last line. """ + fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) + buf = os.read(fread, 100000).decode('utf-8', 'replace') + os.close(fread) + + line = buf.rstrip('\r\n') + left = max(line.rfind('\r'), line.rfind('\n')) + if left != -1: + left += 1 + line = line[left:] + + return line + +def main(): + thr.current_thread().name = 'main' + nthreads = int(vim.eval('s:update.threads')) + plugs = vim.eval('s:update.todo') + mac_gui = vim.eval('s:mac_gui') == '1' + + lock = thr.Lock() + buf = Buffer(lock, len(plugs), G_PULL) + buf_q, work_q = queue.Queue(), queue.Queue() + for work in plugs.items(): + work_q.put(work) + + start_cnt = thr.active_count() + for num in range(nthreads): + tname = 'PlugT-{0:02}'.format(num) + thread = PlugThread(tname, (buf_q, work_q, lock)) + thread.start() + if mac_gui: + rthread = RefreshThread(lock) + rthread.start() + + while not buf_q.empty() or thr.active_count() != start_cnt: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, ['OK'] if not msg else msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + + if mac_gui: + rthread.stop() + rthread.join() + +main() +EOF +endfunction + +function! s:update_ruby() + ruby << EOF + module PlugStream + SEP = ["\r", "\n", nil] + def get_line + buffer = '' + loop do + char = readchar rescue return + if SEP.include? char.chr + buffer << $/ + break + else + buffer << char + end + end + buffer + end + end unless defined?(PlugStream) + + def esc arg + %["#{arg.gsub('"', '\"')}"] + end + + def killall pid + pids = [pid] + if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM + pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } + else + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + end + + def compare_git_uri a, b + regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} + regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) + end + + require 'thread' + require 'fileutils' + require 'timeout' + running = true + iswin = VIM::evaluate('s:is_win').to_i == 1 + pull = VIM::evaluate('s:update.pull').to_i == 1 + base = VIM::evaluate('g:plug_home') + all = VIM::evaluate('s:update.todo') + limit = VIM::evaluate('get(g:, "plug_timeout", 60)') + tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 + nthr = VIM::evaluate('s:update.threads').to_i + maxy = VIM::evaluate('winheight(".")').to_i + vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ + cd = iswin ? 'cd /d' : 'cd' + tot = VIM::evaluate('len(s:update.todo)') || 0 + bar = '' + skip = 'Already installed' + mtx = Mutex.new + take1 = proc { mtx.synchronize { running && all.shift } } + logh = proc { + cnt = bar.length + $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" + $curbuf[2] = '[' + bar.ljust(tot) + ']' + VIM::command('normal! 2G') + VIM::command('redraw') + } + where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } + log = proc { |name, result, type| + mtx.synchronize do + ing = ![true, false].include?(type) + bar += type ? '=' : 'x' unless ing + b = case type + when :install then '+' when :update then '*' + when true, nil then '-' else + VIM::command("call add(s:update.errors, '#{name}')") + 'x' + end + result = + if type || type.nil? + ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] + elsif result =~ /^Interrupted|^Timeout/ + ["#{b} #{name}: #{result}"] + else + ["#{b} #{name}"] + result.lines.map { |l| " " << l } + end + if lnum = where.call(name) + $curbuf.delete lnum + lnum = 4 if ing && lnum > maxy + end + result.each_with_index do |line, offset| + $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) + end + logh.call + end + } + bt = proc { |cmd, name, type, cleanup| + tried = timeout = 0 + begin + tried += 1 + timeout += limit + fd = nil + data = '' + if iswin + Timeout::timeout(timeout) do + tmp = VIM::evaluate('tempname()') + system("(#{cmd}) > #{tmp}") + data = File.read(tmp).chomp + File.unlink tmp rescue nil + end + else + fd = IO.popen(cmd).extend(PlugStream) + first_line = true + log_prob = 1.0 / nthr + while line = Timeout::timeout(timeout) { fd.get_line } + data << line + log.call name, line.chomp, type if name && (first_line || rand < log_prob) + first_line = false + end + fd.close + end + [$? == 0, data.chomp] + rescue Timeout::Error, Interrupt => e + if fd && !fd.closed? + killall fd.pid + fd.close + end + cleanup.call if cleanup + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end + [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] + end + } + main = Thread.current + threads = [] + watcher = Thread.new { + if vim7 + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + else + require 'io/console' # >= Ruby 1.9 + nil until IO.console.getch == 3.chr + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } unless vim7 + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, tag = pair.last.values_at *%w[dir uri tag] + exists = File.directory? dir + ok, result = + if exists + chdir = "#{cd} #{iswin ? dir : esc(dir)}" + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif !compare_git_uri(current_uri, uri) + [false, ["Invalid URI: #{current_uri}", + "Expected: #{uri}", + "PlugClean required."].join($/)] + else + if pull + log.call name, 'Updating ...', :update + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil + else + [true, skip] + end + end + else + d = esc dir.sub(%r{[\\/]+$}, '') + log.call name, 'Installing ...', :install + bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { + FileUtils.rm_rf dir + } + end + mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok + log.call name, result, ok + end + } if running + end + end + threads.each { |t| t.join rescue nil } + logh.call + refresh.kill if refresh + watcher.kill +EOF +endfunction + +function! s:shellesc_cmd(arg) + let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g') + let escaped = substitute(escaped, '%', '%%', 'g') + let escaped = substitute(escaped, '"', '\\^&', 'g') + let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g') + return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"' +endfunction + +function! s:shellesc(arg) + if &shell =~# 'cmd.exe$' + return s:shellesc_cmd(a:arg) + endif + return shellescape(a:arg) +endfunction + +function! s:glob_dir(path) + return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') +endfunction + +function! s:progress_bar(line, bar, total) + call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') +endfunction + +function! s:compare_git_uri(a, b) + " See `git help clone' + " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] + " [git@] github.com[:port] : junegunn/vim-plug [.git] + " file:// / junegunn/vim-plug [/] + " / junegunn/vim-plug [/] + let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' + let ma = matchlist(a:a, pat) + let mb = matchlist(a:b, pat) + return ma[1:2] ==# mb[1:2] +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) +endfunction + +function! s:system(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + return system(s:is_win ? '('.cmd.')' : cmd) + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_validate(spec, check_branch) + let err = '' + if isdirectory(a:spec.dir) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) + let remote = result[-1] + if v:shell_error + let err = join([remote, 'PlugClean required.'], "\n") + elseif !s:compare_git_uri(remote, a:spec.uri) + let err = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + elseif a:check_branch && has_key(a:spec, 'commit') + let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) + let sha = result[-1] + if v:shell_error + let err = join(add(result, 'PlugClean required.'), "\n") + elseif !s:hash_match(sha, a:spec.commit) + let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', + \ a:spec.commit[:6], sha[:6]), + \ 'PlugUpdate required.'], "\n") + endif + elseif a:check_branch + let branch = result[0] + " Check tag + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag && a:spec.tag !~ '\*' + let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + endif + " Check branch + elseif a:spec.branch !=# branch + let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ branch, a:spec.branch) + endif + if empty(err) + let [ahead, behind] = split(s:lastline(s:system(printf( + \ 'git rev-list --count --left-right HEAD...origin/%s', + \ a:spec.branch), a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ a:spec.branch, ahead) + endif + endif + endif + endif + else + let err = 'Not found' + endif + return [err, err =~# 'PlugClean'] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for invalid plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let errs = {} + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) + call add(dirs, spec.dir) + else + let [err, clean] = s:git_validate(spec, 1) + if clean + let errs[spec.dir] = s:lines(err)[0] + else + call add(dirs, spec.dir) + endif + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + if has_key(errs, f) + call append(line('$'), ' ' . errs[f]) + endif + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + 4 + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + let s:clean_count = 0 + call append(3, ['Directories to delete:', '']) + redraw! + if a:force || s:ask_no_interrupt('Delete all directories?') + call s:delete([6, line('$')], 1) + else + call setline(4, 'Cancelled.') + nnoremap d :set opfunc=delete_opg@ + nmap dd d_ + xnoremap d :call delete_op(visualmode(), 1) + echo 'Delete the lines (d{motion}) to delete the corresponding directories' + endif + endif + 4 + setlocal nomodifiable +endfunction + +function! s:delete_op(type, ...) + call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) +endfunction + +function! s:delete(range, force) + let [l1, l2] = a:range + let force = a:force + while l1 <= l2 + let line = getline(l1) + if line =~ '^- ' && isdirectory(line[2:]) + execute l1 + redraw! + let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) + let force = force || answer > 1 + if answer + call s:rm_rf(line[2:]) + setlocal modifiable + call setline(l1, '~'.line[1:]) + let s:clean_count += 1 + call setline(4, printf('Removed %d directories.', s:clean_count)) + setlocal nomodifiable + endif + endif + let l1 += 1 + endwhile +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + let is_dir = isdirectory(spec.dir) + if has_key(spec, 'uri') + if is_dir + let [err, _] = s:git_validate(spec, 1) + let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] + else + let [valid, msg] = [0, 'Not found. Try PlugInstall.'] + endif + else + if is_dir + let [valid, msg] = [1, 'OK'] + else + let [valid, msg] = [0, 'Not found.'] + endif + endif + let cnt += 1 + let ecnt += !valid + " `s:loaded` entry can be missing if PlugUpgraded + if is_dir && get(s:loaded, name, -1) == 0 + let unloaded = 1 + let msg .= ' (not loaded)' + endif + call s:progress_bar(2, repeat('=', cnt), total) + call append(3, s:format_message(valid ? '-' : 'x', name, msg)) + normal! 2G + redraw + endfor + call setline(1, 'Finished. '.ecnt.' error(s).') + normal! gg + setlocal nomodifiable + if unloaded + echo "Press 'L' on each line to load plugin, or 'U' to update" + nnoremap L :call status_load(line('.')) + xnoremap L :call status_load(line('.')) + end +endfunction + +function! s:extract_name(str, prefix, suffix) + return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') +endfunction + +function! s:status_load(lnum) + let line = getline(a:lnum) + let name = s:extract_name(line, '-', '(not loaded)') + if !empty(name) + call plug#load(name) + setlocal modifiable + call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) + setlocal nomodifiable + endif +endfunction + +function! s:status_update() range + let lines = getline(a:firstline, a:lastline) + let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') + if !empty(names) + echo + execute 'PlugUpdate' join(names) + endif +endfunction + +function! s:is_preview_window_open() + silent! wincmd P + if &previewwindow + wincmd p + return 1 + endif +endfunction + +function! s:find_name(lnum) + for lnum in reverse(range(1, a:lnum)) + let line = getline(lnum) + if empty(line) + return '' + endif + let name = s:extract_name(line, '-', '') + if !empty(name) + return name + endif + endfor + return '' +endfunction + +function! s:preview_commit() + if b:plug_preview < 0 + let b:plug_preview = !s:is_preview_window_open() + endif + + let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') + if empty(sha) + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) + return + endif + + if exists('g:plug_pwindow') && !s:is_preview_window_open() + execute g:plug_pwindow + execute 'e' sha + else + execute 'pedit' sha + wincmd P + endif + setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + execute 'silent %!' cmd + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:format_git_log(line) + let indent = ' ' + let tokens = split(a:line, nr2char(1)) + if len(tokens) != 5 + return indent.substitute(a:line, '\s*$', '', '') + endif + let [graph, sha, refs, subject, date] = tokens + let tag = matchstr(refs, 'tag: [^,)]\+') + let tag = empty(tag) ? ' ' : ' ('.tag.') ' + return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) +endfunction + +function! s:append_ul(lnum, text) + call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) +endfunction + +function! s:diff() + call s:prepare() + call append(0, ['Collecting changes ...', '']) + let cnts = [0, 0] + let bar = '' + let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') + call s:progress_bar(2, bar, len(total)) + for origin in [1, 0] + let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) + if empty(plugs) + continue + endif + call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') + for [k, v] in plugs + let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' + let diff = s:system_chomp('git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')), v.dir) + if !empty(diff) + let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' + call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) + let cnts[origin] += 1 + endif + let bar .= '=' + call s:progress_bar(2, bar, len(total)) + normal! 2G + redraw + endfor + if !cnts[origin] + call append(5, ['', 'N/A']) + endif + endfor + call setline(1, printf('%d plugin(s) updated.', cnts[0]) + \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) + + if cnts[0] || cnts[1] + nnoremap :silent! call preview_commit() + nnoremap o :silent! call preview_commit() + endif + if cnts[0] + nnoremap X :call revert() + echo "Press 'X' on each block to revert the update" + endif + normal! gg + setlocal nomodifiable +endfunction + +function! s:revert() + if search('^Pending updates', 'bnW') + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch).' --', g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted' +endfunction + +function! s:snapshot(force, ...) abort + call s:prepare() + setf vim + call append(0, ['" Generated by vim-plug', + \ '" '.strftime("%c"), + \ '" :source this file in vim to restore the snapshot', + \ '" or execute: vim -S snapshot.vim', + \ '', '', 'PlugUpdate!']) + 1 + let anchor = line('$') - 3 + let names = sort(keys(filter(copy(g:plugs), + \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + for name in reverse(names) + let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) + if !empty(sha) + call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = expand(a:1) + if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) + return + endif + call writefile(getline(1, '$'), fn) + echo 'Saved as '.a:1 + silent execute 'e' s:esc(fn) + setf vim + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@ Date: Thu, 15 Mar 2018 19:39:36 +0800 Subject: [PATCH 119/171] =?UTF-8?q?=E6=8A=8A=E4=BE=9D=E8=B5=96=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=8F=90=E5=88=B0=E5=BC=80=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 4 ++++ proxy.sh | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index bfdf35f..78d1b5f 100755 --- a/install.sh +++ b/install.sh @@ -9,6 +9,10 @@ lnif() { } +echo "Step0: install dependencies " +sudo apt-get install silversearcher-ag +sudo yum install the_silver_searcher +brew install the_silver_searcher echo "Step1: backing up current vim config" today=`date +%Y%m%d` diff --git a/proxy.sh b/proxy.sh index 719f318..02358fa 100755 --- a/proxy.sh +++ b/proxy.sh @@ -39,7 +39,3 @@ go get -u github.com/josharian/impl go get -u github.com/dominikh/go-tools/cmd/keyify go get -u github.com/fatih/motion -#tools -sudo apt-get install silversearcher-ag -sudo yum install the_silver_searcher -brew install the_silver_searcher \ No newline at end of file From 6de682a143d0ca96a72a455582b189d86b4f73ed Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 20:07:27 +0800 Subject: [PATCH 120/171] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BF=98=E8=A6=81=E5=BD=B1=E5=93=8D=E5=88=B0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=EF=BC=8C=E4=BD=86=E6=98=AF=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=9B=B4=E6=96=B0=E6=9C=89=E5=BC=82=E6=AD=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=B2=A1=E6=B3=95=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=8A=8Aplug.vim=E5=88=87=E6=8D=A2=E5=9B=9E?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=AC=E4=BC=9A=E6=9C=89=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=91=A2=EF=BC=8C=E4=B8=8D=E5=BE=97=E8=80=8C=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/vimrc b/config/vimrc index a5136ec..d3bd418 100644 --- a/config/vimrc +++ b/config/vimrc @@ -595,8 +595,17 @@ if !exists("*Update") let git_pull_job=job_start("git -C " . $HOME . "/vim-plug pull",{"out_cb":"SourceHandler","err_cb":"ErrHandler"}) endfunc else + "多个异步事件会引发问题,所以去掉 + "let plug_pull_job=job_start("vim +PlugInstall!",{"callback":"PlugHandler"}) + "AsyncRun vim +PlugInstall! echom "updated" endif +if !exists("*PlugHandler") +func PlugHandler(channel,msg) + echo "Plug" . a:msg +endfunc +endif + if !exists("*ErrHandler") func ErrHandler(channel,msg) echo "Err" . a:msg From 7d07773604d745f10c391adf110f700edda7c489 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 22:59:33 +0800 Subject: [PATCH 121/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86vue=E7=9A=84?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=AE=BE=E5=AE=9A=EF=BC=8C=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0install=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/eslintrc.json | 5 ++++- config/vimrc | 1 + install.bat | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/eslintrc.json b/config/eslintrc.json index 0716cf6..e31461a 100644 --- a/config/eslintrc.json +++ b/config/eslintrc.json @@ -11,8 +11,10 @@ "es6": true, "node": true }, - "extends": ["airbnb","eslint:recommended", "plugin:react/recommended"], + "extends": ["airbnb","eslint:recommended", "plugin:react/recommended", "plugin:vue/essential"], "parserOptions": { + "parser":"babel-eslint", + "ecmaVersion":2017, "ecmaFeatures": { "experimentalObjectRestSpread": true, "jsx": true @@ -21,6 +23,7 @@ }, "plugins": [ "babel", + "vue", "react", "react-native" ], diff --git a/config/vimrc b/config/vimrc index d3bd418..135c085 100644 --- a/config/vimrc +++ b/config/vimrc @@ -152,6 +152,7 @@ Plug 'chemzqm/wxapp.vim' "Plug 'ctrlpvim/ctrlp.vim' "用不了ack的命令,不知道为什么 "Plug 'mileszs/ack.vim' +Plug 'posva/vim-vue' call plug#end() diff --git a/install.bat b/install.bat index db684cf..3efe65d 100644 --- a/install.bat +++ b/install.bat @@ -55,4 +55,4 @@ call curl -fLo %USERPROFILE%/.vim/autoload/plug.vim --create-dirs https://raw.gi call vim +PlugInstall! +PlugClean! +qall call proxy.bat call vim -c "GoInstallBinaries" -c "qa" -call npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org +call npm i -g eslint eslint-plugin-vue eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org From 7ed4b53d838326277db5aaf6d4d34be556af0cb4 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 15 Mar 2018 23:00:48 +0800 Subject: [PATCH 122/171] =?UTF-8?q?sh=E4=B9=9F=E5=A2=9E=E5=8A=A0=E4=BA=86n?= =?UTF-8?q?pm=E7=9A=84=E5=8C=85=E7=9A=84=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 78d1b5f..7d1c5f3 100755 --- a/install.sh +++ b/install.sh @@ -47,5 +47,5 @@ vim +GoInstallBinaries! +qall echo "Step4: install eslint" echo "It will take a long time, just be patient!" echo "npm i -g eslint --registry=http://registry.npm.taobao.org" -npm i -g eslint eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org +npm i -g eslint eslint-plugin-vue eslint_d eslint-plugin-babel eslint-plugin-react eslint-plugin-react-native babel-eslint eslint-config-airbnb --registry=http://registry.npm.taobao.org echo "Install Done!" From 1cdfe7716ed4f618889d1640e08d89a5c6b0788a Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 16 Mar 2018 09:03:11 +0800 Subject: [PATCH 123/171] =?UTF-8?q?=E4=B8=8D=E6=B8=85=E6=A5=9Ats=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=85=B7=E4=BD=93=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/vimrc b/config/vimrc index 135c085..9b543c9 100644 --- a/config/vimrc +++ b/config/vimrc @@ -153,6 +153,10 @@ Plug 'chemzqm/wxapp.vim' "用不了ack的命令,不知道为什么 "Plug 'mileszs/ack.vim' Plug 'posva/vim-vue' +"微软typerscript支持,高亮 +Plug 'leafgarland/typescript-vim' +"ts的功能插件 +Plug 'Quramy/tsuquyomi' call plug#end() From 75ced3e9b586e95ef1ba83e5cbbabb5ed8f9876d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 16 Mar 2018 09:05:53 +0800 Subject: [PATCH 124/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=8B=89?= =?UTF-8?q?=E5=8F=96=E7=9A=84=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 9b543c9..73927bf 100644 --- a/config/vimrc +++ b/config/vimrc @@ -398,7 +398,7 @@ nmap nnoremap gca :Gcommit -a -v "nnoremap gp :Gpush "git push 这步阻塞太痛苦了,改成异步的 -nnoremap gpl :AsyncRun git pull +nnoremap gl :AsyncRun git pull nnoremap gp :AsyncRun git push "当有消息时自动弹出消息窗 augroup vimrc From d3dc006669e6172f75596d513ff9c469957aae12 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 16 Mar 2018 09:49:04 +0800 Subject: [PATCH 125/171] try to support nvim jobstart --- config/vimrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/config/vimrc b/config/vimrc index a5136ec..72dfd87 100644 --- a/config/vimrc +++ b/config/vimrc @@ -580,6 +580,26 @@ augroup autoupdate "------------------------------------------------------- if has("job") autocmd VimEnter * nested call Update() + elseif has("nvim") + function! s:OnEvent(job_id, data, event) dict + echom "nvim jobstart" + if a:event == 'stdout' + let str = self.shell.' stdout: '.join(a:data) + elseif a:event == 'stderr' + let str = self.shell.' stderr: '.join(a:data) + else + let str = self.shell.' exited' + endif + + call append(line('$'), str) + endfunction + let s:callbacks = { + \ 'on_stdout': function('s:OnEvent'), + \ 'on_stderr': function('s:OnEvent'), + \ 'on_exit': function('s:OnEvent') + \ } + "let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks)) + let job2 = jobstart(['bash', '-c', "git -C " . $HOME . "/vim-plug pull"], extend({'shell': 'shell 2'}, s:callbacks)) else autocmd VimEnter * nested call Fuck() endif @@ -664,3 +684,7 @@ let tern_show_signature_in_pum = 1 let tern_show_argument_hints = 'on_hold' autocmd FileType javascript setlocal omnifunc=tern#Complete autocmd FileType javascript nnoremap d :TernDef +shell 2 stderr: fatal: unable to access 'http://github.com/sherylynn/vim-plug/': Failed to connect to 127.0.0.1 port 10808: Connection refused +shell 2 stderr: +shell 2 stdout: +shell 2 exited From c2971242ea956d2dcdf1dcc402d53cfecd5e2cdb Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 16 Mar 2018 10:04:02 +0800 Subject: [PATCH 126/171] =?UTF-8?q?=E6=8A=8Anvim=E4=B8=8B=E5=BC=84?= =?UTF-8?q?=E9=94=99=E7=9A=84=E8=84=9A=E6=9C=AC=E6=90=9E=E9=94=99=E7=9A=84?= =?UTF-8?q?=E4=B8=9C=E8=A5=BF=E6=94=B9=E4=BA=86=E5=9B=9E=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 59c158f..9118467 100644 --- a/config/vimrc +++ b/config/vimrc @@ -698,7 +698,3 @@ let tern_show_signature_in_pum = 1 let tern_show_argument_hints = 'on_hold' autocmd FileType javascript setlocal omnifunc=tern#Complete autocmd FileType javascript nnoremap d :TernDef -shell 2 stderr: fatal: unable to access 'http://github.com/sherylynn/vim-plug/': Failed to connect to 127.0.0.1 port 10808: Connection refused -shell 2 stderr: -shell 2 stdout: -shell 2 exited From dd8c7fbb41822b0e595074e58524e8faf6114ed8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 16 Mar 2018 16:27:54 +0800 Subject: [PATCH 127/171] =?UTF-8?q?=E6=8A=8Anvim=E7=9A=84=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=85=BC=E5=AE=B9=E9=83=A8=E5=88=86=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E8=BF=98=E6=98=AF=E5=85=88=E7=94=A8=E8=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E5=90=8C=E6=AD=A5=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 9118467..b4235ce 100644 --- a/config/vimrc +++ b/config/vimrc @@ -585,7 +585,7 @@ augroup autoupdate "------------------------------------------------------- if has("job") autocmd VimEnter * nested call Update() - elseif has("nvim") + elseif has("nvim#还没兼容好") function! s:OnEvent(job_id, data, event) dict echom "nvim jobstart" if a:event == 'stdout' @@ -604,7 +604,7 @@ augroup autoupdate \ 'on_exit': function('s:OnEvent') \ } "let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks)) - let job2 = jobstart(['bash', '-c', "git -C " . $HOME . "/vim-plug pull"], extend({'shell': 'shell 2'}, s:callbacks)) + let job2 = jobstart(["git -C " . $HOME . "/vim-plug pull"], extend({'shell': 'shell 2'}, s:callbacks)) else autocmd VimEnter * nested call Fuck() endif From d735ae60332fa78783023135c0aa84424a7e1796 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sat, 17 Mar 2018 01:12:03 +0800 Subject: [PATCH 128/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=BD=A9?= =?UTF-8?q?=E8=99=B9=E6=8B=AC=E5=8F=B7=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86markdown=E5=85=BC=E5=AE=B9,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E4=B8=AA=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=9A=84?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/config/vimrc b/config/vimrc index b4235ce..1bdaa87 100644 --- a/config/vimrc +++ b/config/vimrc @@ -70,8 +70,8 @@ Plug 'tomasr/molokai' Plug 'lifepillar/vim-solarized8' "Plug 'PDV--phpDocumentor-for-Vim' - -Plug 'https://github.com/luofei614/html5css3.git' +"注释看看会不会影响到markdown +"Plug 'https://github.com/luofei614/html5css3.git' "bookmark mm 添加书签, mn 移动书签 mp 移动到前一个书签 ma 删除所有书签 Plug 'MattesGroeger/vim-bookmarks' @@ -157,6 +157,10 @@ Plug 'posva/vim-vue' Plug 'leafgarland/typescript-vim' "ts的功能插件 Plug 'Quramy/tsuquyomi' +"彩虹括号 +Plug 'luochen1990/rainbow' +"markdown +Plug 'tpope/vim-markdown' call plug#end() @@ -182,7 +186,8 @@ let g:acp_behaviorKeywordCommand="\" let g:NERDTreeWinSize = 20 let g:tagbar_width=20 - +"彩虹括号开启 +let g:rainbow_active = 1 "颜色主题设置 From e8d81d082f8acb4e65a9d7fbe9dd06b5b3b5d471 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sat, 17 Mar 2018 13:06:46 +0800 Subject: [PATCH 129/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86leader+5?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=EF=BC=8C=E4=BD=BF=E5=BE=97=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=BF=9B=E5=85=A5vim-plug=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9B=B4=E6=8E=A5=E4=BF=AE=E6=94=B9=E5=90=8E?= =?UTF-8?q?git=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 1bdaa87..8c9a300 100644 --- a/config/vimrc +++ b/config/vimrc @@ -186,6 +186,8 @@ let g:acp_behaviorKeywordCommand="\" let g:NERDTreeWinSize = 20 let g:tagbar_width=20 +"自动打开nerdtree +"autocmd vimenter * NERDTree "彩虹括号开启 let g:rainbow_active = 1 "颜色主题设置 @@ -562,8 +564,14 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k nmap p (Gpush) "F5 刷新编辑器 nmap :source% +if !exists("*Edit_vim_plug") +func Edit_vim_plug() + :cd $HOME/vim-plug + :edit $HOME/vim-plug/config/vimrc +endfunc +endif "leader+5 编辑vimrc -map 5 :edit $MYVIMRC +map 5 :call Edit_vim_plug() "source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 if !exists("*Fuck") function! Fuck() From ff988a4b32d1a4d9f7f4c4c90780e31b3496c9a3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sat, 17 Mar 2018 13:42:12 +0800 Subject: [PATCH 130/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BA=9B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=E5=8C=96=E5=92=8C=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=8E=92=E7=89=88=E8=A7=84=E8=8C=83=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/vimrc b/config/vimrc index 8c9a300..6eee1ac 100644 --- a/config/vimrc +++ b/config/vimrc @@ -161,6 +161,10 @@ Plug 'Quramy/tsuquyomi' Plug 'luochen1990/rainbow' "markdown Plug 'tpope/vim-markdown' +"formate js +Plug 'prettier/vim-prettier', { 'do': 'npm install' } +"中文排版规范化用法 :PanGu +Plug 'hotoo/pangu.vim' call plug#end() From 098b5da56d014bcc24f17de12a0e30c4b5aa0d2c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 12:08:03 +0800 Subject: [PATCH 131/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=AA?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E7=9A=84=E8=A1=A5=E5=85=A8=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E7=9C=8B=E8=B5=B7=E6=9D=A5=E6=88=91=E7=9A=84vim?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81python3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/vimrc b/config/vimrc index 6eee1ac..6a12e3f 100644 --- a/config/vimrc +++ b/config/vimrc @@ -165,6 +165,17 @@ Plug 'tpope/vim-markdown' Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu Plug 'hotoo/pangu.vim' +"异步补全,需要python3 +if has("python3") +if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +else + Plug 'Shougo/deoplete.nvim' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' +endif +let g:deoplete#enable_at_startup = 1 +endif call plug#end() From 81dc103d3cb0788f2b07cb1c2573db2b77b81d95 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 13:14:21 +0800 Subject: [PATCH 132/171] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E6=9C=89?= =?UTF-8?q?=E7=96=91=E9=97=AE=EF=BC=8C=E5=85=88=E6=B3=A8=E9=94=80=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=8F=90=E7=A4=BA=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/vimrc b/config/vimrc index 6a12e3f..4f1b10d 100644 --- a/config/vimrc +++ b/config/vimrc @@ -166,16 +166,16 @@ Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu Plug 'hotoo/pangu.vim' "异步补全,需要python3 -if has("python3") -if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' -endif -let g:deoplete#enable_at_startup = 1 -endif +"if has("python3") +"if has('nvim') +" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +"else +" Plug 'Shougo/deoplete.nvim' +" Plug 'roxma/nvim-yarp' +" Plug 'roxma/vim-hug-neovim-rpc' +"endif +"let g:deoplete#enable_at_startup = 1 +"endif call plug#end() From 104904fa15c3f9f027fefaa75fdbb28ebf368572 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 13:31:23 +0800 Subject: [PATCH 133/171] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=8A=A0=E5=85=A5npm=E7=9A=84=E5=91=BD=E4=BB=A4=EF=BC=8C?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E6=98=AF=E6=A0=B9=E6=8D=AE=E7=BC=96=E8=BE=91?= =?UTF-8?q?js=E4=B8=8E=E5=90=A6=E6=89=93=E5=BC=80=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/vimrc b/config/vimrc index 4f1b10d..6fa0d7c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -675,6 +675,13 @@ augroup gocmd autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) augroup END +augroup jscmd + autocmd FileType javascript nmap t :AsyncRun npm test + autocmd FileType javascript nmap b :AsyncRun npm run build + autocmd FileType javascript nmap r :AsyncRun npm run start + autocmd FileType javascript nmap d :asyncrun npm run dev +augroup END + "状态栏改变 "set statusline+=%#warningmsg# From f6cea599c7163b14f2613c1a87664bd78224089d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 14:29:01 +0800 Subject: [PATCH 134/171] =?UTF-8?q?=E6=B3=A8=E9=94=80=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 6fa0d7c..52e3f95 100644 --- a/config/vimrc +++ b/config/vimrc @@ -732,4 +732,5 @@ map g# (incsearch-nohl-g#) let tern_show_signature_in_pum = 1 let tern_show_argument_hints = 'on_hold' autocmd FileType javascript setlocal omnifunc=tern#Complete -autocmd FileType javascript nnoremap d :TernDef +"不晓得什么用,先注销 +"autocmd FileType javascript nnoremap d :TernDef From fdbec9e47a69b62b31d35bc605362ab28e8acaa3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 14:33:30 +0800 Subject: [PATCH 135/171] =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 52e3f95..8dcf670 100644 --- a/config/vimrc +++ b/config/vimrc @@ -679,7 +679,7 @@ augroup jscmd autocmd FileType javascript nmap t :AsyncRun npm test autocmd FileType javascript nmap b :AsyncRun npm run build autocmd FileType javascript nmap r :AsyncRun npm run start - autocmd FileType javascript nmap d :asyncrun npm run dev + autocmd FileType javascript nmap d :Asyncrun npm run dev augroup END From 1a0956eafd9e7524f9913a27bdd56a769956371c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 18 Mar 2018 14:40:26 +0800 Subject: [PATCH 136/171] =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 8dcf670..37d82cd 100644 --- a/config/vimrc +++ b/config/vimrc @@ -679,7 +679,7 @@ augroup jscmd autocmd FileType javascript nmap t :AsyncRun npm test autocmd FileType javascript nmap b :AsyncRun npm run build autocmd FileType javascript nmap r :AsyncRun npm run start - autocmd FileType javascript nmap d :Asyncrun npm run dev + autocmd FileType javascript nmap d :AsyncRun npm run dev augroup END From 659c8adf20f3d4c9101cf13f4781e4bf35653eec Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 20 Mar 2018 20:08:48 +0800 Subject: [PATCH 137/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9gvim=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E7=8E=B0=E4=B8=BA=E6=8E=A5=E8=BF=91vim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/config/vimrc b/config/vimrc index 37d82cd..c3fa8cb 100644 --- a/config/vimrc +++ b/config/vimrc @@ -22,12 +22,12 @@ if has('win32') || has('win64') " Newer Windows files might contain utf-8 or utf-16 LE so we might " want to try them first. set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15,chines -set guifont=Consolas:h12 -"解决菜单乱码 -source $VIMRUNTIME/delmenu.vim -source $VIMRUNTIME/menu.vim -"解决consle输出乱码 -language messages zh_CN.utf-8 + set guifont=Consolas:h12 + "解决菜单乱码 + source $VIMRUNTIME/delmenu.vim + source $VIMRUNTIME/menu.vim + "解决consle输出乱码 + language messages zh_CN.utf-8 endif endif " } @@ -391,6 +391,7 @@ let g:multi_cursor_quit_key='' " 映射全选 ctrl+a "map ggVG +"窗口类--------------------------------------- "map! ggVG "快速关闭单个窗口 nmap q q @@ -401,6 +402,18 @@ nmap h nmap j nmap k nmap l +" 分割出的窗口 在下边或右边 +set splitbelow +set splitright +" gvim 不显示工具/菜单栏 +set guioptions-=T +set guioptions-=m +set guioptions-=L +set guioptions-=r +set guioptions-=b +" 使用内置tab样式而不是gui样式 +set guioptions-=e +set nolist " import emacs map imap imap From ec4c6da55310017ae0aa4cdd9b73c50e98f7b0be Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 20 Mar 2018 22:30:32 +0800 Subject: [PATCH 138/171] =?UTF-8?q?=E5=85=88=E7=94=A8tab=E9=94=AE=E5=81=9A?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E4=BA=9Btab=E7=9A=84=E6=98=A0=E5=B0=84?= =?UTF-8?q?=EF=BC=8C=E8=BF=98=E6=83=B3=E5=BC=95=E5=85=A5alt=E9=94=AE?= =?UTF-8?q?=E5=92=8Cleader=E9=94=AE=E5=81=9A=E6=95=B0=E5=AD=97=E7=9A=84?= =?UTF-8?q?=E5=AF=B9=E6=98=A0=EF=BC=8C=E4=BD=86=E6=98=AF=E4=B8=80=E6=96=B9?= =?UTF-8?q?=E9=9D=A2=E7=8E=B0=E5=9C=A8=E5=B7=B2=E7=BB=8F=E7=94=A8=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=95=B0=E5=AD=97=E9=94=AE=E7=BB=91=E4=BA=86?= =?UTF-8?q?leader=E4=BA=86=EF=BC=8C=E5=BE=97=E7=9C=8B=E7=9C=8B=E5=A6=82?= =?UTF-8?q?=E4=BD=95=E5=88=87=E6=8D=A2=EF=BC=8C=E5=8F=A6=E5=A4=96=E5=B0=B1?= =?UTF-8?q?=E6=98=AFalt=E5=9C=A8=E7=BB=88=E7=AB=AF=E7=9A=84=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E4=B8=8D=E6=80=8E=E4=B9=88=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index c3fa8cb..013e86c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -7,7 +7,8 @@ set nocompatible " Must be first line " across (heterogeneous) systems easier. if has('win32') || has('win64') set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after - + "禁用win下alt快捷键,只在gui下生效,不实用 + set winaltkeys=no " Be nice and check for multi_byte even if the config requires " multi_byte support most of the time if has("multi_byte") @@ -402,6 +403,12 @@ nmap h nmap j nmap k nmap l +"tab窗口的切换移动 +nmap h :tabp +nmap j :tabnew +nmap k :tabclose +nmap l :tabn +nmap :tabnext " 分割出的窗口 在下边或右边 set splitbelow set splitright From fd3a7a5f6110d709abc4238b2d3bf6bce314cde9 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 20 Mar 2018 23:24:21 +0800 Subject: [PATCH 139/171] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 013e86c..c5d8816 100644 --- a/config/vimrc +++ b/config/vimrc @@ -320,7 +320,7 @@ map :! ctags -R map! :! ctags -R "快捷键设置 - +"在tree中t就可以新建一个tab来编辑 nmap 3 :NERDTreeToggle "vim中的map中的!代表了插入模式和命令模式 "而在后两者的模式的输入中对空格本身的判断延时会影响使用 From 0976abb37bbf80f1aedc261f7c045a9e0362e841 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 00:36:32 +0800 Subject: [PATCH 140/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86markdown?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/vimrc b/config/vimrc index c5d8816..6304d09 100644 --- a/config/vimrc +++ b/config/vimrc @@ -162,6 +162,9 @@ Plug 'Quramy/tsuquyomi' Plug 'luochen1990/rainbow' "markdown Plug 'tpope/vim-markdown' +"markdown preview +Plug 'iamcco/mathjax-support-for-mkdp' +Plug 'iamcco/markdown-preview.vim' "formate js Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu From 167818408d6ed97cc1b302c66776b57afec840ad Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:06:00 +0800 Subject: [PATCH 141/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86markdown?= =?UTF-8?q?=E7=9A=84=E9=A2=84=E8=A7=88=E9=94=AE=E4=BD=8D=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/vimrc b/config/vimrc index 6304d09..73dbbc9 100644 --- a/config/vimrc +++ b/config/vimrc @@ -610,6 +610,8 @@ endfunc endif "leader+5 编辑vimrc map 5 :call Edit_vim_plug() +"leader+6 预览markdown 需要python和插件支持 +nnoremap 6 markdownPreview "source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 if !exists("*Fuck") function! Fuck() From 58285435de36a94c1692c0dc485d4450fd32269e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:08:08 +0800 Subject: [PATCH 142/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=8Bf5?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 73dbbc9..5fe8b3c 100644 --- a/config/vimrc +++ b/config/vimrc @@ -601,7 +601,7 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "快捷提交 nmap p (Gpush) "F5 刷新编辑器 -nmap :source% +nmap :source $MYVIMRC if !exists("*Edit_vim_plug") func Edit_vim_plug() :cd $HOME/vim-plug From 253fad7bd4ee95a368191288b32a8d7dfa1cdaa4 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:09:17 +0800 Subject: [PATCH 143/171] =?UTF-8?q?f5=E5=9B=9E=E5=88=B0=E5=8E=9F=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=B9=B6=E4=B8=94=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E7=9A=84vimrc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 5fe8b3c..b211995 100644 --- a/config/vimrc +++ b/config/vimrc @@ -601,7 +601,7 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "快捷提交 nmap p (Gpush) "F5 刷新编辑器 -nmap :source $MYVIMRC +nmap :cd - && source $MYVIMRC if !exists("*Edit_vim_plug") func Edit_vim_plug() :cd $HOME/vim-plug From cac17199a0fb9132702ca01a9eb668514b8dd556 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:14:29 +0800 Subject: [PATCH 144/171] =?UTF-8?q?=E5=AE=8C=E7=BE=8E=E7=9A=84=E5=85=88lea?= =?UTF-8?q?der+5=E4=BF=AE=E6=94=B9vimrc=E5=86=8Df5=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E5=8E=9F=E5=B7=A5=E7=A8=8B=E8=B7=AF=E5=BE=84=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=BD=BD=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index b211995..4d4936b 100644 --- a/config/vimrc +++ b/config/vimrc @@ -601,13 +601,19 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "快捷提交 nmap p (Gpush) "F5 刷新编辑器 -nmap :cd - && source $MYVIMRC +nmap :call Cd_source() if !exists("*Edit_vim_plug") func Edit_vim_plug() :cd $HOME/vim-plug :edit $HOME/vim-plug/config/vimrc endfunc endif +if !exists("*Cd_source") + func Cd_source() + :cd - + :source $MYVIMRC +endfunc +endif "leader+5 编辑vimrc map 5 :call Edit_vim_plug() "leader+6 预览markdown 需要python和插件支持 From 1f448b16913596d159b3e820cef4b9fddef58303 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:24:31 +0800 Subject: [PATCH 145/171] =?UTF-8?q?=E4=BF=AE=E5=A5=BD=E4=BA=86leader6?= =?UTF-8?q?=E9=A2=84=E8=A7=88markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 4d4936b..891d36d 100644 --- a/config/vimrc +++ b/config/vimrc @@ -617,7 +617,7 @@ endif "leader+5 编辑vimrc map 5 :call Edit_vim_plug() "leader+6 预览markdown 需要python和插件支持 -nnoremap 6 markdownPreview +nnoremap 6 :MarkdownPreview "source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 if !exists("*Fuck") function! Fuck() From beb84ee6ac9eb2305e21c03447fac9672c648cbc Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 01:27:33 +0800 Subject: [PATCH 146/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9leader6=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=BC=96=E8=BE=91=20leader7=E9=A2=84=E8=A7=88markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/vimrc b/config/vimrc index 891d36d..c31a44a 100644 --- a/config/vimrc +++ b/config/vimrc @@ -600,8 +600,8 @@ set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k "test2 "快捷提交 nmap p (Gpush) -"F5 刷新编辑器 -nmap :call Cd_source() +"leader6 刷新编辑器 +nnoremap 6 :call Cd_source() if !exists("*Edit_vim_plug") func Edit_vim_plug() :cd $HOME/vim-plug @@ -616,8 +616,8 @@ endfunc endif "leader+5 编辑vimrc map 5 :call Edit_vim_plug() -"leader+6 预览markdown 需要python和插件支持 -nnoremap 6 :MarkdownPreview +"leader+7 预览markdown 需要python和插件支持 +nnoremap 7 :MarkdownPreview "source vimrc的时候会重新定义一下fuck,所以要想不触发错误,得在定义时加入判断 if !exists("*Fuck") function! Fuck() From 1c085f1121723f9f169b5810404cba115a26c4c3 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 10:31:55 +0800 Subject: [PATCH 147/171] vim-surround --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index c31a44a..a85b2ab 100644 --- a/config/vimrc +++ b/config/vimrc @@ -114,7 +114,7 @@ Plug 'w0rp/ale' "jsx插件 Plug 'mxw/vim-jsx' "括号改变 -"Plug 'surround.vim' +Plug 'tpope/vim-surround' "css color Plug 'ap/vim-css-color' " {} From 39c400c031525c6b06797b17535d88c45fe9abf8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 15:49:05 +0800 Subject: [PATCH 148/171] =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=BA=86=E4=B8=AAlea?= =?UTF-8?q?der=20v=20=E6=9D=A5=E7=94=9F=E6=88=90tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/config/vimrc b/config/vimrc index a85b2ab..c8ea35e 100644 --- a/config/vimrc +++ b/config/vimrc @@ -316,11 +316,6 @@ map! :! tab vim "nnoremap r "_d "noremap r "_d -"快速生成tag文件 - -map :! ctags -R - -map! :! ctags -R "快捷键设置 "在tree中t就可以新建一个tab来编辑 @@ -346,7 +341,8 @@ let g:CommandTAcceptSelectionTabMap = '' "silent是指执行后面的命令时不显示在命令栏 nnoremap f :Files -nnoremap g :Ag +nnoremap g :Ag +nnoremap v :Tags "map :tabnew:FZF "map! :w :tabnew:FZF From c420307a3faeee87a9492453f0d5c5b13cd4164e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 16:36:33 +0800 Subject: [PATCH 149/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E5=92=8Cleader+number=E7=BB=91=E5=AE=9A=E7=9A=84?= =?UTF-8?q?=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 ++++++++++++++++----- config/vimrc | 27 +++++++++++++++------------ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 827141e..dd80958 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,26 @@ windows下把install.sh改为 install.bat即可 * leader+hjjk:窗口间移动 -* leader+3 : 在编辑器左侧打开文件浏览器, 再按一次F11则会关闭文件浏览器。 +* leader+1 :在编辑器左侧打开文件浏览器。 + +* leader+2 :开关quickfix窗口 + +* leader+3 :在编辑器右侧打开当前文件的函数列表 * leader+4 :关闭quickfix窗口 * leader+5 :快速编辑vimrc +* leader+6 :快速加载vimrc + +* leader+7 :预览markdown + +* leader+t: 测试 + +* leader+r: 运行 + +* leader+b: build + * leader+q: 快速退出VIM单个窗口 * leader+f : 按文件名快速查找当前目录中的文件 @@ -46,13 +60,10 @@ windows下把install.sh改为 install.bat即可 * shift+q: 快速退出VIM。 如果vim同时打开多个文件是,不用挨着一个一个关闭。 -* F5 : 刷新vim更改 - -* F12: 在编辑器右侧打开当前文件的函数列表, 再安一次F12关闭函数列表。函数列表是基于ctags的先需要在项目目录下运行 `ctags -R` 在VIM中按快捷键 F3 可以自动执行ctags命令。 - * ctrl+] : 跳到函数声明出(自己定义的函数,非系统函数),会在当前界面打开函数声明文件,如果想新建个tab页再跳到函数声明处,可以用 `ctrl+\` + diff --git a/config/vimrc b/config/vimrc index c8ea35e..fd319ff 100644 --- a/config/vimrc +++ b/config/vimrc @@ -317,17 +317,8 @@ map! :! tab vim "noremap r "_d -"快捷键设置 -"在tree中t就可以新建一个tab来编辑 -nmap 3 :NERDTreeToggle -"vim中的map中的!代表了插入模式和命令模式 -"而在后两者的模式的输入中对空格本身的判断延时会影响使用 -"所以去掉 -"nmap! 3 :NERDTreeToggle -map :TagbarToggle -map! :TagbarToggle "快速查找文件 @@ -342,7 +333,7 @@ let g:CommandTAcceptSelectionTabMap = '' "silent是指执行后面的命令时不显示在命令栏 nnoremap f :Files nnoremap g :Ag -nnoremap v :Tags +"nnoremap v :Tags "map :tabnew:FZF "map! :w :tabnew:FZF @@ -445,8 +436,20 @@ nnoremap gp :AsyncRun git push augroup vimrc autocmd QuickFixCmdPost * botright copen 8 augroup END -"F4 操控quickfixc窗口 -noremap 4 :call asyncrun#quickfix_toggle(8) + +"leader+0~9 快捷键设置 +"在tree中t就可以新建一个tab来编辑 +nmap 1 :NERDTreeToggle +"vim中的map中的!代表了插入模式和命令模式 +"而在后两者的模式的输入中对空格本身的判断延时会影响使用 +"所以去掉 +"nmap! 3 :NERDTreeToggle +"leader2 操控quickfixc窗口 +nnoremap 2 :call asyncrun#quickfix_toggle(8) +"leader 3 打开 tagbar +nnoremap 3 :TagbarToggle +"leader 4 打开 Tags +nnoremap 4 :AsyncRun ctags -R "ctrl+s为保存 map :w inoremap :w From 17dfe2bf61bb2fdb897d4b6f2f0f5c0f70416d0b Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 16:38:22 +0800 Subject: [PATCH 150/171] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 7d1c5f3..dbf06c1 100755 --- a/install.sh +++ b/install.sh @@ -10,9 +10,9 @@ lnif() { } echo "Step0: install dependencies " -sudo apt-get install silversearcher-ag -sudo yum install the_silver_searcher -brew install the_silver_searcher +sudo apt-get install silversearcher-ag ctags +sudo yum install the_silver_searcher ctags +brew install the_silver_searcher ctags echo "Step1: backing up current vim config" today=`date +%Y%m%d` From 30ea33e7905a9a84ad166092e540b2fdb01c374c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 16:47:26 +0800 Subject: [PATCH 151/171] fix --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index fd319ff..eb817e6 100644 --- a/config/vimrc +++ b/config/vimrc @@ -449,7 +449,7 @@ nnoremap 2 :call asyncrun#quickfix_toggle(8) "leader 3 打开 tagbar nnoremap 3 :TagbarToggle "leader 4 打开 Tags -nnoremap 4 :AsyncRun ctags -R +nnoremap 4 :AsyncRun ctags -R --fields=+S . "ctrl+s为保存 map :w inoremap :w From 0fb7fd100e920af80449090439dde1f08f980304 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 22:07:47 +0800 Subject: [PATCH 152/171] =?UTF-8?q?windows=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E4=BA=86config=E4=B8=AD=E6=9C=89ahk=E7=9A=84=E9=94=AE=E4=BD=8D?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/capslock.ahk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 config/capslock.ahk diff --git a/config/capslock.ahk b/config/capslock.ahk new file mode 100644 index 0000000..4bf195c --- /dev/null +++ b/config/capslock.ahk @@ -0,0 +1,17 @@ +SetCapsLockState , AlwaysOff +CapsLock & b::SendInput {Left} +CapsLock & n::SendInput {Down} +CapsLock & p::SendInput {Up} +CapsLock & f::SendInput {Right} +CapsLock & a::SendInput {Home} +CapsLock & e::SendInput {End} +CapsLock & d::SendInput {Delete} +CapsLock & k::SendInput, +{End}{Delete} +;Shift & CapsLock::SendInput, {Shift Down}{Blind}{Esc}{Shift Up} +;用^表示ctrl 用+表示 shift +CapsLock::SendInput ^ +;Esc::CapsLock +;下面是以前自己做给windows和mac键位兼容的映射 +;Capslock::Ctrl +;LWin::Alt +;Alt::Ctrl From 4b4b359309b5f09d72298a630452fc2376596c66 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Wed, 21 Mar 2018 22:25:04 +0800 Subject: [PATCH 153/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd80958..cec6aeb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ windows下把install.sh改为 install.bat即可 默认leader键是空格 -* git命令:gca 提交 gp推送 gpl 拉取 +* git命令:gca 提交 gp推送 gl 拉取 * jk: 映射为ESC键 @@ -32,7 +32,7 @@ windows下把install.sh改为 install.bat即可 * leader+hjjk:窗口间移动 -* leader+1 :在编辑器左侧打开文件浏览器。 +* leader+1 :在编辑器左侧打开文件浏览器。[C进入文件夹 cd切换路径 t新标签打开 i新窗口打开] * leader+2 :开关quickfix窗口 From 3b4085f60ae08cef7ec52309366640b435e66e7f Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Thu, 22 Mar 2018 11:11:40 +0800 Subject: [PATCH 154/171] =?UTF-8?q?=E6=94=B9=E5=8F=98=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/config/vimrc b/config/vimrc index eb817e6..aa62796 100644 --- a/config/vimrc +++ b/config/vimrc @@ -590,6 +590,7 @@ set foldlevel=99 "退出后不清空 "set t_ti= t_te= set relativenumber " show relative line number +set number " show absolute number with relativenumber set ruler " show the current line number and column number set scrolloff=9 " Set lines to the cursor - when moving vertically using j/k" "代码提示 配合scrooloose/syntastic From 7601fb242fc3e3e4f24e28bf734767afe076af95 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 23 Mar 2018 09:51:23 +0800 Subject: [PATCH 155/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=8F=92=E4=BB=B6=E7=9A=84=E5=8A=A0=E8=BD=BD,?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E4=BA=86capslock=E7=9A=84=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/capslock.ahk => capslock.ahk | 3 +++ config/vimrc | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) rename config/capslock.ahk => capslock.ahk (85%) diff --git a/config/capslock.ahk b/capslock.ahk similarity index 85% rename from config/capslock.ahk rename to capslock.ahk index 4bf195c..fb356b8 100644 --- a/config/capslock.ahk +++ b/capslock.ahk @@ -7,6 +7,9 @@ CapsLock & a::SendInput {Home} CapsLock & e::SendInput {End} CapsLock & d::SendInput {Delete} CapsLock & k::SendInput, +{End}{Delete} +;CapsLock & c::SendInput {Esc} +;CapsLock & c::SendInput, ^{[} +CapsLock & c::SendInput, ^{C} ;Shift & CapsLock::SendInput, {Shift Down}{Blind}{Esc}{Shift Up} ;用^表示ctrl 用+表示 shift CapsLock::SendInput ^ diff --git a/config/vimrc b/config/vimrc index aa62796..b2e7535 100644 --- a/config/vimrc +++ b/config/vimrc @@ -39,7 +39,7 @@ let g:mapleader = ' ' " Make sure you use single quotes Plug 'junegunn/vim-easy-align' " Plugin options -Plug 'nsf/gocode', { 'rtp': 'vim' } +Plug 'nsf/gocode', { 'rtp': 'vim','for':'go' } Plug 'vim-scripts/AutoComplPop' "浏览树 @@ -58,16 +58,13 @@ else Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } endif Plug 'junegunn/fzf.vim' +"国人出品 flygrep 功能类似the-silver-searcher +Plug 'wsdjeg/flygrep.vim' Plug 'vim-scripts/WebAPI.vim' Plug 'vim-scripts/Gist.vim' -Plug 'tomasr/molokai' -"七年没更新的配色能用个鬼 -"Plug 'altercation/solarized' -"Plug 'altercation/vim-colors-solarized' -"Plug 'Solarized' -"找来个支持truecolor的 +"Plug 'tomasr/molokai' Plug 'lifepillar/vim-solarized8' "Plug 'PDV--phpDocumentor-for-Vim' @@ -120,7 +117,6 @@ Plug 'ap/vim-css-color' " {} Plug 'jiangmiao/auto-pairs' " -"Plug 'docunext/closetag.vim' Plug 'alvan/vim-closetag' "highlight tag "Plug 'gregsexton/matchtag' @@ -129,7 +125,7 @@ Plug 'vim-scripts/matchit.zip' "tern js 补全 Plug 'marijnh/tern_for_vim', {'do': 'npm install'} "Go 插件 -Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries' } +Plug 'fatih/vim-go' , { 'do': ':GoInstallBinaries','for':'go' } "git 插件 Plug 'tpope/vim-fugitive' "Plug 'mhinz/vim-signify' @@ -148,7 +144,7 @@ Plug 'skywind3000/asyncrun.vim' "编译任务插件 Plug 'skywind3000/vimmake' Plug 'hsanson/vim-android' -Plug 'chemzqm/wxapp.vim' +"Plug 'chemzqm/wxapp.vim' "太慢了不准备用了 "Plug 'ctrlpvim/ctrlp.vim' "用不了ack的命令,不知道为什么 @@ -161,10 +157,10 @@ Plug 'Quramy/tsuquyomi' "彩虹括号 Plug 'luochen1990/rainbow' "markdown -Plug 'tpope/vim-markdown' +Plug 'tpope/vim-markdown',{'for':'markdown'} "markdown preview -Plug 'iamcco/mathjax-support-for-mkdp' -Plug 'iamcco/markdown-preview.vim' +Plug 'iamcco/mathjax-support-for-mkdp',{'for':'markdown'} +Plug 'iamcco/markdown-preview.vim',{'for':'markdown'} "formate js Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu @@ -333,6 +329,7 @@ let g:CommandTAcceptSelectionTabMap = '' "silent是指执行后面的命令时不显示在命令栏 nnoremap f :Files nnoremap g :Ag +nnoremap s :FlyGrep "nnoremap v :Tags "map :tabnew:FZF "map! :w :tabnew:FZF From 87ed9f80bcc3ccb626ccc04b08c994c9ad80c40d Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 23 Mar 2018 15:27:01 +0800 Subject: [PATCH 156/171] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E7=B2=98=E8=B4=B4=E7=9A=84=E4=B8=80=E4=BA=9B=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ config/vimrc | 16 ++++++---------- tips.md | 7 +++++++ 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 tips.md diff --git a/README.md b/README.md index cec6aeb..a4e801f 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ windows下把install.sh改为 install.bat即可 * leader+7 :预览markdown +* leader+x: 可视模式下剪切 + +* leader+c: 可视模式下复制 + +* leader+v: 粘贴 + * leader+t: 测试 * leader+r: 运行 diff --git a/config/vimrc b/config/vimrc index b2e7535..5b39084 100644 --- a/config/vimrc +++ b/config/vimrc @@ -357,16 +357,6 @@ nnoremap g vnoremap g -"映射复制、粘贴、剪贴ctrl+c ctrl+v ctrl+x - -"还原了C-V的多行编辑模式 -map "+pa - -map! "+pa - -map "+y - -map "+x "多行光标键位解绑 let g:multi_cursor_use_default_mapping=0 " Default mapping @@ -381,6 +371,12 @@ let g:multi_cursor_quit_key='' "map ggVG "窗口类--------------------------------------- "map! ggVG +"映射复制、粘贴、剪贴ctrl+c ctrl+v ctrl+x +"理解了下寄存器 命令模式需要C-R"才能粘贴 可视模式复制剪切 +cnoremap v " +nnoremap v "+p +vnoremap c "+y +vnoremap x "+x "快速关闭单个窗口 nmap q q "多窗口切换 diff --git a/tips.md b/tips.md new file mode 100644 index 0000000..be0f3a4 --- /dev/null +++ b/tips.md @@ -0,0 +1,7 @@ +:%s#http://www.baidu.com/#http://google.com/#g + +用#可以代替/来搜索替换 + +:g//d + +ctrl+r " 在命令模式粘贴字 From 7f0443f44dfaca0a4b699447924dbbb3f936538e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 23 Mar 2018 17:13:19 +0800 Subject: [PATCH 157/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=AA?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/vimrc b/config/vimrc index 5b39084..0db937b 100644 --- a/config/vimrc +++ b/config/vimrc @@ -165,6 +165,11 @@ Plug 'iamcco/markdown-preview.vim',{'for':'markdown'} Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu Plug 'hotoo/pangu.vim' +func PanGu_Full() + :call PanGuSpacing() + "段首加俩全角空格 + :g!/^$/s/^/  / +endfunc "异步补全,需要python3 "if has("python3") "if has('nvim') @@ -373,6 +378,7 @@ let g:multi_cursor_quit_key='' "map! ggVG "映射复制、粘贴、剪贴ctrl+c ctrl+v ctrl+x "理解了下寄存器 命令模式需要C-R"才能粘贴 可视模式复制剪切 +"内部寄存器是",外部是+ cnoremap v " nnoremap v "+p vnoremap c "+y From 0ae12902ee5ea2be044e1bf9e6d402294deab08e Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Fri, 23 Mar 2018 20:20:28 +0800 Subject: [PATCH 158/171] =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E4=BA=86=E8=A7=A3=E5=85=B3=E4=BA=8Efunc!=20=E5=92=8Cfunc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 0db937b..de611be 100644 --- a/config/vimrc +++ b/config/vimrc @@ -165,7 +165,7 @@ Plug 'iamcco/markdown-preview.vim',{'for':'markdown'} Plug 'prettier/vim-prettier', { 'do': 'npm install' } "中文排版规范化用法 :PanGu Plug 'hotoo/pangu.vim' -func PanGu_Full() +func! PanGu_Full() :call PanGuSpacing() "段首加俩全角空格 :g!/^$/s/^/  / From eff053ba4d30e37021ca63f3154a9295e31efafb Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 19:46:38 +0800 Subject: [PATCH 159/171] =?UTF-8?q?leader=20'"=20=E5=8C=85=E8=A3=B9?= =?UTF-8?q?=E5=8D=95=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index de611be..a1e810a 100644 --- a/config/vimrc +++ b/config/vimrc @@ -110,8 +110,8 @@ Plug 'https://github.com/burnettk/vim-angular.git' Plug 'w0rp/ale' "jsx插件 Plug 'mxw/vim-jsx' -"括号改变 -Plug 'tpope/vim-surround' +"括号改变 有自己定制了 +"Plug 'tpope/vim-surround' "css color Plug 'ap/vim-css-color' " {} @@ -383,6 +383,11 @@ cnoremap v " nnoremap v "+p vnoremap c "+y vnoremap x "+x +"添加括号 +"这个规则和下个规则实际效果一致 +nnoremap ' viwa'hbi'lel +"映射了连续操作,成对的引号插件不生效不影响 +nnoremap " bi"ea" "快速关闭单个窗口 nmap q q "多窗口切换 From b8b3d8070e066b51bf075689ce5c94779680c92f Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 19:49:29 +0800 Subject: [PATCH 160/171] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4e801f..f00ff5f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,9 @@ windows下把install.sh改为 install.bat即可 * leader+7 :预览markdown -* leader+x: 可视模式下剪切 +* leader+': 将单词用'包裹 + +* leader+": 将单词用"包裹 * leader+c: 可视模式下复制 From 6f601e41b612979f9a7b67e4247183413c2fde24 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 21:33:09 +0800 Subject: [PATCH 161/171] =?UTF-8?q?=E7=98=A6=E8=BA=AB=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index a1e810a..5efd207 100644 --- a/config/vimrc +++ b/config/vimrc @@ -81,8 +81,8 @@ Plug 'pangloss/vim-javascript' " jquery , angularjs 等语法 Plug 'https://github.com/othree/javascript-libraries-syntax.vim.git' - -Plug 'vim-scripts/Mark' +"不晓得怎么用而且还有冲突,去掉,单引号自带mark作用 +"Plug 'vim-scripts/Mark' "css私有前缀 Plug 'vim-scripts/prefixer.vim' "能缩减HTML代码 @@ -709,6 +709,7 @@ augroup gocmd autocmd FileType go nmap t (go-test) autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) + autocmd FileType go let g:go_highlight_types =1 augroup END augroup jscmd autocmd FileType javascript nmap t :AsyncRun npm test From 07483f49ed1c821eb249b4e12c27f5083d8f2f93 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 21:46:58 +0800 Subject: [PATCH 162/171] =?UTF-8?q?=E6=94=B9=E5=8F=98=E4=BA=86=E8=A1=A5?= =?UTF-8?q?=E5=85=A8=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/vimrc b/config/vimrc index 5efd207..f042ca7 100644 --- a/config/vimrc +++ b/config/vimrc @@ -40,8 +40,11 @@ let g:mapleader = ' ' Plug 'junegunn/vim-easy-align' " Plugin options Plug 'nsf/gocode', { 'rtp': 'vim','for':'go' } - -Plug 'vim-scripts/AutoComplPop' +"纯vimscript异步补全 +Plug 'prabirshrestha/asyncomplete.vim' +"Plug 'vim-scripts/AutoComplPop' +"autocomplpop 设置 +"let g:AutoComplPop_IgnoreCaseOption=1 "浏览树 Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "浏览树显示git状态插件 @@ -194,9 +197,6 @@ let g:used_javascript_libs = 'jQuery,AngularJS,AngularUI,RequireJS' "php只做语法检查 "let g:syntastic_php_checkers = ['php'] -"autocomplpop 设置 - -let g:AutoComplPop_IgnoreCaseOption=1 set ignorecase From 788b0b965ff04c4872f6fa7b3831c23293660bb1 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 21:50:00 +0800 Subject: [PATCH 163/171] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f00ff5f..4f76be8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ windows下把install.sh改为 install.bat即可 支持自动更新,默认开启 -设置了很多方便的快捷键 +设置了很多方便的快捷键,一些自定义函数,PanGu_Full是中文排版加行首空格 默认leader键是空格 From 9f3db27668118d4c7a4fee6adb0bca511ccb8dc1 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Sun, 25 Mar 2018 23:33:34 +0800 Subject: [PATCH 164/171] =?UTF-8?q?=E6=8D=A2=E4=BA=86=E4=B8=AA=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E8=A1=A5=E5=85=A8=EF=BC=8C=E6=84=9F=E8=A7=89=E4=B8=8D?= =?UTF-8?q?=E5=A5=BD=E7=94=A8=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/config/vimrc b/config/vimrc index f042ca7..3f49f31 100644 --- a/config/vimrc +++ b/config/vimrc @@ -40,8 +40,6 @@ let g:mapleader = ' ' Plug 'junegunn/vim-easy-align' " Plugin options Plug 'nsf/gocode', { 'rtp': 'vim','for':'go' } -"纯vimscript异步补全 -Plug 'prabirshrestha/asyncomplete.vim' "Plug 'vim-scripts/AutoComplPop' "autocomplpop 设置 "let g:AutoComplPop_IgnoreCaseOption=1 @@ -174,16 +172,44 @@ func! PanGu_Full() :g!/^$/s/^/  / endfunc "异步补全,需要python3 -"if has("python3") -"if has('nvim') -" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -"else -" Plug 'Shougo/deoplete.nvim' -" Plug 'roxma/nvim-yarp' -" Plug 'roxma/vim-hug-neovim-rpc' -"endif -"let g:deoplete#enable_at_startup = 1 -"endif +if has('python3') + if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } + else + Plug 'Shougo/deoplete.nvim' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' + endif + let g:deoplete#enable_at_startup = 1 +else + "纯vimscript异步补全 + Plug 'prabirshrestha/asyncomplete.vim' + Plug 'prabirshrestha/asyncomplete-buffer.vim' + Plug 'prabirshrestha/asyncomplete-file.vim' + Plug 'prabirshrestha/asyncomplete-gocode.vim' + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ + \ 'name':'buffer', + \ 'whitelist':['*'], + \ 'blacklist':['go'], + \ 'completor':function('asyncomplete#sources#buffer#completor'), + \ })) + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({ + \ 'name':'file', + \ 'whitelist':['*'], + \ 'priority':10, + \ 'completor':function('asyncomplete#sources#file#completor') + \ })) + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#gocode#get_source_options({ + \ 'name':'gocode', + \ 'whitelist':['go'], + \ 'completor':function('asyncomplete#sources#gocode#completor'), + \ 'config':{ + \ 'gocode_path':expand('~/go/bin/gocode') + \ } + \ })) + +endif + call plug#end() From 1731a5d8c567b33225985c9a3a18321ce9b327c8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 26 Mar 2018 17:05:48 +0800 Subject: [PATCH 165/171] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=88=90vscode=20dark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 78 +++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/config/vimrc b/config/vimrc index 3f49f31..23a44a9 100644 --- a/config/vimrc +++ b/config/vimrc @@ -66,7 +66,11 @@ Plug 'vim-scripts/WebAPI.vim' Plug 'vim-scripts/Gist.vim' "Plug 'tomasr/molokai' -Plug 'lifepillar/vim-solarized8' +"Plug 'lifepillar/vim-solarized8' +"vscode dark +Plug 'tomasiser/vim-code-dark' +colorscheme codedark +let g:airline_theme = 'codedark' "Plug 'PDV--phpDocumentor-for-Vim' "注释看看会不会影响到markdown @@ -255,32 +259,32 @@ set background=dark endif endfunction "let g:solarized_use16 = 1 -if has('gui_running') - colorscheme solarized8 -else - "if has('win32') || has('win64') - "if $COLORTERM == 'truecolor' - " colorscheme solarized8 - "else - "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 - "发现都不是,只要设置win下都真彩色就行,不用丑的次级配色了,可能支持更早的系统 - " colorscheme apprentice - "endif - "else - "是否支持真彩色 - if $COLORTERM == 'truecolor' - "设置终端真彩色 - set termguicolors - elseif has('win32') || has('win64') - set termguicolors - "设置256色 - "似乎windows不安装ubuntu前是色不全,安装后色全了 - else - set t_Co=256 - endif - colorscheme solarized8 - "endif -endif +"if has('gui_running') +" colorscheme solarized8 +"else +" "if has('win32') || has('win64') +" "if $COLORTERM == 'truecolor' +" " colorscheme solarized8 +" "else +" "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 +" "发现都不是,只要设置win下都真彩色就行,不用丑的次级配色了,可能支持更早的系统 +" " colorscheme apprentice +" "endif +" "else +" "是否支持真彩色 +" if $COLORTERM == 'truecolor' +" "设置终端真彩色 +" set termguicolors +" elseif has('win32') || has('win64') +" set termguicolors +" "设置256色 +" "似乎windows不安装ubuntu前是色不全,安装后色全了 +" else +" set t_Co=256 +" endif +" colorscheme solarized8 +" "endif +"endif "high low normal "let g:solarized_visibility='high' "high low normal bold @@ -564,16 +568,16 @@ set expandtab "加快速度 "set synmaxcol=200 set ttyfast " u got a fast terminal -if has('nvim') - if has('win32') || has('win64') - "windows命令行时候必须有termguicolor色彩,但同时在xshellssh中开启这个色彩就不对了 - set termguicolors - else - endif - colorscheme solarized8 -else - set ttyscroll=3 -endif +"if has('nvim') +" if has('win32') || has('win64') +" "windows命令行时候必须有termguicolor色彩,但同时在xshellssh中开启这个色彩就不对了 +" set termguicolors +" else +" endif +" colorscheme solarized8 +"else +" set ttyscroll=3 +"endif set lazyredraw " to avoid scrolling problems "删除键 set backspace=eol,start,indent From 90d3298c5fa0143617174c95f1e0a0a7b87fcfea Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 26 Mar 2018 17:36:09 +0800 Subject: [PATCH 166/171] =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BA=86vscode?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E8=89=B2=E5=90=8E=E8=BF=98=E6=98=AF=E7=94=A8?= =?UTF-8?q?=E5=9B=9E=E4=BA=86solarized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 64 ++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/config/vimrc b/config/vimrc index 23a44a9..54599e5 100644 --- a/config/vimrc +++ b/config/vimrc @@ -66,11 +66,13 @@ Plug 'vim-scripts/WebAPI.vim' Plug 'vim-scripts/Gist.vim' "Plug 'tomasr/molokai' -"Plug 'lifepillar/vim-solarized8' +Plug 'lifepillar/vim-solarized8' "vscode dark -Plug 'tomasiser/vim-code-dark' -colorscheme codedark -let g:airline_theme = 'codedark' +"原作者的不能使用了 发现换一个人也不行 原来是colorschemey应该放外面 +"Plug 'tomasiser/vim-code-dark' +"Plug 'dunstontc/vim-code-dark' +"Plug 'dunstontc/vim-vscode-theme' +"colorscheme dark_plus "Plug 'PDV--phpDocumentor-for-Vim' "注释看看会不会影响到markdown @@ -243,6 +245,8 @@ let g:rainbow_active = 1 "颜色主题设置 +"colorscheme codedark +"let g:airline_theme = 'codedark' "let g:solarized_termcolors=16 "两种流行风格的主题 "colorscheme molokai @@ -259,32 +263,32 @@ set background=dark endif endfunction "let g:solarized_use16 = 1 -"if has('gui_running') -" colorscheme solarized8 -"else -" "if has('win32') || has('win64') -" "if $COLORTERM == 'truecolor' -" " colorscheme solarized8 -" "else -" "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 -" "发现都不是,只要设置win下都真彩色就行,不用丑的次级配色了,可能支持更早的系统 -" " colorscheme apprentice -" "endif -" "else -" "是否支持真彩色 -" if $COLORTERM == 'truecolor' -" "设置终端真彩色 -" set termguicolors -" elseif has('win32') || has('win64') -" set termguicolors -" "设置256色 -" "似乎windows不安装ubuntu前是色不全,安装后色全了 -" else -" set t_Co=256 -" endif -" colorscheme solarized8 -" "endif -"endif +if has('gui_running') + colorscheme solarized8 +else + "if has('win32') || has('win64') + "if $COLORTERM == 'truecolor' + " colorscheme solarized8 + "else + "其实这里还有一个情况。当在win10从商店下好ubuntu子系统后,命令行就支持真彩色了 + "发现都不是,只要设置win下都真彩色就行,不用丑的次级配色了,可能支持更早的系统 + " colorscheme apprentice + "endif + "else + "是否支持真彩色 + if $COLORTERM == 'truecolor' + "设置终端真彩色 + set termguicolors + elseif has('win32') || has('win64') + set termguicolors + "设置256色 + "似乎windows不安装ubuntu前是色不全,安装后色全了 + else + set t_Co=256 + endif + colorscheme solarized8 + "endif +endif "high low normal "let g:solarized_visibility='high' "high low normal bold From 8e8ffcccecc05cde0290a36966e78055dce60b9c Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Mon, 26 Mar 2018 18:25:03 +0800 Subject: [PATCH 167/171] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E5=B1=82=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/config/vimrc b/config/vimrc index 54599e5..4d85454 100644 --- a/config/vimrc +++ b/config/vimrc @@ -71,7 +71,7 @@ Plug 'lifepillar/vim-solarized8' "原作者的不能使用了 发现换一个人也不行 原来是colorschemey应该放外面 "Plug 'tomasiser/vim-code-dark' "Plug 'dunstontc/vim-code-dark' -"Plug 'dunstontc/vim-vscode-theme' +Plug 'dunstontc/vim-vscode-theme' "colorscheme dark_plus "Plug 'PDV--phpDocumentor-for-Vim' @@ -252,6 +252,19 @@ let g:rainbow_active = 1 "colorscheme molokai "let g:rehash256 = 1 set background=dark +let g:tcc="solarized8" +" Allow to trigger colorscheme + function! ToggleCC() + " Inversion + if g:tcc== "solarized8" + colorscheme dark_plus + let g:tcc="dark_plus" + echom g:tcc + else + colorscheme solarized8 + let g:tcc="solarized8" + endif + endfunction " Allow to trigger background function! ToggleBG() let s:tbg = &background @@ -296,13 +309,14 @@ endif "老版光标 "let g:solarized_old_cursor_style=1 map cbg :call ToggleBG() +map ccs :call ToggleCC() "colorscheme space-vim-dark inoremap jk "删除了半天的插件后得出的结论 "普通模式会对j进行一个判断,判断后面没跟k才会输出j,结果就造成了看上去往下走的时候最后一个键卡顿的效果 "map jk "命令模式还是可以用 -cmap jk +cnoremap jk "emmet 设置 let g:user_emmet_expandabbr_key = '' From 7157a3953f55c243c30b4e5ad849c3ad61f25ba8 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 27 Mar 2018 00:25:27 +0800 Subject: [PATCH 168/171] =?UTF-8?q?=E8=A1=A5=E5=85=A8=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/config/vimrc b/config/vimrc index 4d85454..79ce4e2 100644 --- a/config/vimrc +++ b/config/vimrc @@ -535,31 +535,29 @@ map map! - - -function! InsertTabWrapper() - - let col=col('.')-1 - - if !col || getline('.')[col-1] !~ '\k' - - return "\" - - else - - return "\\" - - endif - -endfunction - +"补全方式换异步 +func! s:check_back_space() abort + let col = col('.') -1 + return !col || getline('.')[col-1]=~ '\s' +endfunc +inoremap + \ pumvisible() ?"\": + \ check_back_space() ? "\": + \ asyncomplete#force_refresh() +inoremap pumvisible() ? "\" : "\" +"function! InsertTabWrapper() +" let col=col('.')-1 +" if !col || getline('.')[col-1] !~ '\k' +" return "\" +" else +" return "\\" +" endif +"endfunction "按tab键,全能提示, - "注意要用inoremap,不能用map!,如果用map!在命令模式下tab键没有提示功能。 - -inoremap =InsertTabWrapper() +"inoremap =InsertTabWrapper() "shift+tab 展开代码片段 -imap snipMateNextOrTrigger +"imap snipMateNextOrTrigger "在mac下iterm终端标题中中显示文件名称 autocmd BufEnter *.* exe 'silent ! echo -ne "\033];%:t\007"' From 46436bb30a8a23a1fce52197c5d49ddd0184c0d6 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 27 Mar 2018 00:41:12 +0800 Subject: [PATCH 169/171] =?UTF-8?q?=E7=BB=88=E4=BA=8E=E8=B0=83=E5=A5=BD?= =?UTF-8?q?=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/config/vimrc b/config/vimrc index 79ce4e2..79ea6d1 100644 --- a/config/vimrc +++ b/config/vimrc @@ -536,6 +536,7 @@ map map! "补全方式换异步 +let g:asyncomplete_auto_popup =1 func! s:check_back_space() abort let col = col('.') -1 return !col || getline('.')[col-1]=~ '\s' From 9bd0b19c8c294513aadce643f4206575764c5481 Mon Sep 17 00:00:00 2001 From: sherylynn <352281674@qq.com> Date: Tue, 27 Mar 2018 01:26:11 +0800 Subject: [PATCH 170/171] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=AE=89=E8=A3=85,?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=BF=87=E4=BF=AE=E6=94=B9=E9=85=8D=E8=89=B2?= =?UTF-8?q?,=E9=BA=BB=E7=83=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vimrc b/config/vimrc index 79ea6d1..b2e38f8 100644 --- a/config/vimrc +++ b/config/vimrc @@ -184,7 +184,7 @@ if has('python3') else Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' + Plug 'roxma/vim-hug-neovim-rpc',{'do':'pip3 install neovim'} endif let g:deoplete#enable_at_startup = 1 else From 8928d8e65ab4829edae4919904d4522731fdd9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=A2=9E?= <352281674@qq.com> Date: Tue, 27 Mar 2018 16:09:33 +0800 Subject: [PATCH 171/171] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BA=86=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=EF=BC=8C=E6=96=B0=E5=9C=B0=E5=9D=80=20https://github.?= =?UTF-8?q?com/sherylynn/vimcode.git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构了项目,新地址 https://github.com/sherylynn/vimcode.git --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f76be8..586be06 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ - +## 停止支持 重构后 新项目地址 https://github.com/sherylynn/vimcode.git + + (一些插件如node和vim-go依赖相应的node和go环境支持) 运行2个命令配置一个强大的VIM编辑器。