aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar Damani <damani.kumar@gmail.com>2019-04-26 18:49:26 +0000
committerKumar Damani <damani.kumar@gmail.com>2019-04-26 18:49:26 +0000
commit5a6ed5fcb3b89d0c2b4e8ba2953c4ba806d4b171 (patch)
tree5be0c043b0c8d632e35a8b4ef7e23452b103b94d
parentaf821092fe78ef159d7cb6536bb006712dc01b9d (diff)
added vim dir
-rw-r--r--vim/.vim/.netrwhist11
-rw-r--r--vim/.vim/autoload/plug.vim2526
-rw-r--r--vim/.vim/plugged/fzf.vim/README.md335
-rw-r--r--vim/.vim/plugged/fzf.vim/autoload/fzf/vim.vim1324
-rw-r--r--vim/.vim/plugged/fzf.vim/autoload/fzf/vim/complete.vim163
-rw-r--r--vim/.vim/plugged/fzf.vim/bin/preview.rb59
-rw-r--r--vim/.vim/plugged/fzf.vim/bin/preview.sh54
-rw-r--r--vim/.vim/plugged/fzf.vim/bin/tags.pl15
-rw-r--r--vim/.vim/plugged/fzf.vim/doc/fzf-vim.txt378
-rw-r--r--vim/.vim/plugged/fzf.vim/doc/tags25
-rw-r--r--vim/.vim/plugged/fzf.vim/plugin/fzf.vim149
-rw-r--r--vim/.vim/plugged/goyo.vim/README.md130
-rw-r--r--vim/.vim/plugged/goyo.vim/autoload/goyo.vim447
-rw-r--r--vim/.vim/plugged/goyo.vim/doc/goyo.txt170
-rw-r--r--vim/.vim/plugged/goyo.vim/doc/tags16
-rw-r--r--vim/.vim/plugged/goyo.vim/plugin/goyo.vim24
-rw-r--r--vim/.vim/plugged/i3-vim-syntax/README.md18
-rw-r--r--vim/.vim/plugged/i3-vim-syntax/ftdetect/i3.vim4
-rw-r--r--vim/.vim/plugged/i3-vim-syntax/ftplugin/i3.vim1
-rw-r--r--vim/.vim/plugged/i3-vim-syntax/syntax/i3.vim134
-rw-r--r--vim/.vim/plugged/lightline.vim/.travis.yml28
-rw-r--r--vim/.vim/plugged/lightline.vim/LICENSE21
-rw-r--r--vim/.vim/plugged/lightline.vim/README.md389
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline.vim502
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim257
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/16color.vim49
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/OldHope.vim44
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor.vim12
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_dark.vim60
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_light.vim55
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow.vim41
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night.vim41
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim43
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim42
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim42
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/darcula.vim37
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/default.vim8
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/deus.vim40
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim40
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/landscape.vim25
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/materia.vim63
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/material.vim63
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/molokai.vim36
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/nord.vim46
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/one.vim64
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/powerline.vim28
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/seoul256.vim42
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/solarized.vim80
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim44
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/wombat.vim40
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/colortable.vim42
-rw-r--r--vim/.vim/plugged/lightline.vim/autoload/lightline/tab.vim33
-rw-r--r--vim/.vim/plugged/lightline.vim/doc/lightline.txt1332
-rw-r--r--vim/.vim/plugged/lightline.vim/doc/tags66
-rw-r--r--vim/.vim/plugged/lightline.vim/plugin/lightline.vim26
-rw-r--r--vim/.vim/plugged/lightline.vim/test/.themisrc20
-rw-r--r--vim/.vim/plugged/lightline.vim/test/concatenate.vim90
-rw-r--r--vim/.vim/plugged/lightline.vim/test/error.vim15
-rw-r--r--vim/.vim/plugged/lightline.vim/test/expand.vim667
-rw-r--r--vim/.vim/plugged/lightline.vim/test/highlight.vim171
-rw-r--r--vim/.vim/plugged/lightline.vim/test/link.vim143
-rw-r--r--vim/.vim/plugged/lightline.vim/test/mode.vim14
-rw-r--r--vim/.vim/plugged/lightline.vim/test/onetab.vim98
-rw-r--r--vim/.vim/plugged/lightline.vim/test/subseparator.vim407
-rw-r--r--vim/.vim/plugged/lightline.vim/test/tabline.vim67
-rw-r--r--vim/.vim/plugged/lightline.vim/test/tabs.vim99
-rw-r--r--vim/.vim/plugged/lightline.vim/test/toggle.vim45
-rw-r--r--vim/.vim/plugged/lightline.vim/test/uniq.vim46
-rw-r--r--vim/.vim/plugged/nerdtree/CHANGELOG179
-rw-r--r--vim/.vim/plugged/nerdtree/LICENCE13
-rw-r--r--vim/.vim/plugged/nerdtree/README.markdown96
-rw-r--r--vim/.vim/plugged/nerdtree/autoload/nerdtree.vim200
-rw-r--r--vim/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim649
-rw-r--r--vim/.vim/plugged/nerdtree/doc/NERDTree.txt1392
-rw-r--r--vim/.vim/plugged/nerdtree/doc/tags101
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim354
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/creator.vim389
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/event.vim13
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim58
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim163
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim186
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim114
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim208
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim34
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/opener.vim352
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/path.vim875
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim700
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim347
-rw-r--r--vim/.vim/plugged/nerdtree/lib/nerdtree/ui.vim516
-rw-r--r--vim/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim40
-rw-r--r--vim/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim368
-rw-r--r--vim/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim38
-rw-r--r--vim/.vim/plugged/nerdtree/plugin/NERD_tree.vim244
-rw-r--r--vim/.vim/plugged/nerdtree/screenshot.pngbin0 -> 87896 bytes
-rw-r--r--vim/.vim/plugged/nerdtree/syntax/nerdtree.vim91
-rw-r--r--vim/.vim/plugged/vim-gitgutter/LICENCE22
-rw-r--r--vim/.vim/plugged/vim-gitgutter/README.mkd582
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter.vim160
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/async.vim95
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/debug.vim119
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/diff.vim405
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/fold.vim84
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim170
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/hunk.vim332
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/sign.vim230
-rw-r--r--vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim222
-rw-r--r--vim/.vim/plugged/vim-gitgutter/doc/gitgutter.txt549
-rw-r--r--vim/.vim/plugged/vim-gitgutter/doc/tags56
-rw-r--r--vim/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim231
-rw-r--r--vim/.vim/plugged/vim-gitgutter/screenshot.pngbin0 -> 16191 bytes
-rw-r--r--vim/.vim/plugged/vim-gitgutter/test/cp932.txt8
-rw-r--r--vim/.vim/plugged/vim-gitgutter/test/fixture.txt11
-rw-r--r--vim/.vim/plugged/vim-gitgutter/test/runner.vim162
-rw-r--r--vim/.vim/plugged/vim-gitgutter/test/test21
-rw-r--r--vim/.vim/plugged/vim-gitgutter/test/test_gitgutter.vim680
-rw-r--r--vim/.vim/plugged/vim-gitgutter/unplace.vim27
-rw-r--r--vim/.vim/plugged/vim-pug/README.markdown21
-rw-r--r--vim/.vim/plugged/vim-pug/ftdetect/pug.vim5
-rw-r--r--vim/.vim/plugged/vim-pug/ftplugin/pug.vim57
-rw-r--r--vim/.vim/plugged/vim-pug/indent/pug.vim70
-rw-r--r--vim/.vim/plugged/vim-pug/syntax/pug.vim113
-rw-r--r--vim/.vim/plugged/vimling/LICENSE674
-rw-r--r--vim/.vim/plugged/vimling/README.md34
-rw-r--r--vim/.vim/plugged/vimling/plugin/deadkeys.vim253
-rw-r--r--vim/.vim/plugged/vimling/plugin/ipa.vim186
-rw-r--r--vim/.vim/plugged/vimling/plugin/prose.vim38
-rw-r--r--vim/.vim/plugged/vimling/plugin/vimling.vim8
-rw-r--r--vim/.vim/plugged/vimwiki/LICENSE22
-rw-r--r--vim/.vim/plugged/vimwiki/README-cn.md161
-rw-r--r--vim/.vim/plugged/vimwiki/README.md170
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/base.vim2046
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/customwiki2html.sh62
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/default.tpl11
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/diary.vim322
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/html.vim1666
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/lst.vim1677
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/markdown_base.vim150
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/path.vim183
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/style.css82
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/tags.vim342
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/tbl.vim703
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/u.vim72
-rw-r--r--vim/.vim/plugged/vimwiki/autoload/vimwiki/vars.vim711
-rw-r--r--vim/.vim/plugged/vimwiki/doc/screenshot_1.pngbin0 -> 29362 bytes
-rw-r--r--vim/.vim/plugged/vimwiki/doc/screenshot_2.pngbin0 -> 49959 bytes
-rw-r--r--vim/.vim/plugged/vimwiki/doc/tags214
-rw-r--r--vim/.vim/plugged/vimwiki/doc/vimwiki.txt3238
-rw-r--r--vim/.vim/plugged/vimwiki/ftplugin/vimwiki.vim699
-rw-r--r--vim/.vim/plugged/vimwiki/plugin/vimwiki.vim396
-rw-r--r--vim/.vim/plugged/vimwiki/syntax/vimwiki.vim487
-rw-r--r--vim/.vim/plugged/vimwiki/syntax/vimwiki_default.vim110
-rw-r--r--vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown.vim104
-rw-r--r--vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown_custom.vim194
-rw-r--r--vim/.vim/plugged/vimwiki/syntax/vimwiki_media.vim85
-rw-r--r--vim/.vim/plugged/wal.vim/LICENSE.md9
-rw-r--r--vim/.vim/plugged/wal.vim/README.md15
-rw-r--r--vim/.vim/plugged/wal.vim/autoload/airline/themes/wal.vim62
-rw-r--r--vim/.vim/plugged/wal.vim/autoload/lightline/colorscheme/wal.vim36
-rw-r--r--vim/.vim/plugged/wal.vim/colors/wal.vim195
-rw-r--r--vim/.vim/spell/en.utf-8.add12
-rw-r--r--vim/.vim/spell/en.utf-8.add.splbin0 -> 261 bytes
-rw-r--r--vim/.vim/spell/es.utf-8.splbin0 -> 601019 bytes
-rw-r--r--vim/.vim/spell/es.utf-8.sugbin0 -> 1912378 bytes
-rw-r--r--vim/.vim/syntax/i3.vim110
-rw-r--r--vim/.vim/view/~=+dotfiles=+README.md=235
165 files changed, 39572 insertions, 0 deletions
diff --git a/vim/.vim/.netrwhist b/vim/.vim/.netrwhist
new file mode 100644
index 0000000..b7579c3
--- /dev/null
+++ b/vim/.vim/.netrwhist
@@ -0,0 +1,11 @@
+let g:netrw_dirhistmax =10
+let g:netrw_dirhist_cnt =9
+let g:netrw_dirhist_1='/home/kdam0/Dropbox/winter2018'
+let g:netrw_dirhist_2='/home/kdam0/Dropbox/winter2018/cla203'
+let g:netrw_dirhist_3='/home/kdam0/Dropbox/winter2018'
+let g:netrw_dirhist_4='/home/kdam0/Dropbox'
+let g:netrw_dirhist_5='/home/kdam0/.dropbox-dist'
+let g:netrw_dirhist_6='/home/kdam0/Dropbox/fall2018/csc458/assignments/project/code'
+let g:netrw_dirhist_7='/home/kdam0/.config/neofetch'
+let g:netrw_dirhist_8='/home/kdam0/Documents/301project/project-team-02/web/models'
+let g:netrw_dirhist_9='/home/kdam0/Documents/301project/project-team-02/mobile/screens'
diff --git a/vim/.vim/autoload/plug.vim b/vim/.vim/autoload/plug.vim
new file mode 100644
index 0000000..4e05630
--- /dev/null
+++ b/vim/.vim/autoload/plug.vim
@@ -0,0 +1,2526 @@
+" 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 `<Plug>`-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')
+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('<sfile>: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#(<args>)
+ 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(<bang>0, [<f-args>])
+ command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
+ command! -nargs=0 -bar -bang PlugClean call s:clean(<bang>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(<bang>0, <f-args>)
+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! s:lazy(plug, opt)
+ return has_key(a:plug, a:opt) &&
+ \ (empty(s:to_a(a:plug[a:opt])) ||
+ \ !isdirectory(a:plug.dir) ||
+ \ len(s:glob(s:rtp(a:plug), 'plugin')) ||
+ \ len(s:glob(s:rtp(a:plug), 'after/plugin')))
+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) || !s:lazy(plug, 'on') && !s:lazy(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 =~? '^<Plug>.\+'
+ 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 `<Plug>`.')
+ 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, "<bang>", <line1>, <line2>, <q-args>, %s)',
+ \ cmd, string(cmd), string(names))
+ endfor
+
+ for [map, names] in items(lod.map)
+ for [mode, map_prefix, key_prefix] in
+ \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ execute printf(
+ \ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
+ \ 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 <SID>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')) ? '<nomodeline>' : '') 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 = "\<esc>" . prefix
+ endif
+ let prefix .= v:operator
+ endif
+ call feedkeys(prefix, 'n')
+ endif
+ call feedkeys(substitute(a:map, '^<Plug>', "\<Plug>", '') . 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 <silent> <buffer> R :call <SID>retry()<cr>
+ nnoremap <silent> <buffer> D :PlugDiff<cr>
+ nnoremap <silent> <buffer> S :PlugStatus<cr>
+ nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
+ xnoremap <silent> <buffer> U :call <SID>status_update()<cr>
+ nnoremap <silent> <buffer> ]] :silent! call <SID>section('')<cr>
+ nnoremap <silent> <buffer> [[ :silent! call <SID>section('b')<cr>
+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 <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
+ 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 ['<cr>', 'L', 'o', 'X', 'd', 'dd']
+ execute 'silent! unmap <buffer>' k
+ endfor
+ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
+ if exists('+colorcolumn')
+ setlocal colorcolumn=
+ endif
+ 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\r", cmd . "\r"], batchfile)
+ let cmd = batchfile
+ endif
+ let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
+ execute "normal! :execute g:_plug_bang\<cr>\<cr>"
+ 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
+
+ let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : ''
+
+ " 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'.s:submodule_opt.' 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\r", cmd . "\r"], 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 = empty(globpath(spec.dir, '.git', 1))
+
+ 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\r", cmd . "\r"], 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 <silent> <buffer> d :set opfunc=<sid>delete_op<cr>g@
+ nmap <silent> <buffer> dd d_
+ xnoremap <silent> <buffer> d :<c-u>call <sid>delete_op(visualmode(), 1)<cr>
+ 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 <silent> <buffer> L :call <SID>status_load(line('.'))<cr>
+ xnoremap <silent> <buffer> L :call <SID>status_load(line('.'))<cr>
+ 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\r", cmd . "\r"], 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 <silent> <buffer> q :q<cr>
+ 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 cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
+ if has_key(v, 'rtp')
+ let cmd .= ' -- '.s:shellesc(v.rtp)
+ endif
+ let diff = s:system_chomp(cmd, 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> <buffer> <plug>(plug-preview) :silent! call <SID>preview_commit()<cr>
+ if empty(maparg("\<cr>", 'n'))
+ nmap <buffer> <cr> <plug>(plug-preview)
+ endif
+ if empty(maparg('o', 'n'))
+ nmap <buffer> o <plug>(plug-preview)
+ endif
+ endif
+ if cnts[0]
+ nnoremap <silent> <buffer> X :call <SID>revert()<cr>
+ 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, '\\\@<!,')
+endfunction
+
+let s:first_rtp = s:escrtp(get(s:split_rtp(), 0, ''))
+let s:last_rtp = s:escrtp(get(s:split_rtp(), -1, ''))
+
+if exists('g:plugs')
+ let g:plugs_order = get(g:, 'plugs_order', keys(g:plugs))
+ call s:upgrade_specs()
+ call s:define_commands()
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/vim/.vim/plugged/fzf.vim/README.md b/vim/.vim/plugged/fzf.vim/README.md
new file mode 100644
index 0000000..6e2faf0
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/README.md
@@ -0,0 +1,335 @@
+fzf :heart: vim
+===============
+
+Things you can do with [fzf][fzf] and Vim.
+
+Rationale
+---------
+
+[fzf][fzf] in itself is not a Vim plugin, and the official repository only
+provides the [basic wrapper function][run] for Vim and it's up to the users to
+write their own Vim commands with it. However, I've learned that many users of
+fzf are not familiar with Vimscript and are looking for the "default"
+implementation of the features they can find in the alternative Vim plugins.
+
+This repository is a bundle of fzf-based commands and mappings extracted from
+my [.vimrc][vimrc] to address such needs. They are *not* designed to be
+flexible or configurable, and there's no guarantee of backward-compatibility.
+
+Why you should use fzf on Vim
+-----------------------------
+
+Because you can and you love fzf.
+
+fzf runs asynchronously and can be orders of magnitude faster than similar Vim
+plugins. However, the benefit may not be noticeable if the size of the input
+is small, which is the case for many of the commands provided here.
+Nevertheless I wrote them anyway since it's really easy to implement custom
+selector with fzf.
+
+Installation
+------------
+
+fzf.vim depends on the basic Vim plugin of [the main fzf
+repository][fzf-main], which means you need to **set up both "fzf" and
+"fzf.vim" on Vim**. To learn more about fzf/Vim integration, see
+[README-VIM][README-VIM].
+
+[fzf-main]: https://github.com/junegunn/fzf
+[README-VIM]: https://github.com/junegunn/fzf/blob/master/README-VIM.md
+
+### Using [vim-plug](https://github.com/junegunn/vim-plug)
+
+If you already installed fzf using [Homebrew](https://brew.sh/), the following
+should suffice:
+
+```vim
+Plug '/usr/local/opt/fzf'
+Plug 'junegunn/fzf.vim'
+```
+
+But if you want to install fzf as well using vim-plug:
+
+```vim
+Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
+Plug 'junegunn/fzf.vim'
+```
+
+- `dir` and `do` options are not mandatory
+- Use `./install --bin` instead if you don't need fzf outside of Vim
+- Make sure to use Vim 7.4 or above
+
+Commands
+--------
+
+| Command | List |
+| --- | --- |
+| `Files [PATH]` | Files (similar to `:FZF`) |
+| `GFiles [OPTS]` | Git files (`git ls-files`) |
+| `GFiles?` | Git files (`git status`) |
+| `Buffers` | Open buffers |
+| `Colors` | Color schemes |
+| `Ag [PATTERN]` | [ag][ag] search result (`ALT-A` to select all, `ALT-D` to deselect all) |
+| `Rg [PATTERN]` | [rg][rg] search result (`ALT-A` to select all, `ALT-D` to deselect all) |
+| `Lines [QUERY]` | Lines in loaded buffers |
+| `BLines [QUERY]` | Lines in the current buffer |
+| `Tags [QUERY]` | Tags in the project (`ctags -R`) |
+| `BTags [QUERY]` | Tags in the current buffer |
+| `Marks` | Marks |
+| `Windows` | Windows |
+| `Locate PATTERN` | `locate` command output |
+| `History` | `v:oldfiles` and open buffers |
+| `History:` | Command history |
+| `History/` | Search history |
+| `Snippets` | Snippets ([UltiSnips][us]) |
+| `Commits` | Git commits (requires [fugitive.vim][f]) |
+| `BCommits` | Git commits for the current buffer |
+| `Commands` | Commands |
+| `Maps` | Normal mode mappings |
+| `Helptags` | Help tags <sup id="a1">[1](#helptags)</sup> |
+| `Filetypes` | File types
+
+- Most commands support `CTRL-T` / `CTRL-X` / `CTRL-V` key
+ bindings to open in a new tab, a new split, or in a new vertical split
+- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
+- You can set `g:fzf_command_prefix` to give the same prefix to the commands
+ - e.g. `let g:fzf_command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
+
+(<a name="helptags">1</a>: `Helptags` will shadow the command of the same name
+from [pathogen][pat]. But its functionality is still available via `call
+pathogen#helptags()`. [↩](#a1))
+
+[pat]: https://github.com/tpope/vim-pathogen
+[f]: https://github.com/tpope/vim-fugitive
+
+### Customization
+
+#### Global options
+
+See [README-VIM.md][readme-vim] of the main fzf repository for details.
+
+[readme-vim]: https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration
+
+```vim
+" This is the default extra key bindings
+let g:fzf_action = {
+ \ 'ctrl-t': 'tab split',
+ \ 'ctrl-x': 'split',
+ \ 'ctrl-v': 'vsplit' }
+
+" Default fzf layout
+" - down / up / left / right
+let g:fzf_layout = { 'down': '~40%' }
+
+" In Neovim, you can set up fzf window using a Vim command
+let g:fzf_layout = { 'window': 'enew' }
+let g:fzf_layout = { 'window': '-tabnew' }
+let g:fzf_layout = { 'window': '10split enew' }
+
+" Customize fzf colors to match your color scheme
+let g:fzf_colors =
+\ { 'fg': ['fg', 'Normal'],
+ \ 'bg': ['bg', 'Normal'],
+ \ 'hl': ['fg', 'Comment'],
+ \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
+ \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
+ \ 'hl+': ['fg', 'Statement'],
+ \ 'info': ['fg', 'PreProc'],
+ \ 'border': ['fg', 'Ignore'],
+ \ 'prompt': ['fg', 'Conditional'],
+ \ 'pointer': ['fg', 'Exception'],
+ \ 'marker': ['fg', 'Keyword'],
+ \ 'spinner': ['fg', 'Label'],
+ \ 'header': ['fg', 'Comment'] }
+
+" Enable per-command history.
+" CTRL-N and CTRL-P will be automatically bound to next-history and
+" previous-history instead of down and up. If you don't like the change,
+" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
+let g:fzf_history_dir = '~/.local/share/fzf-history'
+```
+
+#### Command-local options
+
+```vim
+" [Buffers] Jump to the existing window if possible
+let g:fzf_buffers_jump = 1
+
+" [[B]Commits] Customize the options used by 'git log':
+let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
+
+" [Tags] Command to generate tags file
+let g:fzf_tags_command = 'ctags -R'
+
+" [Commands] --expect expression for directly executing the command
+let g:fzf_commands_expect = 'alt-enter,ctrl-x'
+```
+
+#### Advanced customization
+
+You can use autoload functions to define your own commands.
+
+```vim
+" Command for git grep
+" - fzf#vim#grep(command, with_column, [options], [fullscreen])
+command! -bang -nargs=* GGrep
+ \ call fzf#vim#grep(
+ \ 'git grep --line-number '.shellescape(<q-args>), 0,
+ \ { 'dir': systemlist('git rev-parse --show-toplevel')[0] }, <bang>0)
+
+" Override Colors command. You can safely do this in your .vimrc as fzf.vim
+" will not override existing commands.
+command! -bang Colors
+ \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}, <bang>0)
+
+" Augmenting Ag command using fzf#vim#with_preview function
+" * fzf#vim#with_preview([[options], [preview window], [toggle keys...]])
+" * For syntax-highlighting, Ruby and any of the following tools are required:
+" - Bat: https://github.com/sharkdp/bat
+" - Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
+" - CodeRay: http://coderay.rubychan.de/
+" - Rouge: https://github.com/jneen/rouge
+"
+" :Ag - Start fzf with hidden preview window that can be enabled with "?" key
+" :Ag! - Start fzf in fullscreen and display the preview window above
+command! -bang -nargs=* Ag
+ \ call fzf#vim#ag(<q-args>,
+ \ <bang>0 ? fzf#vim#with_preview('up:60%')
+ \ : fzf#vim#with_preview('right:50%:hidden', '?'),
+ \ <bang>0)
+
+" Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag:
+command! -bang -nargs=* Rg
+ \ call fzf#vim#grep(
+ \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
+ \ <bang>0 ? fzf#vim#with_preview('up:60%')
+ \ : fzf#vim#with_preview('right:50%:hidden', '?'),
+ \ <bang>0)
+
+" Likewise, Files command with preview window
+command! -bang -nargs=? -complete=dir Files
+ \ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
+```
+
+Mappings
+--------
+
+| Mapping | Description |
+| --- | --- |
+| `<plug>(fzf-maps-n)` | Normal mode mappings |
+| `<plug>(fzf-maps-i)` | Insert mode mappings |
+| `<plug>(fzf-maps-x)` | Visual mode mappings |
+| `<plug>(fzf-maps-o)` | Operator-pending mappings |
+| `<plug>(fzf-complete-word)` | `cat /usr/share/dict/words` |
+| `<plug>(fzf-complete-path)` | Path completion using `find` (file + dir) |
+| `<plug>(fzf-complete-file)` | File completion using `find` |
+| `<plug>(fzf-complete-file-ag)` | File completion using `ag` |
+| `<plug>(fzf-complete-line)` | Line completion (all open buffers) |
+| `<plug>(fzf-complete-buffer-line)` | Line completion (current buffer only) |
+
+### Usage
+
+```vim
+" Mapping selecting mappings
+nmap <leader><tab> <plug>(fzf-maps-n)
+xmap <leader><tab> <plug>(fzf-maps-x)
+omap <leader><tab> <plug>(fzf-maps-o)
+
+" Insert mode completion
+imap <c-x><c-k> <plug>(fzf-complete-word)
+imap <c-x><c-f> <plug>(fzf-complete-path)
+imap <c-x><c-j> <plug>(fzf-complete-file-ag)
+imap <c-x><c-l> <plug>(fzf-complete-line)
+
+" Advanced customization using autoload functions
+inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})
+```
+
+### Completion helper
+
+`fzf#vim#complete` is a helper function for creating custom fuzzy completion
+using fzf. If the first parameter is a command string or a Vim list, it will
+be used as the source.
+
+```vim
+" Replace the default dictionary completion with fzf-based fuzzy completion
+inoremap <expr> <c-x><c-k> fzf#vim#complete('cat /usr/share/dict/words')
+```
+
+For advanced uses, you can pass an options dictionary to the function. The set
+of options is pretty much identical to that for `fzf#run` only with the
+following exceptions:
+
+- `reducer` (funcref)
+ - Reducer transforms the output lines of fzf into a single string value
+- `prefix` (string or funcref; default: `\k*$`)
+ - Regular expression pattern to extract the completion prefix
+ - Or a function to extract completion prefix
+- Both `source` and `options` can be given as funcrefs that take the
+ completion prefix as the argument and return the final value
+- `sink` or `sink*` are ignored
+
+```vim
+" Global line completion (not just open buffers. ripgrep required.)
+inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
+ \ 'prefix': '^.*$',
+ \ 'source': 'rg -n ^ --color always',
+ \ 'options': '--ansi --delimiter : --nth 3..',
+ \ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}))
+```
+
+#### Reducer example
+
+```vim
+function! s:make_sentence(lines)
+ return substitute(join(a:lines), '^.', '\=toupper(submatch(0))', '').'.'
+endfunction
+
+inoremap <expr> <c-x><c-s> fzf#vim#complete({
+ \ 'source': 'cat /usr/share/dict/words',
+ \ 'reducer': function('<sid>make_sentence'),
+ \ 'options': '--multi --reverse --margin 15%,0',
+ \ 'left': 20})
+```
+
+Status line of terminal buffer
+------------------------------
+
+When fzf starts in a terminal buffer (see [fzf/README-VIM.md][termbuf]), you
+may want to customize the statusline of the containing buffer.
+
+[termbuf]: https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf-inside-terminal-buffer
+
+### Hide statusline
+
+```vim
+autocmd! FileType fzf
+autocmd FileType fzf set laststatus=0 noshowmode noruler
+ \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
+```
+
+### Custom statusline
+
+```vim
+function! s:fzf_statusline()
+ " Override statusline as you like
+ highlight fzf1 ctermfg=161 ctermbg=251
+ highlight fzf2 ctermfg=23 ctermbg=251
+ highlight fzf3 ctermfg=237 ctermbg=251
+ setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
+endfunction
+
+autocmd! User FzfStatusLine call <SID>fzf_statusline()
+```
+
+License
+-------
+
+MIT
+
+[fzf]: https://github.com/junegunn/fzf
+[run]: https://github.com/junegunn/fzf#usage-as-vim-plugin
+[vimrc]: https://github.com/junegunn/dotfiles/blob/master/vimrc
+[ag]: https://github.com/ggreer/the_silver_searcher
+[rg]: https://github.com/BurntSushi/ripgrep
+[us]: https://github.com/SirVer/ultisnips
diff --git a/vim/.vim/plugged/fzf.vim/autoload/fzf/vim.vim b/vim/.vim/plugged/fzf.vim/autoload/fzf/vim.vim
new file mode 100644
index 0000000..22ca98d
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/autoload/fzf/vim.vim
@@ -0,0 +1,1324 @@
+" 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.
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" ------------------------------------------------------------------
+" Common
+" ------------------------------------------------------------------
+
+let s:is_win = has('win32') || has('win64')
+let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
+let s:bin_dir = expand('<sfile>:h:h:h').'/bin/'
+let s:bin = {
+\ 'preview': s:bin_dir.'preview.sh',
+\ 'tags': s:bin_dir.'tags.pl' }
+let s:TYPE = {'dict': type({}), 'funcref': type(function('call')), 'string': type(''), 'list': type([])}
+if s:is_win
+ if has('nvim')
+ let s:bin.preview = split(system('for %A in ("'.s:bin.preview.'") do @echo %~sA'), "\n")[0]
+ else
+ let s:bin.preview = fnamemodify(s:bin.preview, ':8')
+ endif
+ let s:bin.preview = 'bash '.escape(s:bin.preview, '\')
+endif
+
+let s:wide = 120
+
+function! s:extend_opts(dict, eopts, prepend)
+ if empty(a:eopts)
+ return
+ endif
+ if has_key(a:dict, 'options')
+ if type(a:dict.options) == s:TYPE.list && type(a:eopts) == s:TYPE.list
+ if a:prepend
+ let a:dict.options = extend(copy(a:eopts), a:dict.options)
+ else
+ call extend(a:dict.options, a:eopts)
+ endif
+ else
+ let all_opts = a:prepend ? [a:eopts, a:dict.options] : [a:dict.options, a:eopts]
+ let a:dict.options = join(map(all_opts, 'type(v:val) == s:TYPE.list ? join(map(copy(v:val), "fzf#shellescape(v:val)")) : v:val'))
+ endif
+ else
+ let a:dict.options = a:eopts
+ endif
+endfunction
+
+function! s:merge_opts(dict, eopts)
+ return s:extend_opts(a:dict, a:eopts, 0)
+endfunction
+
+function! s:prepend_opts(dict, eopts)
+ return s:extend_opts(a:dict, a:eopts, 1)
+endfunction
+
+" [[options to wrap], [preview window expression], [toggle-preview keys...]]
+function! fzf#vim#with_preview(...)
+ " Default options
+ let options = {}
+ let window = 'right'
+
+ let args = copy(a:000)
+
+ " Options to wrap
+ if len(args) && type(args[0]) == s:TYPE.dict
+ let options = copy(args[0])
+ call remove(args, 0)
+ endif
+
+ " Preview window
+ if len(args) && type(args[0]) == s:TYPE.string
+ if args[0] !~# '^\(up\|down\|left\|right\)'
+ throw 'invalid preview window: '.args[0]
+ endif
+ let window = args[0]
+ call remove(args, 0)
+ endif
+
+ let preview = ['--preview-window', window, '--preview', (s:is_win ? s:bin.preview : fzf#shellescape(s:bin.preview)).' {}']
+
+ if len(args)
+ call extend(preview, ['--bind', join(map(args, 'v:val.":toggle-preview"'), ',')])
+ endif
+ call s:merge_opts(options, preview)
+ return options
+endfunction
+
+function! s:remove_layout(opts)
+ for key in s:layout_keys
+ if has_key(a:opts, key)
+ call remove(a:opts, key)
+ endif
+ endfor
+ return a:opts
+endfunction
+
+function! s:wrap(name, opts, bang)
+ " fzf#wrap does not append --expect if sink or sink* is found
+ let opts = copy(a:opts)
+ let options = ''
+ if has_key(opts, 'options')
+ let options = type(opts.options) == s:TYPE.list ? join(opts.options) : opts.options
+ endif
+ if options !~ '--expect' && has_key(opts, 'sink*')
+ let Sink = remove(opts, 'sink*')
+ let wrapped = fzf#wrap(a:name, opts, a:bang)
+ let wrapped['sink*'] = Sink
+ else
+ let wrapped = fzf#wrap(a:name, opts, a:bang)
+ endif
+ return wrapped
+endfunction
+
+function! s:strip(str)
+ return substitute(a:str, '^\s*\|\s*$', '', 'g')
+endfunction
+
+function! s:chomp(str)
+ return substitute(a:str, '\n*$', '', 'g')
+endfunction
+
+function! s:escape(path)
+ let path = fnameescape(a:path)
+ return s:is_win ? escape(path, '$') : path
+endfunction
+
+if v:version >= 704
+ function! s:function(name)
+ return function(a:name)
+ endfunction
+else
+ function! s:function(name)
+ " By Ingo Karkat
+ return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '<SNR>\d\+_\zefunction$'), ''))
+ endfunction
+endif
+
+function! s:get_color(attr, ...)
+ let gui = has('termguicolors') && &termguicolors
+ let fam = gui ? 'gui' : 'cterm'
+ let pat = gui ? '^#[a-f0-9]\+' : '^[0-9]\+$'
+ for group in a:000
+ let code = synIDattr(synIDtrans(hlID(group)), a:attr, fam)
+ if code =~? pat
+ return code
+ endif
+ endfor
+ return ''
+endfunction
+
+let s:ansi = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36}
+
+function! s:csi(color, fg)
+ let prefix = a:fg ? '38;' : '48;'
+ if a:color[0] == '#'
+ return prefix.'2;'.join(map([a:color[1:2], a:color[3:4], a:color[5:6]], 'str2nr(v:val, 16)'), ';')
+ endif
+ return prefix.'5;'.a:color
+endfunction
+
+function! s:ansi(str, group, default, ...)
+ let fg = s:get_color('fg', a:group)
+ let bg = s:get_color('bg', a:group)
+ let color = (empty(fg) ? s:ansi[a:default] : s:csi(fg, 1)) .
+ \ (empty(bg) ? '' : ';'.s:csi(bg, 0))
+ return printf("\x1b[%s%sm%s\x1b[m", color, a:0 ? ';1' : '', a:str)
+endfunction
+
+for s:color_name in keys(s:ansi)
+ execute "function! s:".s:color_name."(str, ...)\n"
+ \ " return s:ansi(a:str, get(a:, 1, ''), '".s:color_name."')\n"
+ \ "endfunction"
+endfor
+
+function! s:buflisted()
+ return filter(range(1, bufnr('$')), 'buflisted(v:val) && getbufvar(v:val, "&filetype") != "qf"')
+endfunction
+
+function! s:fzf(name, opts, extra)
+ let [extra, bang] = [{}, 0]
+ if len(a:extra) <= 1
+ let first = get(a:extra, 0, 0)
+ if type(first) == s:TYPE.dict
+ let extra = first
+ else
+ let bang = first
+ endif
+ elseif len(a:extra) == 2
+ let [extra, bang] = a:extra
+ else
+ throw 'invalid number of arguments'
+ endif
+
+ let eopts = has_key(extra, 'options') ? remove(extra, 'options') : ''
+ let merged = extend(copy(a:opts), extra)
+ call s:merge_opts(merged, eopts)
+ return fzf#run(s:wrap(a:name, merged, bang))
+endfunction
+
+let s:default_action = {
+ \ 'ctrl-t': 'tab split',
+ \ 'ctrl-x': 'split',
+ \ 'ctrl-v': 'vsplit' }
+
+function! s:action_for(key, ...)
+ let default = a:0 ? a:1 : ''
+ let Cmd = get(get(g:, 'fzf_action', s:default_action), a:key, default)
+ return type(Cmd) == s:TYPE.string ? Cmd : default
+endfunction
+
+function! s:open(cmd, target)
+ if stridx('edit', a:cmd) == 0 && fnamemodify(a:target, ':p') ==# expand('%:p')
+ return
+ endif
+ execute a:cmd s:escape(a:target)
+endfunction
+
+function! s:align_lists(lists)
+ let maxes = {}
+ for list in a:lists
+ let i = 0
+ while i < len(list)
+ let maxes[i] = max([get(maxes, i, 0), len(list[i])])
+ let i += 1
+ endwhile
+ endfor
+ for list in a:lists
+ call map(list, "printf('%-'.maxes[v:key].'s', v:val)")
+ endfor
+ return a:lists
+endfunction
+
+function! s:warn(message)
+ echohl WarningMsg
+ echom a:message
+ echohl None
+ return 0
+endfunction
+
+function! s:fill_quickfix(list, ...)
+ if len(a:list) > 1
+ call setqflist(a:list)
+ copen
+ wincmd p
+ if a:0
+ execute a:1
+ endif
+ endif
+endfunction
+
+function! fzf#vim#_uniq(list)
+ let visited = {}
+ let ret = []
+ for l in a:list
+ if !empty(l) && !has_key(visited, l)
+ call add(ret, l)
+ let visited[l] = 1
+ endif
+ endfor
+ return ret
+endfunction
+
+" ------------------------------------------------------------------
+" Files
+" ------------------------------------------------------------------
+function! s:shortpath()
+ let short = fnamemodify(getcwd(), ':~:.')
+ if !has('win32unix')
+ let short = pathshorten(short)
+ endif
+ let slash = (s:is_win && !&shellslash) ? '\' : '/'
+ return empty(short) ? '~'.slash : short . (short =~ escape(slash, '\').'$' ? '' : slash)
+endfunction
+
+function! fzf#vim#files(dir, ...)
+ let args = {}
+ if !empty(a:dir)
+ if !isdirectory(expand(a:dir))
+ return s:warn('Invalid directory')
+ endif
+ let slash = (s:is_win && !&shellslash) ? '\\' : '/'
+ let dir = substitute(a:dir, '[/\\]*$', slash, '')
+ let args.dir = dir
+ else
+ let dir = s:shortpath()
+ endif
+
+ let args.options = ['-m', '--prompt', strwidth(dir) < &columns / 2 - 20 ? dir : '> ']
+ call s:merge_opts(args, get(g:, 'fzf_files_options', []))
+ return s:fzf('files', args, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Lines
+" ------------------------------------------------------------------
+function! s:line_handler(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ normal! m'
+ let cmd = s:action_for(a:lines[0])
+ if !empty(cmd) && stridx('edit', cmd) < 0
+ execute 'silent' cmd
+ endif
+
+ let keys = split(a:lines[1], '\t')
+ execute 'buffer' keys[0]
+ execute keys[2]
+ normal! ^zvzz
+endfunction
+
+function! fzf#vim#_lines(all)
+ let cur = []
+ let rest = []
+ let buf = bufnr('')
+ let longest_name = 0
+ let display_bufnames = &columns > s:wide
+ if display_bufnames
+ let bufnames = {}
+ for b in s:buflisted()
+ let bufnames[b] = pathshorten(fnamemodify(bufname(b), ":~:."))
+ let longest_name = max([longest_name, len(bufnames[b])])
+ endfor
+ endif
+ let len_bufnames = min([15, longest_name])
+ for b in s:buflisted()
+ let lines = getbufline(b, 1, "$")
+ if empty(lines)
+ let path = fnamemodify(bufname(b), ':p')
+ let lines = filereadable(path) ? readfile(path) : []
+ endif
+ if display_bufnames
+ let bufname = bufnames[b]
+ if len(bufname) > len_bufnames + 1
+ let bufname = '…' . bufname[-len_bufnames+1:]
+ endif
+ let bufname = printf(s:green("%".len_bufnames."s", "Directory"), bufname)
+ else
+ let bufname = ''
+ endif
+ let linefmt = s:blue("%2d\t", "TabLine")."%s".s:yellow("\t%4d ", "LineNr")."\t%s"
+ call extend(b == buf ? cur : rest,
+ \ filter(
+ \ map(lines,
+ \ '(!a:all && empty(v:val)) ? "" : printf(linefmt, b, bufname, v:key + 1, v:val)'),
+ \ 'a:all || !empty(v:val)'))
+ endfor
+ return [display_bufnames, extend(cur, rest)]
+endfunction
+
+function! fzf#vim#lines(...)
+ let [display_bufnames, lines] = fzf#vim#_lines(1)
+ let nth = display_bufnames ? 3 : 2
+ let [query, args] = (a:0 && type(a:1) == type('')) ?
+ \ [a:1, a:000[1:]] : ['', a:000]
+ return s:fzf('lines', {
+ \ 'source': lines,
+ \ 'sink*': s:function('s:line_handler'),
+ \ 'options': ['+m', '--tiebreak=index', '--prompt', 'Lines> ', '--ansi', '--extended', '--nth='.nth.'..', '--layout=reverse-list', '--tabstop=1', '--query', query]
+ \}, args)
+endfunction
+
+" ------------------------------------------------------------------
+" BLines
+" ------------------------------------------------------------------
+function! s:buffer_line_handler(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ let qfl = []
+ for line in a:lines[1:]
+ let chunks = split(line, "\t", 1)
+ let ln = chunks[0]
+ let ltxt = join(chunks[1:], "\t")
+ call add(qfl, {'filename': expand('%'), 'lnum': str2nr(ln), 'text': ltxt})
+ endfor
+ call s:fill_quickfix(qfl, 'cfirst')
+ normal! m'
+ let cmd = s:action_for(a:lines[0])
+ if !empty(cmd)
+ execute 'silent' cmd
+ endif
+
+ execute split(a:lines[1], '\t')[0]
+ normal! ^zvzz
+endfunction
+
+function! s:buffer_lines(query)
+ let linefmt = s:yellow(" %4d ", "LineNr")."\t%s"
+ let fmtexpr = 'printf(linefmt, v:key + 1, v:val)'
+ let lines = getline(1, '$')
+ if empty(a:query)
+ return map(lines, fmtexpr)
+ end
+ return filter(map(lines, 'v:val =~ a:query ? '.fmtexpr.' : ""'), 'len(v:val)')
+endfunction
+
+function! fzf#vim#buffer_lines(...)
+ let [query, args] = (a:0 && type(a:1) == type('')) ?
+ \ [a:1, a:000[1:]] : ['', a:000]
+ return s:fzf('blines', {
+ \ 'source': s:buffer_lines(query),
+ \ 'sink*': s:function('s:buffer_line_handler'),
+ \ 'options': ['+m', '--tiebreak=index', '--multi', '--prompt', 'BLines> ', '--ansi', '--extended', '--nth=2..', '--layout=reverse-list', '--tabstop=1']
+ \}, args)
+endfunction
+
+" ------------------------------------------------------------------
+" Colors
+" ------------------------------------------------------------------
+function! fzf#vim#colors(...)
+ let colors = split(globpath(&rtp, "colors/*.vim"), "\n")
+ if has('packages')
+ let colors += split(globpath(&packpath, "pack/*/opt/*/colors/*.vim"), "\n")
+ endif
+ return s:fzf('colors', {
+ \ 'source': fzf#vim#_uniq(map(colors, "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')")),
+ \ 'sink': 'colo',
+ \ 'options': '+m --prompt="Colors> "'
+ \}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Locate
+" ------------------------------------------------------------------
+function! fzf#vim#locate(query, ...)
+ return s:fzf('locate', {
+ \ 'source': 'locate '.a:query,
+ \ 'options': '-m --prompt "Locate> "'
+ \}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" History[:/]
+" ------------------------------------------------------------------
+function! s:all_files()
+ return fzf#vim#_uniq(map(
+ \ filter([expand('%')], 'len(v:val)')
+ \ + filter(map(s:buflisted_sorted(), 'bufname(v:val)'), 'len(v:val)')
+ \ + filter(copy(v:oldfiles), "filereadable(fnamemodify(v:val, ':p'))"),
+ \ 'fnamemodify(v:val, ":~:.")'))
+endfunction
+
+function! s:history_source(type)
+ let max = histnr(a:type)
+ let fmt = ' %'.len(string(max)).'d '
+ let list = filter(map(range(1, max), 'histget(a:type, - v:val)'), '!empty(v:val)')
+ return extend([' :: Press '.s:magenta('CTRL-E', 'Special').' to edit'],
+ \ map(list, 's:yellow(printf(fmt, len(list) - v:key), "Number")." ".v:val'))
+endfunction
+
+nnoremap <plug>(-fzf-vim-do) :execute g:__fzf_command<cr>
+nnoremap <plug>(-fzf-/) /
+nnoremap <plug>(-fzf-:) :
+
+function! s:history_sink(type, lines)
+ if len(a:lines) < 2
+ return
+ endif
+
+ let prefix = "\<plug>(-fzf-".a:type.')'
+ let key = a:lines[0]
+ let item = matchstr(a:lines[1], ' *[0-9]\+ *\zs.*')
+ if key == 'ctrl-e'
+ call histadd(a:type, item)
+ redraw
+ call feedkeys(a:type."\<up>")
+ else
+ if a:type == ':'
+ call histadd(a:type, item)
+ endif
+ let g:__fzf_command = "normal ".prefix.item."\<cr>"
+ call feedkeys("\<plug>(-fzf-vim-do)")
+ endif
+endfunction
+
+function! s:cmd_history_sink(lines)
+ call s:history_sink(':', a:lines)
+endfunction
+
+function! fzf#vim#command_history(...)
+ return s:fzf('history-command', {
+ \ 'source': s:history_source(':'),
+ \ 'sink*': s:function('s:cmd_history_sink'),
+ \ 'options': '+m --ansi --prompt="Hist:> " --header-lines=1 --expect=ctrl-e --tiebreak=index'}, a:000)
+endfunction
+
+function! s:search_history_sink(lines)
+ call s:history_sink('/', a:lines)
+endfunction
+
+function! fzf#vim#search_history(...)
+ return s:fzf('history-search', {
+ \ 'source': s:history_source('/'),
+ \ 'sink*': s:function('s:search_history_sink'),
+ \ 'options': '+m --ansi --prompt="Hist/> " --header-lines=1 --expect=ctrl-e --tiebreak=index'}, a:000)
+endfunction
+
+function! fzf#vim#history(...)
+ return s:fzf('history-files', {
+ \ 'source': s:all_files(),
+ \ 'options': ['-m', '--header-lines', !empty(expand('%')), '--prompt', 'Hist> ']
+ \}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" GFiles[?]
+" ------------------------------------------------------------------
+
+function! s:get_git_root()
+ let root = split(system('git rev-parse --show-toplevel'), '\n')[0]
+ return v:shell_error ? '' : root
+endfunction
+
+function! fzf#vim#gitfiles(args, ...)
+ let root = s:get_git_root()
+ if empty(root)
+ return s:warn('Not in git repo')
+ endif
+ if a:args != '?'
+ return s:fzf('gfiles', {
+ \ 'source': 'git ls-files '.a:args.(s:is_win ? '' : ' | uniq'),
+ \ 'dir': root,
+ \ 'options': '-m --prompt "GitFiles> "'
+ \}, a:000)
+ endif
+
+ " Here be dragons!
+ " We're trying to access the common sink function that fzf#wrap injects to
+ " the options dictionary.
+ let wrapped = fzf#wrap({
+ \ 'source': 'git -c color.status=always status --short --untracked-files=all',
+ \ 'dir': root,
+ \ 'options': ['--ansi', '--multi', '--nth', '2..,..', '--tiebreak=index', '--prompt', 'GitFiles?> ', '--preview', 'sh -c "(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500"']
+ \})
+ call s:remove_layout(wrapped)
+ let wrapped.common_sink = remove(wrapped, 'sink*')
+ function! wrapped.newsink(lines)
+ let lines = extend(a:lines[0:0], map(a:lines[1:], 'substitute(v:val[3:], ".* -> ", "", "")'))
+ return self.common_sink(lines)
+ endfunction
+ let wrapped['sink*'] = remove(wrapped, 'newsink')
+ return s:fzf('gfiles-diff', wrapped, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Buffers
+" ------------------------------------------------------------------
+function! s:find_open_window(b)
+ let [tcur, tcnt] = [tabpagenr() - 1, tabpagenr('$')]
+ for toff in range(0, tabpagenr('$') - 1)
+ let t = (tcur + toff) % tcnt + 1
+ let buffers = tabpagebuflist(t)
+ for w in range(1, len(buffers))
+ let b = buffers[w - 1]
+ if b == a:b
+ return [t, w]
+ endif
+ endfor
+ endfor
+ return [0, 0]
+endfunction
+
+function! s:jump(t, w)
+ execute 'normal!' a:t.'gt'
+ execute a:w.'wincmd w'
+endfunction
+
+function! s:bufopen(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ let b = matchstr(a:lines[1], '\[\zs[0-9]*\ze\]')
+ if empty(a:lines[0]) && get(g:, 'fzf_buffers_jump')
+ let [t, w] = s:find_open_window(b)
+ if t
+ call s:jump(t, w)
+ return
+ endif
+ endif
+ let cmd = s:action_for(a:lines[0])
+ if !empty(cmd)
+ execute 'silent' cmd
+ endif
+ execute 'buffer' b
+endfunction
+
+function! s:format_buffer(b)
+ let name = bufname(a:b)
+ let name = empty(name) ? '[No Name]' : fnamemodify(name, ":p:~:.")
+ let flag = a:b == bufnr('') ? s:blue('%', 'Conditional') :
+ \ (a:b == bufnr('#') ? s:magenta('#', 'Special') : ' ')
+ let modified = getbufvar(a:b, '&modified') ? s:red(' [+]', 'Exception') : ''
+ let readonly = getbufvar(a:b, '&modifiable') ? '' : s:green(' [RO]', 'Constant')
+ let extra = join(filter([modified, readonly], '!empty(v:val)'), '')
+ return s:strip(printf("[%s] %s\t%s\t%s", s:yellow(a:b, 'Number'), flag, name, extra))
+endfunction
+
+function! s:sort_buffers(...)
+ let [b1, b2] = map(copy(a:000), 'get(g:fzf#vim#buffers, v:val, v:val)')
+ " Using minus between a float and a number in a sort function causes an error
+ return b1 < b2 ? 1 : -1
+endfunction
+
+function! s:buflisted_sorted()
+ return sort(s:buflisted(), 's:sort_buffers')
+endfunction
+
+function! fzf#vim#buffers(...)
+ let [query, args] = (a:0 && type(a:1) == type('')) ?
+ \ [a:1, a:000[1:]] : ['', a:000]
+ return s:fzf('buffers', {
+ \ 'source': map(s:buflisted_sorted(), 's:format_buffer(v:val)'),
+ \ 'sink*': s:function('s:bufopen'),
+ \ 'options': ['+m', '-x', '--tiebreak=index', '--header-lines=1', '--ansi', '-d', '\t', '-n', '2,1..2', '--prompt', 'Buf> ', '--query', query]
+ \}, args)
+endfunction
+
+" ------------------------------------------------------------------
+" Ag / Rg
+" ------------------------------------------------------------------
+function! s:ag_to_qf(line, with_column)
+ let parts = split(a:line, ':')
+ let text = join(parts[(a:with_column ? 3 : 2):], ':')
+ let dict = {'filename': &acd ? fnamemodify(parts[0], ':p') : parts[0], 'lnum': parts[1], 'text': text}
+ if a:with_column
+ let dict.col = parts[2]
+ endif
+ return dict
+endfunction
+
+function! s:ag_handler(lines, with_column)
+ if len(a:lines) < 2
+ return
+ endif
+
+ let cmd = s:action_for(a:lines[0], 'e')
+ let list = map(filter(a:lines[1:], 'len(v:val)'), 's:ag_to_qf(v:val, a:with_column)')
+ if empty(list)
+ return
+ endif
+
+ let first = list[0]
+ try
+ call s:open(cmd, first.filename)
+ execute first.lnum
+ if a:with_column
+ execute 'normal!' first.col.'|'
+ endif
+ normal! zz
+ catch
+ endtry
+
+ call s:fill_quickfix(list)
+endfunction
+
+" query, [[ag options], options]
+function! fzf#vim#ag(query, ...)
+ if type(a:query) != s:TYPE.string
+ return s:warn('Invalid query argument')
+ endif
+ let query = empty(a:query) ? '^(?=.)' : a:query
+ let args = copy(a:000)
+ let ag_opts = len(args) > 1 && type(args[0]) == s:TYPE.string ? remove(args, 0) : ''
+ let command = ag_opts . ' ' . fzf#shellescape(query)
+ return call('fzf#vim#ag_raw', insert(args, command, 0))
+endfunction
+
+" ag command suffix, [options]
+function! fzf#vim#ag_raw(command_suffix, ...)
+ if !executable('ag')
+ return s:warn('ag is not found')
+ endif
+ return call('fzf#vim#grep', extend(['ag --nogroup --column --color '.a:command_suffix, 1], a:000))
+endfunction
+
+" command, with_column, [options]
+function! fzf#vim#grep(grep_command, with_column, ...)
+ let words = []
+ for word in split(a:grep_command)
+ if word !~# '^[a-z]'
+ break
+ endif
+ call add(words, word)
+ endfor
+ let words = empty(words) ? ['grep'] : words
+ let name = join(words, '-')
+ let capname = join(map(words, 'toupper(v:val[0]).v:val[1:]'), '')
+ let opts = {
+ \ 'source': a:grep_command,
+ \ 'column': a:with_column,
+ \ 'options': ['--ansi', '--prompt', capname.'> ',
+ \ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
+ \ '--color', 'hl:4,hl+:12']
+ \}
+ function! opts.sink(lines)
+ return s:ag_handler(a:lines, self.column)
+ endfunction
+ let opts['sink*'] = remove(opts, 'sink')
+ return s:fzf(name, opts, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" BTags
+" ------------------------------------------------------------------
+function! s:btags_source(tag_cmds)
+ if !filereadable(expand('%'))
+ throw 'Save the file first'
+ endif
+
+ for cmd in a:tag_cmds
+ let lines = split(system(cmd), "\n")
+ if !v:shell_error && len(lines)
+ break
+ endif
+ endfor
+ if v:shell_error
+ throw get(lines, 0, 'Failed to extract tags')
+ elseif empty(lines)
+ throw 'No tags found'
+ endif
+ return map(s:align_lists(map(lines, 'split(v:val, "\t")')), 'join(v:val, "\t")')
+endfunction
+
+function! s:btags_sink(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ normal! m'
+ let cmd = s:action_for(a:lines[0])
+ if !empty(cmd)
+ execute 'silent' cmd '%'
+ endif
+ let qfl = []
+ for line in a:lines[1:]
+ execute split(line, "\t")[2]
+ call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
+ endfor
+ call s:fill_quickfix(qfl, 'cfirst')
+ normal! zz
+endfunction
+
+" query, [[tag commands], options]
+function! fzf#vim#buffer_tags(query, ...)
+ let args = copy(a:000)
+ let escaped = fzf#shellescape(expand('%'))
+ let null = s:is_win ? 'nul' : '/dev/null'
+ let sort = has('unix') && !has('win32unix') && executable('sort') ? '| sort -s -k 5' : ''
+ let tag_cmds = (len(args) > 1 && type(args[0]) != type({})) ? remove(args, 0) : [
+ \ printf('ctags -f - --sort=yes --excmd=number --language-force=%s %s 2> %s %s', &filetype, escaped, null, sort),
+ \ printf('ctags -f - --sort=yes --excmd=number %s 2> %s %s', escaped, null, sort)]
+ if type(tag_cmds) != type([])
+ let tag_cmds = [tag_cmds]
+ endif
+ try
+ return s:fzf('btags', {
+ \ 'source': s:btags_source(tag_cmds),
+ \ 'sink*': s:function('s:btags_sink'),
+ \ 'options': ['--layout=reverse-list', '-m', '-d', '\t', '--with-nth', '1,4..', '-n', '1', '--prompt', 'BTags> ', '--query', a:query]}, args)
+ catch
+ return s:warn(v:exception)
+ endtry
+endfunction
+
+" ------------------------------------------------------------------
+" Tags
+" ------------------------------------------------------------------
+function! s:tags_sink(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ normal! m'
+ let qfl = []
+ let cmd = s:action_for(a:lines[0], 'e')
+ try
+ let [magic, &magic, wrapscan, &wrapscan, acd, &acd] = [&magic, 0, &wrapscan, 1, &acd, 0]
+ for line in a:lines[1:]
+ try
+ let parts = split(line, '\t\zs')
+ let excmd = matchstr(join(parts[2:-2], '')[:-2], '^.\{-}\ze;\?"\t')
+ let base = fnamemodify(parts[-1], ':h')
+ let relpath = parts[1][:-2]
+ let abspath = relpath =~ (s:is_win ? '^[A-Z]:\' : '^/') ? relpath : join([base, relpath], '/')
+ call s:open(cmd, expand(abspath, 1))
+ execute excmd
+ call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
+ catch /^Vim:Interrupt$/
+ break
+ catch
+ call s:warn(v:exception)
+ endtry
+ endfor
+ finally
+ let [&magic, &wrapscan, &acd] = [magic, wrapscan, acd]
+ endtry
+ call s:fill_quickfix(qfl, 'clast')
+ normal! zz
+endfunction
+
+function! fzf#vim#tags(query, ...)
+ if !executable('perl')
+ return s:warn('Tags command requires perl')
+ endif
+ if empty(tagfiles())
+ call inputsave()
+ echohl WarningMsg
+ let gen = input('tags not found. Generate? (y/N) ')
+ echohl None
+ call inputrestore()
+ redraw
+ if gen =~? '^y'
+ call s:warn('Preparing tags')
+ call system(get(g:, 'fzf_tags_command', 'ctags -R'.(s:is_win ? ' --output-format=e-ctags' : '')))
+ if empty(tagfiles())
+ return s:warn('Failed to create tags')
+ endif
+ else
+ return s:warn('No tags found')
+ endif
+ endif
+
+ let tagfiles = tagfiles()
+ let v2_limit = 1024 * 1024 * 200
+ for tagfile in tagfiles
+ let v2_limit -= getfsize(tagfile)
+ if v2_limit < 0
+ break
+ endif
+ endfor
+ let opts = v2_limit < 0 ? ['--algo=v1'] : []
+
+ return s:fzf('tags', {
+ \ 'source': 'perl '.fzf#shellescape(s:bin.tags).' '.join(map(tagfiles, 'fzf#shellescape(fnamemodify(v:val, ":p"))')),
+ \ 'sink*': s:function('s:tags_sink'),
+ \ 'options': extend(opts, ['--nth', '1..2', '-m', '--tiebreak=begin', '--prompt', 'Tags> ', '--query', a:query])}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Snippets (UltiSnips)
+" ------------------------------------------------------------------
+function! s:inject_snippet(line)
+ let snip = split(a:line, "\t")[0]
+ execute 'normal! a'.s:strip(snip)."\<c-r>=UltiSnips#ExpandSnippet()\<cr>"
+endfunction
+
+function! fzf#vim#snippets(...)
+ if !exists(':UltiSnipsEdit')
+ return s:warn('UltiSnips not found')
+ endif
+ let list = UltiSnips#SnippetsInCurrentScope()
+ if empty(list)
+ return s:warn('No snippets available here')
+ endif
+ let aligned = sort(s:align_lists(items(list)))
+ let colored = map(aligned, 's:yellow(v:val[0])."\t".v:val[1]')
+ return s:fzf('snippets', {
+ \ 'source': colored,
+ \ 'options': '--ansi --tiebreak=index +m -n 1 -d "\t"',
+ \ 'sink': s:function('s:inject_snippet')}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Commands
+" ------------------------------------------------------------------
+let s:nbs = nr2char(0x2007)
+
+function! s:format_cmd(line)
+ return substitute(a:line, '\C \([A-Z]\S*\) ',
+ \ '\=s:nbs.s:yellow(submatch(1), "Function").s:nbs', '')
+endfunction
+
+function! s:command_sink(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ let cmd = matchstr(a:lines[1], s:nbs.'\zs\S*\ze'.s:nbs)
+ if empty(a:lines[0])
+ call feedkeys(':'.cmd.(a:lines[1][0] == '!' ? '' : ' '))
+ else
+ execute cmd
+ endif
+endfunction
+
+let s:fmt_excmd = ' '.s:blue('%-38s', 'Statement').'%s'
+
+function! s:format_excmd(ex)
+ let match = matchlist(a:ex, '^|:\(\S\+\)|\s*\S*\(.*\)')
+ return printf(s:fmt_excmd, s:nbs.match[1].s:nbs, s:strip(match[2]))
+endfunction
+
+function! s:excmds()
+ let help = globpath($VIMRUNTIME, 'doc/index.txt')
+ if empty(help)
+ return []
+ endif
+
+ let commands = []
+ let command = ''
+ for line in readfile(help)
+ if line =~ '^|:[^|]'
+ if !empty(command)
+ call add(commands, s:format_excmd(command))
+ endif
+ let command = line
+ elseif line =~ '^\s\+\S' && !empty(command)
+ let command .= substitute(line, '^\s*', ' ', '')
+ elseif !empty(commands) && line =~ '^\s*$'
+ break
+ endif
+ endfor
+ if !empty(command)
+ call add(commands, s:format_excmd(command))
+ endif
+ return commands
+endfunction
+
+function! fzf#vim#commands(...)
+ redir => cout
+ silent command
+ redir END
+ let list = split(cout, "\n")
+ return s:fzf('commands', {
+ \ 'source': extend(extend(list[0:0], map(list[1:], 's:format_cmd(v:val)')), s:excmds()),
+ \ 'sink*': s:function('s:command_sink'),
+ \ 'options': '--ansi --expect '.get(g:, 'fzf_commands_expect', 'ctrl-x').
+ \ ' --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Marks
+" ------------------------------------------------------------------
+function! s:format_mark(line)
+ return substitute(a:line, '\S', '\=s:yellow(submatch(0), "Number")', '')
+endfunction
+
+function! s:mark_sink(lines)
+ if len(a:lines) < 2
+ return
+ endif
+ let cmd = s:action_for(a:lines[0])
+ if !empty(cmd)
+ execute 'silent' cmd
+ endif
+ execute 'normal! `'.matchstr(a:lines[1], '\S').'zz'
+endfunction
+
+function! fzf#vim#marks(...)
+ redir => cout
+ silent marks
+ redir END
+ let list = split(cout, "\n")
+ return s:fzf('marks', {
+ \ 'source': extend(list[0:0], map(list[1:], 's:format_mark(v:val)')),
+ \ 'sink*': s:function('s:mark_sink'),
+ \ 'options': '+m -x --ansi --tiebreak=index --header-lines 1 --tiebreak=begin --prompt "Marks> "'}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Help tags
+" ------------------------------------------------------------------
+function! s:helptag_sink(line)
+ let [tag, file, path] = split(a:line, "\t")[0:2]
+ let rtp = fnamemodify(path, ':p:h:h')
+ if stridx(&rtp, rtp) < 0
+ execute 'set rtp+='.s:escape(rtp)
+ endif
+ execute 'help' tag
+endfunction
+
+function! fzf#vim#helptags(...)
+ if !executable('grep') || !executable('perl')
+ return s:warn('Helptags command requires grep and perl')
+ endif
+ let sorted = sort(split(globpath(&runtimepath, 'doc/tags', 1), '\n'))
+ let tags = exists('*uniq') ? uniq(sorted) : fzf#vim#_uniq(sorted)
+
+ if exists('s:helptags_script')
+ silent! call delete(s:helptags_script)
+ endif
+ let s:helptags_script = tempname()
+ call writefile(['/('.(s:is_win ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('.s:green('%-40s', 'Label').'\t%s\t%s\n), $2, $3, $1)'], s:helptags_script)
+ return s:fzf('helptags', {
+ \ 'source': 'grep -H ".*" '.join(map(tags, 'fzf#shellescape(v:val)')).
+ \ ' | perl -n '.fzf#shellescape(s:helptags_script).' | sort',
+ \ 'sink': s:function('s:helptag_sink'),
+ \ 'options': ['--ansi', '+m', '--tiebreak=begin', '--with-nth', '..-2']}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" File types
+" ------------------------------------------------------------------
+function! fzf#vim#filetypes(...)
+ return s:fzf('filetypes', {
+ \ 'source': fzf#vim#_uniq(sort(map(split(globpath(&rtp, 'syntax/*.vim'), '\n'),
+ \ 'fnamemodify(v:val, ":t:r")'))),
+ \ 'sink': 'setf',
+ \ 'options': '+m --prompt="File types> "'
+ \}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Windows
+" ------------------------------------------------------------------
+function! s:format_win(tab, win, buf)
+ let modified = getbufvar(a:buf, '&modified')
+ let name = bufname(a:buf)
+ let name = empty(name) ? '[No Name]' : name
+ let active = tabpagewinnr(a:tab) == a:win
+ return (active? s:blue('> ', 'Operator') : ' ') . name . (modified? s:red(' [+]', 'Exception') : '')
+endfunction
+
+function! s:windows_sink(line)
+ let list = matchlist(a:line, '^ *\([0-9]\+\) *\([0-9]\+\)')
+ call s:jump(list[1], list[2])
+endfunction
+
+function! fzf#vim#windows(...)
+ let lines = []
+ for t in range(1, tabpagenr('$'))
+ let buffers = tabpagebuflist(t)
+ for w in range(1, len(buffers))
+ call add(lines,
+ \ printf('%s %s %s',
+ \ s:yellow(printf('%3d', t), 'Number'),
+ \ s:cyan(printf('%3d', w), 'String'),
+ \ s:format_win(t, w, buffers[w-1])))
+ endfor
+ endfor
+ return s:fzf('windows', {
+ \ 'source': extend(['Tab Win Name'], lines),
+ \ 'sink': s:function('s:windows_sink'),
+ \ 'options': '+m --ansi --tiebreak=begin --header-lines=1'}, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" Commits / BCommits
+" ------------------------------------------------------------------
+function! s:yank_to_register(data)
+ let @" = a:data
+ silent! let @* = a:data
+ silent! let @+ = a:data
+endfunction
+
+function! s:commits_sink(lines)
+ if len(a:lines) < 2
+ return
+ endif
+
+ let pat = '[0-9a-f]\{7,9}'
+
+ if a:lines[0] == 'ctrl-y'
+ let hashes = join(filter(map(a:lines[1:], 'matchstr(v:val, pat)'), 'len(v:val)'))
+ return s:yank_to_register(hashes)
+ end
+
+ let diff = a:lines[0] == 'ctrl-d'
+ let cmd = s:action_for(a:lines[0], 'e')
+ let buf = bufnr('')
+ for idx in range(1, len(a:lines) - 1)
+ let sha = matchstr(a:lines[idx], pat)
+ if !empty(sha)
+ if diff
+ if idx > 1
+ execute 'tab sb' buf
+ endif
+ execute 'Gdiff' sha
+ else
+ " Since fugitive buffers are unlisted, we can't keep using 'e'
+ let c = (cmd == 'e' && idx > 1) ? 'tab split' : cmd
+ execute c FugitiveFind(sha)
+ endif
+ endif
+ endfor
+endfunction
+
+function! s:commits(buffer_local, args)
+ let s:git_root = s:get_git_root()
+ if empty(s:git_root)
+ return s:warn('Not in git repository')
+ endif
+
+ let source = 'git log '.get(g:, 'fzf_commits_log_options', '--color=always '.fzf#shellescape('--format=%C(auto)%h%d %s %C(green)%cr'))
+ let current = expand('%')
+ let managed = 0
+ if !empty(current)
+ call system('git show '.fzf#shellescape(current).' 2> '.(s:is_win ? 'nul' : '/dev/null'))
+ let managed = !v:shell_error
+ endif
+
+ if a:buffer_local
+ if !managed
+ return s:warn('The current buffer is not in the working tree')
+ endif
+ let source .= ' --follow '.fzf#shellescape(current)
+ else
+ let source .= ' --graph'
+ endif
+
+ let command = a:buffer_local ? 'BCommits' : 'Commits'
+ let expect_keys = join(keys(get(g:, 'fzf_action', s:default_action)), ',')
+ let options = {
+ \ 'source': source,
+ \ 'sink*': s:function('s:commits_sink'),
+ \ 'options': ['--ansi', '--multi', '--tiebreak=index', '--layout=reverse-list',
+ \ '--inline-info', '--prompt', command.'> ', '--bind=ctrl-s:toggle-sort',
+ \ '--header', ':: Press '.s:magenta('CTRL-S', 'Special').' to toggle sort, '.s:magenta('CTRL-Y', 'Special').' to yank commit hashes',
+ \ '--expect=ctrl-y,'.expect_keys]
+ \ }
+
+ if a:buffer_local
+ let options.options[-2] .= ', '.s:magenta('CTRL-D', 'Special').' to diff'
+ let options.options[-1] .= ',ctrl-d'
+ endif
+
+ if !s:is_win && &columns > s:wide
+ call extend(options.options,
+ \ ['--preview', 'echo {} | grep -o "[a-f0-9]\{7,\}" | head -1 | xargs git show --format=format: --color=always | head -200'])
+ endif
+
+ return s:fzf(a:buffer_local ? 'bcommits' : 'commits', options, a:args)
+endfunction
+
+function! fzf#vim#commits(...)
+ return s:commits(0, a:000)
+endfunction
+
+function! fzf#vim#buffer_commits(...)
+ return s:commits(1, a:000)
+endfunction
+
+" ------------------------------------------------------------------
+" fzf#vim#maps(mode, opts[with count and op])
+" ------------------------------------------------------------------
+function! s:align_pairs(list)
+ let maxlen = 0
+ let pairs = []
+ for elem in a:list
+ let match = matchlist(elem, '^\(\S*\)\s*\(.*\)$')
+ let [_, k, v] = match[0:2]
+ let maxlen = max([maxlen, len(k)])
+ call add(pairs, [k, substitute(v, '^\*\?[@ ]\?', '', '')])
+ endfor
+ let maxlen = min([maxlen, 35])
+ return map(pairs, "printf('%-'.maxlen.'s', v:val[0]).' '.v:val[1]")
+endfunction
+
+function! s:highlight_keys(str)
+ return substitute(
+ \ substitute(a:str, '<[^ >]\+>', s:yellow('\0', 'Special'), 'g'),
+ \ '<Plug>', s:blue('<Plug>', 'SpecialKey'), 'g')
+endfunction
+
+function! s:key_sink(line)
+ let key = matchstr(a:line, '^\S*')
+ redraw
+ call feedkeys(s:map_gv.s:map_cnt.s:map_reg, 'n')
+ call feedkeys(s:map_op.
+ \ substitute(key, '<[^ >]\+>', '\=eval("\"\\".submatch(0)."\"")', 'g'))
+endfunction
+
+function! fzf#vim#maps(mode, ...)
+ let s:map_gv = a:mode == 'x' ? 'gv' : ''
+ let s:map_cnt = v:count == 0 ? '' : v:count
+ let s:map_reg = empty(v:register) ? '' : ('"'.v:register)
+ let s:map_op = a:mode == 'o' ? v:operator : ''
+
+ redir => cout
+ silent execute 'verbose' a:mode.'map'
+ redir END
+ let list = []
+ let curr = ''
+ for line in split(cout, "\n")
+ if line =~ "^\t"
+ let src = ' '.join(reverse(reverse(split(split(line)[-1], '/'))[0:2]), '/')
+ call add(list, printf('%s %s', curr, s:green(src, 'Comment')))
+ let curr = ''
+ else
+ let curr = line[3:]
+ endif
+ endfor
+ if !empty(curr)
+ call add(list, curr)
+ endif
+ let aligned = s:align_pairs(list)
+ let sorted = sort(aligned)
+ let colored = map(sorted, 's:highlight_keys(v:val)')
+ let pcolor = a:mode == 'x' ? 9 : a:mode == 'o' ? 10 : 12
+ return s:fzf('maps', {
+ \ 'source': colored,
+ \ 'sink': s:function('s:key_sink'),
+ \ 'options': '--prompt "Maps ('.a:mode.')> " --ansi --no-hscroll --nth 1,.. --color prompt:'.pcolor}, a:000)
+endfunction
+
+" ----------------------------------------------------------------------------
+" fzf#vim#complete - completion helper
+" ----------------------------------------------------------------------------
+inoremap <silent> <Plug>(-fzf-complete-trigger) <c-o>:call <sid>complete_trigger()<cr>
+
+function! s:pluck(dict, key, default)
+ return has_key(a:dict, a:key) ? remove(a:dict, a:key) : a:default
+endfunction
+
+function! s:complete_trigger()
+ let opts = copy(s:opts)
+ call s:prepend_opts(opts, ['+m', '-q', s:query])
+ let opts['sink*'] = s:function('s:complete_insert')
+ let s:reducer = s:pluck(opts, 'reducer', s:function('s:first_line'))
+ call fzf#run(opts)
+endfunction
+
+" The default reducer
+function! s:first_line(lines)
+ return a:lines[0]
+endfunction
+
+function! s:complete_insert(lines)
+ if empty(a:lines)
+ return
+ endif
+
+ let chars = strchars(s:query)
+ if chars == 0 | let del = ''
+ elseif chars == 1 | let del = '"_x'
+ else | let del = (chars - 1).'"_dvh'
+ endif
+
+ let data = call(s:reducer, [a:lines])
+ let ve = &ve
+ set ve=
+ execute 'normal!' ((s:eol || empty(chars)) ? '' : 'h').del.(s:eol ? 'a': 'i').data
+ let &ve = ve
+ if mode() =~ 't'
+ call feedkeys('a', 'n')
+ else
+ execute "normal! \<esc>la"
+ endif
+endfunction
+
+function! s:eval(dict, key, arg)
+ if has_key(a:dict, a:key) && type(a:dict[a:key]) == s:TYPE.funcref
+ let ret = copy(a:dict)
+ let ret[a:key] = call(a:dict[a:key], [a:arg])
+ return ret
+ endif
+ return a:dict
+endfunction
+
+function! fzf#vim#complete(...)
+ if a:0 == 0
+ let s:opts = fzf#wrap()
+ elseif type(a:1) == s:TYPE.dict
+ let s:opts = copy(a:1)
+ elseif type(a:1) == s:TYPE.string
+ let s:opts = extend({'source': a:1}, get(a:000, 1, fzf#wrap()))
+ else
+ echoerr 'Invalid argument: '.string(a:000)
+ return ''
+ endif
+ for s in ['sink', 'sink*']
+ if has_key(s:opts, s)
+ call remove(s:opts, s)
+ endif
+ endfor
+
+ let eol = col('$')
+ let ve = &ve
+ set ve=all
+ let s:eol = col('.') == eol
+ let &ve = ve
+
+ let Prefix = s:pluck(s:opts, 'prefix', '\k*$')
+ if col('.') == 1
+ let s:query = ''
+ else
+ let full_prefix = getline('.')[0 : col('.')-2]
+ if type(Prefix) == s:TYPE.funcref
+ let s:query = call(Prefix, [full_prefix])
+ else
+ let s:query = matchstr(full_prefix, Prefix)
+ endif
+ endif
+ let s:opts = s:eval(s:opts, 'source', s:query)
+ let s:opts = s:eval(s:opts, 'options', s:query)
+ let s:opts = s:eval(s:opts, 'extra_options', s:query)
+ if has_key(s:opts, 'extra_options')
+ call s:merge_opts(s:opts, remove(s:opts, 'extra_options'))
+ endif
+ if has_key(s:opts, 'options')
+ if type(s:opts.options) == s:TYPE.list
+ call add(s:opts.options, '--no-expect')
+ else
+ let s:opts.options .= ' --no-expect'
+ endif
+ endif
+
+ call feedkeys("\<Plug>(-fzf-complete-trigger)")
+ return ''
+endfunction
+
+" ------------------------------------------------------------------
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
diff --git a/vim/.vim/plugged/fzf.vim/autoload/fzf/vim/complete.vim b/vim/.vim/plugged/fzf.vim/autoload/fzf/vim/complete.vim
new file mode 100644
index 0000000..03c9b3b
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/autoload/fzf/vim/complete.vim
@@ -0,0 +1,163 @@
+" 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.
+
+let s:cpo_save = &cpo
+set cpo&vim
+let s:is_win = has('win32') || has('win64')
+
+function! s:extend(base, extra)
+ let base = copy(a:base)
+ if has_key(a:extra, 'options')
+ let extra = copy(a:extra)
+ let extra.extra_options = remove(extra, 'options')
+ return extend(base, extra)
+ endif
+ return extend(base, a:extra)
+endfunction
+
+if v:version >= 704
+ function! s:function(name)
+ return function(a:name)
+ endfunction
+else
+ function! s:function(name)
+ " By Ingo Karkat
+ return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '<SNR>\d\+_\zefunction$'), ''))
+ endfunction
+endif
+
+function! fzf#vim#complete#word(...)
+ return fzf#vim#complete(s:extend({
+ \ 'source': 'cat /usr/share/dict/words'},
+ \ get(a:000, 0, fzf#wrap())))
+endfunction
+
+" ----------------------------------------------------------------------------
+" <plug>(fzf-complete-path)
+" <plug>(fzf-complete-file)
+" <plug>(fzf-complete-file-ag)
+" ----------------------------------------------------------------------------
+function! s:file_split_prefix(prefix)
+ let expanded = expand(a:prefix)
+ let slash = (s:is_win && !&shellslash) ? '\\' : '/'
+ return isdirectory(expanded) ?
+ \ [expanded,
+ \ substitute(a:prefix, '[/\\]*$', slash, ''),
+ \ ''] :
+ \ [fnamemodify(expanded, ':h'),
+ \ substitute(fnamemodify(a:prefix, ':h'), '[/\\]*$', slash, ''),
+ \ fnamemodify(expanded, ':t')]
+endfunction
+
+function! s:file_source(prefix)
+ let [dir, head, tail] = s:file_split_prefix(a:prefix)
+ return printf(
+ \ "cd %s && ".s:file_cmd." | sed %s",
+ \ fzf#shellescape(dir), fzf#shellescape('s:^:'.(empty(a:prefix) || a:prefix == tail ? '' : head).':'))
+endfunction
+
+function! s:file_options(prefix)
+ let [_, head, tail] = s:file_split_prefix(a:prefix)
+ return ['--prompt', head, '--query', tail]
+endfunction
+
+function! s:fname_prefix(str)
+ let isf = &isfname
+ let white = []
+ let black = []
+ if isf =~ ',,,'
+ call add(white, ',')
+ let isf = substitute(isf, ',,,', ',', 'g')
+ endif
+ if isf =~ ',^,,'
+ call add(black, ',')
+ let isf = substitute(isf, ',^,,', ',', 'g')
+ endif
+
+ for token in split(isf, ',')
+ let target = white
+ if token[0] == '^'
+ let target = black
+ let token = token[1:]
+ endif
+
+ let ends = matchlist(token, '\(.\+\)-\(.\+\)')
+ if empty(ends)
+ call add(target, token)
+ else
+ let ends = map(ends[1:2], "len(v:val) == 1 ? char2nr(v:val) : str2nr(v:val)")
+ for i in range(ends[0], ends[1])
+ call add(target, nr2char(i))
+ endfor
+ endif
+ endfor
+
+ let prefix = a:str
+ for offset in range(1, len(a:str))
+ let char = a:str[len(a:str) - offset]
+ if (char =~ '\w' || index(white, char) >= 0) && index(black, char) < 0
+ continue
+ endif
+ let prefix = strpart(a:str, len(a:str) - offset + 1)
+ break
+ endfor
+
+ return prefix
+endfunction
+
+function! fzf#vim#complete#path(command, ...)
+ let s:file_cmd = a:command
+ return fzf#vim#complete(s:extend({
+ \ 'prefix': s:function('s:fname_prefix'),
+ \ 'source': s:function('s:file_source'),
+ \ 'options': s:function('s:file_options')}, get(a:000, 0, fzf#wrap())))
+endfunction
+
+" ----------------------------------------------------------------------------
+" <plug>(fzf-complete-line)
+" <plug>(fzf-complete-buffer-line)
+" ----------------------------------------------------------------------------
+function! s:reduce_line(lines)
+ return join(split(a:lines[0], '\t\zs')[3:], '')
+endfunction
+
+
+function! fzf#vim#complete#line(...)
+ let [display_bufnames, lines] = fzf#vim#_lines(0)
+ let nth = display_bufnames ? 4 : 3
+ return fzf#vim#complete(s:extend({
+ \ 'prefix': '^.*$',
+ \ 'source': lines,
+ \ 'options': '--tiebreak=index --ansi --nth '.nth.'.. --tabstop=1',
+ \ 'reducer': s:function('s:reduce_line')}, get(a:000, 0, fzf#wrap())))
+endfunction
+
+function! fzf#vim#complete#buffer_line(...)
+ return fzf#vim#complete(s:extend({
+ \ 'prefix': '^.*$',
+ \ 'source': fzf#vim#_uniq(getline(1, '$'))}, get(a:000, 0, fzf#wrap())))
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
diff --git a/vim/.vim/plugged/fzf.vim/bin/preview.rb b/vim/.vim/plugged/fzf.vim/bin/preview.rb
new file mode 100644
index 0000000..48feef5
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/bin/preview.rb
@@ -0,0 +1,59 @@
+#!/usr/bin/env ruby
+#
+# usage: ./preview.rb FILENAME[:LINE][:IGNORED]
+
+require 'open3'
+require 'shellwords'
+
+COMMAND = ENV.fetch(
+ 'FZF_PREVIEW_COMMAND',
+ %[bat --style=numbers --color=always {} || highlight -O ansi -l {} || coderay {} || rougify {} || cat {}]
+)
+ANSI = /\x1b\[[0-9;]*m/
+REVERSE = "\x1b[7m"
+RESET = "\x1b[m"
+
+def usage
+ puts "usage: #$0 FILENAME[:LINENO][:IGNORED]"
+ exit 1
+end
+
+usage if ARGV.empty?
+
+file, center, extra = ARGV.first.split(':')
+if ARGV.first =~ /^[A-Z]:\\/
+ file << ':' + center
+ center = extra
+end
+usage unless file
+
+path = File.expand_path(file)
+unless File.readable? path
+ puts "File not found: #{file}"
+ exit 1
+end
+
+if `file --mime "#{file}"` =~ /binary/
+ puts "#{file} is a binary file"
+ exit 0
+end
+
+center = (center || 0).to_i
+height =
+ if ENV['LINES']
+ ENV['LINES'].to_i
+ else
+ File.readable?('/dev/tty') ? `stty size < /dev/tty`.split.first.to_i : 40
+ end
+offset = [1, center - height / 3].max
+
+Open3.popen3(COMMAND.gsub('{}', Shellwords.shellescape(path))) do |_in, out, _err|
+ out.each_line.drop(offset - 1).take(height).each_with_index do |line, lno|
+ if lno + offset == center
+ puts REVERSE + line.chomp.gsub(ANSI) { |m| m + REVERSE } + RESET
+ else
+ puts line
+ end
+ end
+end
+print RESET
diff --git a/vim/.vim/plugged/fzf.vim/bin/preview.sh b/vim/.vim/plugged/fzf.vim/bin/preview.sh
new file mode 100644
index 0000000..d786abb
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/bin/preview.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+REVERSE="\x1b[7m"
+RESET="\x1b[m"
+
+if [ -z "$1" ]; then
+ echo "usage: $0 FILENAME[:LINENO][:IGNORED]"
+ exit 1
+fi
+
+IFS=':' read -r -a INPUT <<< "$1"
+FILE=${INPUT[0]}
+CENTER=${INPUT[1]}
+
+if [[ $1 =~ ^[A-Z]:\\ ]]; then
+ FILE=$FILE:${INPUT[1]}
+ CENTER=${INPUT[2]}
+fi
+
+if [ ! -r "$FILE" ]; then
+ echo "File not found ${FILE}"
+ exit 1
+fi
+
+if [[ "$(file --mime "$FILE")" =~ binary ]]; then
+ echo "$1 is a binary file"
+ exit 0
+fi
+
+if [ -z "$CENTER" ]; then
+ CENTER=0
+fi
+
+if [ -z "$LINES" ]; then
+ if [ -r /dev/tty ]; then
+ LINES=$(stty size < /dev/tty | awk '{print $1}')
+ else
+ LINES=40
+ fi
+fi
+
+FIRST=$(($CENTER-$LINES/3))
+FIRST=$(($FIRST < 1 ? 1 : $FIRST))
+LAST=$((${FIRST}+${LINES}-1))
+
+DEFAULT_COMMAND="bat --style=numbers --color=always {} || highlight -O ansi -l {} || coderay {} || rougify {} || cat {}"
+CMD=${FZF_PREVIEW_COMMAND:-$DEFAULT_COMMAND}
+CMD=${CMD//{\}/$(printf %q "$FILE")}
+
+eval "$CMD" 2> /dev/null | awk "NR >= $FIRST && NR <= $LAST { \
+ if (NR == $CENTER) \
+ { gsub(/\x1b[[0-9;]*m/, \"&$REVERSE\"); printf(\"$REVERSE%s\n$RESET\", \$0); } \
+ else printf(\"$RESET%s\n\", \$0); \
+ }"
diff --git a/vim/.vim/plugged/fzf.vim/bin/tags.pl b/vim/.vim/plugged/fzf.vim/bin/tags.pl
new file mode 100644
index 0000000..4208c16
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/bin/tags.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+
+use strict;
+
+foreach my $file (@ARGV) {
+ open my $lines, $file;
+ while (<$lines>) {
+ unless (/^\!/) {
+ s/^[^\t]*/sprintf("%-24s", $&)/e;
+ s/$/\t$file/;
+ print;
+ }
+ }
+ close $lines;
+}
diff --git a/vim/.vim/plugged/fzf.vim/doc/fzf-vim.txt b/vim/.vim/plugged/fzf.vim/doc/fzf-vim.txt
new file mode 100644
index 0000000..457e8a4
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/doc/fzf-vim.txt
@@ -0,0 +1,378 @@
+fzf-vim.txt fzf-vim Last change: August 31 2018
+FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
+==============================================================================
+
+ fzf :heart: vim
+ Rationale
+ Why you should use fzf on Vim
+ Installation
+ Using vim-plug
+ Commands
+ Customization
+ Global options
+ Command-local options
+ Advanced customization
+ Mappings
+ Usage
+ Completion helper
+ Reducer example
+ Status line of terminal buffer
+ Hide statusline
+ Custom statusline
+ License
+
+FZF :HEART: VIM *fzf-vim-fzf-heart-vim*
+==============================================================================
+
+Things you can do with {fzf}{1} and Vim.
+
+ {1} https://github.com/junegunn/fzf
+
+
+RATIONALE *fzf-vim-rationale*
+==============================================================================
+
+{fzf}{1} in itself is not a Vim plugin, and the official repository only
+provides the {basic wrapper function}{2} for Vim and it's up to the users to
+write their own Vim commands with it. However, I've learned that many users of
+fzf are not familiar with Vimscript and are looking for the "default"
+implementation of the features they can find in the alternative Vim plugins.
+
+This repository is a bundle of fzf-based commands and mappings extracted from
+my {.vimrc}{3} to address such needs. They are not designed to be flexible or
+configurable, and there's no guarantee of backward-compatibility.
+
+ {1} https://github.com/junegunn/fzf
+ {2} https://github.com/junegunn/fzf#usage-as-vim-plugin
+ {3} https://github.com/junegunn/dotfiles/blob/master/vimrc
+
+
+WHY YOU SHOULD USE FZF ON VIM *fzf-vim-why-you-should-use-fzf-on-vim*
+==============================================================================
+
+Because you can and you love fzf.
+
+fzf runs asynchronously and can be orders of magnitude faster than similar Vim
+plugins. However, the benefit may not be noticeable if the size of the input
+is small, which is the case for many of the commands provided here.
+Nevertheless I wrote them anyway since it's really easy to implement custom
+selector with fzf.
+
+
+INSTALLATION *fzf-vim-installation*
+==============================================================================
+
+fzf.vim depends on the basic Vim plugin of {the main fzf repository}{1}, which
+means you need to set up both "fzf" and "fzf.vim" on Vim. To learn more about
+fzf/Vim integration, see {README-VIM}{4}.
+
+ {1} https://github.com/junegunn/fzf
+ {4} https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration
+
+
+< Using vim-plug >____________________________________________________________~
+ *fzf-vim-using-vim-plug*
+
+If you already installed fzf using {Homebrew}{5}, the following should
+suffice:
+>
+ Plug '/usr/local/opt/fzf'
+ Plug 'junegunn/fzf.vim'
+<
+But if you want to install fzf as well using vim-plug:
+>
+ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
+ Plug 'junegunn/fzf.vim'
+<
+ - `dir` and `do` options are not mandatory
+ - Use `./install --bin` instead if you don't need fzf outside of Vim
+ - Make sure to use Vim 7.4 or above
+
+ {5} https://brew.sh/
+
+
+COMMANDS *fzf-vim-commands*
+==============================================================================
+
+
+ -----------------+-----------------------------------------------------------------------
+ Command | List ~
+ -----------------+-----------------------------------------------------------------------
+ `Files [PATH]` | Files (similar to `:FZF` )
+ `GFiles [OPTS]` | Git files ( `git ls-files` )
+ `GFiles?` | Git files ( `git status` )
+ `Buffers` | Open buffers
+ `Colors` | Color schemes
+ `Ag [PATTERN]` | {ag}{6} search result ( `ALT-A` to select all, `ALT-D` to deselect all)
+ `Rg [PATTERN]` | {rg}{7} search result ( `ALT-A` to select all, `ALT-D` to deselect all)
+ `Lines [QUERY]` | Lines in loaded buffers
+ `BLines [QUERY]` | Lines in the current buffer
+ `Tags [QUERY]` | Tags in the project ( `ctags -R` )
+ `BTags [QUERY]` | Tags in the current buffer
+ `Marks` | Marks
+ `Windows` | Windows
+ `Locate PATTERN` | `locate` command output
+ `History` | `v:oldfiles` and open buffers
+ `History:` | Command history
+ `History/` | Search history
+ `Snippets` | Snippets ({UltiSnips}{8})
+ `Commits` | Git commits (requires {fugitive.vim}{9})
+ `BCommits` | Git commits for the current buffer
+ `Commands` | Commands
+ `Maps` | Normal mode mappings
+ `Helptags` | Help tags [1]
+ `Filetypes` | File types
+ -----------------+-----------------------------------------------------------------------
+
+ *g:fzf_command_prefix*
+
+ - Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new
+ tab, a new split, or in a new vertical split
+ - Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
+ - You can set `g:fzf_command_prefix` to give the same prefix to the commands
+ - e.g. `let g:fzf_command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
+
+(1: `Helptags` will shadow the command of the same name from {pathogen}{10}.
+But its functionality is still available via `call pathogen#helptags()`.)
+
+ {6} https://github.com/ggreer/the_silver_searcher
+ {7} https://github.com/BurntSushi/ripgrep
+ {8} https://github.com/SirVer/ultisnips
+ {9} https://github.com/tpope/vim-fugitive
+ {10} https://github.com/tpope/vim-pathogen
+
+
+< Customization >_____________________________________________________________~
+ *fzf-vim-customization*
+
+
+Global options~
+ *fzf-vim-global-options*
+
+See {README-VIM.md}{4} of the main fzf repository for details.
+>
+ " This is the default extra key bindings
+ let g:fzf_action = {
+ \ 'ctrl-t': 'tab split',
+ \ 'ctrl-x': 'split',
+ \ 'ctrl-v': 'vsplit' }
+
+ " Default fzf layout
+ " - down / up / left / right
+ let g:fzf_layout = { 'down': '~40%' }
+
+ " In Neovim, you can set up fzf window using a Vim command
+ let g:fzf_layout = { 'window': 'enew' }
+ let g:fzf_layout = { 'window': '-tabnew' }
+ let g:fzf_layout = { 'window': '10split enew' }
+
+ " Customize fzf colors to match your color scheme
+ let g:fzf_colors =
+ \ { 'fg': ['fg', 'Normal'],
+ \ 'bg': ['bg', 'Normal'],
+ \ 'hl': ['fg', 'Comment'],
+ \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
+ \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
+ \ 'hl+': ['fg', 'Statement'],
+ \ 'info': ['fg', 'PreProc'],
+ \ 'border': ['fg', 'Ignore'],
+ \ 'prompt': ['fg', 'Conditional'],
+ \ 'pointer': ['fg', 'Exception'],
+ \ 'marker': ['fg', 'Keyword'],
+ \ 'spinner': ['fg', 'Label'],
+ \ 'header': ['fg', 'Comment'] }
+
+ " Enable per-command history.
+ " CTRL-N and CTRL-P will be automatically bound to next-history and
+ " previous-history instead of down and up. If you don't like the change,
+ " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
+ let g:fzf_history_dir = '~/.local/share/fzf-history'
+<
+ {4} https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration
+
+
+Command-local options~
+ *fzf-vim-command-local-options*
+
+ *g:fzf_buffers_jump* *g:fzf_commits_log_options* *g:fzf_tags_command*
+ *g:fzf_commands_expect*
+>
+ " [Buffers] Jump to the existing window if possible
+ let g:fzf_buffers_jump = 1
+
+ " [[B]Commits] Customize the options used by 'git log':
+ let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
+
+ " [Tags] Command to generate tags file
+ let g:fzf_tags_command = 'ctags -R'
+
+ " [Commands] --expect expression for directly executing the command
+ let g:fzf_commands_expect = 'alt-enter,ctrl-x'
+<
+
+Advanced customization~
+ *fzf-vim-advanced-customization*
+
+You can use autoload functions to define your own commands.
+>
+ " Command for git grep
+ " - fzf#vim#grep(command, with_column, [options], [fullscreen])
+ command! -bang -nargs=* GGrep
+ \ call fzf#vim#grep(
+ \ 'git grep --line-number '.shellescape(<q-args>), 0,
+ \ { 'dir': systemlist('git rev-parse --show-toplevel')[0] }, <bang>0)
+
+ " Override Colors command. You can safely do this in your .vimrc as fzf.vim
+ " will not override existing commands.
+ command! -bang Colors
+ \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}, <bang>0)
+
+ " Augmenting Ag command using fzf#vim#with_preview function
+ " * fzf#vim#with_preview([[options], [preview window], [toggle keys...]])
+ " * For syntax-highlighting, Ruby and any of the following tools are required:
+ " - Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
+ " - CodeRay: http://coderay.rubychan.de/
+ " - Rouge: https://github.com/jneen/rouge
+ "
+ " :Ag - Start fzf with hidden preview window that can be enabled with "?" key
+ " :Ag! - Start fzf in fullscreen and display the preview window above
+ command! -bang -nargs=* Ag
+ \ call fzf#vim#ag(<q-args>,
+ \ <bang>0 ? fzf#vim#with_preview('up:60%')
+ \ : fzf#vim#with_preview('right:50%:hidden', '?'),
+ \ <bang>0)
+
+ " Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag:
+ command! -bang -nargs=* Rg
+ \ call fzf#vim#grep(
+ \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
+ \ <bang>0 ? fzf#vim#with_preview('up:60%')
+ \ : fzf#vim#with_preview('right:50%:hidden', '?'),
+ \ <bang>0)
+
+ " Likewise, Files command with preview window
+ command! -bang -nargs=? -complete=dir Files
+ \ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
+<
+
+MAPPINGS *fzf-vim-mappings*
+==============================================================================
+
+ ---------------------------------+------------------------------------------
+ Mapping | Description ~
+ ---------------------------------+------------------------------------------
+ <plug>(fzf-maps-n) | Normal mode mappings
+ <plug>(fzf-maps-i) | Insert mode mappings
+ <plug>(fzf-maps-x) | Visual mode mappings
+ <plug>(fzf-maps-o) | Operator-pending mappings
+ <plug>(fzf-complete-word) | `cat /usr/share/dict/words`
+ <plug>(fzf-complete-path) | Path completion using `find` (file + dir)
+ <plug>(fzf-complete-file) | File completion using `find`
+ <plug>(fzf-complete-file-ag) | File completion using `ag`
+ <plug>(fzf-complete-line) | Line completion (all open buffers)
+ <plug>(fzf-complete-buffer-line) | Line completion (current buffer only)
+ ---------------------------------+------------------------------------------
+
+
+< Usage >_____________________________________________________________________~
+ *fzf-vim-usage*
+>
+ " Mapping selecting mappings
+ nmap <leader><tab> <plug>(fzf-maps-n)
+ xmap <leader><tab> <plug>(fzf-maps-x)
+ omap <leader><tab> <plug>(fzf-maps-o)
+
+ " Insert mode completion
+ imap <c-x><c-k> <plug>(fzf-complete-word)
+ imap <c-x><c-f> <plug>(fzf-complete-path)
+ imap <c-x><c-j> <plug>(fzf-complete-file-ag)
+ imap <c-x><c-l> <plug>(fzf-complete-line)
+
+ " Advanced customization using autoload functions
+ inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})
+<
+
+< Completion helper >_________________________________________________________~
+ *fzf-vim-completion-helper*
+
+`fzf#vim#complete` is a helper function for creating custom fuzzy completion
+using fzf. If the first parameter is a command string or a Vim list, it will
+be used as the source.
+>
+ " Replace the default dictionary completion with fzf-based fuzzy completion
+ inoremap <expr> <c-x><c-k> fzf#vim#complete('cat /usr/share/dict/words')
+<
+For advanced uses, you can pass an options dictionary to the function. The set
+of options is pretty much identical to that for `fzf#run` only with the
+following exceptions:
+
+ - `reducer` (funcref)
+ - Reducer transforms the output lines of fzf into a single string value
+ - `prefix` (string or funcref; default: `\k*$`)
+ - Regular expression pattern to extract the completion prefix
+ - Or a function to extract completion prefix
+ - Both `source` and `options` can be given as funcrefs that take the completion
+ prefix as the argument and return the final value
+ - `sink` or `sink*` are ignored
+>
+ " Global line completion (not just open buffers. ripgrep required.)
+ inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
+ \ 'prefix': '^.*$',
+ \ 'source': 'rg -n ^ --color always',
+ \ 'options': '--ansi --delimiter : --nth 3..',
+ \ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}))
+<
+
+Reducer example~
+ *fzf-vim-reducer-example*
+>
+ function! s:make_sentence(lines)
+ return substitute(join(a:lines), '^.', '\=toupper(submatch(0))', '').'.'
+ endfunction
+
+ inoremap <expr> <c-x><c-s> fzf#vim#complete({
+ \ 'source': 'cat /usr/share/dict/words',
+ \ 'reducer': function('<sid>make_sentence'),
+ \ 'options': '--multi --reverse --margin 15%,0',
+ \ 'left': 20})
+<
+
+STATUS LINE OF TERMINAL BUFFER *fzf-vim-status-line-of-terminal-buffer*
+==============================================================================
+
+When fzf starts in a terminal buffer (see {fzf/README-VIM.md}{11}), you may
+want to customize the statusline of the containing buffer.
+
+{11} https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf-inside-terminal-buffer
+
+
+< Hide statusline >___________________________________________________________~
+ *fzf-vim-hide-statusline*
+>
+ autocmd! FileType fzf
+ autocmd FileType fzf set laststatus=0 noshowmode noruler
+ \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
+<
+
+< Custom statusline >_________________________________________________________~
+ *fzf-vim-custom-statusline*
+>
+ function! s:fzf_statusline()
+ " Override statusline as you like
+ highlight fzf1 ctermfg=161 ctermbg=251
+ highlight fzf2 ctermfg=23 ctermbg=251
+ highlight fzf3 ctermfg=237 ctermbg=251
+ setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
+ endfunction
+
+ autocmd! User FzfStatusLine call <SID>fzf_statusline()
+<
+
+LICENSE *fzf-vim-license*
+==============================================================================
+
+MIT
+
+
+==============================================================================
+vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:
diff --git a/vim/.vim/plugged/fzf.vim/doc/tags b/vim/.vim/plugged/fzf.vim/doc/tags
new file mode 100644
index 0000000..ff2c2ff
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/doc/tags
@@ -0,0 +1,25 @@
+fzf-vim fzf-vim.txt /*fzf-vim*
+fzf-vim-advanced-customization fzf-vim.txt /*fzf-vim-advanced-customization*
+fzf-vim-command-local-options fzf-vim.txt /*fzf-vim-command-local-options*
+fzf-vim-commands fzf-vim.txt /*fzf-vim-commands*
+fzf-vim-completion-helper fzf-vim.txt /*fzf-vim-completion-helper*
+fzf-vim-custom-statusline fzf-vim.txt /*fzf-vim-custom-statusline*
+fzf-vim-customization fzf-vim.txt /*fzf-vim-customization*
+fzf-vim-fzf-heart-vim fzf-vim.txt /*fzf-vim-fzf-heart-vim*
+fzf-vim-global-options fzf-vim.txt /*fzf-vim-global-options*
+fzf-vim-hide-statusline fzf-vim.txt /*fzf-vim-hide-statusline*
+fzf-vim-installation fzf-vim.txt /*fzf-vim-installation*
+fzf-vim-license fzf-vim.txt /*fzf-vim-license*
+fzf-vim-mappings fzf-vim.txt /*fzf-vim-mappings*
+fzf-vim-rationale fzf-vim.txt /*fzf-vim-rationale*
+fzf-vim-reducer-example fzf-vim.txt /*fzf-vim-reducer-example*
+fzf-vim-status-line-of-terminal-buffer fzf-vim.txt /*fzf-vim-status-line-of-terminal-buffer*
+fzf-vim-toc fzf-vim.txt /*fzf-vim-toc*
+fzf-vim-usage fzf-vim.txt /*fzf-vim-usage*
+fzf-vim-using-vim-plug fzf-vim.txt /*fzf-vim-using-vim-plug*
+fzf-vim-why-you-should-use-fzf-on-vim fzf-vim.txt /*fzf-vim-why-you-should-use-fzf-on-vim*
+g:fzf_buffers_jump fzf-vim.txt /*g:fzf_buffers_jump*
+g:fzf_command_prefix fzf-vim.txt /*g:fzf_command_prefix*
+g:fzf_commands_expect fzf-vim.txt /*g:fzf_commands_expect*
+g:fzf_commits_log_options fzf-vim.txt /*g:fzf_commits_log_options*
+g:fzf_tags_command fzf-vim.txt /*g:fzf_tags_command*
diff --git a/vim/.vim/plugged/fzf.vim/plugin/fzf.vim b/vim/.vim/plugged/fzf.vim/plugin/fzf.vim
new file mode 100644
index 0000000..a1f2c05
--- /dev/null
+++ b/vim/.vim/plugged/fzf.vim/plugin/fzf.vim
@@ -0,0 +1,149 @@
+" 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.
+
+let s:cpo_save = &cpo
+set cpo&vim
+let s:is_win = has('win32') || has('win64')
+
+function! s:defs(commands)
+ let prefix = get(g:, 'fzf_command_prefix', '')
+ if prefix =~# '^[^A-Z]'
+ echoerr 'g:fzf_command_prefix must start with an uppercase letter'
+ return
+ endif
+ for command in a:commands
+ let name = ':'.prefix.matchstr(command, '\C[A-Z]\S\+')
+ if 2 != exists(name)
+ execute substitute(command, '\ze\C[A-Z]', prefix, '')
+ endif
+ endfor
+endfunction
+
+call s:defs([
+\'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, <bang>0)',
+\'command! -bang -nargs=? GitFiles call fzf#vim#gitfiles(<q-args>, <bang>0)',
+\'command! -bang -nargs=? GFiles call fzf#vim#gitfiles(<q-args>, <bang>0)',
+\'command! -bar -bang -nargs=? -complete=buffer Buffers call fzf#vim#buffers(<q-args>, <bang>0)',
+\'command! -bang -nargs=* Lines call fzf#vim#lines(<q-args>, <bang>0)',
+\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(<q-args>, <bang>0)',
+\'command! -bar -bang Colors call fzf#vim#colors(<bang>0)',
+\'command! -bang -nargs=+ -complete=dir Locate call fzf#vim#locate(<q-args>, <bang>0)',
+\'command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, <bang>0)',
+\'command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, <bang>0)',
+\'command! -bang -nargs=* Tags call fzf#vim#tags(<q-args>, <bang>0)',
+\'command! -bang -nargs=* BTags call fzf#vim#buffer_tags(<q-args>, <bang>0)',
+\'command! -bar -bang Snippets call fzf#vim#snippets(<bang>0)',
+\'command! -bar -bang Commands call fzf#vim#commands(<bang>0)',
+\'command! -bar -bang Marks call fzf#vim#marks(<bang>0)',
+\'command! -bar -bang Helptags call fzf#vim#helptags(<bang>0)',
+\'command! -bar -bang Windows call fzf#vim#windows(<bang>0)',
+\'command! -bar -bang Commits call fzf#vim#commits(<bang>0)',
+\'command! -bar -bang BCommits call fzf#vim#buffer_commits(<bang>0)',
+\'command! -bar -bang Maps call fzf#vim#maps("n", <bang>0)',
+\'command! -bar -bang Filetypes call fzf#vim#filetypes(<bang>0)',
+\'command! -bang -nargs=* History call s:history(<q-args>, <bang>0)'])
+
+function! s:history(arg, bang)
+ let bang = a:bang || a:arg[len(a:arg)-1] == '!'
+ if a:arg[0] == ':'
+ call fzf#vim#command_history(bang)
+ elseif a:arg[0] == '/'
+ call fzf#vim#search_history(bang)
+ else
+ call fzf#vim#history(bang)
+ endif
+endfunction
+
+function! fzf#complete(...)
+ return call('fzf#vim#complete', a:000)
+endfunction
+
+if (has('nvim') || has('terminal') && has('patch-8.0.995')) && (get(g:, 'fzf_statusline', 1) || get(g:, 'fzf_nvim_statusline', 1))
+ function! s:fzf_restore_colors()
+ if exists('#User#FzfStatusLine')
+ doautocmd User FzfStatusLine
+ else
+ if $TERM !~ "256color"
+ highlight default fzf1 ctermfg=1 ctermbg=8 guifg=#E12672 guibg=#565656
+ highlight default fzf2 ctermfg=2 ctermbg=8 guifg=#BCDDBD guibg=#565656
+ highlight default fzf3 ctermfg=7 ctermbg=8 guifg=#D9D9D9 guibg=#565656
+ else
+ highlight default fzf1 ctermfg=161 ctermbg=238 guifg=#E12672 guibg=#565656
+ highlight default fzf2 ctermfg=151 ctermbg=238 guifg=#BCDDBD guibg=#565656
+ highlight default fzf3 ctermfg=252 ctermbg=238 guifg=#D9D9D9 guibg=#565656
+ endif
+ setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
+ endif
+ endfunction
+
+ function! s:fzf_vim_term()
+ if get(w:, 'airline_active', 0)
+ let w:airline_disabled = 1
+ autocmd BufWinLeave <buffer> let w:airline_disabled = 0
+ endif
+ autocmd WinEnter,ColorScheme <buffer> call s:fzf_restore_colors()
+
+ setlocal nospell
+ call s:fzf_restore_colors()
+ endfunction
+
+ augroup _fzf_statusline
+ autocmd!
+ autocmd FileType fzf call s:fzf_vim_term()
+ augroup END
+endif
+
+if !exists('g:fzf#vim#buffers')
+ let g:fzf#vim#buffers = {}
+endif
+
+augroup fzf_buffers
+ autocmd!
+ if exists('*reltimefloat')
+ autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = reltimefloat(reltime())
+ else
+ autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = localtime()
+ endif
+ autocmd BufDelete * silent! call remove(g:fzf#vim#buffers, expand('<abuf>'))
+augroup END
+
+inoremap <expr> <plug>(fzf-complete-word) fzf#vim#complete#word()
+if s:is_win
+ inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path('dir /s/b')
+ inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path('dir /s/b/a:-d')
+else
+ inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'")
+ inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed 's:^..::'")
+endif
+inoremap <expr> <plug>(fzf-complete-file-ag) fzf#vim#complete#path('ag -l -g ""')
+inoremap <expr> <plug>(fzf-complete-line) fzf#vim#complete#line()
+inoremap <expr> <plug>(fzf-complete-buffer-line) fzf#vim#complete#buffer_line()
+
+nnoremap <silent> <plug>(fzf-maps-n) :<c-u>call fzf#vim#maps('n', 0)<cr>
+inoremap <silent> <plug>(fzf-maps-i) <c-o>:call fzf#vim#maps('i', 0)<cr>
+xnoremap <silent> <plug>(fzf-maps-x) :<c-u>call fzf#vim#maps('x', 0)<cr>
+onoremap <silent> <plug>(fzf-maps-o) <c-c>:<c-u>call fzf#vim#maps('o', 0)<cr>
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
diff --git a/vim/.vim/plugged/goyo.vim/README.md b/vim/.vim/plugged/goyo.vim/README.md
new file mode 100644
index 0000000..0e1475b
--- /dev/null
+++ b/vim/.vim/plugged/goyo.vim/README.md
@@ -0,0 +1,130 @@
+goyo.vim ([고요](http://en.wiktionary.org/wiki/고요하다))
+=========================================================
+
+Distraction-free writing in Vim.
+
+![](https://raw.github.com/junegunn/i/master/goyo.png)
+
+(Color scheme: [seoul256](https://github.com/junegunn/seoul256.vim))
+
+Best served with [limelight.vim](https://github.com/junegunn/limelight.vim).
+
+Installation
+------------
+
+Use your favorite plugin manager.
+
+- [vim-plug](https://github.com/junegunn/vim-plug)
+ 1. Add `Plug 'junegunn/goyo.vim'` to .vimrc
+ 2. Run `:PlugInstall`
+
+Usage
+-----
+
+- `:Goyo`
+ - Toggle Goyo
+- `:Goyo [dimension]`
+ - Turn on or resize Goyo
+- `:Goyo!`
+ - Turn Goyo off
+
+The window can be resized with the usual `[count]<CTRL-W>` + `>`, `<`, `+`,
+`-` keys.
+
+### Dimension expression
+
+The expected format of a dimension expression is
+`[WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]`. `XOFFSET` and `YOFFSET` should be
+prefixed by `+` or `-`. Each component can be given in percentage.
+
+```vim
+" Width
+Goyo 120
+
+" Height
+Goyo x30
+
+" Both
+Goyo 120x30
+
+" In percentage
+Goyo 120x50%
+
+" With offsets
+Goyo 50%+25%x50%-25%
+```
+
+Configuration
+-------------
+
+- `g:goyo_width` (default: 80)
+- `g:goyo_height` (default: 85%)
+- `g:goyo_linenr` (default: 0)
+
+### Callbacks
+
+By default, [vim-airline](https://github.com/bling/vim-airline),
+[vim-powerline](https://github.com/Lokaltog/vim-powerline),
+[powerline](https://github.com/Lokaltog/powerline),
+[lightline.vim](https://github.com/itchyny/lightline.vim),
+[vim-signify](https://github.com/mhinz/vim-signify),
+and [vim-gitgutter](https://github.com/airblade/vim-gitgutter) are temporarily
+disabled while in Goyo mode.
+
+If you have other plugins that you want to disable/enable, or if you want to
+change the default settings of Goyo window, you can set up custom routines
+to be triggered on `GoyoEnter` and `GoyoLeave` events.
+
+```vim
+function! s:goyo_enter()
+ silent !tmux set status off
+ silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
+ set noshowmode
+ set noshowcmd
+ set scrolloff=999
+ Limelight
+ " ...
+endfunction
+
+function! s:goyo_leave()
+ silent !tmux set status on
+ silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
+ set showmode
+ set showcmd
+ set scrolloff=5
+ Limelight!
+ " ...
+endfunction
+
+autocmd! User GoyoEnter nested call <SID>goyo_enter()
+autocmd! User GoyoLeave nested call <SID>goyo_leave()
+```
+
+More examples can be found here:
+[Customization](https://github.com/junegunn/goyo.vim/wiki/Customization)
+
+Inspiration
+-----------
+
+- [LiteDFM](https://github.com/bilalq/lite-dfm)
+- [VimRoom](http://projects.mikewest.org/vimroom/)
+
+Pros.
+-----
+
+1. Works well with splits. Doesn't mess up with the current window arrangement
+1. Works well with popular statusline plugins
+1. Prevents accessing the empty windows around the central buffer
+1. Can be closed with any of `:q[uit]`, `:clo[se]`, `:tabc[lose]`, or `:Goyo`
+1. Can dynamically change the width of the window
+1. Adjusts its colors when color scheme is changed
+1. Realigns the window when the terminal (or window) is resized or when the size
+ of the font is changed
+1. Correctly hides colorcolumns and Emojis in statusline
+1. Highly customizable with callbacks
+
+License
+-------
+
+MIT
+
diff --git a/vim/.vim/plugged/goyo.vim/autoload/goyo.vim b/vim/.vim/plugged/goyo.vim/autoload/goyo.vim
new file mode 100644
index 0000000..94216d1
--- /dev/null
+++ b/vim/.vim/plugged/goyo.vim/autoload/goyo.vim
@@ -0,0 +1,447 @@
+" 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.
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+function! s:const(val, min, max)
+ return min([max([a:val, a:min]), a:max])
+endfunction
+
+function! s:get_color(group, attr)
+ return synIDattr(synIDtrans(hlID(a:group)), a:attr)
+endfunction
+
+function! s:set_color(group, attr, color)
+ let gui = has('gui_running') || has('termguicolors') && &termguicolors
+ execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color)
+endfunction
+
+function! s:blank(repel)
+ if bufwinnr(t:goyo_pads.r) <= bufwinnr(t:goyo_pads.l) + 1
+ \ || bufwinnr(t:goyo_pads.b) <= bufwinnr(t:goyo_pads.t) + 3
+ call s:goyo_off()
+ endif
+ execute 'wincmd' a:repel
+endfunction
+
+function! s:init_pad(command)
+ execute a:command
+
+ setlocal buftype=nofile bufhidden=wipe nomodifiable nobuflisted noswapfile
+ \ nonu nocursorline nocursorcolumn winfixwidth winfixheight statusline=\
+ if exists('&rnu')
+ setlocal nornu
+ endif
+ if exists('&colorcolumn')
+ setlocal colorcolumn=
+ endif
+ let bufnr = winbufnr(0)
+
+ execute winnr('#') . 'wincmd w'
+ return bufnr
+endfunction
+
+function! s:setup_pad(bufnr, vert, size, repel)
+ let win = bufwinnr(a:bufnr)
+ execute win . 'wincmd w'
+ execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size])
+ augroup goyop
+ execute 'autocmd WinEnter,CursorMoved <buffer> nested call s:blank("'.a:repel.'")'
+ autocmd WinLeave <buffer> call s:hide_statusline()
+ augroup END
+
+ " To hide scrollbars of pad windows in GVim
+ let diff = winheight(0) - line('$') - (has('gui_running') ? 2 : 0)
+ if diff > 0
+ setlocal modifiable
+ call append(0, map(range(1, diff), '""'))
+ normal! gg
+ setlocal nomodifiable
+ endif
+ execute winnr('#') . 'wincmd w'
+endfunction
+
+function! s:resize_pads()
+ augroup goyop
+ autocmd!
+ augroup END
+
+ let t:goyo_dim.width = s:const(t:goyo_dim.width, 2, &columns)
+ let t:goyo_dim.height = s:const(t:goyo_dim.height, 2, &lines)
+
+ let vmargin = max([0, (&lines - t:goyo_dim.height) / 2 - 1])
+ let yoff = s:const(t:goyo_dim.yoff, - vmargin, vmargin)
+ let top = vmargin + yoff
+ let bot = vmargin - yoff - 1
+ call s:setup_pad(t:goyo_pads.t, 0, top, 'j')
+ call s:setup_pad(t:goyo_pads.b, 0, bot, 'k')
+
+ let nwidth = max([len(string(line('$'))) + 1, &numberwidth])
+ let width = t:goyo_dim.width + (&number ? nwidth : 0)
+ let hmargin = max([0, (&columns - width) / 2 - 1])
+ let xoff = s:const(t:goyo_dim.xoff, - hmargin, hmargin)
+ call s:setup_pad(t:goyo_pads.l, 1, hmargin + xoff, 'l')
+ call s:setup_pad(t:goyo_pads.r, 1, hmargin - xoff, 'h')
+endfunction
+
+function! s:tranquilize()
+ let bg = s:get_color('Normal', 'bg#')
+ for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit',
+ \ 'StatusLine', 'StatusLineNC', 'SignColumn']
+ " -1 on Vim / '' on GVim
+ if bg == -1 || empty(bg)
+ call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black'))
+ call s:set_color(grp, 'bg', 'NONE')
+ else
+ call s:set_color(grp, 'fg', bg)
+ call s:set_color(grp, 'bg', bg)
+ endif
+ call s:set_color(grp, '', 'NONE')
+ endfor
+endfunction
+
+function! s:hide_statusline()
+ setlocal statusline=\
+endfunction
+
+function! s:hide_linenr()
+ if !get(g:, 'goyo_linenr', 0)
+ setlocal nonu
+ if exists('&rnu')
+ setlocal nornu
+ endif
+ endif
+ if exists('&colorcolumn')
+ setlocal colorcolumn=
+ endif
+endfunction
+
+function! s:maps_nop()
+ let mapped = filter(['R', 'H', 'J', 'K', 'L', '|', '_'],
+ \ "empty(maparg(\"\<c-w>\".v:val, 'n'))")
+ for c in mapped
+ execute 'nnoremap <c-w>'.escape(c, '|').' <nop>'
+ endfor
+ return mapped
+endfunction
+
+function! s:maps_resize()
+ let commands = {
+ \ '=': ':<c-u>let t:goyo_dim = <sid>parse_arg(t:goyo_dim_expr) <bar> call <sid>resize_pads()<cr>',
+ \ '>': ':<c-u>let t:goyo_dim.width = winwidth(0) + 2 * v:count1 <bar> call <sid>resize_pads()<cr>',
+ \ '<': ':<c-u>let t:goyo_dim.width = winwidth(0) - 2 * v:count1 <bar> call <sid>resize_pads()<cr>',
+ \ '+': ':<c-u>let t:goyo_dim.height += 2 * v:count1 <bar> call <sid>resize_pads()<cr>',
+ \ '-': ':<c-u>let t:goyo_dim.height -= 2 * v:count1 <bar> call <sid>resize_pads()<cr>'
+ \ }
+ let mapped = filter(keys(commands), "empty(maparg(\"\<c-w>\".v:val, 'n'))")
+ for c in mapped
+ execute 'nnoremap <silent> <c-w>'.c.' '.commands[c]
+ endfor
+ return mapped
+endfunction
+
+nnoremap <silent> <plug>(goyo-resize) :<c-u>call <sid>resize_pads()<cr>
+
+function! s:goyo_on(dim)
+ let dim = s:parse_arg(a:dim)
+ if empty(dim)
+ return
+ endif
+
+ let s:orig_tab = tabpagenr()
+ let settings =
+ \ { 'laststatus': &laststatus,
+ \ 'showtabline': &showtabline,
+ \ 'fillchars': &fillchars,
+ \ 'winminwidth': &winminwidth,
+ \ 'winwidth': &winwidth,
+ \ 'winminheight': &winminheight,
+ \ 'winheight': &winheight,
+ \ 'ruler': &ruler,
+ \ 'sidescroll': &sidescroll,
+ \ 'sidescrolloff': &sidescrolloff
+ \ }
+
+ " New tab
+ tab split
+
+ let t:goyo_master = winbufnr(0)
+ let t:goyo_dim = dim
+ let t:goyo_dim_expr = a:dim
+ let t:goyo_pads = {}
+ let t:goyo_revert = settings
+ let t:goyo_maps = extend(s:maps_nop(), s:maps_resize())
+ if has('gui_running')
+ let t:goyo_revert.guioptions = &guioptions
+ endif
+
+ " vim-gitgutter
+ let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0)
+ if t:goyo_disabled_gitgutter
+ silent! GitGutterDisable
+ endif
+
+ " vim-signify
+ let t:goyo_disabled_signify = exists('b:sy') && b:sy.active
+ if t:goyo_disabled_signify
+ SignifyToggle
+ endif
+
+ " vim-airline
+ let t:goyo_disabled_airline = exists('#airline')
+ if t:goyo_disabled_airline
+ AirlineToggle
+ endif
+
+ " vim-powerline
+ let t:goyo_disabled_powerline = exists('#PowerlineMain')
+ if t:goyo_disabled_powerline
+ augroup PowerlineMain
+ autocmd!
+ augroup END
+ augroup! PowerlineMain
+ endif
+
+ " lightline.vim
+ let t:goyo_disabled_lightline = exists('#lightline')
+ if t:goyo_disabled_lightline
+ silent! call lightline#disable()
+ endif
+
+ call s:hide_linenr()
+ " Global options
+ let &winheight = max([&winminheight, 1])
+ set winminheight=1
+ set winheight=1
+ set winminwidth=1 winwidth=1
+ set laststatus=0
+ set showtabline=0
+ set noruler
+ set fillchars+=vert:\
+ set fillchars+=stl:\
+ set fillchars+=stlnc:\
+ set sidescroll=1
+ set sidescrolloff=0
+
+ " Hide left-hand scrollbars
+ if has('gui_running')
+ set guioptions-=l
+ set guioptions-=L
+ endif
+
+ let t:goyo_pads.l = s:init_pad('vertical topleft new')
+ let t:goyo_pads.r = s:init_pad('vertical botright new')
+ let t:goyo_pads.t = s:init_pad('topleft new')
+ let t:goyo_pads.b = s:init_pad('botright new')
+
+ call s:resize_pads()
+ call s:tranquilize()
+
+ augroup goyo
+ autocmd!
+ autocmd TabLeave * call s:goyo_off()
+ autocmd VimResized * call s:resize_pads()
+ autocmd ColorScheme * call s:tranquilize()
+ autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline()
+ autocmd WinEnter,WinLeave * call s:hide_statusline()
+ if has('nvim')
+ autocmd TermClose * call feedkeys("\<plug>(goyo-resize)")
+ endif
+ augroup END
+
+ call s:hide_statusline()
+ if exists('g:goyo_callbacks[0]')
+ call g:goyo_callbacks[0]()
+ endif
+ if exists('#User#GoyoEnter')
+ doautocmd User GoyoEnter
+ endif
+endfunction
+
+function! s:goyo_off()
+ if !exists('#goyo')
+ return
+ endif
+
+ " Oops, not this tab
+ if !exists('t:goyo_revert')
+ return
+ endif
+
+ " Clear auto commands
+ augroup goyo
+ autocmd!
+ augroup END
+ augroup! goyo
+ augroup goyop
+ autocmd!
+ augroup END
+ augroup! goyop
+
+ for c in t:goyo_maps
+ execute 'nunmap <c-w>'.escape(c, '|')
+ endfor
+
+ let goyo_revert = t:goyo_revert
+ let goyo_disabled_gitgutter = t:goyo_disabled_gitgutter
+ let goyo_disabled_signify = t:goyo_disabled_signify
+ let goyo_disabled_airline = t:goyo_disabled_airline
+ let goyo_disabled_powerline = t:goyo_disabled_powerline
+ let goyo_disabled_lightline = t:goyo_disabled_lightline
+ let goyo_orig_buffer = t:goyo_master
+ let [line, col] = [line('.'), col('.')]
+
+ if tabpagenr() == 1
+ tabnew
+ normal! gt
+ bd
+ endif
+ tabclose
+ execute 'normal! '.s:orig_tab.'gt'
+ if winbufnr(0) == goyo_orig_buffer
+ " Doesn't work if window closed with `q`
+ execute printf('normal! %dG%d|', line, col)
+ endif
+
+ let wmw = remove(goyo_revert, 'winminwidth')
+ let ww = remove(goyo_revert, 'winwidth')
+ let &winwidth = ww
+ let &winminwidth = wmw
+ let wmh = remove(goyo_revert, 'winminheight')
+ let wh = remove(goyo_revert, 'winheight')
+ let &winheight = max([wmh, 1])
+ let &winminheight = wmh
+ let &winheight = wh
+
+ for [k, v] in items(goyo_revert)
+ execute printf('let &%s = %s', k, string(v))
+ endfor
+ execute 'colo '. get(g:, 'colors_name', 'default')
+
+ if goyo_disabled_gitgutter
+ silent! GitGutterEnable
+ endif
+
+ if goyo_disabled_signify
+ silent! if !b:sy.active
+ SignifyToggle
+ endif
+ endif
+
+ if goyo_disabled_airline && !exists('#airline')
+ AirlineToggle
+ " For some reason, Airline requires two refreshes to avoid display
+ " artifacts
+ silent! AirlineRefresh
+ silent! AirlineRefresh
+ endif
+
+ if goyo_disabled_powerline && !exists('#PowerlineMain')
+ doautocmd PowerlineStartup VimEnter
+ silent! PowerlineReloadColorscheme
+ endif
+
+ if goyo_disabled_lightline
+ silent! call lightline#enable()
+ endif
+
+ if exists('#Powerline')
+ doautocmd Powerline ColorScheme
+ endif
+
+ if exists('g:goyo_callbacks[1]')
+ call g:goyo_callbacks[1]()
+ endif
+ if exists('#User#GoyoLeave')
+ doautocmd User GoyoLeave
+ endif
+endfunction
+
+function! s:relsz(expr, limit)
+ if a:expr !~ '%$'
+ return str2nr(a:expr)
+ endif
+ return a:limit * str2nr(a:expr[:-2]) / 100
+endfunction
+
+function! s:parse_arg(arg)
+ if exists('g:goyo_height') || !exists('g:goyo_margin_top') && !exists('g:goyo_margin_bottom')
+ let height = s:relsz(get(g:, 'goyo_height', '85%'), &lines)
+ let yoff = 0
+ else
+ let top = max([0, s:relsz(get(g:, 'goyo_margin_top', 4), &lines)])
+ let bot = max([0, s:relsz(get(g:, 'goyo_margin_bottom', 4), &lines)])
+ let height = &lines - top - bot
+ let yoff = top - bot
+ endif
+
+ let dim = { 'width': s:relsz(get(g:, 'goyo_width', 80), &columns),
+ \ 'height': height,
+ \ 'xoff': 0,
+ \ 'yoff': yoff }
+ if empty(a:arg)
+ return dim
+ endif
+ let parts = matchlist(a:arg, '^\s*\([0-9]\+%\?\)\?\([+-][0-9]\+%\?\)\?\%(x\([0-9]\+%\?\)\?\([+-][0-9]\+%\?\)\?\)\?\s*$')
+ if empty(parts)
+ echohl WarningMsg
+ echo 'Invalid dimension expression: '.a:arg
+ echohl None
+ return {}
+ endif
+ if !empty(parts[1]) | let dim.width = s:relsz(parts[1], &columns) | endif
+ if !empty(parts[2]) | let dim.xoff = s:relsz(parts[2], &columns) | endif
+ if !empty(parts[3]) | let dim.height = s:relsz(parts[3], &lines) | endif
+ if !empty(parts[4]) | let dim.yoff = s:relsz(parts[4], &lines) | endif
+ return dim
+endfunction
+
+function! goyo#execute(bang, dim)
+ if a:bang
+ if exists('#goyo')
+ call s:goyo_off()
+ endif
+ else
+ if exists('#goyo') == 0
+ call s:goyo_on(a:dim)
+ elseif !empty(a:dim)
+ if winnr('$') < 5
+ call s:goyo_off()
+ return goyo#execute(a:bang, a:dim)
+ endif
+ let dim = s:parse_arg(a:dim)
+ if !empty(dim)
+ let t:goyo_dim = dim
+ let t:goyo_dim_expr = a:dim
+ call s:resize_pads()
+ endif
+ else
+ call s:goyo_off()
+ end
+ end
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
diff --git a/vim/.vim/plugged/goyo.vim/doc/goyo.txt b/vim/.vim/plugged/goyo.vim/doc/goyo.txt
new file mode 100644
index 0000000..0af9e6b
--- /dev/null
+++ b/vim/.vim/plugged/goyo.vim/doc/goyo.txt
@@ -0,0 +1,170 @@
+goyo.txt goyo Last change: April 2 2017
+GOYO - TABLE OF CONTENTS *goyo* *goyo-toc*
+==============================================================================
+
+ goyo.vim (고요)
+ Installation
+ Usage
+ Dimension expression
+ Configuration
+ Callbacks
+ Inspiration
+ Pros.
+ License
+
+GOYO.VIM (고요) *goyo-vim*
+==============================================================================
+
+Distraction-free writing in Vim.
+
+https://raw.github.com/junegunn/i/master/goyo.png
+
+(Color scheme: {seoul256}{1})
+
+Best served with {limelight.vim}{2}.
+
+ {1} https://github.com/junegunn/seoul256.vim
+ {2} https://github.com/junegunn/limelight.vim
+
+
+INSTALLATION *goyo-installation*
+==============================================================================
+
+Use your favorite plugin manager.
+
+ *:PlugInstall*
+
+ - {vim-plug}{3}
+ 1. Add `Plug 'junegunn/goyo.vim'` to .vimrc
+ 2. Run `:PlugInstall`
+
+ {3} https://github.com/junegunn/vim-plug
+
+
+USAGE *goyo-usage*
+==============================================================================
+
+ *:Goyo*
+
+ - `:Goyo`
+ - Toggle Goyo
+ - `:Goyo [dimension]`
+ - Turn on or resize Goyo
+ - `:Goyo!`
+ - Turn Goyo off
+
+The window can be resized with the usual count]<CTRL-W + `>`, `<`, `+`, `-`
+keys.
+
+
+< Dimension expression >______________________________________________________~
+ *goyo-dimension-expression*
+
+The expected format of a dimension expression is
+`[WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]`. `XOFFSET` and `YOFFSET` should be
+prefixed by `+` or `-`. Each component can be given in percentage.
+>
+ " Width
+ Goyo 120
+
+ " Height
+ Goyo x30
+
+ " Both
+ Goyo 120x30
+
+ " In percentage
+ Goyo 120x50%
+
+ " With offsets
+ Goyo 50%+25%x50%-25%
+<
+
+CONFIGURATION *goyo-configuration*
+==============================================================================
+
+ *g:goyo_width* *g:goyo_height* *g:goyo_linenr*
+
+ - `g:goyo_width` (default: 80)
+ - `g:goyo_height` (default: 85%)
+ - `g:goyo_linenr` (default: 0)
+
+
+< Callbacks >_________________________________________________________________~
+ *goyo-callbacks*
+
+By default, {vim-airline}{4}, {vim-powerline}{5}, {powerline}{6},
+{lightline.vim}{7}, {vim-signify}{8}, and {vim-gitgutter}{9} are temporarily
+disabled while in Goyo mode.
+
+If you have other plugins that you want to disable/enable, or if you want to
+change the default settings of Goyo window, you can set up custom routines to
+be triggered on `GoyoEnter` and `GoyoLeave` events.
+>
+ function! s:goyo_enter()
+ silent !tmux set status off
+ silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
+ set noshowmode
+ set noshowcmd
+ set scrolloff=999
+ Limelight
+ " ...
+ endfunction
+
+ function! s:goyo_leave()
+ silent !tmux set status on
+ silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
+ set showmode
+ set showcmd
+ set scrolloff=5
+ Limelight!
+ " ...
+ endfunction
+
+ autocmd! User GoyoEnter nested call <SID>goyo_enter()
+ autocmd! User GoyoLeave nested call <SID>goyo_leave()
+<
+More examples can be found here: {Customization}{10}
+
+ {4} https://github.com/bling/vim-airline
+ {5} https://github.com/Lokaltog/vim-powerline
+ {6} https://github.com/Lokaltog/powerline
+ {7} https://github.com/itchyny/lightline.vim
+ {8} https://github.com/mhinz/vim-signify
+ {9} https://github.com/airblade/vim-gitgutter
+ {10} https://github.com/junegunn/goyo.vim/wiki/Customization
+
+
+INSPIRATION *goyo-inspiration*
+==============================================================================
+
+ - {LiteDFM}{11}
+ - {VimRoom}{12}
+
+ {11} https://github.com/bilalq/lite-dfm
+ {12} http://projects.mikewest.org/vimroom/
+
+
+PROS. *goyo-pros*
+==============================================================================
+
+ 1. Works well with splits. Doesn't mess up with the current window arrangement
+ 2. Works well with popular statusline plugins
+ 3. Prevents accessing the empty windows around the central buffer
+ 4. Can be closed with any of `:q[uit]`, `:clo[se]`, `:tabc[lose]`, or `:Goyo`
+ 5. Can dynamically change the width of the window
+ 6. Adjusts its colors when color scheme is changed
+ 7. Realigns the window when the terminal (or window) is resized or when the size
+ of the font is changed
+ 8. Correctly hides colorcolumns and Emojis in statusline
+ 9. Highly customizable with callbacks
+
+
+LICENSE *goyo-license*
+==============================================================================
+
+MIT
+
+
+==============================================================================
+vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:
diff --git a/vim/.vim/plugged/goyo.vim/doc/tags b/vim/.vim/plugged/goyo.vim/doc/tags
new file mode 100644
index 0000000..cfe722c
--- /dev/null
+++ b/vim/.vim/plugged/goyo.vim/doc/tags
@@ -0,0 +1,16 @@
+:Goyo goyo.txt /*:Goyo*
+:PlugInstall goyo.txt /*:PlugInstall*
+g:goyo_height goyo.txt /*g:goyo_height*
+g:goyo_linenr goyo.txt /*g:goyo_linenr*
+g:goyo_width goyo.txt /*g:goyo_width*
+goyo goyo.txt /*goyo*
+goyo-callbacks goyo.txt /*goyo-callbacks*
+goyo-configuration goyo.txt /*goyo-configuration*
+goyo-dimension-expression goyo.txt /*goyo-dimension-expression*
+goyo-inspiration goyo.txt /*goyo-inspiration*
+goyo-installation goyo.txt /*goyo-installation*
+goyo-license goyo.txt /*goyo-license*
+goyo-pros goyo.txt /*goyo-pros*
+goyo-toc goyo.txt /*goyo-toc*
+goyo-usage goyo.txt /*goyo-usage*
+goyo-vim goyo.txt /*goyo-vim*
diff --git a/vim/.vim/plugged/goyo.vim/plugin/goyo.vim b/vim/.vim/plugged/goyo.vim/plugin/goyo.vim
new file mode 100644
index 0000000..af4793a
--- /dev/null
+++ b/vim/.vim/plugged/goyo.vim/plugin/goyo.vim
@@ -0,0 +1,24 @@
+" 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.
+
+command! -nargs=? -bar -bang Goyo call goyo#execute(<bang>0, <q-args>)
diff --git a/vim/.vim/plugged/i3-vim-syntax/README.md b/vim/.vim/plugged/i3-vim-syntax/README.md
new file mode 100644
index 0000000..ca03b27
--- /dev/null
+++ b/vim/.vim/plugged/i3-vim-syntax/README.md
@@ -0,0 +1,18 @@
+:warning: *This syntax file is not maintained anymore. Feel free to take over or try some alternative
+(eg: [i3config.vim](https://github.com/mboughaba/i3config.vim)).*
+
+---
+
+This is a [Vim](http://vim.org) syntax file for [i3](http://i3wm.org/) config file.
+
+![Screenshot](https://raw.githubusercontent.com/PotatoesMaster/i3-vim-syntax/junk/screenshot.png)
+
+## Using it
+
+You can install it using a Vim plugin manager ([Vundle], [Pathogen], …) or just by putting [i3.vim][i3vim] in your `~/.vim/syntax` directory.
+
+I recommend you to add `# vim:filetype=i3` at the end of your i3 config file, unless you really want to type `:set filetype=i3` every time you edit this file.
+
+[Vundle]:http://github.com/gmarik/vundle/
+[Pathogen]:http://github.com/tpope/vim-pathogen/
+[i3vim]: http://raw.github.com/PotatoesMaster/i3-vim-syntax/master/syntax/i3.vim
diff --git a/vim/.vim/plugged/i3-vim-syntax/ftdetect/i3.vim b/vim/.vim/plugged/i3-vim-syntax/ftdetect/i3.vim
new file mode 100644
index 0000000..21603c5
--- /dev/null
+++ b/vim/.vim/plugged/i3-vim-syntax/ftdetect/i3.vim
@@ -0,0 +1,4 @@
+augroup i3_ftdetect
+ au!
+ au BufRead,BufNewFile *i3/config,*sway/config set ft=i3
+augroup END
diff --git a/vim/.vim/plugged/i3-vim-syntax/ftplugin/i3.vim b/vim/.vim/plugged/i3-vim-syntax/ftplugin/i3.vim
new file mode 100644
index 0000000..463eea9
--- /dev/null
+++ b/vim/.vim/plugged/i3-vim-syntax/ftplugin/i3.vim
@@ -0,0 +1 @@
+setlocal commentstring=#\ %s
diff --git a/vim/.vim/plugged/i3-vim-syntax/syntax/i3.vim b/vim/.vim/plugged/i3-vim-syntax/syntax/i3.vim
new file mode 100644
index 0000000..7de599d
--- /dev/null
+++ b/vim/.vim/plugged/i3-vim-syntax/syntax/i3.vim
@@ -0,0 +1,134 @@
+" Vim syntax file
+" Language: i3-wm config file
+" Maintainer: Emanuel Guével
+" Latest Revision: 16 October 2012
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Symbols
+syn match i3Operators "+\|→"
+syn match i3ChainDelimiter ";"
+
+syn match i3Var "\$\w\+"
+
+" Key modifiers
+syn keyword i3KeyModifier Shift Control Ctrl Mod1 Mod2 Mod3 Mod4 Mod5 Mode_switch
+
+" Strings
+syn region i3SimpleString keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var
+syn match i3QuotedString '"[^"]\+"' contained
+syn cluster i3String contains=i3SimpleString,i3QuotedString
+
+" Config commands
+syn keyword i3ConfigCommand bind bindcode bindsym assign new_window popup_during_fullscreen font floating_modifier default_orientation workspace_layout for_window focus_follows_mouse bar position colors output tray_output workspace_buttons workspace_auto_back_and_forth binding_mode_indicator debuglog floating_minimum_size floating_maximum_size force_focus_wrapping force_xinerama force_display_urgency_hint hidden_state modifier new_float shmlog socket_path verbose mouse_warping strip_workspace_numbers focus_on_window_activation no_focus
+syn match i3IpcSocket "ipc[-_]socket" nextgroup=@i3String skipwhite
+
+" Command keywords
+syn keyword i3Command exit reload restart kill fullscreen global layout border focus move open split append_layout mark unmark resize grow shrink show nop rename title_format sticky
+syn keyword i3Param 1pixel default stacked tabbed normal none tiling stacking floating enable disable up down horizontal vertical auto up down left right parent child px or ppt leave_fullscreen toggle mode_toggle scratchpad width height top bottom client hide primary yes all active window container to absolute center on off x ms h v smart ignore pixel splith splitv output true
+syn match i3DashedParam '--\(release\|border\|whole-window\|toggle\)' skipwhite
+syn match i3NoStartupId '--no-startup-id' contained
+syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
+syn keyword i3BordersSpecialParam none vertical horizontal both
+syn keyword i3ModeParam dock hide invisible skipwhite
+syn keyword i3GapsCommand gaps smart_gaps smart_borders
+syn keyword i3GapsParam inner outer current all set plus minus no_gaps
+
+" these are not keywords but we add them for consistency
+syn keyword i3PseudoParam no false inactive
+
+" Exec commands
+syn region i3ExecCommand keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var,i3NoStartupId
+syn match i3QuotedExecCommand '"[^"]\+"' contained
+syn keyword i3ExecKeyword exec exec_always i3bar_command nextgroup=i3QuotedExecCommand,i3ExecCommand skipwhite
+
+" Status command
+syn match i3StatusCommand ".*$" contained
+syn keyword i3StatusCommandKeyword status_command nextgroup=i3StatusCommand skipwhite
+
+" Font statement
+syn keyword i3FontStatement font nextgroup=@i3String skipwhite
+
+" Separator symbol
+syn keyword i3SeparatorSymbol separator_symbol nextgroup=@i3String skipwhite
+
+" Set statement
+syn match i3SetVar "\$\w\+" contained nextgroup=@i3String skipwhite
+syn keyword i3SetKeyword set set_from_resource nextgroup=i3SetVar skipwhite
+
+" Workspaces
+syn keyword i3WsKeyword workspace nextgroup=i3WsSpecialParam,@i3String skipwhite
+
+" Hide edge borders
+syn keyword i3BordersConfigCommand hide_edge_borders nextgroup=i3BordersSpecialParam skipwhite
+
+" Mode
+syn keyword i3ModeKeyword mode nextgroup=i3ModeParam,@i3String skipwhite
+
+" Comments
+syn keyword i3Todo contained TODO FIXME XXX NOTE
+syn match i3Comment "^\s*#.*$" contains=i3Todo
+
+" Error (at end of line)
+syn match i3Error ".*$" contained
+
+" Hex color code
+syn match i3ColorLast "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Error skipwhite
+syn match i3Color2nd "#[0-9a-fA-F]\{6\}" contained nextgroup=i3ColorLast skipwhite
+syn match i3Color1st "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Color2nd skipwhite
+
+syn match i3ColorDef1 "client\.background\|statusline\|background\|separator\|statusline" nextgroup=i3ColorLast skipwhite
+syn match i3ColorDef3 "client\.\(focused_inactive\|focused\|unfocused\|urgent\)\|inactive_workspace\|urgent_workspace\|focused_workspace\|active_workspace" nextgroup=i3Color1st skipwhite
+
+highlight link i3ChainDelimiter Operator
+highlight link i3Operators Operator
+
+highlight link i3ExecCommand Special
+highlight link i3QuotedExecCommand Special
+highlight link i3StatusCommand Special
+
+highlight link i3Param Constant
+highlight link i3PseudoParam Constant
+highlight link i3DashedParam Constant
+highlight link i3NoStartupId Constant
+highlight link i3Color1st Constant
+highlight link i3Color2nd Constant
+highlight link i3ColorLast Constant
+highlight link i3WsSpecialParam Constant
+highlight link i3BordersSpecialParam Constant
+highlight link i3ModeParam Constant
+highlight link i3GapsParam Constant
+
+highlight link i3Var Identifier
+highlight link i3SetVar Identifier
+
+highlight link i3KeyModifier Function
+
+highlight link i3SimpleString String
+highlight link i3QuotedString String
+highlight link i3WsName String
+highlight link i3QuotedWsName String
+highlight link i3SetValue String
+highlight link i3Font String
+
+highlight link i3ExecKeyword Keyword
+highlight link i3Command Keyword
+highlight link i3WsKeyword Keyword
+highlight link i3GapsCommand Keyword
+
+highlight link i3ColorDef1 Define
+highlight link i3ColorDef3 Define
+highlight link i3ConfigCommand Define
+highlight link i3IpcSocket Define
+highlight link i3SetKeyword Define
+highlight link i3ModeKeyword Define
+highlight link i3FontStatement Define
+highlight link i3SeparatorSymbol Define
+highlight link i3StatusCommandKeyword Define
+highlight link i3BordersConfigCommand Define
+
+highlight link i3Todo Todo
+highlight link i3Comment Comment
+highlight link i3Error Error
diff --git a/vim/.vim/plugged/lightline.vim/.travis.yml b/vim/.vim/plugged/lightline.vim/.travis.yml
new file mode 100644
index 0000000..b385a18
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/.travis.yml
@@ -0,0 +1,28 @@
+language: generic
+
+sudo: false
+
+install:
+ - git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis
+ - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then
+ git clone https://github.com/vim/vim $HOME/vim &&
+ cd $HOME/vim &&
+ git checkout v$VIM_VERSION &&
+ ./configure --prefix=$HOME/vim-$VIM_VERSION &&
+ make &&
+ make install;
+ fi)
+
+cache:
+ directories:
+ - $HOME/vim-$VIM_VERSION
+
+env:
+ - VIM_VERSION=8.0.0000
+ - VIM_VERSION=7.4
+ - VIM_VERSION=7.3
+
+script:
+ - export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH
+ - vim --version
+ - /tmp/themis/bin/themis --reporter spec
diff --git a/vim/.vim/plugged/lightline.vim/LICENSE b/vim/.vim/plugged/lightline.vim/LICENSE
new file mode 100644
index 0000000..2b0f7e1
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2017 itchyny
+
+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.
diff --git a/vim/.vim/plugged/lightline.vim/README.md b/vim/.vim/plugged/lightline.vim/README.md
new file mode 100644
index 0000000..1e6eb81
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/README.md
@@ -0,0 +1,389 @@
+# lightline.vim
+A light and configurable statusline/tabline plugin for Vim
+
+https://github.com/itchyny/lightline.vim
+
+### powerline (default)
+
+![lightline.vim - powerline](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/powerline.png)
+
+### wombat
+
+![lightline.vim - wombat](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/wombat.png)
+
+### jellybeans
+
+![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans.png)
+
+### solarized dark
+
+![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png)
+
+### solarized light
+
+![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png)
+
+### PaperColor light
+
+![lightline.vim - PaperColor](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor.png)
+
+### seoul256
+
+![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png)
+
+### one
+
+![lightline.vim - one](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one.png)
+
+### landscape
+
+![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png)
+
+landscape is my colorscheme, which is a high-contrast cterm-supported colorscheme, available at https://github.com/itchyny/landscape.vim
+
+## Why yet another clone of powerline?
++ [vim-powerline](https://github.com/Lokaltog/vim-powerline) is a nice plugin, but deprecated.
++ [powerline](https://github.com/powerline/powerline) is a nice plugin, but difficult to configure.
++ [vim-airline](https://github.com/vim-airline/vim-airline) is a nice plugin, but it uses too much functions of other plugins, which should be done by users in `.vimrc`.
+
+## Spirit of this plugin
++ Minimalism. The core script is very small to achieve enough functions as a statusline plugin.
++ Configurability. You can create your own component and easily add to the statusline and the tabline.
++ Orthogonality. The plugin does not rely on the implementation of other plugins. Such plugin crossing settings should be configured by users.
+
+## Installation
+### [Pathogen](https://github.com/tpope/vim-pathogen)
+1. Install with the following command.
+
+ git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
+
+### [Vundle](https://github.com/VundleVim/Vundle.vim)
+1. Add the following configuration to your `.vimrc`.
+
+ Plugin 'itchyny/lightline.vim'
+
+2. Install with `:PluginInstall`.
+
+### [NeoBundle](https://github.com/Shougo/neobundle.vim)
+1. Add the following configuration to your `.vimrc`.
+
+ NeoBundle 'itchyny/lightline.vim'
+
+2. Install with `:NeoBundleInstall`.
+
+### [vim-plug](https://github.com/junegunn/vim-plug)
+1. Add the following configuration to your `.vimrc`.
+
+ Plug 'itchyny/lightline.vim'
+
+2. Install with `:PlugInstall`.
+
+## Introduction
+After installing this plugin, you restart the editor and will get a cool statusline.
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/1.png)
+
+The color of the statusline changes due to the mode of Vim. Try typing something, selecting in visual mode and replacing some texts.
+
+If the statusline looks like
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/21.png)
+
+add the following configuration to your `.vimrc`.
+```vim
+set laststatus=2
+```
+
+If the statusline is not coloured like
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/20.png)
+
+then modify `TERM` in your shell configuration (`.zshrc` for example)
+```sh
+export TERM=xterm-256color
+```
+and then add the following configure to your `.vimrc`.
+```vim
+if !has('gui_running')
+ set t_Co=256
+endif
+```
+
+Your statusline appears to work correctly? If yes, great, thanks for choosing lightline.vim! If no, please file an issue report to the [issue tracker](https://github.com/itchyny/lightline.vim/issues).
+
+By the way, `-- INSERT --` is unnecessary anymore because the mode information is displayed in the statusline.
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/13.png)
+If you want to get rid of it, configure as follows.
+```vim
+set noshowmode
+```
+
+## Colorscheme configuration
+The lightline.vim plugin provides multiple colorschemes to meet your editor colorscheme.
+Do not be confused, editor colorscheme rules how codes look like in buffers and lightline.vim has independent colorscheme feature, which rules how the statusline looks like.
+
+If you are using wombat colorscheme, add the following setting to your `.vimrc`,
+```vim
+let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ }
+```
+restart Vim and the statusline looks like:
+
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/2.png)
+
+If the colors of the statusline do not change, move the settings of `g:lightline` before setting the editor colorscheme.
+
+There are many lightline colorschemes available as screenshots shown above. See `:h g:lightline.colorscheme` for the complete list.
+
+## Advanced configuration
+The default appearance of lightline.vim is carefully designed that the tutorial is enough here for most people.
+So please read this section if you really want to configure and enjoy the configurability of lightline.vim.
+
+Sometimes people want to display information of other plugins.
+For example git branch information, syntax check errors and some statuses of plugins.
+
+The lightline.vim plugin does not provide any plugin integration by default.
+This plugin considers orthogonality to be one of the important ideas, which means that the plugin does not rely on implementation of other plugins.
+Once a plugin starts to integrate with some famous plugins, it should be kept updated to follow the changes of the plugins, and should accept integration requests with new plugins and it will suffer from performance regression due to plugin availability checks.
+
+Instead, lightline.vim provides a simple API that user can easily integrate with other plugins.
+Once you understand how to configure and how it will be displayed in the statusline, you can also tell how to integrate with your favorite plugins.
+
+Let's start to configure the appearance.
+The statusline is composed by multiple components.
+It shows the current mode, filename, modified status on the left, and file format, encoding, filetype and cursor positions on the right.
+So in order to add something in the statusline, you firstly create a new component and specify the place.
+
+This is the hello world of lightline.vim component.
+```vim
+let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'readonly', 'filename', 'modified', 'helloworld' ] ]
+ \ },
+ \ 'component': {
+ \ 'helloworld': 'Hello, world!'
+ \ },
+ \ }
+```
+The statusline will look like:
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/3.png)
+
+You have succeeded in displaying `Hello, world!` in the statusline.
+The `helloworld` component is added to `g:lightline.active.left` and its content is configured in `g:lightline.component`.
+The component contents are simply added to `&statusline`.
+Try `:echo &statusline`, it might be a little bit complicated, but you will find `Hello, world!` somewhere.
+
+You can use `'statusline'` syntax for lightline.vim components.
+Consult `:h 'statusline'` to see what's available here.
+For example, if you want to print the value of character under the cursor in hexadecimal, configure as
+```vim
+let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'readonly', 'filename', 'modified', 'charvaluehex' ] ]
+ \ },
+ \ 'component': {
+ \ 'charvaluehex': '0x%B'
+ \ },
+ \ }
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/4.png)
+
+You want the character value information on the right hand side? OK, configure as
+```vim
+let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'right': [ [ 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ] ]
+ \ },
+ \ 'component': {
+ \ 'charvaluehex': '0x%B'
+ \ },
+ \ }
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/5.png)
+
+We have learned how to add a simple component.
+
+- See `:h 'statusline'` to check the statusline flags.
+- Add a new component to `g:lightline.component`.
+- Add the component name to `g:lightline.active.left` or `g:lightline.active.right`.
+
+You can also configure the statusline of inactive buffers by adding the component to `g:lightline.inactive.left` or `g:lightline.inactive.right`.
+
+
+Now let's add some integrations with other plugin.
+The name of the git branch is important these days.
+But lightline.vim does not provide this information by default because it is also one of plugin crossing configurations, and not all people want the integration.
+
+In order to show the branch name in the statusline, install some plugins which provides the branch information.
+The [vim-fugitive](https://github.com/tpope/vim-fugitive) plugin is a famous plugin so let's integrate lightline.vim with it.
+If you don't like to install full git integration but just want to display the branch name in the statusline, you can use the [vim-gitbranch](https://github.com/itchyny/vim-gitbranch) plugin which provides `gitbranch#name` function.
+```vim
+let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'gitbranch': 'fugitive#head'
+ \ },
+ \ }
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png)
+
+Okay, now the statusline shows that we are coding at the master branch.
+What do we learn from this example?
+
+- Find out the function which is suitable to use in the statusline.
+- Create a function component. The previous `charvaluehex` component has `'statusline'` item configuration and registered in `g:lightline.component`. In the current example, we register the name of the function in `g:lightline.component_function`. It should return the string to be displayed in the statusline.
+- Add the component name `gitbranch` to `g:lightline.active.left` or `g:lightline.active.right`.
+
+
+Here we have leaned two kinds of components.
+
+- component: it has a `%`-prefixed item which you can find the meaning at `:h 'statusline'`. All the default components of lightline.vim are components in this style. See the default components at `:h g:lightline.component`.
+- function component: the name of functions are registered. The function is called again and again so be careful not to register a heavy function. See the help with `:h g:lightline.component_function`.
+
+
+The function component is an important design for the configurability of lightline.vim.
+By providing the configuration interface via functions, you can adjust the statusline information as you wish.
+For the proof, let's look into some configuration examples in Q&amp;A style.
+
+### Can I hide the readonly component in the help buffer?
+Yes, create a function component for `readonly`.
+The configuration of function component has priority over the default component.
+```vim
+let g:lightline = {
+ \ 'component_function': {
+ \ 'readonly': 'LightlineReadonly',
+ \ },
+ \ }
+
+function! LightlineReadonly()
+ return &readonly && &filetype !=# 'help' ? 'RO' : ''
+endfunction
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png)
+
+### Can I hide the readonly component in other plugins buffer?
+Yes, modify the `LightlineReadonly` function as you wish.
+```vim
+function! LightlineReadonly()
+ return &readonly && &filetype !~# '\v(help|vimfiler|unite)' ? 'RO' : ''
+endfunction
+
+let g:unite_force_overwrite_statusline = 0
+let g:vimfiler_force_overwrite_statusline = 0
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png)
+
+### Can I display the plugin information at the filename component?
+Yes, overwrite the filename component.
+```vim
+let g:lightline = {
+ \ 'component_function': {
+ \ 'filename': 'LightlineFilename',
+ \ },
+ \ }
+
+function! LightlineFilename()
+ return &filetype ==# 'vimfiler' ? vimfiler#get_status_string() :
+ \ &filetype ==# 'unite' ? unite#get_status_string() :
+ \ &filetype ==# 'vimshell' ? vimshell#get_status_string() :
+ \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
+endfunction
+
+let g:unite_force_overwrite_statusline = 0
+let g:vimfiler_force_overwrite_statusline = 0
+let g:vimshell_force_overwrite_statusline = 0
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/9.png)
+
+### Can I display the plugin name at the mode component?
+Yes, overwrite the mode component.
+```vim
+let g:lightline = {
+ \ 'component_function': {
+ \ 'mode': 'LightlineMode',
+ \ },
+ \ }
+
+function! LightlineMode()
+ return expand('%:t') ==# '__Tagbar__' ? 'Tagbar':
+ \ expand('%:t') ==# 'ControlP' ? 'CtrlP' :
+ \ &filetype ==# 'unite' ? 'Unite' :
+ \ &filetype ==# 'vimfiler' ? 'VimFiler' :
+ \ &filetype ==# 'vimshell' ? 'VimShell' :
+ \ lightline#mode()
+endfunction
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/10.png)
+
+### Can I trim the file format and encoding information on narrow windows?
+Yes, check `winwidth(0)` and return empty string with some threshold.
+```vim
+let g:lightline = {
+ \ 'component_function': {
+ \ 'fileformat': 'LightlineFileformat',
+ \ 'filetype': 'LightlineFiletype',
+ \ },
+ \ }
+
+function! LightlineFileformat()
+ return winwidth(0) > 70 ? &fileformat : ''
+endfunction
+
+function! LightlineFiletype()
+ return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
+endfunction
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/11.png)
+
+### Can I trim the bar between the filename and modified sign?
+Yes, by joining the two components.
+```vim
+let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'readonly', 'filename' ] ],
+ \ },
+ \ 'component_function': {
+ \ 'filename': 'LightlineFilename',
+ \ },
+ \ }
+
+function! LightlineFilename()
+ let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
+ let modified = &modified ? ' +' : ''
+ return filename . modified
+endfunction
+```
+![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/12.png)
+
+You can control the visibility and contents by writing simple functions.
+Now you notice how much function component is important for the configurability of lightline.vim.
+
+## Note for developers of other plugins
+Appearance consistency matters.
+
+The statusline is an important space for Vim users.
+Overwriting the statusline forcibly in your plugin is not a good idea.
+It is not hospitality, but just an annoying feature.
+If your plugin has such a feature, add an option to be modest.
+
+A good design is as follows.
+Firstly, give the users a clue to judge which buffer is the one your plugin creates.
+The filename is a manner and the filetype is another.
+Then, export a function which is useful to be shown in the statusline.
+Lastly, for advanced users, set important information in buffer variables so that the users can obtain the condition of the plugin easily.
+
+## Author
+itchyny (https://github.com/itchyny)
+
+## License
+This software is released under the MIT License, see LICENSE.
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline.vim
new file mode 100644
index 0000000..2076a11
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline.vim
@@ -0,0 +1,502 @@
+" =============================================================================
+" Filename: autoload/lightline.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2018/11/24 12:00:00.
+" =============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:_ = 1 " 1: uninitialized, 2: disabled
+
+function! lightline#update() abort
+ if s:_
+ if s:_ == 2 | return | endif
+ call lightline#init()
+ call lightline#colorscheme()
+ endif
+ if !s:lightline.enable.statusline
+ return
+ endif
+ let w = winnr()
+ let s = winnr('$') == 1 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)]
+ for n in range(1, winnr('$'))
+ call setwinvar(n, '&statusline', s[n!=w])
+ call setwinvar(n, 'lightline', n!=w)
+ endfor
+endfunction
+
+function! lightline#update_once() abort
+ if !exists('w:lightline') || w:lightline
+ call lightline#update()
+ endif
+endfunction
+
+function! lightline#update_disable() abort
+ if !s:lightline.enable.statusline
+ return
+ endif
+ call setwinvar(0, '&statusline', '')
+endfunction
+
+function! lightline#enable() abort
+ let s:_ = 1
+ call lightline#update()
+ augroup lightline
+ autocmd!
+ autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
+ autocmd SessionLoadPost * call lightline#highlight()
+ autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
+ \ | call lightline#update() | call lightline#highlight() | endif
+ autocmd CursorMoved,BufUnload * call lightline#update_once()
+ augroup END
+ augroup lightline-disable
+ autocmd!
+ augroup END
+ augroup! lightline-disable
+endfunction
+
+function! lightline#disable() abort
+ let [&statusline, &tabline] = [get(s:, '_statusline', ''), get(s:, '_tabline', '')]
+ for t in range(1, tabpagenr('$'))
+ for n in range(1, tabpagewinnr(t, '$'))
+ call settabwinvar(t, n, '&statusline', '')
+ endfor
+ endfor
+ augroup lightline
+ autocmd!
+ augroup END
+ augroup! lightline
+ augroup lightline-disable
+ autocmd!
+ autocmd WinEnter * call lightline#update_disable()
+ augroup END
+ let s:_ = 2
+endfunction
+
+function! lightline#toggle() abort
+ if exists('#lightline')
+ call lightline#disable()
+ else
+ call lightline#enable()
+ endif
+endfunction
+
+let s:_lightline = {
+ \ 'active': {
+ \ 'left': [['mode', 'paste'], ['readonly', 'filename', 'modified']],
+ \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype']]
+ \ },
+ \ 'inactive': {
+ \ 'left': [['filename']],
+ \ 'right': [['lineinfo'], ['percent']]
+ \ },
+ \ 'tabline': {
+ \ 'left': [['tabs']],
+ \ 'right': [['close']]
+ \ },
+ \ 'tab': {
+ \ 'active': ['tabnum', 'filename', 'modified'],
+ \ 'inactive': ['tabnum', 'filename', 'modified']
+ \ },
+ \ 'component': {
+ \ 'mode': '%{lightline#mode()}',
+ \ 'absolutepath': '%F', 'relativepath': '%f', 'filename': '%t', 'modified': '%M', 'bufnum': '%n',
+ \ 'paste': '%{&paste?"PASTE":""}', 'readonly': '%R', 'charvalue': '%b', 'charvaluehex': '%B',
+ \ 'spell': '%{&spell?&spelllang:""}', 'fileencoding': '%{&fenc!=#""?&fenc:&enc}', 'fileformat': '%{&ff}',
+ \ 'filetype': '%{&ft!=#""?&ft:"no ft"}', 'percent': '%3p%%', 'percentwin': '%P',
+ \ 'lineinfo': '%3l:%-2v', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}'
+ \ },
+ \ 'component_visible_condition': {
+ \ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
+ \ },
+ \ 'component_function': {},
+ \ 'component_function_visible_condition': {},
+ \ 'component_expand': {
+ \ 'tabs': 'lightline#tabs'
+ \ },
+ \ 'component_type': {
+ \ 'tabs': 'tabsel', 'close': 'raw'
+ \ },
+ \ 'component_raw': {},
+ \ 'tab_component': {},
+ \ 'tab_component_function': {
+ \ 'filename': 'lightline#tab#filename', 'modified': 'lightline#tab#modified',
+ \ 'readonly': 'lightline#tab#readonly', 'tabnum': 'lightline#tab#tabnum'
+ \ },
+ \ 'colorscheme': 'default',
+ \ 'mode_map': {
+ \ 'n': 'NORMAL', 'i': 'INSERT', 'R': 'REPLACE', 'v': 'VISUAL', 'V': 'V-LINE', "\<C-v>": 'V-BLOCK',
+ \ 'c': 'COMMAND', 's': 'SELECT', 'S': 'S-LINE', "\<C-s>": 'S-BLOCK', 't': 'TERMINAL'
+ \ },
+ \ 'separator': { 'left': '', 'right': '' },
+ \ 'subseparator': { 'left': '|', 'right': '|' },
+ \ 'tabline_separator': {},
+ \ 'tabline_subseparator': {},
+ \ 'enable': { 'statusline': 1, 'tabline': 1 },
+ \ '_mode_': {
+ \ 'n': 'normal', 'i': 'insert', 'R': 'replace', 'v': 'visual', 'V': 'visual', "\<C-v>": 'visual',
+ \ 'c': 'command', 's': 'select', 'S': 'select', "\<C-s>": 'select', 't': 'terminal'
+ \ },
+ \ 'mode_fallback': { 'replace': 'insert', 'terminal': 'insert', 'select': 'visual' },
+ \ 'palette': {},
+ \ 'winwidth': winwidth(0),
+ \ }
+function! lightline#init() abort
+ let s:lightline = deepcopy(get(g:, 'lightline', {}))
+ for [key, value] in items(s:_lightline)
+ if type(value) == 4
+ if !has_key(s:lightline, key)
+ let s:lightline[key] = {}
+ endif
+ call extend(s:lightline[key], value, 'keep')
+ elseif !has_key(s:lightline, key)
+ let s:lightline[key] = value
+ endif
+ unlet value
+ endfor
+ call extend(s:lightline.tabline_separator, s:lightline.separator, 'keep')
+ call extend(s:lightline.tabline_subseparator, s:lightline.subseparator, 'keep')
+ let s:lightline.tabline_configured = has_key(get(get(g:, 'lightline', {}), 'component_expand', {}), 'tabs')
+ for components in deepcopy(s:lightline.tabline.left + s:lightline.tabline.right)
+ if len(filter(components, 'v:val !=# "tabs" && v:val !=# "close"')) > 0
+ let s:lightline.tabline_configured = 1
+ break
+ endif
+ endfor
+ if !exists('s:_statusline')
+ let s:_statusline = &statusline
+ endif
+ if !exists('s:_tabline')
+ let s:_tabline = &tabline
+ endif
+ if s:lightline.enable.tabline
+ set tabline=%!lightline#tabline()
+ else
+ let &tabline = get(s:, '_tabline', '')
+ endif
+ for f in values(s:lightline.component_function)
+ silent! call call(f, [])
+ endfor
+ for f in values(s:lightline.tab_component_function)
+ silent! call call(f, [1])
+ endfor
+ let s:mode = ''
+endfunction
+
+function! lightline#colorscheme() abort
+ try
+ let s:lightline.palette = g:lightline#colorscheme#{s:lightline.colorscheme}#palette
+ catch
+ call lightline#error('Could not load colorscheme ' . s:lightline.colorscheme . '.')
+ let s:lightline.colorscheme = 'default'
+ let s:lightline.palette = g:lightline#colorscheme#{s:lightline.colorscheme}#palette
+ finally
+ if has('win32') && !has('gui_running') && &t_Co < 256
+ for u in values(s:lightline.palette)
+ for v in values(u)
+ for _ in v
+ let [_[2], _[3]] = [lightline#colortable#gui2cui(_[0], _[2]), lightline#colortable#gui2cui(_[1], _[3])]
+ endfor
+ endfor
+ endfor
+ endif
+ let s:highlight = {}
+ call lightline#highlight('normal')
+ call lightline#link()
+ let s:_ = 0
+ endtry
+endfunction
+
+function! lightline#palette() abort
+ return s:lightline.palette
+endfunction
+
+function! lightline#mode() abort
+ return get(s:lightline.mode_map, mode(), '')
+endfunction
+
+let s:mode = ''
+function! lightline#link(...) abort
+ let mode = get(s:lightline._mode_, a:0 ? a:1 : mode(), 'normal')
+ if s:mode == mode
+ return ''
+ endif
+ let s:mode = mode
+ if !has_key(s:highlight, mode)
+ call lightline#highlight(mode)
+ endif
+ let types = map(s:uniq(sort(filter(values(s:lightline.component_type), 'v:val !=# "raw"'))), '[v:val, 1]')
+ for [p, l] in [['Left', len(s:lightline.active.left)], ['Right', len(s:lightline.active.right)]]
+ for [i, t] in map(range(0, l), '[v:val, 0]') + types
+ if i != l
+ exec printf('hi link Lightline%s_active_%s Lightline%s_%s_%s', p, i, p, mode, i)
+ endif
+ for [j, s] in map(range(0, l), '[v:val, 0]') + types
+ if i + 1 == j || t || s && i != l
+ exec printf('hi link Lightline%s_active_%s_%s Lightline%s_%s_%s_%s', p, i, j, p, mode, i, j)
+ endif
+ endfor
+ endfor
+ endfor
+ exec printf('hi link LightlineMiddle_active LightlineMiddle_%s', mode)
+ return ''
+endfunction
+
+function! s:term(p) abort
+ return get(a:p, 4) !=# '' ? 'term='.a:p[4].' cterm='.a:p[4].' gui='.a:p[4] : ''
+endfunction
+
+if exists('*uniq')
+ let s:uniq = function('uniq')
+else
+ function! s:uniq(xs) abort
+ let i = len(a:xs) - 1
+ while i > 0
+ if a:xs[i] ==# a:xs[i - 1]
+ call remove(a:xs, i)
+ endif
+ let i -= 1
+ endwhile
+ return a:xs
+ endfunction
+endif
+
+function! lightline#highlight(...) abort
+ let [c, f] = [s:lightline.palette, s:lightline.mode_fallback]
+ let [s:lightline.llen, s:lightline.rlen] = [len(c.normal.left), len(c.normal.right)]
+ let [s:lightline.tab_llen, s:lightline.tab_rlen] = [len(has_key(get(c, 'tabline', {}), 'left') ? c.tabline.left : c.normal.left), len(has_key(get(c, 'tabline', {}), 'right') ? c.tabline.right : c.normal.right)]
+ let types = map(s:uniq(sort(filter(values(s:lightline.component_type), 'v:val !=# "raw"'))), '[v:val, 1]')
+ let modes = a:0 ? [a:1] : extend(['normal', 'insert', 'replace', 'visual', 'inactive', 'command', 'select', 'tabline'], exists(':terminal') == 2 ? ['terminal'] : [])
+ for mode in modes
+ let s:highlight[mode] = 1
+ let d = has_key(c, mode) ? mode : has_key(f, mode) && has_key(c, f[mode]) ? f[mode] : 'normal'
+ let left = d ==# 'tabline' ? s:lightline.tabline.left : d ==# 'inactive' ? s:lightline.inactive.left : s:lightline.active.left
+ let right = d ==# 'tabline' ? s:lightline.tabline.right : d ==# 'inactive' ? s:lightline.inactive.right : s:lightline.active.right
+ let ls = has_key(get(c, d, {}), 'left') ? c[d].left : has_key(f, d) && has_key(get(c, f[d], {}), 'left') ? c[f[d]].left : c.normal.left
+ let ms = has_key(get(c, d, {}), 'middle') ? c[d].middle[0] : has_key(f, d) && has_key(get(c, f[d], {}), 'middle') ? c[f[d]].middle[0] : c.normal.middle[0]
+ let rs = has_key(get(c, d, {}), 'right') ? c[d].right : has_key(f, d) && has_key(get(c, f[d], {}), 'right') ? c[f[d]].right : c.normal.right
+ for [p, l, zs] in [['Left', len(left), ls], ['Right', len(right), rs]]
+ for [i, t] in map(range(0, l), '[v:val, 0]') + types
+ if i < l || i < 1
+ let r = t ? (has_key(get(c, d, []), i) ? c[d][i][0] : has_key(get(c, 'tabline', {}), i) ? c.tabline[i][0] : get(c.normal, i, zs)[0]) : get(zs, i, ms)
+ exec printf('hi Lightline%s_%s_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', p, mode, i, r[0], r[1], r[2], r[3], s:term(r))
+ endif
+ for [j, s] in map(range(0, l), '[v:val, 0]') + types
+ if i + 1 == j || t || s && i != l
+ let q = s ? (has_key(get(c, d, []), j) ? c[d][j][0] : has_key(get(c, 'tabline', {}), j) ? c.tabline[j][0] : get(c.normal, j, zs)[0]) : (j != l ? get(zs, j, ms) :ms)
+ exec printf('hi Lightline%s_%s_%s_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s', p, mode, i, j, r[1], q[1], r[3], q[3])
+ endif
+ endfor
+ endfor
+ endfor
+ exec printf('hi LightlineMiddle_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', mode, ms[0], ms[1], ms[2], ms[3], s:term(ms))
+ endfor
+endfunction
+
+function! s:subseparator(components, subseparator, expanded) abort
+ let [a, c, f, v, u] = [a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_visible_condition]
+ let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
+ \ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[a[v:val]].")" : (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"") :
+ \ has_key(v, a[v:val]) ? "(".v[a[v:val]].")" : has_key(c, a[v:val]) ? "1" : "0"')
+ return '%{' . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : ')') . '?"' . a:subseparator . '":""}'
+endfunction
+
+function! lightline#concatenate(xs, right) abort
+ let separator = a:right ? s:lightline.subseparator.right : s:lightline.subseparator.left
+ return join(filter(copy(a:xs), 'v:val !=# ""'), ' ' . separator . ' ')
+endfunction
+
+function! lightline#statusline(inactive) abort
+ if a:inactive && !has_key(s:highlight, 'inactive')
+ call lightline#highlight('inactive')
+ endif
+ return s:line(0, a:inactive)
+endfunction
+
+function! s:normalize(result) abort
+ if type(a:result) == 3
+ return map(a:result, 'type(v:val) == 1 ? v:val : string(v:val)')
+ elseif type(a:result) == 1
+ return [a:result]
+ else
+ return [string(a:result)]
+ endif
+endfunction
+
+function! s:evaluate_expand(component) abort
+ try
+ let result = eval(a:component . '()')
+ if type(result) == 1 && result ==# ''
+ return []
+ endif
+ catch
+ return []
+ endtry
+ return map(type(result) == 3 ? (result + [[], [], []])[:2] : [[], [result], []], 'filter(s:normalize(v:val), "v:val !=# ''''")')
+endfunction
+
+function! s:convert(name, index) abort
+ if has_key(s:lightline.component_expand, a:name)
+ let type = get(s:lightline.component_type, a:name, a:index)
+ let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw'
+ return filter(s:map(s:evaluate_expand(s:lightline.component_expand[a:name]),
+ \ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []')
+ else
+ return [[[a:name], 0, a:index, a:index]]
+ endif
+endfunction
+
+function! s:flatten_twice(xss) abort
+ let ys = []
+ for xs in a:xss
+ for x in xs
+ let ys += x
+ endfor
+ endfor
+ return ys
+endfunction
+
+if v:version > 702 || v:version == 702 && has('patch295')
+ let s:map = function('map')
+else
+ function! s:map(xs, f) abort
+ let ys = []
+ for i in range(len(a:xs))
+ call extend(ys, map(a:xs[(i):(i)], substitute(a:f, 'v:key', i, 'g')))
+ endfor
+ return ys
+ endfunction
+endif
+
+function! s:expand(components) abort
+ let components = []
+ let expanded = []
+ let indices = []
+ let prevtype = ''
+ let previndex = -1
+ let xs = s:flatten_twice(s:map(deepcopy(a:components), 'map(v:val, "s:convert(v:val, ''" . v:key . "'')")'))
+ for [component, expand, type, index] in xs
+ if prevtype !=# type
+ for i in range(previndex + 1, max([previndex, index - 1]))
+ call add(indices, string(i))
+ call add(components, [])
+ call add(expanded, [])
+ endfor
+ call add(indices, type)
+ call add(components, [])
+ call add(expanded, [])
+ endif
+ call extend(components[-1], component)
+ call extend(expanded[-1], repeat([expand], len(component)))
+ let prevtype = type
+ let previndex = index
+ endfor
+ for i in range(previndex + 1, max([previndex, len(a:components) - 1]))
+ call add(indices, string(i))
+ call add(components, [])
+ call add(expanded, [])
+ endfor
+ call add(indices, string(len(a:components)))
+ return [components, expanded, indices]
+endfunction
+
+function! s:line(tabline, inactive) abort
+ let _ = a:tabline ? '' : '%{lightline#link()}'
+ if s:lightline.palette == {}
+ call lightline#colorscheme()
+ endif
+ let [l, r] = a:tabline ? [s:lightline.tab_llen, s:lightline.tab_rlen] : [s:lightline.llen, s:lightline.rlen]
+ let [p, s] = a:tabline ? [s:lightline.tabline_separator, s:lightline.tabline_subseparator] : [s:lightline.separator, s:lightline.subseparator]
+ let [c, f, t, w] = [s:lightline.component, s:lightline.component_function, s:lightline.component_type, s:lightline.component_raw]
+ let mode = a:tabline ? 'tabline' : a:inactive ? 'inactive' : 'active'
+ let l_ = has_key(s:lightline, mode) ? s:lightline[mode].left : s:lightline.active.left
+ let [lt, lc, ll] = s:expand(copy(l_))
+ let r_ = has_key(s:lightline, mode) ? s:lightline[mode].right : s:lightline.active.right
+ let [rt, rc, rl] = s:expand(copy(r_))
+ for i in range(len(lt))
+ let _ .= '%#LightlineLeft_' . mode . '_' . ll[i] . '#'
+ for j in range(len(lt[i]))
+ let x = lc[i][j] ? lt[i][j] : has_key(f, lt[i][j]) ? (exists('*' . f[lt[i][j]]) ? '%{' . f[lt[i][j]] . '()}' : '%{exists("*' . f[lt[i][j]] . '")?' . f[lt[i][j]] . '():""}') : get(c, lt[i][j], '')
+ let _ .= has_key(t, lt[i][j]) && t[lt[i][j]] ==# 'raw' || get(w, lt[i][j]) || lc[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)'
+ if j < len(lt[i]) - 1 && s.left !=# ''
+ let _ .= s:subseparator(lt[i][(j):], s.left, lc[i][(j):])
+ endif
+ endfor
+ let _ .= '%#LightlineLeft_' . mode . '_' . ll[i] . '_' . ll[i + 1] . '#'
+ let _ .= i < l + len(lt) - len(l_) && ll[i] < l || ll[i] != ll[i + 1] ? p.left : len(lt[i]) ? s.left : ''
+ endfor
+ let _ .= '%#LightlineMiddle_' . mode . '#%='
+ for i in reverse(range(len(rt)))
+ let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#'
+ let _ .= i < r + len(rt) - len(r_) && rl[i] < r || rl[i] != rl[i + 1] ? p.right : len(rt[i]) ? s.right : ''
+ let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '#'
+ for j in range(len(rt[i]))
+ let x = rc[i][j] ? rt[i][j] : has_key(f, rt[i][j]) ? (exists('*' . f[rt[i][j]]) ? '%{' . f[rt[i][j]] . '()}' : '%{exists("*' . f[rt[i][j]] . '")?' . f[rt[i][j]] . '():""}') : get(c, rt[i][j], '')
+ let _ .= has_key(t, rt[i][j]) && t[rt[i][j]] ==# 'raw' || get(w, rt[i][j]) || rc[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)'
+ if j < len(rt[i]) - 1 && s.right !=# ''
+ let _ .= s:subseparator(rt[i][(j):], s.right, rc[i][(j):])
+ endif
+ endfor
+ endfor
+ return _
+endfunction
+
+let s:tabnr = -1
+let s:tabcnt = -1
+let s:tabline = ''
+function! lightline#tabline() abort
+ if !has_key(s:highlight, 'tabline')
+ call lightline#highlight('tabline')
+ endif
+ if s:lightline.tabline_configured || s:tabnr != tabpagenr() || s:tabcnt != tabpagenr('$')
+ let s:tabnr = tabpagenr()
+ let s:tabcnt = tabpagenr('$')
+ let s:tabline = s:line(1, 0)
+ endif
+ return s:tabline
+endfunction
+
+function! lightline#tabs() abort
+ let [x, y, z] = [[], [], []]
+ let nr = tabpagenr()
+ let cnt = tabpagenr('$')
+ for i in range(1, cnt)
+ call add(i < nr ? x : i == nr ? y : z, (i > nr + 3 ? '%<' : '') . '%'. i . 'T%{lightline#onetab(' . i . ',' . (i == nr) . ')}' . (i == cnt ? '%T' : ''))
+ endfor
+ let abbr = '...'
+ let n = min([max([s:lightline.winwidth / 40, 2]), 8])
+ if len(x) > n && len(z) > n
+ let x = extend(add(x[:n/2-1], abbr), x[-(n+1)/2:])
+ let z = extend(add(z[:(n+1)/2-1], abbr), z[-n/2:])
+ elseif len(x) + len(z) > 2 * n
+ if len(x) > n
+ let x = extend(add(x[:(2*n-len(z))/2-1], abbr), x[-(2*n-len(z)+1)/2:])
+ elseif len(z) > n
+ let z = extend(add(z[:(2*n-len(x)+1)/2-1], abbr), z[-(2*n-len(x))/2:])
+ endif
+ endif
+ return [x, y, z]
+endfunction
+
+function! lightline#onetab(n, active) abort
+ let _ = []
+ for name in a:active ? s:lightline.tab.active : s:lightline.tab.inactive
+ if has_key(s:lightline.tab_component_function, name)
+ call add(_, call(s:lightline.tab_component_function[name], [a:n]))
+ else
+ call add(_, get(s:lightline.tab_component, name, ''))
+ endif
+ endfor
+ return join(filter(_, 'v:val !=# ""'), ' ')
+endfunction
+
+function! lightline#error(msg) abort
+ echohl ErrorMsg
+ echomsg 'lightline.vim: '.a:msg
+ echohl None
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim
new file mode 100644
index 0000000..79013ff
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim
@@ -0,0 +1,257 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2018/09/01 22:48:24.
+" =============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:cuicolor = {
+ \ 'black' : 16,
+ \ 'white' : 231,
+ \
+ \ 'darkestgreen' : 22,
+ \ 'darkgreen' : 28,
+ \ 'mediumgreen' : 70,
+ \ 'brightgreen' : 148,
+ \
+ \ 'darkestcyan' : 23,
+ \ 'mediumcyan' : 117,
+ \
+ \ 'darkestblue' : 24,
+ \ 'darkblue' : 31,
+ \
+ \ 'darkestred' : 52,
+ \ 'darkred' : 88,
+ \ 'mediumred' : 124,
+ \ 'brightred' : 160,
+ \ 'brightestred' : 196,
+ \
+ \ 'darkestpurple' : 55,
+ \ 'mediumpurple' : 98,
+ \ 'brightpurple' : 189,
+ \
+ \ 'brightorange' : 208,
+ \ 'brightestorange': 214,
+ \
+ \ 'gray0' : 233,
+ \ 'gray1' : 235,
+ \ 'gray2' : 236,
+ \ 'gray3' : 239,
+ \ 'gray4' : 240,
+ \ 'gray5' : 241,
+ \ 'gray6' : 244,
+ \ 'gray7' : 245,
+ \ 'gray8' : 247,
+ \ 'gray9' : 250,
+ \ 'gray10' : 252,
+ \
+ \ 'yellow' : 136,
+ \ 'orange' : 166,
+ \ 'red' : 160,
+ \ 'magenta' : 125,
+ \ 'violet' : 61,
+ \ 'blue' : 33,
+ \ 'cyan' : 37,
+ \ 'green' : 64,
+ \ }
+
+let s:guicolor = {
+ \ 'black' : '#000000',
+ \ 'white' : '#ffffff',
+ \
+ \ 'darkestgreen' : '#005f00',
+ \ 'darkgreen' : '#008700',
+ \ 'mediumgreen' : '#5faf00',
+ \ 'brightgreen' : '#afdf00',
+ \
+ \ 'darkestcyan' : '#005f5f',
+ \ 'mediumcyan' : '#87dfff',
+ \
+ \ 'darkestblue' : '#005f87',
+ \ 'darkblue' : '#0087af',
+ \
+ \ 'darkestred' : '#5f0000',
+ \ 'darkred' : '#870000',
+ \ 'mediumred' : '#af0000',
+ \ 'brightred' : '#df0000',
+ \ 'brightestred' : '#ff0000',
+ \
+ \ 'darkestpurple' : '#5f00af',
+ \ 'mediumpurple' : '#875fdf',
+ \ 'brightpurple' : '#dfdfff',
+ \
+ \ 'brightorange' : '#ff8700',
+ \ 'brightestorange': '#ffaf00',
+ \
+ \ 'gray0' : '#121212',
+ \ 'gray1' : '#262626',
+ \ 'gray2' : '#303030',
+ \ 'gray3' : '#4e4e4e',
+ \ 'gray4' : '#585858',
+ \ 'gray5' : '#606060',
+ \ 'gray6' : '#808080',
+ \ 'gray7' : '#8a8a8a',
+ \ 'gray8' : '#9e9e9e',
+ \ 'gray9' : '#bcbcbc',
+ \ 'gray10' : '#d0d0d0',
+ \
+ \ 'yellow' : '#b58900',
+ \ 'orange' : '#cb4b16',
+ \ 'red' : '#dc322f',
+ \ 'magenta' : '#d33682',
+ \ 'violet' : '#6c71c4',
+ \ 'blue' : '#268bd2',
+ \ 'cyan' : '#2aa198',
+ \ 'green' : '#859900',
+ \ }
+
+function! s:convert(rgb) abort
+ let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
+ if len(rgb) == 0
+ return 0
+ endif
+ if rgb[0] == 0xc0 && rgb[1] == 0xc0 && rgb[2] == 0xc0
+ return 7
+ elseif rgb[0] == 0x80 && rgb[1] == 0x80 && rgb[2] == 0x80
+ return 8
+ elseif (rgb[0] == 0x80 || rgb[0] == 0x00) && (rgb[1] == 0x80 || rgb[1] == 0x00) && (rgb[2] == 0x80 || rgb[2] == 0x00)
+ return (rgb[0] / 0x80) + (rgb[1] / 0x80) * 2 + (rgb[1] / 0x80) * 4
+ elseif abs(rgb[0]-rgb[1]) < 3 && abs(rgb[1]-rgb[2]) < 3 && abs(rgb[2]-rgb[0]) < 3
+ return s:black((rgb[0] + rgb[1] + rgb[2]) / 3)
+ else
+ return 16 + ((s:nr(rgb[0]) * 6) + s:nr(rgb[1])) * 6 + s:nr(rgb[2])
+ endif
+endfunction
+
+function! s:black(x) abort
+ if a:x < 0x04
+ return 16
+ elseif a:x > 0xf4
+ return 231
+ elseif index([0x00, 0x5f, 0x87, 0xaf, 0xdf, 0xff], a:x) >= 0
+ let l = a:x / 0x30
+ return ((l * 6) + l) * 6 + l + 16
+ else
+ return 232 + (a:x < 8 ? 0 : a:x < 0x60 ? (a:x-8)/10 : a:x < 0x76 ? (a:x-0x60)/6+9 : (a:x-8)/10)
+ endif
+endfunction
+
+function! s:nr(x) abort
+ return a:x < 0x2f ? 0 : a:x < 0x73 ? 1 : a:x < 0x9b ? 2 : a:x < 0xc7 ? 3 : a:x < 0xef ? 4 : 5
+endfunction
+
+function! s:rgb(r, g, b) abort
+ return printf('#%02x%02x%02x', a:r, a:g, a:b)
+endfunction
+
+function! s:upconvert(nr) abort
+ let x = a:nr * 1
+ if x < 7
+ let [b, rg] = [x / 4, x % 4]
+ let [g, r] = [rg / 2, rg % 2]
+ return s:rgb(r * 0x80, g * 0x80, b * 0x80)
+ elseif x == 7
+ return s:rgb(0xc0, 0xc0, 0xc0)
+ elseif x == 8
+ return s:rgb(0x80, 0x80, 0x80)
+ elseif x < 16
+ let y = x - 8
+ let [b, rg] = [y / 4, y % 4]
+ let [g, r] = [rg / 2, rg % 2]
+ return s:rgb(r * 0xff, g * 0xff, b * 0xff)
+ elseif x < 232
+ let y = x - 16
+ let [rg, b] = [y / 6, y % 6]
+ let [r, g] = [rg / 6, rg % 6]
+ let l = [0x00, 0x5f, 0x87, 0xaf, 0xdf, 0xff]
+ return s:rgb(l[r], l[g], l[b])
+ elseif x < 241
+ let k = (x - 232) * 10 + 8
+ return s:rgb(k, k, k)
+ elseif x < 243
+ let k = (x - 241) * 6 + 0x60
+ return s:rgb(k, k, k)
+ else
+ let k = (x - 232) * 10 + 8
+ return s:rgb(k, k, k)
+ endif
+endfunction
+
+function! lightline#colorscheme#fill(p) abort
+ for k in values(a:p)
+ for l in values(k)
+ for m in l
+ if len(m) < 4
+ if type(m[0]) == 1 && type(m[1]) == 1
+ if m[0] =~# '^\d\+$' && m[1] =~# '^\d\+$'
+ call insert(m, s:upconvert(m[1]), 0)
+ call insert(m, s:upconvert(m[1]), 0)
+ else
+ call insert(m, get(s:cuicolor, m[0], s:convert(m[0])), 2)
+ call insert(m, get(s:cuicolor, m[1], s:convert(m[1])), 3)
+ let m[0] = get(s:guicolor, m[0], m[0])
+ let m[1] = get(s:guicolor, m[1], m[1])
+ endif
+ elseif type(m[0]) == 0 && type(m[1]) == 0
+ call insert(m, s:upconvert(m[1]), 0)
+ call insert(m, s:upconvert(m[1]), 0)
+ endif
+ endif
+ endfor
+ endfor
+ endfor
+ return a:p
+endfunction
+
+function! lightline#colorscheme#flatten(p) abort
+ for k in values(a:p)
+ for l in values(k)
+ for m in range(len(l))
+ let attr = ''
+ if len(l[m]) == 3 && type(l[m][2]) == 1
+ let attr = l[m][2]
+ endif
+ let l[m] = [l[m][0][0], l[m][1][0], l[m][0][1], l[m][1][1]]
+ if !empty(attr)
+ call add(l[m], attr)
+ endif
+ endfor
+ endfor
+ endfor
+ return a:p
+endfunction
+
+if has('gui_running') || (has('termguicolors') && &termguicolors)
+ function! lightline#colorscheme#background() abort
+ return &background
+ endfunction
+else
+ " &background is set inappropriately when the colorscheme sets ctermbg of the Normal group
+ function! lightline#colorscheme#background() abort
+ let bg_color = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
+ if bg_color !=# ''
+ if bg_color < 16
+ return &background
+ elseif 232 <= bg_color && bg_color < 244
+ return 'dark'
+ elseif 244 <= bg_color
+ return 'light'
+ endif
+ endif
+ let fg_color = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
+ if fg_color !=# ''
+ if fg_color < 8 || 232 <= fg_color && fg_color < 244
+ return 'light'
+ elseif 8 <= fg_color && fg_color < 16 || 244 <= fg_color
+ return 'dark'
+ endif
+ endif
+ return &background
+ endfunction
+endif
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/16color.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/16color.vim
new file mode 100644
index 0000000..41e6497
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/16color.vim
@@ -0,0 +1,49 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/16color.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2017/11/25 11:14:04.
+" =============================================================================
+
+let s:base03 = [ '#808080', 8 ]
+let s:base02 = [ '#000000', 0 ]
+let s:base01 = [ '#00ff00', 10 ]
+let s:base00 = [ '#ffff00', 11 ]
+let s:base0 = [ '#0000ff', 12 ]
+let s:base1 = [ '#00ffff', 14 ]
+let s:base2 = [ '#c0c0c0', 7 ]
+let s:base3 = [ '#ffffff', 15 ]
+let s:yellow = [ '#808000', 3 ]
+let s:orange = [ '#ff0000', 9 ]
+let s:red = [ '#800000', 1 ]
+let s:magenta = [ '#800080', 5 ]
+let s:violet = [ '#ff00ff', 13 ]
+let s:blue = [ '#000080', 4 ]
+let s:cyan = [ '#008080', 6 ]
+let s:green = [ '#008000', 2 ]
+
+if lightline#colorscheme#background() ==# 'light'
+ let [s:base03, s:base3] = [s:base3, s:base03]
+ let [s:base02, s:base2] = [s:base2, s:base02]
+ let [s:base01, s:base1] = [s:base1, s:base01]
+ let [s:base00, s:base0] = [s:base0, s:base00]
+endif
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base01 ], [ s:base00, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
+let s:p.insert.left = [ [ s:base3, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base3, s:red ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base3, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base02 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base2 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:base2, s:red ] ]
+let s:p.normal.warning = [ [ s:base02, s:yellow ] ]
+
+let g:lightline#colorscheme#16color#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/OldHope.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/OldHope.vim
new file mode 100644
index 0000000..ff78290
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/OldHope.vim
@@ -0,0 +1,44 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/OldHope.vim
+" Author: tomb0y
+" License: MIT License
+" Last Change: 2017/10/15 06:20:54.
+" =============================================================================
+
+let s:yellow = [ '#e5cd52' , 221 ]
+let s:blue = [ '#4fb4d8' , 39 ]
+let s:red = [ '#f92672' , 161 ]
+let s:green = [ '#78bd65' , 41 ]
+let s:orange = [ '#ef7c2a' , 202 ]
+let s:white = [ '#ffffff' , 15 ]
+let s:lightGray = [ '#848794' , 245 ]
+let s:gray = [ '#686b78' , 242 ]
+let s:darkGray = [ '#45474f' , 238 ]
+let s:veryDarkGray = [ '#1c1d21' , 234 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+let s:p.normal.left = [ [ s:white, s:blue ], [ s:white, s:gray ] ]
+let s:p.insert.left = [ [ s:white, s:green ], [ s:white, s:gray ] ]
+let s:p.visual.left = [ [ s:white, s:orange ], [ s:white, s:gray ] ]
+let s:p.replace.left = [ [ s:white, s:red ], [ s:white, s:gray ] ]
+
+let s:p.inactive.right = [ [ s:darkGray, s:gray ], [ s:darkGray, s:gray ] ]
+let s:p.inactive.left = [ [ s:lightGray, s:darkGray ], [ s:white, s:darkGray ] ]
+let s:p.inactive.middle = [ [ s:white, s:darkGray ] ]
+
+let s:p.normal.middle = [ [ s:white, s:darkGray ] ]
+let s:p.normal.error = [ [ s:red, s:darkGray ] ]
+let s:p.normal.warning = [ [ s:orange, s:darkGray ] ]
+
+let s:p.tabline.left = [ [ s:lightGray, s:darkGray ] ]
+let s:p.tabline.tabsel = [ [ s:darkGray, s:yellow ] ]
+let s:p.tabline.middle = [ [ s:yellow, s:veryDarkGray ] ]
+
+let s:p.normal.right = copy(s:p.normal.left)
+let s:p.insert.right = copy(s:p.insert.left)
+let s:p.visual.right = copy(s:p.visual.left)
+let s:p.replace.right = copy(s:p.replace.left)
+let s:p.tabline.right = copy(s:p.tabline.left)
+
+let g:lightline#colorscheme#OldHope#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor.vim
new file mode 100644
index 0000000..90aa426
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor.vim
@@ -0,0 +1,12 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/PaperColor.vim
+" Author: TKNGUE
+" License: MIT License
+" Last Change: 2017/11/25 11:13:35.
+" =============================================================================
+
+if lightline#colorscheme#background() ==# 'light'
+ let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_light#palette
+else
+ let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_dark#palette
+endif
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_dark.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_dark.vim
new file mode 100644
index 0000000..0a70b34
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_dark.vim
@@ -0,0 +1,60 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/PaperColor_dark.vim
+" Author: TKNGUE
+" License: MIT License
+" Last Change: 2015-07-27 06:01
+" =============================================================================
+
+let s:red = '#df0000'
+let s:green = '#008700'
+let s:blue = '#00afaf'
+
+let s:pink = '#afdf00'
+let s:olive = '#dfaf5f'
+let s:navy = '#df875f'
+
+let s:orange = '#d75f00'
+let s:purple = '#8959a8'
+let s:aqua = '#3e999f'
+
+" Basics:
+let s:foreground = '#d0d0d0'
+let s:background = '#444444'
+let s:window = '#efefef'
+let s:status = '#c6c6c6'
+let s:error = '#5f0000'
+
+" Tabline:
+let s:tabline_bg = '#3a3a3a'
+let s:tabline_active_fg = '#1c1c1c'
+let s:tabline_active_bg = '#00afaf'
+let s:tabline_inactive_fg = '#c6c6c6'
+let s:tabline_inactive_bg = '#585858'
+
+" Statusline:
+let s:statusline_active_fg = '#1c1c1c'
+let s:statusline_active_bg = '#5f8787'
+let s:statusline_inactive_fg = '#c6c6c6'
+let s:statusline_inactive_bg = '#444444'
+
+" Visual:
+let s:visual_fg = '#000000'
+let s:visual_bg = '#8787af'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]]
+let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
+let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
+let s:p.inactive.middle = [ [ s:foreground, s:background ], ]
+let s:p.insert.left = [ [ s:background, s:blue], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.visual.left = [ [ s:visual_fg, s:visual_bg ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]]
+let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ]
+let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:background, s:error ] ]
+
+let g:lightline#colorscheme#PaperColor_dark#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_light.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_light.vim
new file mode 100644
index 0000000..aef0b86
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/PaperColor_light.vim
@@ -0,0 +1,55 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/PaperColor_light.vim
+" Author: TKNGUE
+" License: MIT License
+" Last Change: 2015/07/28 07:46:40.
+" =============================================================================
+
+let s:red = '#df0000'
+let s:green = '#008700'
+let s:blue = '#4271ae'
+let s:pink = '#d7005f'
+let s:olive = '#718c00'
+let s:navy = '#005f87'
+let s:orange = '#d75f00'
+let s:purple = '#8959a8'
+let s:aqua = '#3e999f'
+
+" Basics:
+let s:foreground = '#4d4d4c'
+let s:background = '#F5F5F5'
+let s:window = '#efefef'
+let s:status = s:aqua
+let s:error = '#ffafdf'
+
+" Tabline:
+let s:tabline_bg = s:navy
+let s:tabline_active_fg = s:foreground
+let s:tabline_active_bg = s:window
+let s:tabline_inactive_fg = s:background
+let s:tabline_inactive_bg = s:aqua
+
+" Statusline:
+let s:statusline_active_fg = s:window
+let s:statusline_active_bg = s:navy
+let s:statusline_inactive_fg = s:foreground
+let s:statusline_inactive_bg = '#dadada'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]]
+let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
+let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
+let s:p.inactive.middle = [ [ s:foreground, s:background ], ]
+let s:p.insert.left = [ [ s:blue, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.visual.left = [ [ s:background, s:orange ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
+let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]]
+let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ]
+let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:background, s:error ] ]
+let s:p.normal.warning = [ [ s:background, s:olive ] ]
+
+let g:lightline#colorscheme#PaperColor_light#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow.vim
new file mode 100644
index 0000000..8255966
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow.vim
@@ -0,0 +1,41 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/Tomorrow.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 12:22:37.
+" =============================================================================
+let s:base03 = '#fafafa'
+let s:base023 = '#dfdfdf'
+let s:base02 = '#c8c8c8'
+let s:base01 = '#b4b4b4'
+let s:base00 = '#808080'
+let s:base0 = '#666666'
+let s:base1 = '#555555'
+let s:base2 = '#4f4f4f'
+let s:base3 = '#4d4d4c'
+let s:red = '#c82829'
+let s:orange = '#f5871f'
+let s:yellow = '#eab700'
+let s:green = '#718c00'
+let s:cyan = '#3e999f'
+let s:blue = '#4271ae'
+let s:magenta = '#8959a8'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base00, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base03 ] ]
+let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base02, s:orange ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base00 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base01 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base0 ] ]
+
+let g:lightline#colorscheme#Tomorrow#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night.vim
new file mode 100644
index 0000000..8903180
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night.vim
@@ -0,0 +1,41 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/Tomorrow_Night.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 12:23:38.
+" =============================================================================
+let s:base3 = '#c5c8c6'
+let s:base2 = '#bababa'
+let s:base1 = '#a0a0a0'
+let s:base0 = '#909090'
+let s:base00 = '#666666'
+let s:base01 = '#555555'
+let s:base02 = '#434343'
+let s:base023 = '#303030'
+let s:base03 = '#1d1f21'
+let s:red = '#cc6666'
+let s:orange = '#de935f'
+let s:yellow = '#f0c674'
+let s:green = '#b5bd68'
+let s:cyan = '#8abeb7'
+let s:blue = '#81a2be'
+let s:magenta = '#b294bb'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base00, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base03 ] ]
+let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base02, s:orange ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base0 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base023 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base02 ] ]
+
+let g:lightline#colorscheme#Tomorrow_Night#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim
new file mode 100644
index 0000000..31c27f3
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim
@@ -0,0 +1,43 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 14:13:21.
+" =============================================================================
+let s:base3 = '#ffffff'
+let s:base23 = '#ffffff'
+let s:base2 = '#ffffff'
+let s:base1 = '#ffffff'
+let s:base0 = '#ffffff'
+let s:base00 = '#6060df'
+let s:base01 = '#6060af'
+let s:base02 = '#606087'
+let s:base023 = '#202087'
+let s:base03 = '#002451'
+let s:red = '#ff9da4'
+let s:orange = '#ffc58f'
+let s:yellow = '#ffeead'
+let s:green = '#d1f1a9'
+let s:cyan = '#99ffff'
+let s:blue = '#bbdaff'
+let s:magenta = '#ebbbff'
+
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
+let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base03 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:base023, s:red ] ]
+let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
+
+let g:lightline#colorscheme#Tomorrow_Night_Blue#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim
new file mode 100644
index 0000000..5b81a31
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim
@@ -0,0 +1,42 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 14:13:26.
+" =============================================================================
+let s:base3 = '#eaeaea'
+let s:base23 = '#d0d0d0'
+let s:base2 = '#c6c6c6'
+let s:base1 = '#b2b2b2'
+let s:base0 = '#949494'
+let s:base00 = '#767676'
+let s:base01 = '#606060'
+let s:base02 = '#4e4e4e'
+let s:base023 = '#262626'
+let s:base03 = '#12124c'
+let s:red = '#d54e53'
+let s:orange = '#e78c45'
+let s:yellow = '#e7c547'
+let s:green = '#b9ca4a'
+let s:cyan = '#70c0b1'
+let s:blue = '#7aa6da'
+let s:magenta = '#c397d8'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
+let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base023 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base02 ] ]
+
+let g:lightline#colorscheme#Tomorrow_Night_Bright#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim
new file mode 100644
index 0000000..5124ecc
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim
@@ -0,0 +1,42 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 14:14:14.
+" =============================================================================
+let s:base3 = '#cccccc'
+let s:base23 = '#bbbbbb'
+let s:base2 = '#aaaaaa'
+let s:base1 = '#999999'
+let s:base0 = '#777777'
+let s:base00 = '#666666'
+let s:base01 = '#555555'
+let s:base02 = '#444444'
+let s:base023 = '#333333'
+let s:base03 = '#2d2d2d'
+let s:red = '#f2777a'
+let s:orange = '#f99157'
+let s:yellow = '#ffcc66'
+let s:green = '#99cc99'
+let s:cyan = '#009999'
+let s:blue = '#99cccc'
+let s:magenta = '#cc99cc'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
+let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
+let s:p.tabline.tabsel = [ [ s:base2, s:base03 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:base023, s:red ] ]
+let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
+
+let g:lightline#colorscheme#Tomorrow_Night_Eighties#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/darcula.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/darcula.vim
new file mode 100644
index 0000000..928e8b7
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/darcula.vim
@@ -0,0 +1,37 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/darcula.vim
+" Author: kkopec
+" License: MIT License
+" Last Change: 2017/02/11 21:18:54.
+" =============================================================================
+
+let s:black = [ '#2b2b2b', 235 ]
+let s:gray = [ '#323232', 236 ]
+let s:white = [ '#a9b7c6', 250 ]
+let s:blue = [ '#6897bb' , 67 ]
+let s:green = [ '#629755', 71 ]
+let s:purple = [ '#9876aa', 104 ]
+let s:red = [ '#ff6b68', 204 ]
+let s:yellow = [ '#ffc66d', 222 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
+let s:p.normal.right = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
+let s:p.inactive.left = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
+let s:p.inactive.right = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
+let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:gray ] ]
+let s:p.insert.right = [ [ s:black, s:green ], [ s:green, s:gray ] ]
+let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:gray ] ]
+let s:p.replace.right = [ [ s:black, s:red ], [ s:red, s:gray ] ]
+let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
+let s:p.visual.right = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
+let s:p.normal.middle = [ [ s:white, s:gray ] ]
+let s:p.inactive.middle = [ [ s:white, s:gray ] ]
+let s:p.tabline.left = [ [ s:blue, s:gray ] ]
+let s:p.tabline.tabsel = [ [ s:black, s:blue ] ]
+let s:p.tabline.middle = [ [ s:blue, s:gray ] ]
+let s:p.tabline.right = [ [ s:black, s:blue ] ]
+let s:p.normal.error = [ [ s:red, s:black ] ]
+let s:p.normal.warning = [ [ s:yellow, s:black ] ]
+
+let g:lightline#colorscheme#darcula#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/default.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/default.vim
new file mode 100644
index 0000000..ee9835c
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/default.vim
@@ -0,0 +1,8 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/default.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/08/22 06:05:52.
+" =============================================================================
+
+let g:lightline#colorscheme#default#palette = g:lightline#colorscheme#powerline#palette
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/deus.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/deus.vim
new file mode 100644
index 0000000..0a7da60
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/deus.vim
@@ -0,0 +1,40 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/deus.vim
+" Author: nikersify
+" License: MIT License
+" Last Change: 2018/01/24 13:26:00
+" =============================================================================
+
+let s:term_red = 204
+let s:term_green = 114
+let s:term_yellow = 180
+let s:term_blue = 39
+let s:term_purple = 170
+let s:term_white = 145
+let s:term_black = 235
+let s:term_grey = 236
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+let s:p.normal.left = [ [ '#292c33', '#98c379', s:term_black, s:term_green, 'bold' ], [ '#98c379', '#292c33', s:term_green, s:term_black ] ]
+let s:p.normal.right = [ [ '#292c33', '#98c379', s:term_black, s:term_green ], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ], [ '#98c379', '#292c33', s:term_green, s:term_black ] ]
+let s:p.inactive.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ] ]
+let s:p.inactive.left = s:p.inactive.right[1:]
+" her
+let s:p.insert.left = [ [ '#292c33', '#61afef', s:term_black, s:term_blue, 'bold' ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ]
+let s:p.insert.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue ], [ '#ABB2BF', '#3E4452', s:term_white, s:term_grey ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ]
+let s:p.replace.left = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ]
+let s:p.replace.right = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], s:p.normal.right[1], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ]
+let s:p.visual.left = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ]
+let s:p.visual.right = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], s:p.normal.right[1], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ]
+let s:p.normal.middle = [ [ '#abb2bf', '#292c33', s:term_white, s:term_black ] ]
+let s:p.insert.middle = s:p.normal.middle
+let s:p.replace.middle = s:p.normal.middle
+let s:p.tabline.left = [ s:p.normal.left[1] ]
+let s:p.tabline.tabsel = [ s:p.normal.left[0] ]
+let s:p.tabline.middle = s:p.normal.middle
+let s:p.tabline.right = [ s:p.normal.left[1] ]
+let s:p.normal.error = [ [ '#292c33', '#e06c75', s:term_black, s:term_red ] ]
+let s:p.normal.warning = [ [ '#292c33', '#e5c07b', s:term_black, s:term_yellow ] ]
+
+let g:lightline#colorscheme#deus#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim
new file mode 100644
index 0000000..15b2b35
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim
@@ -0,0 +1,40 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/jellybeans.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 12:21:04.
+" =============================================================================
+let s:base03 = [ '#151513', 233 ]
+let s:base02 = [ '#30302c ', 236 ]
+let s:base01 = [ '#4e4e43', 239 ]
+let s:base00 = [ '#666656', 242 ]
+let s:base0 = [ '#808070', 244 ]
+let s:base1 = [ '#949484', 246 ]
+let s:base2 = [ '#a8a897', 248 ]
+let s:base3 = [ '#e8e8d3', 253 ]
+let s:yellow = [ '#ffb964', 215 ]
+let s:orange = [ '#fad07a', 222 ]
+let s:red = [ '#cf6a4c', 167 ]
+let s:magenta = [ '#f0a0c0', 217 ]
+let s:blue = [ '#8197bf', 103 ]
+let s:cyan = [ '#8fbfdc', 110 ]
+let s:green = [ '#99ad6a', 107 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
+let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
+let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base02 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
+
+let g:lightline#colorscheme#jellybeans#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/landscape.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/landscape.vim
new file mode 100644
index 0000000..68d0920
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/landscape.vim
@@ -0,0 +1,25 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/landscape.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2015/11/26 21:49:44.
+" =============================================================================
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ ['#0000ff', '#ffffff', 21, 231, 'bold' ], [ '#ffffff', '#0000ff', 231, 21 ] ]
+let s:p.normal.right = [ [ '#303030', '#d0d0d0', 236, 252 ], [ '#303030', '#8a8a8a', 236, 245 ], [ '#bcbcbc', '#585858', 250, 240 ] ]
+let s:p.inactive.right = [ [ '#121212', '#606060', 233, 241 ], [ '#121212', '#3a3a3a', 233, 237 ], [ '#121212', '#262626', 233, 235 ] ]
+let s:p.inactive.left = s:p.inactive.right[1:]
+let s:p.insert.left = [ ['#005f00', '#ffffff', 22, 231, 'bold' ], [ '#ffffff', '#005f00', 231, 22 ] ]
+let s:p.replace.left = [ [ '#af0000', '#ffffff', 124, 231, 'bold' ], [ '#ffffff', '#af0000', 231, 124 ] ]
+let s:p.visual.left = [ [ '#5f00ff', '#ffffff', 57, 231, 'bold' ], [ '#ffffff', '#5f00ff', 231, 57 ] ]
+let s:p.normal.middle = [ [ '#8a8a8a', '#303030', 245, 236 ] ]
+let s:p.inactive.middle = [ [ '#303030', '#121212', 236, 233 ] ]
+let s:p.tabline.left = [ [ '#d0d0d0', '#666666', 252, 242 ] ]
+let s:p.tabline.tabsel = [ [ '#dadada', '#121212', 253, 233 ] ]
+let s:p.tabline.middle = [ [ '#8a8a8a', '#3a3a3a', 245, 237 ] ]
+let s:p.tabline.right = [ [ '#d0d0d0', '#666666', 252, 242 ] ]
+let s:p.normal.error = [ [ '#d0d0d0', '#ff0000', 252, 196 ] ]
+let s:p.normal.warning = [ [ '#262626', '#ffff00', 235, 226 ] ]
+
+let g:lightline#colorscheme#landscape#palette = s:p
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/materia.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/materia.vim
new file mode 100644
index 0000000..fdab2cb
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/materia.vim
@@ -0,0 +1,63 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/materia.vim
+" Author: Lokesh Krishna
+" License: MIT License
+" Last Change: 2017/11/25 11:13:40.
+" =============================================================================
+
+" Common colors
+let s:fg = '#d5dbe5'
+let s:blue = '#89ddff'
+let s:green = '#8bd649'
+let s:purple = '#82aaff'
+let s:red1 = '#ec5f67'
+let s:red2 = '#ec5f67'
+let s:yellow = '#ffcc00'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+if lightline#colorscheme#background() ==# 'light'
+ " Light variant
+ let s:bg = '#ffffff'
+ let s:gray1 = '#2c393f'
+ let s:gray2 = '#d5dbe5'
+ let s:gray3 = '#707880'
+
+ let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
+else
+ " Dark variant
+ let s:bg = '#263238'
+ let s:gray1 = '#37474f'
+ let s:gray2 = '#2c393f'
+ let s:gray3 = '#37474f'
+
+ let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
+endif
+
+" Common
+let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
+let s:p.normal.error = [ [ s:red2, s:bg ] ]
+let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
+let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
+let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
+let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.left = [ [ s:bg, s:gray3 ] ]
+let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+
+let g:lightline#colorscheme#materia#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/material.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/material.vim
new file mode 100644
index 0000000..0d704b7
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/material.vim
@@ -0,0 +1,63 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/material.vim
+" Author: Lokesh Krishna
+" License: MIT License
+" Last Change: 2017/11/25 11:13:42.
+" =============================================================================
+
+" Common colors
+let s:fg = '#eeffff'
+let s:blue = '#82aaff'
+let s:green = '#c3e88d'
+let s:purple = '#c792ea'
+let s:red1 = '#f07178'
+let s:red2 = '#ff5370'
+let s:yellow = '#ffcb6b'
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+if lightline#colorscheme#background() ==# 'light'
+ " Light variant
+ let s:bg = '#ffffff'
+ let s:gray1 = '#2e3c43'
+ let s:gray2 = '#eeffff'
+ let s:gray3 = '#546e7a'
+
+ let s:p.normal.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.insert.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
+else
+ " Dark variant
+ let s:bg = '#263238'
+ let s:gray1 = '#314549'
+ let s:gray2 = '#2E3C43'
+ let s:gray3 = '#314549'
+
+ let s:p.normal.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.insert.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
+endif
+
+" Common
+let s:p.normal.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
+let s:p.normal.error = [ [ s:red2, s:bg ] ]
+let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
+let s:p.insert.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
+let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
+let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.left = [ [ s:fg, s:gray3 ] ]
+let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
+let s:p.tabline.right = [ [ s:bg, s:red1, 'bold' ] ]
+
+let g:lightline#colorscheme#material#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/molokai.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/molokai.vim
new file mode 100644
index 0000000..9d066a1
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/molokai.vim
@@ -0,0 +1,36 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/molokai.vim
+" Author: challsted
+" License: MIT License
+" Last Change: 2016/11/17 00:27:58.
+" =============================================================================
+"
+let s:black = [ '#232526', 233 ]
+let s:gray = [ '#808080', 244 ]
+let s:white = [ '#f8f8f2', 234 ]
+let s:cyan = [ '#66d9ef', 81 ]
+let s:green = [ '#a6e22e', 118 ]
+let s:orange = [ '#ef5939', 166 ]
+let s:pink = [ '#f92672', 161 ]
+let s:red = [ '#ff0000', 160 ]
+let s:yellow = [ '#e6db74', 229 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+let s:p.normal.left = [ [ s:black, s:cyan ], [ s:orange, s:black ] ]
+let s:p.normal.middle = [ [ s:orange, s:black ] ]
+let s:p.normal.right = [ [ s:pink, s:black ], [ s:black, s:pink ] ]
+let s:p.normal.error = [ [ s:pink, s:black ] ]
+let s:p.normal.warning = [ [ s:yellow, s:black ] ]
+let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:black ] ]
+let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:black ] ]
+let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:black ] ]
+let s:p.inactive.left = [ [ s:pink, s:black ], [ s:white, s:black ] ]
+let s:p.inactive.middle = [ [ s:gray, s:black ] ]
+let s:p.inactive.right = [ [ s:white, s:pink ], [ s:pink, s:black ] ]
+let s:p.tabline.left = [ [ s:pink, s:black ] ]
+let s:p.tabline.middle = [ [ s:pink, s:black] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.tabline.tabsel = [ [ s:black, s:pink ] ]
+
+let g:lightline#colorscheme#molokai#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/nord.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/nord.vim
new file mode 100644
index 0000000..96d24ae
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/nord.vim
@@ -0,0 +1,46 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/nord.vim
+" Author: arcticicestudio
+" License: MIT
+" Last Change: 2017/11/12 20:27:51
+" =============================================================================
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+let s:nord0 = ["#2E3440", "NONE"]
+let s:nord1 = ["#3B4252", 0]
+let s:nord2 = ["#434C5E", "NONE"]
+let s:nord3 = ["#4C566A", 8]
+let s:nord4 = ["#D8DEE9", "NONE"]
+let s:nord5 = ["#E5E9F0", 7]
+let s:nord6 = ["#ECEFF4", 15]
+let s:nord7 = ["#8FBCBB", 14]
+let s:nord8 = ["#88C0D0", 6]
+let s:nord9 = ["#81A1C1", 4]
+let s:nord10 = ["#5E81AC", 12]
+let s:nord11 = ["#BF616A", 1]
+let s:nord12 = ["#D08770", 11]
+let s:nord13 = ["#EBCB8B", 3]
+let s:nord14 = ["#A3BE8C", 2]
+let s:nord15 = ["#B48EAD", 5]
+
+let s:p.normal.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
+let s:p.normal.middle = [ [ s:nord5, s:nord3 ] ]
+let s:p.normal.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
+let s:p.normal.warning = [ [ s:nord1, s:nord13 ] ]
+let s:p.normal.error = [ [ s:nord1, s:nord11 ] ]
+
+let s:p.inactive.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
+let s:p.inactive.middle = [ [ s:nord5, s:nord1 ] ]
+let s:p.inactive.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
+
+let s:p.insert.left = [ [ s:nord1, s:nord6 ], [ s:nord5, s:nord1 ] ]
+let s:p.replace.left = [ [ s:nord1, s:nord13 ], [ s:nord5, s:nord1 ] ]
+let s:p.visual.left = [ [ s:nord1, s:nord7 ], [ s:nord5, s:nord1 ] ]
+
+let s:p.tabline.left = [ [ s:nord5, s:nord3 ] ]
+let s:p.tabline.middle = [ [ s:nord5, s:nord3 ] ]
+let s:p.tabline.right = [ [ s:nord5, s:nord3 ] ]
+let s:p.tabline.tabsel = [ [ s:nord1, s:nord8 ] ]
+
+let g:lightline#colorscheme#nord#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/one.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/one.vim
new file mode 100644
index 0000000..a28fb8d
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/one.vim
@@ -0,0 +1,64 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/one.vim
+" Author: Zoltan Dalmadi
+" License: MIT License
+" Last Change: 2017/11/28 21:53:01.
+" =============================================================================
+
+" Common colors
+let s:fg = [ '#abb2bf', 145 ]
+let s:blue = [ '#61afef', 75 ]
+let s:green = [ '#98c379', 76 ]
+let s:purple = [ '#c678dd', 176 ]
+let s:red1 = [ '#e06c75', 168 ]
+let s:red2 = [ '#be5046', 168 ]
+let s:yellow = [ '#e5c07b', 180 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+
+if lightline#colorscheme#background() ==# 'light'
+ " Light variant
+ let s:bg = [ '#fafafa', 255 ]
+ let s:gray1 = [ '#494b53', 238 ]
+ let s:gray2 = [ '#f0f0f0', 255 ]
+ let s:gray3 = [ '#d0d0d0', 250 ]
+ let s:green = [ '#98c379', 35 ]
+
+ let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
+ let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
+else
+ " Dark variant
+ let s:bg = [ '#282c34', 235 ]
+ let s:gray1 = [ '#5c6370', 241 ]
+ let s:gray2 = [ '#2c323d', 235 ]
+ let s:gray3 = [ '#3e4452', 240 ]
+
+ let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
+ let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
+ let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
+ let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
+ let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
+endif
+
+" Common
+let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
+let s:p.normal.error = [ [ s:red2, s:bg ] ]
+let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
+let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
+let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
+let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.left = [ [ s:bg, s:gray3 ] ]
+let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
+let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+
+let g:lightline#colorscheme#one#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/powerline.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/powerline.vim
new file mode 100644
index 0000000..40e48d4
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/powerline.vim
@@ -0,0 +1,28 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/powerline.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2013/09/07 15:54:41.
+" =============================================================================
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ ['darkestgreen', 'brightgreen', 'bold'], ['white', 'gray4'] ]
+let s:p.normal.right = [ ['gray5', 'gray10'], ['gray9', 'gray4'], ['gray8', 'gray2'] ]
+let s:p.inactive.right = [ ['gray1', 'gray5'], ['gray4', 'gray1'], ['gray4', 'gray0'] ]
+let s:p.inactive.left = s:p.inactive.right[1:]
+let s:p.insert.left = [ ['darkestcyan', 'white', 'bold'], ['white', 'darkblue'] ]
+let s:p.insert.right = [ [ 'darkestcyan', 'mediumcyan' ], [ 'mediumcyan', 'darkblue' ], [ 'mediumcyan', 'darkestblue' ] ]
+let s:p.replace.left = [ ['white', 'brightred', 'bold'], ['white', 'gray4'] ]
+let s:p.visual.left = [ ['darkred', 'brightorange', 'bold'], ['white', 'gray4'] ]
+let s:p.normal.middle = [ [ 'gray7', 'gray2' ] ]
+let s:p.insert.middle = [ [ 'mediumcyan', 'darkestblue' ] ]
+let s:p.replace.middle = s:p.normal.middle
+let s:p.replace.right = s:p.normal.right
+let s:p.tabline.left = [ [ 'gray9', 'gray4' ] ]
+let s:p.tabline.tabsel = [ [ 'gray9', 'gray1' ] ]
+let s:p.tabline.middle = [ [ 'gray2', 'gray8' ] ]
+let s:p.tabline.right = [ [ 'gray9', 'gray3' ] ]
+let s:p.normal.error = [ [ 'gray9', 'brightestred' ] ]
+let s:p.normal.warning = [ [ 'gray1', 'yellow' ] ]
+
+let g:lightline#colorscheme#powerline#palette = lightline#colorscheme#fill(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/seoul256.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/seoul256.vim
new file mode 100644
index 0000000..ca2d5a0
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/seoul256.vim
@@ -0,0 +1,42 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/seoul256.vim
+" Author: atweiden
+" License: MIT License
+" Last Change: 2015/11/02 08:23:27.
+" =============================================================================
+let s:base03 = [ '#151513', 233 ]
+let s:base02 = [ '#30302c ', 236 ]
+let s:base01 = [ '#4e4e43', 239 ]
+let s:base00 = [ '#666656', 242 ]
+let s:base0 = [ '#808070', 244 ]
+let s:base1 = [ '#949484', 246 ]
+let s:base2 = [ '#a8a897', 248 ]
+let s:base3 = [ '#e8e8d3', 253 ]
+let s:yellow = [ '#d8af5f', 3 ]
+let s:orange = [ '#d7875f', 216 ]
+let s:red = [ '#d68787', 131 ]
+let s:magenta = [ '#df5f87', 168 ]
+let s:peach = [ '#d7afaf', 181 ]
+let s:blue = [ '#87afaf', 109 ]
+let s:cyan = [ '#87d7d7', 23 ]
+let s:green = [ '#87af87', 108 ]
+let s:white = [ '#d0d0d0', 252 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
+let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base02, s:peach ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
+let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base02 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
+
+let g:lightline#colorscheme#seoul256#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/solarized.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/solarized.vim
new file mode 100644
index 0000000..d6ee9c6
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/solarized.vim
@@ -0,0 +1,80 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/solarized.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2017/11/25 11:13:46.
+" =============================================================================
+
+let s:cuicolors = {
+ \ 'base03': [ '8', '234', 'DarkGray' ],
+ \ 'base02': [ '0', '235', 'Black' ],
+ \ 'base01': [ '10', '239', 'LightGreen' ],
+ \ 'base00': [ '11', '240', 'LightYellow' ],
+ \ 'base0': [ '12', '244', 'LightBlue' ],
+ \ 'base1': [ '14', '245', 'LightCyan' ],
+ \ 'base2': [ '7', '187', 'LightGray' ],
+ \ 'base3': [ '15', '230', 'White' ],
+ \ 'yellow': [ '3', '136', 'DarkYellow' ],
+ \ 'orange': [ '9', '166', 'LightRed' ],
+ \ 'red': [ '1', '124', 'DarkRed' ],
+ \ 'magenta': [ '5', '125', 'DarkMagenta' ],
+ \ 'violet': [ '13', '61', 'LightMagenta' ],
+ \ 'blue': [ '4', '33', 'DarkBlue' ],
+ \ 'cyan': [ '6', '37', 'DarkCyan' ],
+ \ 'green': [ '2', '64', 'DarkGreen' ],
+ \ }
+
+" The following condition only applies for the console and is the same
+" condition vim-colors-solarized uses to determine which set of colors
+" to use.
+let s:solarized_termcolors = get(g:, 'solarized_termcolors', 256)
+if s:solarized_termcolors != 256 && &t_Co >= 16
+ let s:cuiindex = 0
+elseif s:solarized_termcolors == 256
+ let s:cuiindex = 1
+else
+ let s:cuiindex = 2
+endif
+
+let s:base03 = [ '#002b36', s:cuicolors.base03[s:cuiindex] ]
+let s:base02 = [ '#073642', s:cuicolors.base02[s:cuiindex] ]
+let s:base01 = [ '#586e75', s:cuicolors.base01[s:cuiindex] ]
+let s:base00 = [ '#657b83', s:cuicolors.base00[s:cuiindex] ]
+let s:base0 = [ '#839496', s:cuicolors.base0[s:cuiindex] ]
+let s:base1 = [ '#93a1a1', s:cuicolors.base1[s:cuiindex] ]
+let s:base2 = [ '#eee8d5', s:cuicolors.base2[s:cuiindex] ]
+let s:base3 = [ '#fdf6e3', s:cuicolors.base3[s:cuiindex] ]
+let s:yellow = [ '#b58900', s:cuicolors.yellow[s:cuiindex] ]
+let s:orange = [ '#cb4b16', s:cuicolors.orange[s:cuiindex] ]
+let s:red = [ '#dc322f', s:cuicolors.red[s:cuiindex] ]
+let s:magenta = [ '#d33682', s:cuicolors.magenta[s:cuiindex] ]
+let s:violet = [ '#6c71c4', s:cuicolors.violet[s:cuiindex] ]
+let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ]
+let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ]
+let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ]
+
+if lightline#colorscheme#background() ==# 'light'
+ let [ s:base03, s:base3 ] = [ s:base3, s:base03 ]
+ let [ s:base02, s:base2 ] = [ s:base2, s:base02 ]
+ let [ s:base01, s:base1 ] = [ s:base1, s:base01 ]
+ let [ s:base00, s:base0 ] = [ s:base0, s:base00 ]
+endif
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base03, s:blue ], [ s:base03, s:base00 ] ]
+let s:p.normal.right = [ [ s:base03, s:base1 ], [ s:base03, s:base00 ] ]
+let s:p.inactive.right = [ [ s:base03, s:base00 ], [ s:base0, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base0, s:base02 ] ]
+let s:p.insert.left = [ [ s:base03, s:green ], [ s:base03, s:base00 ] ]
+let s:p.replace.left = [ [ s:base03, s:red ], [ s:base03, s:base00 ] ]
+let s:p.visual.left = [ [ s:base03, s:magenta ], [ s:base03, s:base00 ] ]
+let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base01, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base03, s:base00 ] ]
+let s:p.tabline.tabsel = [ [ s:base03, s:base1 ] ]
+let s:p.tabline.middle = [ [ s:base0, s:base02 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:base03, s:red ] ]
+let s:p.normal.warning = [ [ s:base03, s:yellow ] ]
+
+let g:lightline#colorscheme#solarized#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim
new file mode 100644
index 0000000..f1c7e1d
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim
@@ -0,0 +1,44 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/srcery_drk.vim
+" Author: Christopher Vittal
+" License: MIT License
+" Last Change: 2018/05/19
+" =============================================================================
+let s:base03 = [ '#151513', 233 ]
+let s:base02 = [ '#30302c ', 236 ]
+let s:base01 = [ '#4e4e43', 239 ]
+let s:base00 = [ '#666656', 242 ]
+let s:base0 = [ '#808070', 244 ]
+let s:base1 = [ '#949484', 246 ]
+let s:base2 = [ '#a8a897', 248 ]
+let s:base3 = [ '#e8e8d3', 253 ]
+let s:yellow = [ '#fbb829', 3 ]
+let s:orange = [ '#d75f00', 166 ]
+let s:red = [ '#ff3128', 1 ]
+let s:magenta = [ '#e02c6d', 5 ]
+let s:bright_magenta = [ '#e35682', 13 ]
+let s:blue = [ '#5573a3', 4 ]
+let s:bright_blue = [ '#8eb2f7', 12 ]
+let s:cyan = [ '#0aaeb3', 6 ]
+let s:green = [ '#519f50', 2 ]
+let s:bright_green = [ '#98bc37', 10 ]
+let s:white = [ '#fce8c3', 15 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:bright_blue, 'bold' ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
+let s:p.insert.left = [ [ s:base02, s:bright_green, 'bold' ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base3, s:red, 'bold' ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base3, s:bright_magenta, 'bold' ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
+let s:p.tabline.left = [ [ s:base3, s:base00, 'bold'] ]
+let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
+let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:base02 ] ]
+let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
+
+let g:lightline#colorscheme#srcery_drk#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/wombat.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/wombat.vim
new file mode 100644
index 0000000..9619247
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/wombat.vim
@@ -0,0 +1,40 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/wombat.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2015/11/30 08:37:43.
+" =============================================================================
+let s:base03 = [ '#242424', 235 ]
+let s:base023 = [ '#353535 ', 236 ]
+let s:base02 = [ '#444444 ', 238 ]
+let s:base01 = [ '#585858', 240 ]
+let s:base00 = [ '#666666', 242 ]
+let s:base0 = [ '#808080', 244 ]
+let s:base1 = [ '#969696', 247 ]
+let s:base2 = [ '#a8a8a8', 248 ]
+let s:base3 = [ '#d0d0d0', 252 ]
+let s:yellow = [ '#cae682', 180 ]
+let s:orange = [ '#e5786d', 173 ]
+let s:red = [ '#e5786d', 203 ]
+let s:magenta = [ '#f2c68a', 216 ]
+let s:blue = [ '#8ac6f2', 117 ]
+let s:cyan = s:blue
+let s:green = [ '#95e454', 119 ]
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
+let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
+let s:p.inactive.right = [ [ s:base023, s:base01 ], [ s:base00, s:base02 ] ]
+let s:p.inactive.left = [ [ s:base1, s:base02 ], [ s:base00, s:base023 ] ]
+let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
+let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ]
+let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
+let s:p.normal.middle = [ [ s:base2, s:base02 ] ]
+let s:p.inactive.middle = [ [ s:base1, s:base023 ] ]
+let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
+let s:p.tabline.tabsel = [ [ s:base3, s:base03 ] ]
+let s:p.tabline.middle = [ [ s:base2, s:base02 ] ]
+let s:p.tabline.right = [ [ s:base2, s:base00 ] ]
+let s:p.normal.error = [ [ s:base03, s:red ] ]
+let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
+
+let g:lightline#colorscheme#wombat#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/colortable.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/colortable.vim
new file mode 100644
index 0000000..82617b2
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/colortable.vim
@@ -0,0 +1,42 @@
+" =============================================================================
+" Filename: autoload/lightline/colortable.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2015/03/29 06:21:39.
+" =============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! s:load() abort
+ let rgbfile = $VIMRUNTIME . '/rgb.txt'
+ let table = {}
+ if filereadable(rgbfile)
+ for _ in map(filter(readfile(rgbfile), 'v:val !~# "^!"'), 'matchlist(v:val, "^\\s*\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(.*\\)")[1:4]')
+ let table[tolower(_[3])] = _[0:2]
+ endfor
+ endif
+ return table
+endfunction
+
+let s:table = s:load()
+
+function! lightline#colortable#name_to_rgb(name) abort
+ let name = tolower(a:name)
+ return has_key(s:table, name) ? s:table[name] : []
+endfunction
+
+function! lightline#colortable#gui2cui(rgb, fallback) abort
+ let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
+ if len(rgb) == 0
+ let rgb = lightline#colortable#name_to_rgb(a:rgb)
+ if len(rgb) == 0
+ return a:fallback % 128
+ endif
+ endif
+ let rgb = [rgb[0] > 127 ? 4 : 0, rgb[1] > 127 ? 2 : 0, rgb[2] > 127 ? 1 : 0]
+ return rgb[0] + rgb[1] + rgb[2]
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/vim/.vim/plugged/lightline.vim/autoload/lightline/tab.vim b/vim/.vim/plugged/lightline.vim/autoload/lightline/tab.vim
new file mode 100644
index 0000000..f2accc1
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/autoload/lightline/tab.vim
@@ -0,0 +1,33 @@
+" =============================================================================
+" Filename: autoload/lightline/tab.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2016/05/07 22:31:02.
+" =============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! lightline#tab#filename(n) abort
+ let buflist = tabpagebuflist(a:n)
+ let winnr = tabpagewinnr(a:n)
+ let _ = expand('#'.buflist[winnr - 1].':t')
+ return _ !=# '' ? _ : '[No Name]'
+endfunction
+
+function! lightline#tab#modified(n) abort
+ let winnr = tabpagewinnr(a:n)
+ return gettabwinvar(a:n, winnr, '&modified') ? '+' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : '-'
+endfunction
+
+function! lightline#tab#readonly(n) abort
+ let winnr = tabpagewinnr(a:n)
+ return gettabwinvar(a:n, winnr, '&readonly') ? 'RO' : ''
+endfunction
+
+function! lightline#tab#tabnum(n) abort
+ return a:n
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/vim/.vim/plugged/lightline.vim/doc/lightline.txt b/vim/.vim/plugged/lightline.vim/doc/lightline.txt
new file mode 100644
index 0000000..6f3f176
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/doc/lightline.txt
@@ -0,0 +1,1332 @@
+*lightline.txt* A light and configurable statusline/tabline for Vim
+
+Version: 0.1
+Author: itchyny (https://github.com/itchyny)
+License: MIT License
+Repository: https://github.com/itchyny/lightline.vim
+Last Change: 2018/04/28 00:08:18.
+
+CONTENTS *lightline-contents*
+
+Introduction |lightline-introduction|
+Spirit |lightline-spirit|
+Option |lightline-option|
+Font |lightline-font|
+Function |lightline-function|
+Component Expansion |lightline-component-expansion|
+Colorscheme |lightline-colorscheme|
+Examples |lightline-examples|
+Nice Examples |lightline-nice-examples|
+Powerful Example |lightline-powerful-example|
+Troubleshooting |lightline-troubleshooting|
+
+==============================================================================
+INTRODUCTION *lightline-introduction*
+
+The *lightline* plugin is a light and configurable statusline/tabline for Vim.
+
+------------------------------------------------------------------------------
+SPIRIT *lightline-spirit*
+
+ Minimalism
+ The core script is very small to achieve enough functions as a
+ statusline plugin.
+
+ Configurability
+ You can create your own component and easily add to the statusline
+ and the tabline.
+
+ Orthogonality
+ The plugin does not rely on the implementation of other plugins.
+ Such plugin crossing settings should be configured by users.
+
+ You find this plugin does not integrate with other plugins by default.
+ This plugin does not provide branch information, which is a basic
+ component in existing statusline plugins. It is a design of
+ lightline.vim that such plugin crossing configuration should be
+ written by users. Once a plugin starts to integrate with some famous
+ plugins, it should be kept updated to follow the changes of the
+ plugins and should accept integration requests with new plugins.
+ Instead, lightline.vim is designed very carefully so that users can
+ easily integrate with other plugins. Good APIs keep a plugin clean.
+
+------------------------------------------------------------------------------
+OPTIONS *lightline-option*
+
+ g:lightline *g:lightline*
+ All the configurations are stored in this global variable.
+
+ g:lightline.active *g:lightline.active*
+ g:lightline.inactive *g:lightline.inactive*
+ g:lightline.tabline *g:lightline.tabline*
+ Dictionaries to store the statusline/tabline components.
+ Note that right groups of components are stored from right to
+ left.
+ The default values are:
+>
+ let g:lightline.active = {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'readonly', 'filename', 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ] }
+ let g:lightline.inactive = {
+ \ 'left': [ [ 'filename' ] ],
+ \ 'right': [ [ 'lineinfo' ],
+ \ [ 'percent' ] ] }
+ let g:lightline.tabline = {
+ \ 'left': [ [ 'tabs' ] ],
+ \ 'right': [ [ 'close' ] ] }
+<
+ g:lightline.tab *g:lightline.tab*
+ A dictionary to store the tab components in each tabs.
+ The default values are:
+>
+ let g:lightline.tab = {
+ \ 'active': [ 'tabnum', 'filename', 'modified' ],
+ \ 'inactive': [ 'tabnum', 'filename', 'modified' ] }
+<
+ g:lightline.component *g:lightline.component*
+ A dictionary for statusline/tabline components.
+ The default value is:
+>
+ let g:lightline.component = {
+ \ 'mode': '%{lightline#mode()}',
+ \ 'absolutepath': '%F',
+ \ 'relativepath': '%f',
+ \ 'filename': '%t',
+ \ 'modified': '%M',
+ \ 'bufnum': '%n',
+ \ 'paste': '%{&paste?"PASTE":""}',
+ \ 'readonly': '%R',
+ \ 'charvalue': '%b',
+ \ 'charvaluehex': '%B',
+ \ 'fileencoding': '%{&fenc!=#""?&fenc:&enc}',
+ \ 'fileformat': '%{&ff}',
+ \ 'filetype': '%{&ft!=#""?&ft:"no ft"}',
+ \ 'percent': '%3p%%',
+ \ 'percentwin': '%P',
+ \ 'spell': '%{&spell?&spelllang:""}',
+ \ 'lineinfo': '%3l:%-2v',
+ \ 'line': '%l',
+ \ 'column': '%c',
+ \ 'close': '%999X X ',
+ \ 'winnr': '%{winnr()}' }
+<
+ g:lightline.component_visible_condition
+ *g:lightline.component_visible_condition*
+ A dictionary to store the visible condition of the components.
+ Note that this configuration is used to control the visibility
+ of the subseparators, not to control the visibility of the
+ components themselves. Each expression should correspond to
+ the condition on which each component is not empty.
+ The default value is:
+>
+ let g:lightline.component_visible_condition = {
+ \ 'modified': '&modified||!&modifiable',
+ \ 'readonly': '&readonly',
+ \ 'paste': '&paste',
+ \ 'spell': '&spell' }
+<
+ g:lightline.component_function *g:lightline.component_function*
+ A dictionary to store the function components.
+ This is useful to write a complex component configuration and
+ to integrate with other plugins. If a component set in both
+ component and component_function, the configuration of
+ component_function has priority.
+
+ The default value is:
+>
+ let g:lightline.component_function = {}
+<
+ For example, if you want to display the name of the git branch,
+ install |vim-fugitive| plugin and then configure as:
+>
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'gitbranch': 'fugitive#head'
+ \ },
+ \ }
+<
+ g:lightline.component_function_visible_condition
+ *g:lightline.component_function_visible_condition*
+ A dictionary to store the visible conditions of the function
+ components. Each expression should correspond to the condition
+ each component is not empty. This configuration is used to
+ control the visibility of the sub-separators. You can use this
+ configuration to reduce the number of function calls for
+ performance improvement by setting the value 1 (to tell lightline
+ that the component is always visible).
+ The default value is:
+>
+ let g:lightline.component_function_visible_condition = {}
+<
+ g:lightline.component_expand *g:lightline.component_expand*
+ A dictionary to store expanding components. You can create
+ warning and critical components. The values should be the name
+ of functions should return either one of:
+ + a string
+ + an array of three elements:
+ [[ left ], [ middle ], [ right ]]
+ The component in this dictionary has priority over
+ |g:lightline.component| and |g:lightline.component_function|.
+ Note that the return string is appended to the statusline
+ string without any conversion. So you should replace all the
+ % signs with %%. Otherwise, lightline will be disabled in case
+ the text has a % sign.
+ (example: return substitute(text, '%', '%%', 'g')).
+ See |lightline-component-expansion| for more detail.
+>
+ let g:lightline.component_expand = {
+ \ 'tabs': 'lightline#tabs' }
+<
+ g:lightline.component_type *g:lightline.component_type*
+ A dictionary to specify the types for components in
+ |g:lightline.component_expand|. The types are used to specify
+ the color. Specifically, the type raw is used to specify a
+ component which should not be wrapped by item group: %(...%).
+ If you want to specify the type of a raw component, please use
+ |g:lightline.component_raw|.
+ The default value is: >
+
+ let g:lightline.component_type = {
+ \ 'tabs': 'tabsel',
+ \ 'close': 'raw' }
+<
+ g:lightline.component_raw *g:lightline.component_raw*
+ A dictionary to specify the raw type components. When you
+ register a component to this dictionary (like >
+ let g:lightline.component_raw = { 'example': 1 }
+< ), the example component is not wrapped by item group: %(...%).
+ The default value is: >
+
+ let g:lightline.component_raw = {}
+<
+ g:lightline.tab_component *g:lightline.tab_component*
+ A dictionary for components in one tab.
+ The default value is: >
+
+ let g:lightline.tab_component = {}
+<
+ g:lightline.tab_component_function *g:lightline.tab_component_function*
+ Another dictionary for components in one tab.
+ A function specified as a tab component takes one argument:
+ the tab [count].
+ The default value is:
+>
+ let g:lightline.tab_component_function = {
+ \ 'filename': 'lightline#tab#filename',
+ \ 'modified': 'lightline#tab#modified',
+ \ 'readonly': 'lightline#tab#readonly',
+ \ 'tabnum': 'lightline#tab#tabnum' }
+<
+ g:lightline.colorscheme *g:lightline.colorscheme*
+ The colorscheme for lightline.vim.
+ Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
+ Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties,
+ PaperColor, seoul256, landscape, one, darcula, molokai, materia,
+ material, OldHope, nord, 16color and deus are available.
+ The default value is:
+>
+ let g:lightline.colorscheme = 'default'
+<
+ Note that the default colorscheme is exactly the same as the
+ powerline theme.
+
+ g:lightline.mode_map *g:lightline.mode_map*
+ A dictionary of names for the modes. The keys are the return
+ values of |mode()|.
+ The default value is:
+>
+ let g:lightline.mode_map = {
+ \ 'n' : 'NORMAL',
+ \ 'i' : 'INSERT',
+ \ 'R' : 'REPLACE',
+ \ 'v' : 'VISUAL',
+ \ 'V' : 'V-LINE',
+ \ "\<C-v>": 'V-BLOCK',
+ \ 'c' : 'COMMAND',
+ \ 's' : 'SELECT',
+ \ 'S' : 'S-LINE',
+ \ "\<C-s>": 'S-BLOCK',
+ \ 't': 'TERMINAL',
+ \ }
+<
+ When you search a word, you get into the command mode. But if
+ you want to keep the mode indicator as 'NORMAL', add >
+ let g:lightline = { 'mode_map': { 'c': 'NORMAL' } }
+< to your .vimrc.
+
+ g:lightline.separator *g:lightline.separator*
+ g:lightline.subseparator *g:lightline.subseparator*
+ Dictionaries to store separators.
+ The default value is
+>
+ let g:lightline.separator = { 'left': '', 'right': '' }
+ let g:lightline.subseparator = { 'left': '|', 'right': '|' }
+<
+ g:lightline.tabline_separator *g:lightline.tabline_separator*
+ g:lightline.tabline_subseparator *g:lightline.tabline_subseparator*
+ Dictionaries to store separators for the tabline.
+ The default value is
+>
+ let g:lightline.tabline_separator = g:lightline.separator
+ let g:lightline.tabline_subseparator = g:lightline.subseparator
+<
+ g:lightline.enable *g:lightline.enable*
+ A dictionary to specify which feature is turned on.
+ The default value is
+>
+ let g:lightline.enable = {
+ \ 'statusline': 1,
+ \ 'tabline': 1
+ \ }
+<
+==============================================================================
+FONT *lightline-font*
+You can use the patched font you used for |vim-powerline| and |powerline|.
+
+The patched fonts for |powerline| are available at
+https://github.com/Lokaltog/powerline-fonts
+
+A tutorial to create a patched font for |vim-powerline| is available at
+https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
+
+If you have installed the patched font for |powerline|, following settings look
+nice.
+>
+ let g:lightline = {
+ \ 'component': {
+ \ 'lineinfo': ' %3l:%-2v',
+ \ },
+ \ 'component_function': {
+ \ 'readonly': 'LightlineReadonly',
+ \ 'fugitive': 'LightlineFugitive'
+ \ },
+ \ 'separator': { 'left': '', 'right': '' },
+ \ 'subseparator': { 'left': '', 'right': '' }
+ \ }
+ function! LightlineReadonly()
+ return &readonly ? '' : ''
+ endfunction
+ function! LightlineFugitive()
+ if exists('*fugitive#head')
+ let branch = fugitive#head()
+ return branch !=# '' ? ''.branch : ''
+ endif
+ return ''
+ endfunction
+<
+If you have installed the patched font for |vim-powerline|, following settings
+look nice.
+>
+ let g:lightline = {
+ \ 'component': {
+ \ 'lineinfo': '⭡ %3l:%-2v',
+ \ },
+ \ 'component_function': {
+ \ 'readonly': 'LightlineReadonly',
+ \ 'fugitive': 'LightlineFugitive'
+ \ },
+ \ 'separator': { 'left': '⮀', 'right': '⮂' },
+ \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
+ \ }
+ function! LightlineReadonly()
+ return &readonly ? '⭤' : ''
+ endfunction
+ function! LightlineFugitive()
+ if exists('*fugitive#head')
+ let branch = fugitive#head()
+ return branch !=# '' ? '⭠ '.branch : ''
+ endif
+ return ''
+ endfunction
+<
+If the statusline does not correctly show the special characters, use the
+unicode numbers. For |powerline| font users:
+>
+ \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
+ \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
+<
+For |vim-powerline| font users:
+>
+ \ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
+ \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" }
+<
+See |lightline-problem-9| for more detail.
+==============================================================================
+FUNCTION *lightline-function*
+Exposed functions for lightline.vim.
+
+ lightline#mode() *lightline#mode()*
+ Returns the mode of the Vim using |g:lightline.mode_map|.
+
+ lightline#init() *lightline#init()*
+ Initializes the internal state from |g:lightline|.
+
+ lightline#colorscheme() *lightline#colorscheme()*
+ Initializes the colorscheme and the highlight groups.
+
+ lightline#update() *lightline#update()*
+ Updates all the statuslines of existing windows.
+
+ lightline#update_once() *lightline#update_once()*
+ Updates the statuslines only once.
+
+ lightline#enable() *lightline#enable()*
+ Enables |lightline|.
+
+ lightline#disable() *lightline#disable()*
+ Disables |lightline|.
+
+ lightline#toggle() *lightline#toggle()*
+ Toggles |lightline|.
+
+ lightline#link([mode]) *lightline#link()*
+ Creates links of the highlight groups for the active window.
+ This function accepts an optional argument. It should be one
+ of the return value of |mode()|.
+
+ lightline#highlight() *lightline#highlight()*
+ Set the highlight groups.
+
+ lightline#statusline({inactive}) *lightline#statusline()*
+ Returns |statusline| strings. If the argument is 0, it returns
+ the statusline for active window, and the statusline for
+ inactive window otherwise.
+
+ lightline#tabline() *lightline#tabline()*
+ Returns the tabline string.
+
+ lightline#concatenate({list}, {num}) *lightline#concatenate()*
+ A string concatenation function. Concatenating all the strings
+ in {list} using the sub-separator of lightline. If {num} is 0,
+ then the left sub-separator is used. Otherwise, the right
+ sub-separator is used.
+
+ lightline#palette() *lightline#palette()*
+ Returns the palette data.
+
+==============================================================================
+COMPONENT EXPANSION *lightline-component-expansion*
+You can create components, which have specific colors. This section gives an
+example using |syntastic|.
+
+If you want to add the |syntastic| flag to the statusline, an easy example is:
+>
+ " Example A
+ let g:lightline = {
+ \ 'active': {
+ \ 'right': [ [ 'lineinfo', 'syntastic' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'syntastic': 'SyntasticStatuslineFlag',
+ \ }
+ \ }
+ let g:syntastic_mode_map = { 'mode': 'passive',
+ \ 'active_filetypes': ['c', 'cpp'] }
+<
+However, the color of the syntastic component is the same as the lineinfo
+component.
+
+In order to change the syntastic component more outstanding, you have to use
+|g:lightline.component_expand|. See the following example:
+>
+ " Example B
+ let g:lightline = {
+ \ 'active': {
+ \ 'right': [ [ 'syntastic', 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ]
+ \ },
+ \ 'component_expand': {
+ \ 'syntastic': 'SyntasticStatuslineFlag',
+ \ },
+ \ 'component_type': {
+ \ 'syntastic': 'error',
+ \ }
+ \ }
+ let g:syntastic_mode_map = { 'mode': 'passive' }
+ augroup AutoSyntastic
+ autocmd!
+ autocmd BufWritePost *.c,*.cpp call s:syntastic()
+ augroup END
+ function! s:syntastic()
+ SyntasticCheck
+ call lightline#update()
+ endfunction
+<
+In order to understand the above codes, you firstly should know how the
+colorschemes work in lightline.vim. Open the following file.
+ autoload/lightline/colorscheme/powerline.vim
+The colorscheme is created by one dictionary: s:p (abbreviation for palette).
+See the value of s:p.normal.right.
+>
+ let s:p.normal.right = [ ['gray5', 'gray10'],
+ \ ['gray9', 'gray4'],
+ \ ['gray8', 'gray2'] ]
+<
+This array corresponds to the structure of g:lightline.active.right. Recall
+the example A.
+>
+ " Example A
+ let g:lightline.active.right = [ [ 'lineinfo', 'syntastic' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ]
+<
+The colors are ([fgcolor, bgcolor):
+>
+ (0) [ 'lineinfo', 'syntastic' ] --- s:p.normal.right[0] = ['gray5', 'gray10']
+ (1) [ 'percent' ] --- s:p.normal.right[1] = ['gray9', 'gray4']
+ (2) [ 'fileformat', 'fileencoding', 'filetype' ] --- s:p.normal.right[2] = ['gray8', 'gray2']
+<
+Recall the example B.
+>
+ " Example B
+ let g:lightline.active.right = [ [ 'syntastic', 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ]
+<
+If a component is specified in |g:lightline.component_expand|, lightline.vim
+expands the components before setting to statusline/tabline. In this example,
+the syntastic component is expanded using the |SyntasticStatuslineFlag| function.
+This function returns a {string}. Let us call it `syntastic_flag`.
+>
+ let syntastic_flag = SyntasticStatuslineFlag()
+<
+The syntastic component is now expanded, so it go up to one component group.
+The type of the syntastic component is error, and the palette has error
+colors, the result is:
+>
+ " Expanded result of Example B
+ (error) [ syntastic_flag ] --- s:p.normal.error[0] = ['gray9', 'brightestred']
+ (0) [ 'lineinfo' ] --- s:p.normal.right[0] = ['gray5', 'gray10']
+ (1) [ 'percent' ] --- s:p.normal.right[1] = ['gray9', 'gray4']
+ (2) [ 'fileformat', 'fileencoding', 'filetype' ] --- s:p.normal.right[2] = ['gray8', 'gray2']
+<
+Thus the syntastic component has the red color.
+
+
+Another example for |g:lightline.component_expand| is the tabs component.
+Actually, the expand feature is created for the tabs component.
+>
+ let g:lightline.tabline.left = [ [ 'tabs' ] ]
+ let g:lightline.component_expand = {
+ \ 'tabs': 'lightline#tabs' }
+<
+Create three tabs and select the middle tab. Then execute
+>
+ echo lightline#tabs()
+ " [['%1T%{lightline#onetab(1,0)}'],
+ " ['%2T%{lightline#onetab(2,1)}'],
+ " ['%3T%{lightline#onetab(3,0)}%T']]
+<
+It returns an array of three elements. The expanded result is:
+>
+ " Expanded result of tabline
+ (0) ['%1T%{lightline#onetab(1,0)}'] --- s:p.tabline.left[0] = ['gray9', 'gray4']
+ (tabsel) ['%2T%{lightline#onetab(2,1)}'] --- s:p.tabline.tabsel[0] = ['gray9', 'gray1']
+ (0) ['%3T%{lightline#onetab(3,0)}%T'] --- s:p.tabline.left[0] = ['gray9', 'gray4']
+<
+If the tabline components are
+>
+ let g:lightline.tabline.left = [ [ 'A', 'B', 'tabs', 'C', 'D' ] ]
+<
+then the expanded result is:
+>
+ (0) ['A', 'B', '%1T%{lightline#onetab(1,0)}'] --- s:p.tabline.left[0]
+ (tabsel) ['%2T%{lightline#onetab(2,1)}'] --- s:p.tabline.tabsel[0]
+ (0) ['%3T%{lightline#onetab(3,0)}%T', 'C', 'D'] --- s:p.tabline.left[0]
+<
+In summary, when a function in |g:lightline.component_expand| returns an
+array of three elements, the first element and the last element remains as a
+part of existing component group. And the middle element goes up to new
+component group.
+------------------------------------------------------------------------------
+COLORSCHEME *lightline-colorscheme*
+You can configure the colorscheme of lightline. For example,
+>
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ }
+<
+The colorscheme files are found in the directory
+
+ lightline.vim/autoload/lightline/colorscheme/
+
+In each file, one global variable is defined. For example, in the landscape.vim
+file, you see
+>
+ let g:lightline#colorscheme#landscape#palette = s:p
+<
+In the file, the colors for the landscape colorscheme are defined. For example,
+>
+ let s:p.normal.left = [ ['#0000ff', '#ffffff', 21, 231, 'bold' ], [ '#ffffff', '#0000ff', 231, 21 ] ]
+<
+defines the colors for the components on the left hand side, in normal mode.
+>
+ let s:p.tabline.tabsel = [ [ '#dadada', '#121212', 253, 233 ] ]
+<
+defines the colors for the selected tab in tabline. In general, each palette
+follows the following style:
+>
+ let s:p.{mode}.{where} = [ [ {guifg}, {guibg}, {ctermfg}, {ctermbg} ], ... ]
+<
+
+
+Now, you can create your own colorscheme for lightline. Create a
+yourcolorscheme.vim at
+
+ {one of the paths in &rtp}/autoload/lightline/colorscheme/yourcolorscheme.vim
+
+The following code gives the minimal palette definition for lightline.
+>
+ let s:p = {'normal': {}}
+ let s:p.normal.left = [ [ ... ] ]
+ let s:p.normal.right = [ [ ... ] ]
+ let s:p.normal.middle = [ [ ... ] ]
+ let g:lightline#colorscheme#yourcolorscheme#palette = s:p
+<
+And if you add the colorscheme configuration to your .vimrc(_vimrc),
+>
+ let g:lightline = {
+ \ 'colorscheme': 'yourcolorscheme',
+ \ }
+<
+you find it possible to change the lightline colors as you wish.
+
+Moreover, if you want to change the colors based on the mode of vim, write
+something like this:
+>
+ let s:p.insert.left = [ [ ... ] ]
+ let s:p.insert.right = [ [ ... ] ]
+ let s:p.replace.left = [ [ ... ] ]
+ let s:p.replace.right = [ [ ... ] ]
+ ...
+ ...
+<
+For expanded components, you are recommended to define the following two
+colors.
+>
+ let s:p.normal.error = [ [ ... ] ]
+ let s:p.normal.warning = [ [ ... ] ]
+<
+For the complete list of components the color of which you should define in
+your colorscheme, see the colorscheme files in lightline.
+
+It is sometimes painful to write all the colors for both gui and cterm.
+Actually, lightline has some useful functions for writing colorschemes. For
+example, see
+ lightline.vim/autoload/lightline/colorscheme/Tomorrow_Night.vim
+this colorscheme is defined using only gui color numbers. And convert to the
+normal colorscheme form using:
+>
+ let g:lightline#colorscheme#Tomorrow_Night#palette = lightline#colorscheme#fill(s:p)
+<
+This function fills the cterm colors for a palette which has only gui colors, or
+vice versa. However, note that using the convenient function sources an
+additional Vim script file (autoload/lightline/colorscheme.vim), which causes
+a little slow down. If you want to avoid this situation, write all the colors
+as done in autoload/lightline/colorscheme/landscape.vim; firstly create the
+colorscheme using the fill function, and see the result, in a sense, the
+compiled version of your colorscheme.
+>
+ echo g:lightline#colorscheme#yourcolorscheme#palette
+<
+Then copy and paste the result to the colorscheme file.
+
+If you want to contribute a new colorscheme that is not currently available
+please follow the following rules:
+ *) All hex codes should be lowercase only
+ *) Use 2 space soft tabs
+ *) If your colorscheme has both light and dark variants, use a single file
+ *) Normal Mode should default to Cyan
+ *) Insert Mode should default to Green
+ *) Visual Mode should default to Yellow
+ *) Replace Mode should default to Red
+
+==============================================================================
+EXAMPLES *lightline-examples*
+You can configure the appearance of statusline.
+Write the following examples in you .vimrc(_vimrc).
+
+In order to change the colorscheme:
+>
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ }
+<
+
+In order to define your own component:
+>
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'myfilename': 'LightlineFilename',
+ \ 'myreadonly': 'LightlineReadonly',
+ \ 'mymodified': 'LightlineModified',
+ \ }
+ \ }
+ function! LightlineFilename()
+ return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
+ \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
+ \ &ft == 'unite' ? unite#get_status_string() :
+ \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
+ \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
+ endfunction
+ function! LightlineReadonly()
+ return &ft !~? 'help' && &readonly ? 'RO' : ''
+ endfunction
+ function! LightlineModified()
+ return &modifiable && &modified ? '+' : ''
+ endfunction
+<
+
+Separators settings:
+>
+ let g:lightline = {
+ \ 'separator': { 'left': '', 'right': '' },
+ \ 'subseparator': { 'left': '|', 'right': '|' }
+ \ }
+<
+
+For |powerline| font users:
+>
+ let g:lightline = {
+ \ 'separator': { 'left': '', 'right': '' },
+ \ 'subseparator': { 'left': '', 'right': '' }
+ \ }
+<
+
+For |vim-powerline| font users:
+>
+ let g:lightline = {
+ \ 'separator': { 'left': '⮀', 'right': '⮂' },
+ \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
+ \ }
+<
+
+------------------------------------------------------------------------------
+NICE EXAMPLES *lightline-nice-examples*
+
+A nice example for non-patched font users.
+>
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'fugitive': 'LightlineFugitive',
+ \ 'filename': 'LightlineFilename'
+ \ }
+ \ }
+ function! LightlineModified()
+ return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
+ endfunction
+ function! LightlineReadonly()
+ return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : ''
+ endfunction
+ function! LightlineFilename()
+ return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
+ \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
+ \ &ft == 'unite' ? unite#get_status_string() :
+ \ &ft == 'vimshell' ? vimshell#get_status_string() :
+ \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
+ \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
+ endfunction
+ function! LightlineFugitive()
+ if &ft !~? 'vimfiler' && exists('*fugitive#head')
+ return fugitive#head()
+ endif
+ return ''
+ endfunction
+<
+A nice example for |vim-powerline| font users:
+>
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'fugitive': 'LightlineFugitive',
+ \ 'filename': 'LightlineFilename'
+ \ },
+ \ 'separator': { 'left': '⮀', 'right': '⮂' },
+ \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
+ \ }
+ function! LightlineModified()
+ return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
+ endfunction
+ function! LightlineReadonly()
+ return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : ''
+ endfunction
+ function! LightlineFilename()
+ return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
+ \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
+ \ &ft == 'unite' ? unite#get_status_string() :
+ \ &ft == 'vimshell' ? vimshell#get_status_string() :
+ \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
+ \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
+ endfunction
+ function! LightlineFugitive()
+ if &ft !~? 'vimfiler' && exists('*fugitive#head')
+ let branch = fugitive#head()
+ return branch !=# '' ? '⭠ '.branch : ''
+ endif
+ return ''
+ endfunction
+<
+
+------------------------------------------------------------------------------
+POWERFUL EXAMPLE *lightline-powerful-example*
+
+For users who uses lots of plugins:
+>
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
+ \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'fugitive': 'LightlineFugitive',
+ \ 'filename': 'LightlineFilename',
+ \ 'fileformat': 'LightlineFileformat',
+ \ 'filetype': 'LightlineFiletype',
+ \ 'fileencoding': 'LightlineFileencoding',
+ \ 'mode': 'LightlineMode',
+ \ 'ctrlpmark': 'CtrlPMark',
+ \ },
+ \ 'component_expand': {
+ \ 'syntastic': 'SyntasticStatuslineFlag',
+ \ },
+ \ 'component_type': {
+ \ 'syntastic': 'error',
+ \ },
+ \ 'subseparator': { 'left': '|', 'right': '|' }
+ \ }
+
+ function! LightlineModified()
+ return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
+ endfunction
+
+ function! LightlineReadonly()
+ return &ft !~? 'help' && &readonly ? 'RO' : ''
+ endfunction
+
+ function! LightlineFilename()
+ let fname = expand('%:t')
+ return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item :
+ \ fname == '__Tagbar__' ? g:lightline.fname :
+ \ fname =~ '__Gundo\|NERD_tree' ? '' :
+ \ &ft == 'vimfiler' ? vimfiler#get_status_string() :
+ \ &ft == 'unite' ? unite#get_status_string() :
+ \ &ft == 'vimshell' ? vimshell#get_status_string() :
+ \ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
+ \ ('' != fname ? fname : '[No Name]') .
+ \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
+ endfunction
+
+ function! LightlineFugitive()
+ try
+ if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
+ let mark = '' " edit here for cool mark
+ let branch = fugitive#head()
+ return branch !=# '' ? mark.branch : ''
+ endif
+ catch
+ endtry
+ return ''
+ endfunction
+
+ function! LightlineFileformat()
+ return winwidth(0) > 70 ? &fileformat : ''
+ endfunction
+
+ function! LightlineFiletype()
+ return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
+ endfunction
+
+ function! LightlineFileencoding()
+ return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
+ endfunction
+
+ function! LightlineMode()
+ let fname = expand('%:t')
+ return fname == '__Tagbar__' ? 'Tagbar' :
+ \ fname == 'ControlP' ? 'CtrlP' :
+ \ fname == '__Gundo__' ? 'Gundo' :
+ \ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
+ \ fname =~ 'NERD_tree' ? 'NERDTree' :
+ \ &ft == 'unite' ? 'Unite' :
+ \ &ft == 'vimfiler' ? 'VimFiler' :
+ \ &ft == 'vimshell' ? 'VimShell' :
+ \ winwidth(0) > 60 ? lightline#mode() : ''
+ endfunction
+
+ function! CtrlPMark()
+ if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
+ call lightline#link('iR'[g:lightline.ctrlp_regex])
+ return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
+ \ , g:lightline.ctrlp_next], 0)
+ else
+ return ''
+ endif
+ endfunction
+
+ let g:ctrlp_status_func = {
+ \ 'main': 'CtrlPStatusFunc_1',
+ \ 'prog': 'CtrlPStatusFunc_2',
+ \ }
+
+ function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
+ let g:lightline.ctrlp_regex = a:regex
+ let g:lightline.ctrlp_prev = a:prev
+ let g:lightline.ctrlp_item = a:item
+ let g:lightline.ctrlp_next = a:next
+ return lightline#statusline(0)
+ endfunction
+
+ function! CtrlPStatusFunc_2(str)
+ return lightline#statusline(0)
+ endfunction
+
+ let g:tagbar_status_func = 'TagbarStatusFunc'
+
+ function! TagbarStatusFunc(current, sort, fname, ...) abort
+ let g:lightline.fname = a:fname
+ return lightline#statusline(0)
+ endfunction
+
+ augroup AutoSyntastic
+ autocmd!
+ autocmd BufWritePost *.c,*.cpp call s:syntastic()
+ augroup END
+ function! s:syntastic()
+ SyntasticCheck
+ call lightline#update()
+ endfunction
+
+ let g:unite_force_overwrite_statusline = 0
+ let g:vimfiler_force_overwrite_statusline = 0
+ let g:vimshell_force_overwrite_statusline = 0
+<
+------------------------------------------------------------------------------
+TROUBLESHOOTING *lightline-troubleshooting*
+
+Problem 1: |lightline-problem-1|
+ How to install this plugin.
+
+Problem 2: |lightline-problem-2|
+ How to update this plugin.
+
+Problem 3: |lightline-problem-3|
+ How to uninstall this plugin.
+
+Problem 4: |lightline-problem-4|
+ Cool statuslines appear only on |:vsp|.
+
+Problem 5: |lightline-problem-5|
+ The statusline does not seem to be correctly colored.
+
+Problem 6: |lightline-problem-6|
+ How to install a patched font.
+
+Problem 7: |lightline-problem-7|
+ Right triangles do not stick to the right components with the
+ patched font.
+
+Problem 8: |lightline-problem-8|
+ Triangles do not appear. Triangles look weird.
+
+Problem 9: |lightline-problem-9|
+ Where can I find the list of all the cool characters for patched fonts?
+
+Problem 10: |lightline-problem-10|
+ Cool statusline disappears in |unite|, |vimfiler| and |vimshell|
+ buffers.
+
+Problem 11: |lightline-problem-11|
+ Cool statusline disappears in |CtrlP|, |Tagbar| buffers.
+
+Problem 12: |lightline-problem-12|
+ How to make the plus sign red like |powerline|?
+
+Problem 13: |lightline-problem-13|
+ How to change the lightline colorscheme on the fly.
+
+Problem 14: |lightline-problem-14|
+ The 'E541' warning appears on the right hand side.
+ Many components disable the statusline of lightline.
+
+Problem 15: |lightline-problem-15|
+ Do not deal with the tabline.
+ Do not use the fancy separators in the tabline.
+
+Problem 16: |lightline-problem-16|
+ When changed the component to a function component to an expanding
+ component, the statusline of lightline is sometimes disabled.
+
+Problem 17: |lightline-problem-17|
+ Found a bug of this plugin.
+ Got many errors while using this plugin.
+ Vim hangs while using this plugin.
+ Want this plugin to be more configurable.
+ This troubleshooting is not helpful.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+Problem 1: *lightline-problem-1*
+ How to install this plugin.
+
+ If you are to install this plugin manually:
+
+ 1. Put all the files under $VIM.
+
+ If you are using |vim-pathogen|, install this plugin with the
+ following command.
+>
+ git clone https://github.com/itchyny/lightline.vim \
+ ~/.vim/bundle/lightline.vim
+<
+ If you are to install this plugin using |Vundle|:
+
+ 1. Add the following configuration to your
+ .vimrc(_vimrc).
+>
+ Plugin 'itchyny/lightline.vim'
+<
+ 2. Install with |:PluginInstall|.
+
+ If you are to install this plugin using |NeoBundle|:
+
+ 1. Add the following configuration to your
+ .vimrc(_vimrc).
+>
+ NeoBundle 'itchyny/lightline.vim'
+<
+ 2. Install with |:NeoBundleInstall|.
+
+ If you are to install this plugin using |vim-plug|:
+
+ 1. Add the following configuration to your
+ .vimrc(_vimrc).
+>
+ Plug 'itchyny/lightline.vim'
+<
+ 2. Install with |:PlugInstall|.
+
+Problem 2: *lightline-problem-2*
+ How to update this plugin.
+
+ If you have installed this plugin manually:
+
+ 1. Access https://github.com/itchyny/lightline.vim .
+ 2. Download the latest scripts.
+ 3. Place the scripts as written in Problem 1.
+
+ If you have installed this plugin using Vundle:
+
+ 1. Execute |:PluginUpdate|.
+
+ If you have installed this plugin using NeoBundle:
+
+ 1. Execute |:NeoBundleUpdate|.
+
+ If you have installed this plugin using vim-plug:
+
+ 1. Execute |:PlugUpdate|.
+
+Problem 3: *lightline-problem-3*
+ How to uninstall this plugin.
+
+ If you have installed this plugin manually:
+
+ 1. Remove all the lightline.*s under $VIM.
+
+ If you have installed this plugin using Vundle:
+
+ 1. Remove the :Plugin 'itchyny/lightline.vim'
+ configuration from your .vimrc(_vimrc).
+ 2. Update with |:PluginClean|.
+
+ If you have installed this plugin using NeoBundle:
+
+ 1. Remove the :NeoBundle 'itchyny/lightline.vim'
+ configuration from your .vimrc(_vimrc).
+ 2. Update with |:NeoBundleClean|.
+
+ If you have installed this plugin using vim-plug:
+
+ 1. Remove the :Plug 'itchyny/lightline.vim'
+ configuration from your .vimrc(_vimrc).
+ 2. Update with |:PlugClean|.
+
+Problem 4: *lightline-problem-4*
+ Cool statuslines appear only on |:vsp|.
+
+ Add the following setting to your .vimrc(_vimrc).
+>
+ set laststatus=2
+<
+Problem 5: *lightline-problem-5*
+ The statusline does not seem to be correctly colored.
+
+ Add
+>
+ export TERM=xterm-256color
+<
+ to your .*shrc and add
+>
+ if !has('gui_running')
+ set t_Co=256
+ endif
+<
+ to your .vimrc(_vimrc).
+
+Problem 6: *lightline-problem-6*
+ How to install a patched font.
+
+ There are two kinds of patched fonts:
+
+ + The patched fonts for |vim-powerline|
+ (https://github.com/Lokaltog/vim-powerline):
+ follow the guide https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
+ + The patched fonts for |powerline|
+ (https://github.com/Lokaltog/powerline):
+ download from https://github.com/Lokaltog/powerline-fonts
+
+Problem 7: *lightline-problem-7*
+ Right triangles do not stick to the right components with patched
+ font.
+
+ Remove the following setting from your .vimrc(_vimrc).
+>
+ set ambiwidth=double
+<
+ If you want to keep this setting, try the patched font for
+ |vim-powerline|.
+
+Problem 8: *lightline-problem-8*
+ Triangles do not appear. Triangles look weird.
+
+ If the triangles do not appear (but you get some spaces or
+ weird characters like <bf> or ¿), firstly try adding
+>
+ scriptencoding utf-8
+ set encoding=utf-8
+<
+ to the head of your .vimrc(_vimrc). Still you have weird
+ characters, use the unicode numbers. For |powerline| font
+ users:
+>
+ \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
+ \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
+<
+ For |vim-powerline| font users:
+>
+ \ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
+ \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" }
+<
+ The full list of unicode numbers for fancy characters is shown
+ in |lightline-problem-9|.
+
+ If the triangles are shown in appropriate characters but the
+ colors do not look correctly, see the following.
+ If you are using iTerm2, change the following settings.
+
+ + set Profiles>Colors>Minimum contrast to the Lowest.
+ + set Profiles>Window>Transparency to the Opaquest.
+
+ For other terminals, this weird-triangle problem will be
+ resolved by disabling transparency or contrast adjustment.
+
+Problem 9: *lightline-problem-9*
+ Where can I find the list of all the cool characters for patched fonts?
+
+ Default powerline vim-powerline
+ separator.left '' '' (\ue0b0) '⮀' (\u2b80)
+ separator.right '' '' (\ue0b2) '⮂' (\u2b82)
+ subseparator.left '|' '' (\ue0b1) '⮁' (\u2b81)
+ subseparator.right '|' '' (\ue0b3) '⮃' (\u2b83)
+ branch symbol -- '' (\ue0a0) '⭠' (\u2b60)
+ readonly symbol -- '' (\ue0a2) '⭤' (\u2b64)
+ linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b61)
+
+Problem 10: *lightline-problem-10*
+ Cool statusline disappears on |unite|, |vimfiler| and |vimshell|
+ buffers.
+
+ Add the following settings to your .vimrc(_vimrc).
+>
+ let g:unite_force_overwrite_statusline = 0
+ let g:vimfiler_force_overwrite_statusline = 0
+ let g:vimshell_force_overwrite_statusline = 0
+<
+Problem 11: *lightline-problem-11*
+ Cool statusline disappears in |CtrlP|, |Tagbar| buffers.
+
+ Add the following settings to your .vimrc(_vimrc).
+>
+ let g:ctrlp_status_func = {
+ \ 'main': 'CtrlPStatusFunc_1',
+ \ 'prog': 'CtrlPStatusFunc_2',
+ \ }
+ function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
+ return lightline#statusline(0)
+ endfunction
+ function! CtrlPStatusFunc_2(str)
+ return lightline#statusline(0)
+ endfunction
+
+ let g:tagbar_status_func = 'TagbarStatusFunc'
+ function! TagbarStatusFunc(current, sort, fname, ...) abort
+ return lightline#statusline(0)
+ endfunction
+<
+ See |lightline-powerful-example| for more cool settings for
+ these plugins.
+
+Problem 12: *lightline-problem-12*
+ How to make the plus sign red like |powerline|?
+
+ Use the following settings.
+>
+ let g:lightline = {
+ \ 'component': {
+ \ 'modified': '%#ModifiedColor#%{LightlineModified()}',
+ \ }
+ \ }
+ function! LightlineModified()
+ let map = { 'V': 'n', "\<C-v>": 'n', 's': 'n', 'v': 'n', "\<C-s>": 'n', 'c': 'n', 'R': 'n'}
+ let mode = get(map, mode()[0], mode()[0])
+ let bgcolor = {'n': [240, '#585858'], 'i': [31, '#0087af']}
+ let color = get(bgcolor, mode, bgcolor.n)
+ exe printf('hi ModifiedColor ctermfg=196 ctermbg=%d guifg=#ff0000 guibg=%s term=bold cterm=bold',
+ \ color[0], color[1])
+ return &modified ? '+' : &modifiable ? '' : '-'
+ endfunction
+<
+ It's surely complicated. There's no easy API to do a thing
+ like this. But it means that your request does not match
+ the spirit of lightline.
+
+Problem 13: *lightline-problem-13*
+ How to change the lightline colorscheme on the fly.
+
+ To update your lightline colorscheme in sync with your vim
+ colorscheme (only for select colorschemes which exist for
+ both), add the following settings to your .vimrc(_vimrc).
+>
+ augroup LightlineColorscheme
+ autocmd!
+ autocmd ColorScheme * call s:lightline_update()
+ augroup END
+ function! s:lightline_update()
+ if !exists('g:loaded_lightline')
+ return
+ endif
+ try
+ if g:colors_name =~# 'wombat\|solarized\|landscape\|jellybeans\|seoul256\|Tomorrow'
+ let g:lightline.colorscheme =
+ \ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '')
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#update()
+ endif
+ catch
+ endtry
+ endfunction
+<
+ If you have not settled on a single lightline colorscheme, you
+ can easily switch between lightline colorschemes by adding the
+ following LightlineColorscheme command to your .vimrc(_vimrc).
+>
+ function! s:set_lightline_colorscheme(name) abort
+ let g:lightline.colorscheme = a:name
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#update()
+ endfunction
+
+ function! s:lightline_colorschemes(...) abort
+ return join(map(
+ \ globpath(&rtp,"autoload/lightline/colorscheme/*.vim",1,1),
+ \ "fnamemodify(v:val,':t:r')"),
+ \ "\n")
+ endfunction
+
+ command! -nargs=1 -complete=custom,s:lightline_colorschemes LightlineColorscheme
+ \ call s:set_lightline_colorscheme(<q-args>)
+<
+Problem 14: *lightline-problem-14*
+ The 'E541' warning appears on the right hand side.
+ Many components disable the statusline of lightline.
+
+ The number of items in statusline/tabline is limited to 80
+ (see |E541|). You cannot register too much components.
+
+Problem 15: *lightline-problem-15*
+ Do not deal with the tabline.
+ Do not use the fancy separators in the tabline.
+
+ You can disable the tabline feature of lightline.vim using:
+>
+ let g:lightline = {
+ \ 'enable': { 'tabline': 0 },
+ \ }
+<
+ If you don't like the separators in the tabline, use:
+>
+ let g:lightline = {
+ \ 'tabline_separator': { 'left': "", 'right': "" },
+ \ 'tabline_subseparator': { 'left': "", 'right': "" },
+ \ }
+<
+Problem 16: *lightline-problem-16*
+ When changed the component to a function component to an expanding
+ component, the statusline of lightline is sometimes disabled.
+
+ When you changed from
+>
+ \ 'component_function': {
+ \ 'my': 'My',
+ \ }
+<
+ to
+>
+ \ 'component_expand': {
+ \ 'my': 'My',
+ \ }
+<
+ the statusline of lightline is disabled unexpectedly.
+ In such a case, the text returned by 'My' function may include
+ the '%' character. Replace all the '%' signs with '%%'.
+>
+ function My()
+ ...
+ return substitute(text, '%', '%%', 'g')
+ endfunction
+<
+Problem 17: *lightline-problem-17*
+ Found a bug of this plugin.
+ Got many errors while using this plugin.
+ Vim hangs while using this plugin.
+ Want this plugin to be more configurable.
+ This troubleshooting is not helpful.
+
+ Report/Request the issue/feature at
+ https://github.com/itchyny/lightline.vim/issues.
+
+==============================================================================
+vim:tw=78:sw=4:ts=8:ft=help:norl:noet:
diff --git a/vim/.vim/plugged/lightline.vim/doc/tags b/vim/.vim/plugged/lightline.vim/doc/tags
new file mode 100644
index 0000000..6e21f95
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/doc/tags
@@ -0,0 +1,66 @@
+g:lightline lightline.txt /*g:lightline*
+g:lightline.active lightline.txt /*g:lightline.active*
+g:lightline.colorscheme lightline.txt /*g:lightline.colorscheme*
+g:lightline.component lightline.txt /*g:lightline.component*
+g:lightline.component_expand lightline.txt /*g:lightline.component_expand*
+g:lightline.component_function lightline.txt /*g:lightline.component_function*
+g:lightline.component_function_visible_condition lightline.txt /*g:lightline.component_function_visible_condition*
+g:lightline.component_raw lightline.txt /*g:lightline.component_raw*
+g:lightline.component_type lightline.txt /*g:lightline.component_type*
+g:lightline.component_visible_condition lightline.txt /*g:lightline.component_visible_condition*
+g:lightline.enable lightline.txt /*g:lightline.enable*
+g:lightline.inactive lightline.txt /*g:lightline.inactive*
+g:lightline.mode_map lightline.txt /*g:lightline.mode_map*
+g:lightline.separator lightline.txt /*g:lightline.separator*
+g:lightline.subseparator lightline.txt /*g:lightline.subseparator*
+g:lightline.tab lightline.txt /*g:lightline.tab*
+g:lightline.tab_component lightline.txt /*g:lightline.tab_component*
+g:lightline.tab_component_function lightline.txt /*g:lightline.tab_component_function*
+g:lightline.tabline lightline.txt /*g:lightline.tabline*
+g:lightline.tabline_separator lightline.txt /*g:lightline.tabline_separator*
+g:lightline.tabline_subseparator lightline.txt /*g:lightline.tabline_subseparator*
+lightline lightline.txt /*lightline*
+lightline#colorscheme() lightline.txt /*lightline#colorscheme()*
+lightline#concatenate() lightline.txt /*lightline#concatenate()*
+lightline#disable() lightline.txt /*lightline#disable()*
+lightline#enable() lightline.txt /*lightline#enable()*
+lightline#highlight() lightline.txt /*lightline#highlight()*
+lightline#init() lightline.txt /*lightline#init()*
+lightline#link() lightline.txt /*lightline#link()*
+lightline#mode() lightline.txt /*lightline#mode()*
+lightline#palette() lightline.txt /*lightline#palette()*
+lightline#statusline() lightline.txt /*lightline#statusline()*
+lightline#tabline() lightline.txt /*lightline#tabline()*
+lightline#toggle() lightline.txt /*lightline#toggle()*
+lightline#update() lightline.txt /*lightline#update()*
+lightline#update_once() lightline.txt /*lightline#update_once()*
+lightline-colorscheme lightline.txt /*lightline-colorscheme*
+lightline-component-expansion lightline.txt /*lightline-component-expansion*
+lightline-contents lightline.txt /*lightline-contents*
+lightline-examples lightline.txt /*lightline-examples*
+lightline-font lightline.txt /*lightline-font*
+lightline-function lightline.txt /*lightline-function*
+lightline-introduction lightline.txt /*lightline-introduction*
+lightline-nice-examples lightline.txt /*lightline-nice-examples*
+lightline-option lightline.txt /*lightline-option*
+lightline-powerful-example lightline.txt /*lightline-powerful-example*
+lightline-problem-1 lightline.txt /*lightline-problem-1*
+lightline-problem-10 lightline.txt /*lightline-problem-10*
+lightline-problem-11 lightline.txt /*lightline-problem-11*
+lightline-problem-12 lightline.txt /*lightline-problem-12*
+lightline-problem-13 lightline.txt /*lightline-problem-13*
+lightline-problem-14 lightline.txt /*lightline-problem-14*
+lightline-problem-15 lightline.txt /*lightline-problem-15*
+lightline-problem-16 lightline.txt /*lightline-problem-16*
+lightline-problem-17 lightline.txt /*lightline-problem-17*
+lightline-problem-2 lightline.txt /*lightline-problem-2*
+lightline-problem-3 lightline.txt /*lightline-problem-3*
+lightline-problem-4 lightline.txt /*lightline-problem-4*
+lightline-problem-5 lightline.txt /*lightline-problem-5*
+lightline-problem-6 lightline.txt /*lightline-problem-6*
+lightline-problem-7 lightline.txt /*lightline-problem-7*
+lightline-problem-8 lightline.txt /*lightline-problem-8*
+lightline-problem-9 lightline.txt /*lightline-problem-9*
+lightline-spirit lightline.txt /*lightline-spirit*
+lightline-troubleshooting lightline.txt /*lightline-troubleshooting*
+lightline.txt lightline.txt /*lightline.txt*
diff --git a/vim/.vim/plugged/lightline.vim/plugin/lightline.vim b/vim/.vim/plugged/lightline.vim/plugin/lightline.vim
new file mode 100644
index 0000000..fc8f598
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/plugin/lightline.vim
@@ -0,0 +1,26 @@
+" =============================================================================
+" Filename: plugin/lightline.vim
+" Author: itchyny
+" License: MIT License
+" Last Change: 2018/06/22 08:49:00.
+" =============================================================================
+
+if exists('g:loaded_lightline') || v:version < 700
+ finish
+endif
+let g:loaded_lightline = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+augroup lightline
+ autocmd!
+ autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
+ autocmd SessionLoadPost * call lightline#highlight()
+ autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
+ \ | call lightline#update() | call lightline#highlight() | endif
+ autocmd CursorMoved,BufUnload * call lightline#update_once()
+augroup END
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/vim/.vim/plugged/lightline.vim/test/.themisrc b/vim/.vim/plugged/lightline.vim/test/.themisrc
new file mode 100644
index 0000000..c226c08
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/.themisrc
@@ -0,0 +1,20 @@
+let s:sids = {}
+function! s:sid(path) abort
+ if has_key(s:sids, a:path)
+ return s:sids[a:path]
+ endif
+ redir => scriptnames
+ silent! scriptnames
+ redir END
+ for line in split(scriptnames, '\n')
+ if line =~# a:path
+ let sid = matchstr(line, '\v^\s*\zs\d+\ze')
+ let s:sids[a:path] = sid
+ return sid
+ endif
+ endfor
+endfunction
+
+function! SID(name) abort
+ return function(printf("\<SNR>%d_%s", s:sid('autoload/lightline.vim'), a:name))
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/concatenate.vim b/vim/.vim/plugged/lightline.vim/test/concatenate.vim
new file mode 100644
index 0000000..6fd2723
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/concatenate.vim
@@ -0,0 +1,90 @@
+let s:suite = themis#suite('concatenate')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ let g:lightline = { 'subseparator': { 'left': '>', 'right': '<' } }
+ call lightline#init()
+endfunction
+
+function! s:suite.nil()
+ call s:assert.equals(lightline#concatenate([], 0), '')
+ call s:assert.equals(lightline#concatenate([], 1), '')
+endfunction
+
+function! s:suite.one()
+ call s:assert.equals(lightline#concatenate(['foo'], 0), 'foo')
+ call s:assert.equals(lightline#concatenate(['foo'], 1), 'foo')
+endfunction
+
+function! s:suite.two()
+ call s:assert.equals(lightline#concatenate(['foo', 'bar'], 0), 'foo > bar')
+ call s:assert.equals(lightline#concatenate(['foo', 'bar'], 1), 'foo < bar')
+endfunction
+
+function! s:suite.three()
+ call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 0), 'foo > bar > baz')
+ call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 1), 'foo < bar < baz')
+endfunction
+
+function! s:suite.one_empty()
+ call s:assert.equals(lightline#concatenate([''], 0), '')
+ call s:assert.equals(lightline#concatenate([''], 1), '')
+endfunction
+
+function! s:suite.two_empty_left()
+ call s:assert.equals(lightline#concatenate(['', 'bar'], 0), 'bar')
+ call s:assert.equals(lightline#concatenate(['', 'bar'], 1), 'bar')
+endfunction
+
+function! s:suite.two_empty_right()
+ call s:assert.equals(lightline#concatenate(['foo', ''], 0), 'foo')
+ call s:assert.equals(lightline#concatenate(['foo', ''], 1), 'foo')
+endfunction
+
+function! s:suite.two_empty_both()
+ call s:assert.equals(lightline#concatenate(['', ''], 0), '')
+ call s:assert.equals(lightline#concatenate(['', ''], 1), '')
+endfunction
+
+function! s:suite.three_empty_left()
+ call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 0), 'bar > baz')
+ call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 1), 'bar < baz')
+endfunction
+
+function! s:suite.three_empty_middle()
+ call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 0), 'foo > baz')
+ call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 1), 'foo < baz')
+endfunction
+
+function! s:suite.three_empty_right()
+ call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 0), 'foo > bar')
+ call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 1), 'foo < bar')
+endfunction
+
+function! s:suite.three_empty_middle_right()
+ call s:assert.equals(lightline#concatenate(['foo', '', ''], 0), 'foo')
+ call s:assert.equals(lightline#concatenate(['foo', '', ''], 1), 'foo')
+endfunction
+
+function! s:suite.three_empty_left_right()
+ call s:assert.equals(lightline#concatenate(['', 'bar', ''], 0), 'bar')
+ call s:assert.equals(lightline#concatenate(['', 'bar', ''], 1), 'bar')
+endfunction
+
+function! s:suite.three_empty_left_middle()
+ call s:assert.equals(lightline#concatenate(['', '', 'baz'], 0), 'baz')
+ call s:assert.equals(lightline#concatenate(['', '', 'baz'], 1), 'baz')
+endfunction
+
+function! s:suite.three_empty_all()
+ call s:assert.equals(lightline#concatenate(['', '', ''], 0), '')
+ call s:assert.equals(lightline#concatenate(['', '', ''], 1), '')
+endfunction
+
+function! s:suite.keep_original()
+ let xs = ['', 'bar', '']
+ call s:assert.equals(lightline#concatenate(xs, 0), 'bar')
+ call s:assert.equals(xs, ['', 'bar', ''])
+ call s:assert.equals(lightline#concatenate(xs, 1), 'bar')
+ call s:assert.equals(xs, ['', 'bar', ''])
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/error.vim b/vim/.vim/plugged/lightline.vim/test/error.vim
new file mode 100644
index 0000000..8fdabf4
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/error.vim
@@ -0,0 +1,15 @@
+let s:suite = themis#suite('error')
+let s:assert = themis#helper('assert')
+
+function! s:message() abort
+ redir => messages
+ silent! messages
+ redir END
+ return split(messages, '\n')[-1]
+endfunction
+
+function! s:suite.error()
+ let message = 'An error occurred.'
+ call lightline#error(message)
+ call s:assert.equals(s:message(), 'lightline.vim: ' . message)
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/expand.vim b/vim/.vim/plugged/lightline.vim/test/expand.vim
new file mode 100644
index 0000000..e1ac310
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/expand.vim
@@ -0,0 +1,667 @@
+let s:suite = themis#suite('expand')
+let s:assert = themis#helper('assert')
+
+function! s:expand(...)
+ return call(SID('expand'), a:000)
+endfunction
+
+function! s:suite.expand()
+ let g:lightline = {}
+ call lightline#init()
+ call s:assert.equals(s:expand([]),
+ \ [[], [], ['0']])
+endfunction
+
+function! s:suite.default()
+ let g:lightline = {}
+ call lightline#init()
+ call s:assert.equals(s:expand([['mode', 'paste'], ['readonly', 'filename', 'modified']]),
+ \ [[['mode', 'paste'], ['readonly', 'filename', 'modified']], [[0, 0], [0, 0, 0]], ['0', '1', '2']])
+endfunction
+
+function! s:suite.custom()
+ function! Custom()
+ return [ ['left'], ['middle'], ['right'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type()
+ function! Custom()
+ return [ ['left'], ['middle'], ['right'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.raw_type()
+ function! Custom()
+ return [ ['left'], ['middle'], ['right'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'raw' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [2, 2, 2], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 2, 2, 2, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.component_raw()
+ function! Custom()
+ return [ ['left'], ['middle'], ['right'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' }, 'component_raw': { 'custom': 1 } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [2], [2], [2], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 2], [2], [2, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.multiple()
+ function! Custom()
+ return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.multiple_type()
+ function! Custom()
+ return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1], [1, 1, 1], [1, 1, 1], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1], [1, 1, 1], [1, 1, 1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.flatten()
+ function! Custom()
+ return [ 'left', 'middle', 'right' ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_flatten()
+ function! Custom()
+ return [ 'left', 'middle', 'right' ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_string()
+ function! Custom()
+ return 'custom'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_string()
+ function! Custom()
+ return 'custom'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_void_string()
+ function! Custom()
+ return ''
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_void_string()
+ function! Custom()
+ return ''
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_number()
+ function! Custom()
+ return 24
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', '24', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_number()
+ function! Custom()
+ return 24
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_void_string_array()
+ function! Custom()
+ return ['', '', '']
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_void_string_array()
+ function! Custom()
+ return ['', '', '']
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_void_string_array_2()
+ function! Custom()
+ return [[''], [''], ['']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_void_string_array_2()
+ function! Custom()
+ return [[''], [''], ['']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_void_string_array_3()
+ function! Custom()
+ return ['', 'custom', '']
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_void_string_array_3()
+ function! Custom()
+ return ['', 'custom', '']
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_void_string_array_4()
+ function! Custom()
+ return [[''], ['custom'], ['']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_void_string_array_4()
+ function! Custom()
+ return [[''], ['custom'], ['']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_left_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
+ \ [[['filename', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_left_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
+ \ [[['filename'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_right_nil()
+ function! Custom()
+ return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
+ \ [[['filename'], ['x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
+ \ [[['filename', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_right_nil()
+ function! Custom()
+ return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
+ \ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
+ \ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_one()
+ function! Custom()
+ return [ 'left' ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_one()
+ function! Custom()
+ return [ 'left' ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_two()
+ function! Custom()
+ return [ 'left', 'middle']
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', 'middle'], ['modified']], [[0, 0], [1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'middle', 'modified']], [[0, 0, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_two()
+ function! Custom()
+ return [ 'left', 'middle' ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['middle'], ['modified']], [[0, 0], [1], [1], [0]], ['0', '1', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['middle'], ['modified']], [[0, 0, 1], [1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_mixed()
+ function! Custom()
+ return ['left', { 'custom': 24 }, [function('tr')]]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', '{''custom'': 24}', 'function(''tr'')'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', '{''custom'': 24}', 'function(''tr'')', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_mixed()
+ function! Custom()
+ return ['left', { 'custom': 24 }, [function('tr')]]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['function(''tr'')'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['function(''tr'')', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_mixed_2()
+ function! Custom()
+ return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', '{''custom'': 24}', '[function(''tr'')]'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', '{''custom'': 24}', '[function(''tr'')]', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_mixed_2()
+ function! Custom()
+ return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['[function(''tr'')]'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['[function(''tr'')]', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_error()
+ function! Custom()
+ throw 'error'
+ return 'custom'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.custom_type_error()
+ function! Custom()
+ throw 'error'
+ return 'custom'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.notfound()
+ let g:lightline = { 'component_expand': { 'custom': 'NotFound' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+endfunction
+
+function! s:suite.custom_type_notfound()
+ let g:lightline = { 'component_expand': { 'custom': 'NotFound' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
+endfunction
+
+function! s:suite.duplicated_string()
+ function! Custom()
+ return 'custom'
+ endfunction
+ function! Modified()
+ return ''
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom', 'modified': 'Modified' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['custom', 'custom'], []], [[0], [1, 1], []], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename', 'custom', 'custom']], [[0, 1, 1]], ['0', '1']])
+ delfunction Custom
+ delfunction Modified
+endfunction
+
+function! s:suite.duplicated_left_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename', 'y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_type_left_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '1', 'custom', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1, 0]], ['0', 'custom', '0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_right_nil()
+ function! Custom()
+ return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename', 'x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_type_right_nil()
+ function! Custom()
+ return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '1', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_both_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename', 'y0', 'y1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_type_both_nil()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '2', '3']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_both_nil_left_most()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
+ \ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['0', '1', '2']])
+ call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
+ \ [[['y0', 'y1', 'y0', 'y1', 'modified']], [[1, 1, 1, 1, 0]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_type_both_nil_left_most()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
+ \ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '1', '2']])
+ call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
+ \ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_both_nil_right_most()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', '1', '2']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
+ \ [[['filename', 'y0', 'y1', 'y0', 'y1']], [[0, 1, 1, 1, 1]], ['0', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.duplicated_type_both_nil_right_most()
+ function! Custom()
+ return [ [], ['y0', 'y1'], [] ]
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '2']])
+ call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
+ \ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '1']])
+ delfunction Custom
+endfunction
+
+function! s:suite.dictionary_function()
+ let g:lightline = { 'component_expand': { 'custom': 'g:lightline.Custom' } }
+ function! g:lightline.Custom()
+ return [ ['left'], ['middle'], ['right'] ]
+ endfunction
+ call lightline#init()
+ call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
+ \ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
+ call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
+ \ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/highlight.vim b/vim/.vim/plugged/lightline.vim/test/highlight.vim
new file mode 100644
index 0000000..0e9e656
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/highlight.vim
@@ -0,0 +1,171 @@
+let s:suite = themis#suite('highlight')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ hi clear
+endfunction
+
+function! s:hi(name)
+ redir => hi
+ silent! exec 'hi' a:name
+ redir END
+ return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
+endfunction
+
+function! s:pattern(xs, ...) abort
+ let ys = a:0 ? a:xs[1:] : a:xs
+ let zs = get(a:000, 0, a:xs)
+ return 'ctermfg=' . ys[2] . ' ctermbg=' . zs[3] . '.*guifg=' . ys[0] . ' guibg=' . zs[1]
+endfunction
+
+function! s:suite.highlight()
+ let g:lightline = {}
+ call lightline#init()
+ call lightline#colorscheme()
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_normal_1'), s:pattern(palette.normal.left[1]))
+ call s:assert.match(s:hi('LightlineLeft_normal_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
+ call s:assert.match(s:hi('LightlineRight_normal_1'), s:pattern(palette.normal.right[1]))
+ call s:assert.match(s:hi('LightlineRight_normal_2'), s:pattern(palette.normal.right[2]))
+ call s:assert.match(s:hi('LightlineRight_normal_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
+endfunction
+
+function! s:suite.insert()
+ let g:lightline = {}
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#highlight('insert')
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_insert_0'), s:pattern(palette.insert.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_insert_1'), s:pattern(palette.insert.left[1]))
+ call s:assert.match(s:hi('LightlineLeft_insert_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_insert_0'), s:pattern(palette.insert.right[0]))
+ call s:assert.match(s:hi('LightlineRight_insert_1'), s:pattern(palette.insert.right[1]))
+ call s:assert.match(s:hi('LightlineRight_insert_2'), s:pattern(palette.insert.right[2]))
+ call s:assert.match(s:hi('LightlineRight_insert_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_insert'), s:pattern(palette.insert.middle[0]))
+endfunction
+
+
+function! s:suite.visual()
+ let g:lightline = {}
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#highlight('visual')
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_visual_0'), s:pattern(palette.visual.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_visual_1'), s:pattern(palette.visual.left[1]))
+ call s:assert.match(s:hi('LightlineLeft_visual_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_visual_0'), s:pattern(palette.normal.right[0]))
+ call s:assert.match(s:hi('LightlineRight_visual_1'), s:pattern(palette.normal.right[1]))
+ call s:assert.match(s:hi('LightlineRight_visual_2'), s:pattern(palette.normal.right[2]))
+ call s:assert.match(s:hi('LightlineRight_visual_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
+endfunction
+
+function! s:suite.replace()
+ let g:lightline = {}
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#highlight('replace')
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_replace_0'), s:pattern(palette.replace.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_replace_1'), s:pattern(palette.replace.left[1]))
+ call s:assert.match(s:hi('LightlineLeft_replace_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_replace_0'), s:pattern(palette.replace.right[0]))
+ call s:assert.match(s:hi('LightlineRight_replace_1'), s:pattern(palette.replace.right[1]))
+ call s:assert.match(s:hi('LightlineRight_replace_2'), s:pattern(palette.replace.right[2]))
+ call s:assert.match(s:hi('LightlineRight_replace_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_replace'), s:pattern(palette.replace.middle[0]))
+endfunction
+
+function! s:suite.left_right()
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
+ \ },
+ \ }
+ call lightline#init()
+ call lightline#colorscheme()
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_normal_1'), s:pattern(palette.normal.left[1]))
+ call s:assert.match(s:hi('LightlineLeft_normal_2'), s:pattern(palette.normal.middle[0]))
+ call s:assert.match(s:hi('LightlineLeft_normal_3'), s:pattern(palette.normal.middle[0]))
+ call s:assert.match(s:hi('LightlineLeft_normal_4'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
+ call s:assert.match(s:hi('LightlineRight_normal_1'), s:pattern(palette.normal.right[1]))
+ call s:assert.match(s:hi('LightlineRight_normal_2'), s:pattern(palette.normal.right[2]))
+ call s:assert.match(s:hi('LightlineRight_normal_3'), s:pattern(palette.normal.middle[0]))
+ call s:assert.match(s:hi('LightlineRight_normal_4'), s:pattern(palette.normal.middle[0]))
+ call s:assert.match(s:hi('LightlineRight_normal_5'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
+endfunction
+
+function! s:suite.no_components()
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [],
+ \ 'right': []
+ \ },
+ \ 'inactive': {
+ \ 'left': [],
+ \ 'right': []
+ \ },
+ \ }
+ call lightline#init()
+ call lightline#colorscheme()
+ let palette = lightline#palette()
+ call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
+ call s:assert.match(s:hi('LightlineLeft_normal_1'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
+ call s:assert.match(s:hi('LightlineRight_normal_1'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
+endfunction
+
+function! s:suite.subseparator()
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
+ \ },
+ \ }
+ call lightline#init()
+ call lightline#colorscheme()
+ let palette = lightline#palette()
+ for i in range(4)
+ for j in range(5)
+ if i + 1 == j
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', i, j)), s:pattern(get(palette.normal.left, i, palette.normal.middle[0]), get(palette.normal.left, j, palette.normal.middle[0])))
+ else
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', i, j)), 'E411: highlight group not found\|cleared')
+ endif
+ endfor
+ endfor
+endfunction
+
+function! s:suite.component_type()
+ let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
+ call lightline#init()
+ call lightline#colorscheme()
+ let palette = lightline#palette()
+ for type in ['error', 'warning']
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s', type)), s:pattern(palette.normal[type][0]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_0_%s', type)), s:pattern(palette.normal.left[0], palette.normal[type][0]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_1_%s', type)), s:pattern(palette.normal.left[1], palette.normal[type][0]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_2_%s', type)), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_0', type)), s:pattern(palette.normal[type][0], palette.normal.left[0]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_1', type)), s:pattern(palette.normal[type][0], palette.normal.left[1]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_2', type)), s:pattern(palette.normal[type][0], palette.normal.middle[0]))
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_3', type)), 'E411: highlight group not found\|cleared')
+ endfor
+ for type1 in ['error', 'warning']
+ for type2 in ['error', 'warning']
+ call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', type1, type2)), s:pattern(palette.normal[type1][0], palette.normal[type2][0]))
+ endfor
+ endfor
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/link.vim b/vim/.vim/plugged/lightline.vim/test/link.vim
new file mode 100644
index 0000000..98e409e
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/link.vim
@@ -0,0 +1,143 @@
+let s:suite = themis#suite('link')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ call s:clear()
+ let g:lightline = {}
+ call lightline#init()
+ call lightline#colorscheme()
+endfunction
+
+function! s:clear()
+ hi clear
+ redir => hi
+ silent! hi
+ redir END
+ for line in split(hi, '\n')
+ if match(line, 'links to') > 0
+ exec 'hi link' matchstr(line, '^\S*') 'NONE'
+ endif
+ endfor
+endfunction
+
+function! s:hi(name)
+ redir => hi
+ silent! exec 'hi' a:name
+ redir END
+ return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
+endfunction
+
+function! s:suite.link()
+ call lightline#link()
+ call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0')
+ call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1')
+ call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0')
+ call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1')
+ call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2')
+ call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
+endfunction
+
+function! s:suite.insert()
+ call lightline#link('i')
+ call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_insert_0')
+ call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_insert_1')
+ call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_insert_0')
+ call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_insert_1')
+ call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_insert_2')
+ call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_insert')
+endfunction
+
+function! s:suite.visual()
+ call lightline#link('v')
+ call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_visual_0')
+ call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_visual_1')
+ call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_visual_0')
+ call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_visual_1')
+ call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_visual_2')
+ call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_visual')
+endfunction
+
+function! s:suite.replace()
+ call lightline#link('R')
+ call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_replace_0')
+ call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_replace_1')
+ call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_replace_0')
+ call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_replace_1')
+ call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_replace_2')
+ call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
+ call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_replace')
+endfunction
+
+function! s:suite.left_right()
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
+ \ },
+ \ }
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#link()
+ call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0')
+ call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1')
+ call s:assert.match(s:hi('LightlineLeft_active_2'), 'LightlineLeft_normal_2')
+ call s:assert.match(s:hi('LightlineLeft_active_3'), 'LightlineLeft_normal_3')
+ call s:assert.match(s:hi('LightlineLeft_active_4'), 'E411: highlight group not found')
+ call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0')
+ call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1')
+ call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2')
+ call s:assert.match(s:hi('LightlineRight_active_3'), 'LightlineRight_normal_3')
+ call s:assert.match(s:hi('LightlineRight_active_4'), 'LightlineRight_normal_4')
+ call s:assert.match(s:hi('LightlineRight_active_5'), 'E411: highlight group not found')
+ call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
+endfunction
+
+function! s:suite.subseparator()
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
+ \ },
+ \ }
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#link()
+ for i in range(4)
+ for j in range(5)
+ if i + 1 == j
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', i, j)), printf('LightlineLeft_normal_%s_%s', i, j))
+ else
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', i, j)), 'E411: highlight group not found')
+ endif
+ endfor
+ endfor
+endfunction
+
+function! s:suite.component_type()
+ let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
+ call lightline#init()
+ call lightline#colorscheme()
+ call lightline#link()
+ for type in ['error', 'warning']
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s', type)), printf('LightlineLeft_normal_%s', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_0_%s', type)), printf('LightlineLeft_normal_0_%s', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_1_%s', type)), printf('LightlineLeft_normal_1_%s', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_2_%s', type)), 'E411: highlight group not found')
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_0', type)), printf('LightlineLeft_normal_%s_0', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_1', type)), printf('LightlineLeft_normal_%s_1', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_2', type)), printf('LightlineLeft_normal_%s_2', type))
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_3', type)), 'E411: highlight group not found')
+ endfor
+ for type1 in ['error', 'warning']
+ for type2 in ['error', 'warning']
+ call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', type1, type2)), printf('LightlineLeft_normal_%s_%s', type1, type2))
+ endfor
+ endfor
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/mode.vim b/vim/.vim/plugged/lightline.vim/test/mode.vim
new file mode 100644
index 0000000..53280f5
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/mode.vim
@@ -0,0 +1,14 @@
+let s:suite = themis#suite('mode')
+let s:assert = themis#helper('assert')
+
+function! s:suite.mode()
+ let g:lightline = {}
+ call lightline#init()
+ call s:assert.equals(lightline#mode(), 'NORMAL')
+endfunction
+
+function! s:suite.mode_map()
+ let g:lightline = { 'mode_map': { 'n': 'N' } }
+ call lightline#init()
+ call s:assert.equals(lightline#mode(), 'N')
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/onetab.vim b/vim/.vim/plugged/lightline.vim/test/onetab.vim
new file mode 100644
index 0000000..529d833
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/onetab.vim
@@ -0,0 +1,98 @@
+let s:suite = themis#suite('onetab')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ let g:lightline = {}
+ call lightline#init()
+ tabnew
+ tabonly
+endfunction
+
+function! s:suite.onetab()
+ call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
+endfunction
+
+function! s:suite.tabnew()
+ tabnew
+ call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
+ call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
+endfunction
+
+function! s:suite.tabnew_tabnew()
+ tabnew
+ tabnew
+ call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
+ call s:assert.equals(lightline#onetab(2, 0), '2 [No Name]')
+ call s:assert.equals(lightline#onetab(3, 1), '3 [No Name]')
+endfunction
+
+function! s:suite.modified()
+ call append(0, '')
+ call s:assert.equals(lightline#onetab(1, 1), '1 [No Name] +')
+ undo
+endfunction
+
+function! s:suite.filename()
+ edit test
+ call s:assert.equals(lightline#onetab(1, 1), '1 test')
+ tabnew
+ bunload test
+endfunction
+
+function! s:suite.filename_modified()
+ edit test
+ call append(0, '')
+ call s:assert.equals(lightline#onetab(1, 1), '1 test +')
+ tabnew
+ bunload! test
+endfunction
+
+function! s:suite.active_inactive()
+ let g:lightline = { 'tab': { 'active': [ 'tabnum', 'filename' ], 'inactive': [ 'filename' ] } }
+ call lightline#init()
+ edit test
+ call append(0, '')
+ call s:assert.equals(lightline#onetab(1, 1), '1 test')
+ call s:assert.equals(lightline#onetab(1, 0), 'test')
+ tabnew
+ bunload! test
+endfunction
+
+function! s:suite.tab_component()
+ let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component': { 'custom': 'custom' } }
+ call lightline#init()
+ call s:assert.equals(lightline#onetab(1, 1), 'custom')
+ call s:assert.equals(lightline#onetab(2, 1), 'custom')
+endfunction
+
+function! s:suite.tab_component_function()
+ function! Custom(n)
+ return 'custom: ' . a:n
+ endfunction
+ let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component_function': { 'custom': 'Custom' } }
+ call lightline#init()
+ call s:assert.equals(lightline#onetab(1, 1), 'custom: 1')
+ call s:assert.equals(lightline#onetab(2, 1), 'custom: 2')
+ delfunction Custom
+endfunction
+
+function! s:suite.tab_component_empty_middle()
+ let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom', 'filename' ], 'inactive': [ 'tabnum', 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
+ call lightline#init()
+ call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
+ call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
+endfunction
+
+function! s:suite.tab_component_empty_left()
+ let g:lightline = { 'tab': { 'active': [ 'custom', 'filename' ], 'inactive': [ 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
+ call lightline#init()
+ call s:assert.equals(lightline#onetab(1, 1), '[No Name]')
+ call s:assert.equals(lightline#onetab(2, 1), '[No Name]')
+endfunction
+
+function! s:suite.tab_component_empty_middle()
+ let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom' ], 'inactive': [ 'tabnum', 'custom', 'custom' ] }, 'tab_component': { 'custom': '' } }
+ call lightline#init()
+ call s:assert.equals(lightline#onetab(1, 1), '1')
+ call s:assert.equals(lightline#onetab(2, 1), '2')
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/subseparator.vim b/vim/.vim/plugged/lightline.vim/test/subseparator.vim
new file mode 100644
index 0000000..2393840
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/subseparator.vim
@@ -0,0 +1,407 @@
+let s:suite = themis#suite('subseparator')
+let s:assert = themis#helper('assert')
+
+function! s:subseparator(...)
+ return eval(substitute(call(SID('subseparator'), a:000), '^%{\|}$', '', 'g'))
+endfunction
+
+function! s:suite.subseparator_component()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_1()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_2()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_3()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_4()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_5()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '0', 'custom3': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_6()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||0', 'custom2': '0', 'custom3': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_visible_condition_7()
+ let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||1', 'custom2': '0', 'custom3': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_function()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_1()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom1
+endfunction
+
+function! s:suite.subseparator_component_function_2()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+ delfunction Custom1
+ delfunction Custom2
+endfunction
+
+function! s:suite.subseparator_component_function_3()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+ delfunction Custom1
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_4()
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_5()
+ function! Custom1()
+ return ''
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_6()
+ function! Custom1()
+ return ''
+ endfunction
+ function! Custom2()
+ return ''
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_7()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return ''
+ endfunction
+ function! Custom3()
+ return ''
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_1()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_2()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_3()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_4()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_5()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return ''
+ endfunction
+ function! Custom3()
+ return ''
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_6()
+ function! Custom1()
+ return ''
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom2': '1', 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+endfunction
+
+function! s:suite.subseparator_component_function_visible_condition_7()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return ''
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom3': '1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+endfunction
+
+function! s:suite.subseparator_component_expand()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_expand()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_expand_1()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom1': 'Custom1' }, 'component_function': { 'custom2': 'Custom2', 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 0, 0]), '|')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_expand_2()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_function': { 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 0]), '|')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_expand_3()
+ function! Custom1()
+ return ''
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ function! Custom3()
+ return 'custom3'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_expand': { 'custom3': 'Custom3' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 1]), '')
+ delfunction Custom1
+ delfunction Custom2
+ delfunction Custom3
+endfunction
+
+function! s:suite.subseparator_component_not_found()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom1
+endfunction
+
+function! s:suite.subseparator_component_not_found_1()
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom2': 'Custom2' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
+ delfunction Custom2
+endfunction
+
+function! s:suite.subseparator_component_not_found_2()
+ function! Custom1()
+ return 'custom1'
+ endfunction
+ function! Custom2()
+ return 'custom2'
+ endfunction
+ let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' } }
+ call lightline#init()
+ call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
+ delfunction Custom1
+ delfunction Custom2
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/tabline.vim b/vim/.vim/plugged/lightline.vim/test/tabline.vim
new file mode 100644
index 0000000..0a9879f
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/tabline.vim
@@ -0,0 +1,67 @@
+let s:suite = themis#suite('tabline')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ let g:lightline = {}
+ call lightline#init()
+ tabnew
+ tabonly
+endfunction
+
+function! s:suite.tabline()
+ call s:assert.equals(&tabline, '%!lightline#tabline()')
+endfunction
+
+function! s:suite.enabled()
+ let g:lightline = { 'enable': { 'tabline': 1 } }
+ call lightline#init()
+ call s:assert.equals(&tabline, '%!lightline#tabline()')
+endfunction
+
+function! s:suite.disabled()
+ let g:lightline = { 'enable': { 'tabline': 0 } }
+ call lightline#init()
+ call s:assert.equals(&tabline, '')
+endfunction
+
+function! s:suite.tabnew()
+ let tabline = lightline#tabline()
+ tabnew
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
+
+function! s:suite.tabnew_first()
+ let tabline = lightline#tabline()
+ 0tabnew
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
+
+function! s:suite.tabnext()
+ tabnew
+ let tabline = lightline#tabline()
+ tabnext
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
+
+function! s:suite.tabonly()
+ tabnew
+ tabfirst
+ let tabline = lightline#tabline()
+ tabonly
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
+
+function! s:suite.tabclose()
+ tabnew
+ let tabline = lightline#tabline()
+ tabclose
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
+
+function! s:suite.tabclose_last()
+ tabnew
+ tabfirst
+ let tabline = lightline#tabline()
+ $tabclose
+ call s:assert.not_equals(lightline#tabline(), tabline)
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/tabs.vim b/vim/.vim/plugged/lightline.vim/test/tabs.vim
new file mode 100644
index 0000000..7851e70
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/tabs.vim
@@ -0,0 +1,99 @@
+let s:suite = themis#suite('tabs')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ let g:lightline = { 'winwidth': 180 }
+ call lightline#init()
+ tabnew
+ tabonly
+endfunction
+
+function! s:tab(number, ...) abort
+ let active = get(a:000, 0, 0)
+ let last = get(a:000, 1, 0)
+ return '%' . a:number . 'T%{lightline#onetab(' . a:number . ',' . active . ')}' . (last ? '%T' : '')
+endfunction
+
+function! s:suite.tabs()
+ call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1, 1)], []])
+endfunction
+
+function! s:suite.tabnew()
+ tabnew
+ call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1, 1)], []])
+endfunction
+
+function! s:suite.tabnew_tabnew()
+ tabnew
+ tabnew
+ call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2)], [s:tab(3, 1, 1)], []])
+endfunction
+
+function! s:suite.tabnew_tabfirst()
+ tabnew
+ tabfirst
+ call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_tabnew_tabfirst()
+ tabnew
+ tabnew
+ tabfirst
+ call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_tabnew_tabprevious()
+ tabnew
+ tabnew
+ tabprevious
+ call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_20()
+ for i in range(19)
+ tabnew
+ endfor
+ call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), s:tab(4), '...', s:tab(16), s:tab(17), s:tab(18), s:tab(19)], [s:tab(20, 1, 1)], []])
+endfunction
+
+function! s:suite.tabnew_20_tabfirst()
+ for i in range(19)
+ tabnew
+ endfor
+ tabfirst
+ call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3), s:tab(4), '%<' . s:tab(5), '...', '%<' . s:tab(17), '%<' . s:tab(18), '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_20_tabfirst_tabnext()
+ for i in range(19)
+ tabnew
+ endfor
+ tabfirst
+ tabnext
+ call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3), s:tab(4), s:tab(5), '%<' . s:tab(6), '...', '%<' . s:tab(18), '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_20_tabnext_10()
+ for i in range(19)
+ tabnew
+ endfor
+ tabnext 10
+ call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), '...', s:tab(8), s:tab(9)], [s:tab(10, 1)], [s:tab(11), s:tab(12), '...', '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_20_tabprevious()
+ for i in range(19)
+ tabnew
+ endfor
+ tabprevious
+ call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17), s:tab(18)], [s:tab(19, 1)], [s:tab(20, 0, 1)]])
+endfunction
+
+function! s:suite.tabnew_20_tabprevious_tabprevious()
+ for i in range(19)
+ tabnew
+ endfor
+ tabprevious
+ tabprevious
+ call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17)], [s:tab(18, 1)], [s:tab(19), s:tab(20, 0, 1)]])
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/toggle.vim b/vim/.vim/plugged/lightline.vim/test/toggle.vim
new file mode 100644
index 0000000..7df270f
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/toggle.vim
@@ -0,0 +1,45 @@
+let s:suite = themis#suite('toggle')
+let s:assert = themis#helper('assert')
+
+function! s:suite.before_each()
+ let g:lightline = {}
+ call lightline#init()
+ tabnew
+ tabonly
+endfunction
+
+function! s:suite.default()
+ call s:assert.equals(exists('#lightline'), 1)
+ call s:assert.equals(exists('#lightline-disable'), 0)
+ call s:assert.not_equals(&statusline, '')
+ call s:assert.not_equals(&tabline, '')
+endfunction
+
+function! s:suite.disable_enable()
+ call lightline#disable()
+ call s:assert.equals(exists('#lightline'), 0)
+ call s:assert.equals(exists('#lightline-disable'), 1)
+ call s:assert.equals(&statusline, '')
+ call s:assert.equals(&tabline, '')
+ call lightline#update()
+ call s:assert.equals(&statusline, '')
+ call s:assert.equals(&tabline, '')
+ call lightline#enable()
+ call s:assert.equals(exists('#lightline'), 1)
+ call s:assert.equals(exists('#lightline-disable'), 0)
+ call s:assert.not_equals(&statusline, '')
+ call s:assert.not_equals(&tabline, '')
+endfunction
+
+function! s:suite.toggle()
+ call lightline#toggle()
+ call s:assert.equals(exists('#lightline'), 0)
+ call s:assert.equals(exists('#lightline-disable'), 1)
+ call s:assert.equals(&statusline, '')
+ call s:assert.equals(&tabline, '')
+ call lightline#toggle()
+ call s:assert.equals(exists('#lightline'), 1)
+ call s:assert.equals(exists('#lightline-disable'), 0)
+ call s:assert.not_equals(&statusline, '')
+ call s:assert.not_equals(&tabline, '')
+endfunction
diff --git a/vim/.vim/plugged/lightline.vim/test/uniq.vim b/vim/.vim/plugged/lightline.vim/test/uniq.vim
new file mode 100644
index 0000000..cdfaec0
--- /dev/null
+++ b/vim/.vim/plugged/lightline.vim/test/uniq.vim
@@ -0,0 +1,46 @@
+let s:suite = themis#suite('uniq')
+let s:assert = themis#helper('assert')
+
+function! s:uniq(...)
+ try
+ return call(SID('uniq'), a:000)
+ catch
+ return call(function('uniq'), a:000)
+ endtry
+endfunction
+
+function! s:suite.nil()
+ call s:assert.equals(s:uniq([]), [])
+endfunction
+
+function! s:suite.one()
+ call s:assert.equals(s:uniq(['foo']), ['foo'])
+endfunction
+
+function! s:suite.two()
+ call s:assert.equals(s:uniq(['foo', 'bar']), ['foo', 'bar'])
+endfunction
+
+function! s:suite.three()
+ call s:assert.equals(s:uniq(['foo', 'bar', 'baz']), ['foo', 'bar', 'baz'])
+endfunction
+
+function! s:suite.two_duplicated()
+ call s:assert.equals(s:uniq(['foo', 'foo']), ['foo'])
+endfunction
+
+function! s:suite.three_duplicated()
+ call s:assert.equals(s:uniq(['foo', 'bar', 'foo']), ['foo', 'bar', 'foo'])
+endfunction
+
+function! s:suite.many1()
+ call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'baz', 'baz', 'qux', 'foo']), ['foo', 'bar', 'baz', 'qux', 'foo'])
+endfunction
+
+function! s:suite.many2()
+ call s:assert.equals(s:uniq(['foo', 'foo', 'foo', 'foo', 'bar', 'bar', 'bar']), ['foo', 'bar'])
+endfunction
+
+function! s:suite.many3()
+ call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'bar', 'bar', 'foo', 'foo', 'foo']), ['foo', 'bar', 'foo'])
+endfunction
diff --git a/vim/.vim/plugged/nerdtree/CHANGELOG b/vim/.vim/plugged/nerdtree/CHANGELOG
new file mode 100644
index 0000000..6dac46d
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/CHANGELOG
@@ -0,0 +1,179 @@
+Next
+ - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) #759
+ - Update doc with already existing mapping variables (asnr) #699
+ - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) #696
+ - Correct NERDTreeIgnore pattern in doc (cntoplolicon) #648
+ - Remove empty segments when splitting path (sooth-sayer) #574
+ - Suppress autocmds less agressively (wincent) #578 #691
+ - Add an Issues template to ask for more info initially.
+ - Fix markdown headers in readme (josephfrazier) #676
+ - Don't touch @o and @h registers when rendering
+ - Fix bug with files and directories with dollar signs (alegen) #649
+ - Reuse/reopen existing window trees where possible #244
+ - Remove NERDTree.previousBuf()
+ - Change color of arrow (Leeiio) #630
+ - Improved a tip in README.markdown (ggicci) #628
+ - Shorten delete confimration of empty directory to 'y' (mikeperri) #530
+ - Fix API call to open directory tree in window (devm33) #533
+ - Change default arrows on non-Windows platforms (gwilk) #546
+ - Update to README - combine cd and git clone (zwhitchcox) #584
+ - Update to README - Tip: start NERDTree when vim starts (therealplato) #593
+ - Escape filename when moving an open buffer (zacharyvoase) #595
+ - Fixed incorrect :helptags command in README (curran) #619
+ - Fixed incomplete escaping of folder arrows (adityanatraj) #548
+ - Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558
+ - Replace strchars() with backward compatible workaround.
+ - Add support for copy command in Windows (SkylerLipthay) #231
+ - Fixed typo in README.markdown - :Helptags -> :helptags
+ - Rename "primary" and "secondary" trees to "tab" and "window" trees.
+ - Move a bunch of buffer level variables into the NERDTree and UI classes.
+ - Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing)
+ - Remove the old style UI - Remove 'NERDTreeDirArrows' option.
+ - On windows default to + and ~ for expand/collapse directory symbols.
+ - Lots more refactoring. Move a bunch of b: level vars into b:NERDTree and friends.
+
+5.0.0
+ - Refactor the code significantly:
+ * Break the classes out into their own files.
+ * Make the majority of the code OO - previously large parts were
+ effectively a tangle of "global" methods.
+ - Add an API to assign flags to nodes. This allows VCS plugins like
+ https://github.com/Xuyuanp/nerdtree-git-plugin to exist. Thanks to
+ Xuyuanp for helping design/test/build said API.
+ - add 'scope' argument to the key map API see :help NERDTreeAddKeyMap()
+ - add magic [[dir]] and [[file]] flags to NERDTreeIgnore
+ - add support for custom path filters. See :help NERDTreeAddPathFilter()
+ - add path listener API. See :help NERDTreePathListenerAPI.
+ - expand the fs menu functionality to list file properties (PhilRunninger,
+ apbarrero, JESii)
+ - make bookmarks work with `~` home shortcuts (hiberabyss)
+ - show OSX specific fsmenu options in regular vim on mac (evindor)
+ - make dir arrow icons configurable (PickRelated)
+ - optimise node sorting performance when opening large dirs (vtsang)
+ - make the root note render prettier by truncating it at a path slash (gcmt)
+ - remove NERDChristmasTree option - its always christmas now
+ - add "cascade" open and closing for dirs containing only another single
+ dir. See :help NERDTreeCascadeOpenSingleChildDir (pendulm)
+
+ Many other fixes, doc updates and contributions from:
+ actionshrimp
+ SchDen
+ egalpin
+ cperl82 - many small fixes
+ toiffel
+ WoLpH
+ handcraftedbits
+ devmanhinton
+ xiaodili
+ zhangoose
+ gastropoda
+ mixvin
+ alvan
+ lucascaton
+ kelaban
+ shanesmith
+ staeff
+ pendulm
+ stephenprater
+ franksort
+ agrussellknives
+ AndrewRadev
+ Twinside
+
+4.2.0
+ - Add NERDTreeDirArrows option to make the UI use pretty arrow chars
+ instead of the old +~| chars to define the tree structure (sickill)
+ - shift the syntax highlighting out into its own syntax file (gnap)
+ - add some mac specific options to the filesystem menu - for macvim
+ only (andersonfreitas)
+ - Add NERDTreeMinimalUI option to remove some non functional parts of the
+ nerdtree ui (camthompson)
+ - tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the
+ new behaviour (benjamingeiger)
+ - if no name is given to :Bookmark, make it default to the name of the
+ target file/dir (minyoung)
+ - use 'file' completion when doing copying, create, and move
+ operations (EvanDotPro)
+ - lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly
+ Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!)
+
+4.1.0
+ features:
+ - NERDTreeFind to reveal the node for the current buffer in the tree,
+ see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by
+ Doug McInnes) into the script.
+ - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan
+ Ritter and Rémi Prévost.
+ - truncate the root node if wider than the tree window. Thanks to Victor
+ Gonzalez.
+
+ bugfixes:
+ - really fix window state restoring
+ - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky,
+ jfilip1024, and Chris Chambers
+
+4.0.0
+ - add a new programmable menu system (see :help NERDTreeMenu).
+ - add new APIs to add menus/menu-items to the menu system as well as
+ custom key mappings to the NERD tree buffer (see :help NERDTreeAPI).
+ - removed the old API functions
+ - added a mapping to maximize/restore the size of nerd tree window, thanks
+ to Guillaume Duranceau for the patch. See :help NERDTree-A for details.
+
+ - fix a bug where secondary nerd trees (netrw hijacked trees) and
+ NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
+ - fix a bug where the script ignored directories whose name ended in a dot,
+ thanks to Aggelos Orfanakos for the patch.
+ - fix a bug when using the x mapping on the tree root, thanks to Bryan
+ Venteicher for the patch.
+ - fix a bug where the cursor position/window size of the nerd tree buffer
+ wasnt being stored on closing the window, thanks to Richard Hart.
+ - fix a bug where NERDTreeMirror would mirror the wrong tree
+
+3.1.1
+ - fix a bug where a non-listed no-name buffer was getting created every
+ time the tree windows was created, thanks to Derek Wyatt and owen1
+ - make <CR> behave the same as the 'o' mapping
+ - some helptag fixes in the doc, thanks strull
+ - fix a bug when using :set nohidden and opening a file where the previous
+ buf was modified. Thanks iElectric
+ - other minor fixes
+
+3.1.0
+ New features:
+ - add mappings to open files in a vsplit, see :help NERDTree-s and :help
+ NERDTree-gs
+ - make the statusline for the nerd tree window default to something
+ hopefully more useful. See :help 'NERDTreeStatusline'
+ Bugfixes:
+ - make the hijack netrw functionality work when vim is started with "vim
+ <some dir>" (thanks to Alf Mikula for the patch).
+ - fix a bug where the CWD wasnt being changed for some operations even when
+ NERDTreeChDirMode==2 (thanks to Lucas S. Buchala)
+ - add -bar to all the nerd tree :commands so they can chain with other
+ :commands (thanks to tpope)
+ - fix bugs when ignorecase was set (thanks to nach)
+ - fix a bug with the relative path code (thanks to nach)
+ - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach)
+
+
+3.0.1
+ Bugfixes:
+ - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden
+ was not set
+ - fix a bug where :NERDTree <path> would fail if <path> was relative and
+ didnt start with a ./ or ../ Thanks to James Kanze.
+ - make the q mapping work with secondary (:e <dir> style) trees,
+ thanks to jamessan
+ - fix a bunch of small bugs with secondary trees
+
+ More insane refactoring.
+
+3.0.0
+ - hijack netrw so that doing an :edit <directory> will put a NERD tree in
+ the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw'
+ - allow sharing of trees across tabs, see :help :NERDTreeMirror
+ - remove "top" and "bottom" as valid settings for NERDTreeWinPos
+ - change the '<tab>' mapping to 'i'
+ - change the 'H' mapping to 'I'
+ - lots of refactoring
diff --git a/vim/.vim/plugged/nerdtree/LICENCE b/vim/.vim/plugged/nerdtree/LICENCE
new file mode 100644
index 0000000..8b1a9d8
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/LICENCE
@@ -0,0 +1,13 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+Everyone is permitted to copy and distribute verbatim or modified
+copies of this license document, and changing it is allowed as long
+as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/vim/.vim/plugged/nerdtree/README.markdown b/vim/.vim/plugged/nerdtree/README.markdown
new file mode 100644
index 0000000..6efeb0b
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/README.markdown
@@ -0,0 +1,96 @@
+The NERDTree
+=============
+
+Introduction
+------------
+
+The NERDTree is a file system explorer for the Vim editor. Using this plugin,
+users can visually browse complex directory hierarchies, quickly open files for
+reading or editing, and perform basic file system operations.
+
+This plugin can also be extended with custom mappings using a special API. The
+details of this API and of other NERDTree features are described in the
+included documentation.
+
+![NERDTree Screenshot](https://github.com/scrooloose/nerdtree/raw/master/screenshot.png)
+
+Installation
+------------
+
+#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
+
+ git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
+
+Then reload Vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`, and check out `:help NERDTree.txt`.
+
+
+#### [apt-vim](https://github.com/egalpin/apt-vim)
+
+ apt-vim install -y https://github.com/scrooloose/nerdtree.git
+
+F.A.Q.
+------
+
+> Is there any support for `git` flags?
+
+Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin).
+
+---
+
+> Can I have the nerdtree on every tab automatically?
+
+Nope. If this is something you want then chances are you aren't using tabs and
+buffers as they were intended to be used. Read this
+http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
+
+If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
+
+---
+> How can I open a NERDTree automatically when vim starts up?
+
+Stick this in your vimrc: `autocmd vimenter * NERDTree`
+
+---
+> How can I open a NERDTree automatically when vim starts up if no files were specified?
+
+Stick this in your vimrc:
+
+ autocmd StdinReadPre * let s:std_in=1
+ autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
+
+Note: Now start vim with plain `vim`, not `vim .`
+
+---
+> How can I open NERDTree automatically when vim starts up on opening a directory?
+
+ autocmd StdinReadPre * let s:std_in=1
+ autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
+
+This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file.
+
+---
+> How can I map a specific key or shortcut to open NERDTree?
+
+Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
+
+ map <C-n> :NERDTreeToggle<CR>
+
+---
+> How can I close vim if the only window left open is a NERDTree?
+
+Stick this in your vimrc:
+
+ autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
+
+---
+> Can I have different highlighting for different file extensions?
+
+See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696
+
+---
+> How can I change default arrows?
+
+Use these variables in your vimrc. Note that below are default arrow symbols
+
+ let g:NERDTreeDirArrowExpandable = '▸'
+ let g:NERDTreeDirArrowCollapsible = '▾'
diff --git a/vim/.vim/plugged/nerdtree/autoload/nerdtree.vim b/vim/.vim/plugged/nerdtree/autoload/nerdtree.vim
new file mode 100644
index 0000000..bdf3deb
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/autoload/nerdtree.vim
@@ -0,0 +1,200 @@
+if exists("g:loaded_nerdtree_autoload")
+ finish
+endif
+let g:loaded_nerdtree_autoload = 1
+
+function! nerdtree#version()
+ return '5.0.0'
+endfunction
+
+" SECTION: General Functions {{{1
+"============================================================
+
+"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
+"inits a window tree in the current buffer if appropriate
+function! nerdtree#checkForBrowse(dir)
+ if !isdirectory(a:dir)
+ return
+ endif
+
+ if s:reuseWin(a:dir)
+ return
+ endif
+
+ call g:NERDTreeCreator.CreateWindowTree(a:dir)
+endfunction
+
+"FUNCTION: s:reuseWin(dir) {{{2
+"finds a NERDTree buffer with root of dir, and opens it.
+function! s:reuseWin(dir) abort
+ let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p"))
+
+ for i in range(1, bufnr("$"))
+ unlet! nt
+ let nt = getbufvar(i, "NERDTree")
+ if empty(nt)
+ continue
+ endif
+
+ if nt.isWinTree() && nt.root.path.equals(path)
+ call nt.setPreviousBuf(bufnr("#"))
+ exec "buffer " . i
+ return 1
+ endif
+ endfor
+
+ return 0
+endfunction
+
+" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
+" completion function for the bookmark commands
+function! nerdtree#completeBookmarks(A,L,P)
+ return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
+endfunction
+
+"FUNCTION: nerdtree#compareNodes(dir) {{{2
+function! nerdtree#compareNodes(n1, n2)
+ return a:n1.path.compareTo(a:n2.path)
+endfunction
+
+"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
+function! nerdtree#compareNodesBySortKey(n1, n2)
+ let sortKey1 = a:n1.path.getSortKey()
+ let sortKey2 = a:n2.path.getSortKey()
+ let i = 0
+ while i < min([len(sortKey1), len(sortKey2)])
+ " Compare chunks upto common length.
+ " If chunks have different type, the one which has
+ " integer type is the lesser.
+ if type(sortKey1[i]) == type(sortKey2[i])
+ if sortKey1[i] <# sortKey2[i]
+ return - 1
+ elseif sortKey1[i] ># sortKey2[i]
+ return 1
+ endif
+ elseif type(sortKey1[i]) == v:t_number
+ return -1
+ elseif type(sortKey2[i]) == v:t_number
+ return 1
+ endif
+ let i = i + 1
+ endwhile
+
+ " Keys are identical upto common length.
+ " The key which has smaller chunks is the lesser one.
+ if len(sortKey1) < len(sortKey2)
+ return -1
+ elseif len(sortKey1) > len(sortKey2)
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+" FUNCTION: nerdtree#deprecated(func, [msg]) {{{2
+" Issue a deprecation warning for a:func. If a second arg is given, use this
+" as the deprecation message
+function! nerdtree#deprecated(func, ...)
+ let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated'
+
+ if !exists('s:deprecationWarnings')
+ let s:deprecationWarnings = {}
+ endif
+ if !has_key(s:deprecationWarnings, a:func)
+ let s:deprecationWarnings[a:func] = 1
+ echomsg msg
+ endif
+endfunction
+
+" FUNCTION: nerdtree#exec(cmd) {{{2
+" Same as :exec cmd but with eventignore set for the duration
+" to disable the autocommands used by NERDTree (BufEnter,
+" BufLeave and VimEnter)
+function! nerdtree#exec(cmd)
+ let old_ei = &ei
+ set ei=BufEnter,BufLeave,VimEnter
+ exec a:cmd
+ let &ei = old_ei
+endfunction
+
+" FUNCTION: nerdtree#has_opt(options, name) {{{2
+function! nerdtree#has_opt(options, name)
+ return has_key(a:options, a:name) && a:options[a:name] == 1
+endfunction
+
+" FUNCTION: nerdtree#loadClassFiles() {{{2
+function! nerdtree#loadClassFiles()
+ runtime lib/nerdtree/path.vim
+ runtime lib/nerdtree/menu_controller.vim
+ runtime lib/nerdtree/menu_item.vim
+ runtime lib/nerdtree/key_map.vim
+ runtime lib/nerdtree/bookmark.vim
+ runtime lib/nerdtree/tree_file_node.vim
+ runtime lib/nerdtree/tree_dir_node.vim
+ runtime lib/nerdtree/opener.vim
+ runtime lib/nerdtree/creator.vim
+ runtime lib/nerdtree/flag_set.vim
+ runtime lib/nerdtree/nerdtree.vim
+ runtime lib/nerdtree/ui.vim
+ runtime lib/nerdtree/event.vim
+ runtime lib/nerdtree/notifier.vim
+endfunction
+
+" FUNCTION: nerdtree#postSourceActions() {{{2
+function! nerdtree#postSourceActions()
+ call g:NERDTreeBookmark.CacheBookmarks(1)
+ call nerdtree#ui_glue#createDefaultBindings()
+
+ "load all nerdtree plugins
+ runtime! nerdtree_plugin/**/*.vim
+endfunction
+
+"FUNCTION: nerdtree#runningWindows(dir) {{{2
+function! nerdtree#runningWindows()
+ return has("win16") || has("win32") || has("win64")
+endfunction
+
+"FUNCTION: nerdtree#runningCygwin(dir) {{{2
+function! nerdtree#runningCygwin()
+ return has("win32unix")
+endfunction
+
+" SECTION: View Functions {{{1
+"============================================================
+
+"FUNCTION: nerdtree#echo {{{2
+"A wrapper for :echo. Appends 'NERDTree:' on the front of all messages
+"
+"Args:
+"msg: the message to echo
+function! nerdtree#echo(msg)
+ redraw
+ echomsg "NERDTree: " . a:msg
+endfunction
+
+"FUNCTION: nerdtree#echoError {{{2
+"Wrapper for nerdtree#echo, sets the message type to errormsg for this message
+"Args:
+"msg: the message to echo
+function! nerdtree#echoError(msg)
+ echohl errormsg
+ call nerdtree#echo(a:msg)
+ echohl normal
+endfunction
+
+"FUNCTION: nerdtree#echoWarning {{{2
+"Wrapper for nerdtree#echo, sets the message type to warningmsg for this message
+"Args:
+"msg: the message to echo
+function! nerdtree#echoWarning(msg)
+ echohl warningmsg
+ call nerdtree#echo(a:msg)
+ echohl normal
+endfunction
+
+"FUNCTION: nerdtree#renderView {{{2
+function! nerdtree#renderView()
+ call b:NERDTree.render()
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim b/vim/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim
new file mode 100644
index 0000000..12dd9ae
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim
@@ -0,0 +1,649 @@
+if exists("g:loaded_nerdtree_ui_glue_autoload")
+ finish
+endif
+let g:loaded_nerdtree_ui_glue_autoload = 1
+
+" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1
+function! nerdtree#ui_glue#createDefaultBindings()
+ let s = '<SNR>' . s:SID() . '_'
+
+ call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
+ call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': "all", 'callback': s."handleLeftClick" })
+ call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
+ call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
+ call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" })
+ call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" })
+
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': 'all', 'callback': s . 'upDirCurrentRootClosed' })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': 'all', 'callback': s . 'upDirCurrentRootOpen' })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': 'Node', 'callback': s . 'chRoot' })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#ui_glue#chRootCwd" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Bookmark', 'callback': s . 'openInNewTab' })
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" })
+
+ call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" })
+endfunction
+
+
+"SECTION: Interface bindings {{{1
+"============================================================
+
+"FUNCTION: s:activateAll() {{{1
+"handle the user activating the updir line
+function! s:activateAll()
+ if getline(".") ==# g:NERDTreeUI.UpDirLine()
+ return nerdtree#ui_glue#upDir(0)
+ endif
+endfunction
+
+" FUNCTION: s:activateDirNode(directoryNode) {{{1
+function! s:activateDirNode(directoryNode)
+
+ if a:directoryNode.isRoot() && a:directoryNode.isOpen
+ call nerdtree#echo('cannot close tree root')
+ return
+ endif
+
+ call a:directoryNode.activate()
+endfunction
+
+"FUNCTION: s:activateFileNode() {{{1
+"handle the user activating a tree node
+function! s:activateFileNode(node)
+ call a:node.activate({'reuse': 'all', 'where': 'p'})
+endfunction
+
+"FUNCTION: s:activateBookmark() {{{1
+"handle the user activating a bookmark
+function! s:activateBookmark(bm)
+ call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
+" Associate the current node with the given name
+function! nerdtree#ui_glue#bookmarkNode(...)
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+ if currentNode != {}
+ let name = a:1
+ if empty(name)
+ let name = currentNode.path.getLastPathComponent(0)
+ endif
+ try
+ call currentNode.bookmark(name)
+ call b:NERDTree.render()
+ catch /^NERDTree.IllegalBookmarkNameError/
+ call nerdtree#echo("bookmark names must not contain spaces")
+ endtry
+ else
+ call nerdtree#echo("select a node first")
+ endif
+endfunction
+
+" FUNCTION: s:chCwd(node) {{{1
+function! s:chCwd(node)
+ try
+ call a:node.path.changeToDir()
+ catch /^NERDTree.PathChangeError/
+ call nerdtree#echoWarning("could not change cwd")
+ endtry
+endfunction
+
+" FUNCTION: s:chRoot(node) {{{1
+" changes the current root to the selected one
+function! s:chRoot(node)
+ call b:NERDTree.changeRoot(a:node)
+endfunction
+
+" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1
+" Change the NERDTree root to match the current working directory.
+function! nerdtree#ui_glue#chRootCwd()
+ NERDTreeCWD
+endfunction
+
+" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
+function! nerdtree#ui_glue#clearBookmarks(bookmarks)
+ if a:bookmarks ==# ''
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+ if currentNode != {}
+ call currentNode.clearBookmarks()
+ endif
+ else
+ for name in split(a:bookmarks, ' ')
+ let bookmark = g:NERDTreeBookmark.BookmarkFor(name)
+ call bookmark.delete()
+ endfor
+ endif
+ call b:NERDTree.root.refresh()
+ call b:NERDTree.render()
+endfunction
+
+" FUNCTION: s:closeChildren(node) {{{1
+" closes all childnodes of the current node
+function! s:closeChildren(node)
+ call a:node.closeChildren()
+ call b:NERDTree.render()
+ call a:node.putCursorHere(0, 0)
+endfunction
+
+" FUNCTION: s:closeCurrentDir(node) {{{1
+" Close the parent directory of the current node.
+function! s:closeCurrentDir(node)
+
+ if a:node.isRoot()
+ call nerdtree#echo('cannot close parent of tree root')
+ return
+ endif
+
+ let l:parent = a:node.parent
+
+ while l:parent.isCascadable()
+ let l:parent = l:parent.parent
+ endwhile
+
+ if l:parent.isRoot()
+ call nerdtree#echo('cannot close tree root')
+ return
+ endif
+
+ call l:parent.close()
+ call b:NERDTree.render()
+ call l:parent.putCursorHere(0, 0)
+endfunction
+
+" FUNCTION: s:closeTreeWindow() {{{1
+" close the tree window
+function! s:closeTreeWindow()
+ if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1
+ exec "buffer " . b:NERDTree.previousBuf()
+ else
+ if winnr("$") > 1
+ call g:NERDTree.Close()
+ else
+ call nerdtree#echo("Cannot close last window")
+ endif
+ endif
+endfunction
+
+" FUNCTION: s:deleteBookmark(bookmark) {{{1
+" Prompt the user to confirm the deletion of the selected bookmark.
+function! s:deleteBookmark(bookmark)
+ let l:message = "Delete the bookmark \"" . a:bookmark.name
+ \ . "\" from the bookmark list?"
+
+ let l:choices = "&Yes\n&No"
+
+ echo | redraw
+ let l:selection = confirm(l:message, l:choices, 1, 'Warning')
+
+ if l:selection != 1
+ call nerdtree#echo('bookmark not deleted')
+ return
+ endif
+
+ try
+ call a:bookmark.delete()
+ silent call b:NERDTree.root.refresh()
+ call b:NERDTree.render()
+ echo | redraw
+ catch /^NERDTree/
+ call nerdtree#echoWarning('could not remove bookmark')
+ endtry
+endfunction
+
+" FUNCTION: s:displayHelp() {{{1
+" toggles the help display
+function! s:displayHelp()
+ call b:NERDTree.ui.toggleHelp()
+ call b:NERDTree.render()
+ call b:NERDTree.ui.centerView()
+endfunction
+
+" FUNCTION: s:findAndRevealPath(pathStr) {{{1
+function! s:findAndRevealPath(pathStr)
+ let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
+
+ if empty(l:pathStr)
+ call nerdtree#echoWarning('no file for the current buffer')
+ return
+ endif
+
+ try
+ let l:pathStr = g:NERDTreePath.Resolve(l:pathStr)
+ let l:pathObj = g:NERDTreePath.New(l:pathStr)
+ catch /^NERDTree.InvalidArgumentsError/
+ call nerdtree#echoWarning('invalid path')
+ return
+ endtry
+
+ if !g:NERDTree.ExistsForTab()
+ try
+ let l:cwd = g:NERDTreePath.New(getcwd())
+ catch /^NERDTree.InvalidArgumentsError/
+ call nerdtree#echo('current directory does not exist.')
+ let l:cwd = l:pathObj.getParent()
+ endtry
+
+ if l:pathObj.isUnder(l:cwd)
+ call g:NERDTreeCreator.CreateTabTree(l:cwd.str())
+ else
+ call g:NERDTreeCreator.CreateTabTree(l:pathObj.getParent().str())
+ endif
+ else
+ NERDTreeFocus
+
+ if !l:pathObj.isUnder(b:NERDTree.root.path)
+ call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
+ endif
+ endif
+
+ if l:pathObj.isHiddenUnder(b:NERDTree.root.path)
+ call b:NERDTree.ui.setShowHidden(1)
+ endif
+
+ let l:node = b:NERDTree.root.reveal(l:pathObj)
+ call b:NERDTree.render()
+ call l:node.putCursorHere(1, 0)
+endfunction
+
+"FUNCTION: s:handleLeftClick() {{{1
+"Checks if the click should open the current node
+function! s:handleLeftClick()
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+ if currentNode != {}
+
+ "the dir arrows are multibyte chars, and vim's string functions only
+ "deal with single bytes - so split the line up with the hack below and
+ "take the line substring manually
+ let line = split(getline(line(".")), '\zs')
+ let startToCur = ""
+ for i in range(0,len(line)-1)
+ let startToCur .= line[i]
+ endfor
+
+ if currentNode.path.isDirectory
+ if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$'
+ call currentNode.activate()
+ return
+ endif
+ endif
+
+ if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
+ let char = strpart(startToCur, strlen(startToCur)-1, 1)
+ if char !~# g:NERDTreeUI.MarkupReg()
+ if currentNode.path.isDirectory
+ call currentNode.activate()
+ else
+ call currentNode.activate({'reuse': 'all', 'where': 'p'})
+ endif
+ return
+ endif
+ endif
+ endif
+endfunction
+
+" FUNCTION: s:handleMiddleMouse() {{{1
+function! s:handleMiddleMouse()
+
+ " A middle mouse click does not automatically position the cursor as one
+ " would expect. Forcing the execution of a regular left mouse click here
+ " fixes this problem.
+ execute "normal! \<LeftMouse>"
+
+ let l:currentNode = g:NERDTreeFileNode.GetSelected()
+ if empty(l:currentNode)
+ call nerdtree#echoError('use the pointer to select a node')
+ return
+ endif
+
+ if l:currentNode.path.isDirectory
+ call l:currentNode.openExplorer()
+ else
+ call l:currentNode.open({'where': 'h'})
+ endif
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1
+"this is needed since I cant figure out how to invoke dict functions from a
+"key map
+function! nerdtree#ui_glue#invokeKeyMap(key)
+ call g:NERDTreeKeyMap.Invoke(a:key)
+endfunction
+
+" FUNCTION: s:jumpToFirstChild(node) {{{1
+function! s:jumpToFirstChild(node)
+ call s:jumpToChild(a:node, 0)
+endfunction
+
+" FUNCTION: s:jumpToLastChild(node) {{{1
+function! s:jumpToLastChild(node)
+ call s:jumpToChild(a:node, 1)
+endfunction
+
+" FUNCTION: s:jumpToChild(node, last) {{{2
+" Jump to the first or last child node at the same file system level.
+"
+" Args:
+" node: the node on which the cursor currently sits
+" last: 1 (true) if jumping to last child, 0 (false) if jumping to first
+function! s:jumpToChild(node, last)
+ let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
+
+ if l:node.isRoot()
+ return
+ endif
+
+ let l:parent = l:node.parent
+ let l:children = l:parent.getVisibleChildren()
+
+ let l:target = a:last ? l:children[len(l:children) - 1] : l:children[0]
+
+ call l:target.putCursorHere(1, 0)
+ call b:NERDTree.ui.centerView()
+endfunction
+
+" FUNCTION: s:jumpToParent(node) {{{1
+" Move the cursor to the parent of the specified node. For a cascade, move to
+" the parent of the cascade's first node. At the root node, do nothing.
+function! s:jumpToParent(node)
+ let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
+
+ if l:node.isRoot()
+ return
+ endif
+
+ if empty(l:node.parent)
+ call nerdtree#echo('could not jump to parent node')
+ return
+ endif
+
+ call l:node.parent.putCursorHere(1, 0)
+ call b:NERDTree.ui.centerView()
+endfunction
+
+" FUNCTION: s:jumpToRoot() {{{1
+" moves the cursor to the root node
+function! s:jumpToRoot()
+ call b:NERDTree.root.putCursorHere(1, 0)
+ call b:NERDTree.ui.centerView()
+endfunction
+
+" FUNCTION: s:jumpToNextSibling(node) {{{1
+function! s:jumpToNextSibling(node)
+ call s:jumpToSibling(a:node, 1)
+endfunction
+
+" FUNCTION: s:jumpToPrevSibling(node) {{{1
+function! s:jumpToPrevSibling(node)
+ call s:jumpToSibling(a:node, 0)
+endfunction
+
+" FUNCTION: s:jumpToSibling(node, forward) {{{2
+" Move the cursor to the next or previous node at the same file system level.
+"
+" Args:
+" node: the node on which the cursor currently sits
+" forward: 0 to jump to previous sibling, 1 to jump to next sibling
+function! s:jumpToSibling(node, forward)
+ let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
+ let l:sibling = l:node.findSibling(a:forward)
+
+ if empty(l:sibling)
+ return
+ endif
+
+ call l:sibling.putCursorHere(1, 0)
+ call b:NERDTree.ui.centerView()
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
+" Open the Bookmark that has the specified name. This function provides the
+" implementation for the ":OpenBookmark" command.
+function! nerdtree#ui_glue#openBookmark(name)
+ try
+ let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
+ catch /^NERDTree.BookmarkNotFoundError/
+ call nerdtree#echoError('bookmark "' . a:name . '" not found')
+ return
+ endtry
+ if l:bookmark.path.isDirectory
+ call l:bookmark.open(b:NERDTree)
+ else
+ call l:bookmark.open(b:NERDTree, {'where': 'p'})
+ endif
+endfunction
+
+" FUNCTION: s:openHSplit(target) {{{1
+function! s:openHSplit(target)
+ call a:target.activate({'where': 'h'})
+endfunction
+
+" FUNCTION: s:openVSplit(target) {{{1
+function! s:openVSplit(target)
+ call a:target.activate({'where': 'v'})
+endfunction
+
+" FUNCTION: s:openExplorer(node) {{{1
+function! s:openExplorer(node)
+ call a:node.openExplorer()
+endfunction
+
+" FUNCTION: s:openInNewTab(target) {{{1
+function! s:openInNewTab(target)
+ let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
+ call l:opener.open(a:target)
+endfunction
+
+" FUNCTION: s:openInNewTabSilent(target) {{{1
+function! s:openInNewTabSilent(target)
+ let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
+ call l:opener.open(a:target)
+endfunction
+
+" FUNCTION: s:openNodeRecursively(node) {{{1
+function! s:openNodeRecursively(node)
+ call nerdtree#echo("Recursively opening node. Please wait...")
+ call a:node.openRecursively()
+ call b:NERDTree.render()
+ redraw
+ call nerdtree#echo("Recursively opening node. Please wait... DONE")
+endfunction
+
+"FUNCTION: s:previewNodeCurrent(node) {{{1
+function! s:previewNodeCurrent(node)
+ call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1})
+endfunction
+
+"FUNCTION: s:previewNodeHSplit(node) {{{1
+function! s:previewNodeHSplit(node)
+ call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1})
+endfunction
+
+"FUNCTION: s:previewNodeVSplit(node) {{{1
+function! s:previewNodeVSplit(node)
+ call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1})
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1
+" put the cursor on the node associate with the given name
+function! nerdtree#ui_glue#revealBookmark(name)
+ try
+ let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
+ call targetNode.putCursorHere(0, 1)
+ catch /^NERDTree.BookmarkNotFoundError/
+ call nerdtree#echo("Bookmark isnt cached under the current root")
+ endtry
+endfunction
+
+" FUNCTION: s:refreshRoot() {{{1
+" Reloads the current root. All nodes below this will be lost and the root dir
+" will be reloaded.
+function! s:refreshRoot()
+ if !g:NERDTree.IsOpen()
+ return
+ endif
+ call nerdtree#echo("Refreshing the root node. This could take a while...")
+
+ let l:curWin = winnr()
+ call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
+ call b:NERDTree.root.refresh()
+ call b:NERDTree.render()
+ redraw
+ call nerdtree#exec(l:curWin . "wincmd w")
+ call nerdtree#echo("Refreshing the root node. This could take a while... DONE")
+endfunction
+
+" FUNCTION: s:refreshCurrent(node) {{{1
+" refreshes the root for the current node
+function! s:refreshCurrent(node)
+ let node = a:node
+ if !node.path.isDirectory
+ let node = node.parent
+ endif
+
+ call nerdtree#echo("Refreshing node. This could take a while...")
+ call node.refresh()
+ call b:NERDTree.render()
+ redraw
+ call nerdtree#echo("Refreshing node. This could take a while... DONE")
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1
+function! nerdtree#ui_glue#setupCommands()
+ command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
+ command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
+ command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
+ command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
+ command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
+ command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
+ command! -n=0 -bar NERDTreeRefreshRoot call s:refreshRoot()
+ command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
+ command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
+endfunction
+
+" Function: s:SID() {{{1
+function s:SID()
+ if !exists("s:sid")
+ let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
+ endif
+ return s:sid
+endfun
+
+" FUNCTION: s:showMenu(node) {{{1
+function! s:showMenu(node)
+ let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled())
+ call mc.showMenu()
+endfunction
+
+" FUNCTION: s:toggleIgnoreFilter() {{{1
+function! s:toggleIgnoreFilter()
+ call b:NERDTree.ui.toggleIgnoreFilter()
+endfunction
+
+" FUNCTION: s:toggleShowBookmarks() {{{1
+function! s:toggleShowBookmarks()
+ call b:NERDTree.ui.toggleShowBookmarks()
+endfunction
+
+" FUNCTION: s:toggleShowFiles() {{{1
+function! s:toggleShowFiles()
+ call b:NERDTree.ui.toggleShowFiles()
+endfunction
+
+" FUNCTION: s:toggleShowHidden() {{{1
+" toggles the display of hidden files
+function! s:toggleShowHidden()
+ call b:NERDTree.ui.toggleShowHidden()
+endfunction
+
+" FUNCTION: s:toggleZoom() {{{1
+function! s:toggleZoom()
+ call b:NERDTree.ui.toggleZoom()
+endfunction
+
+" FUNCTION: nerdtree#ui_glue#upDir(preserveState) {{{1
+" Move the NERDTree up one level.
+"
+" Args:
+" preserveState: if 1, the current root is left open when the new tree is
+" rendered; if 0, the current root node is closed
+function! nerdtree#ui_glue#upDir(preserveState)
+
+ try
+ call b:NERDTree.root.cacheParent()
+ catch /^NERDTree.CannotCacheParentError/
+ call nerdtree#echo('already at root directory')
+ return
+ endtry
+
+ let l:oldRoot = b:NERDTree.root
+ let l:newRoot = b:NERDTree.root.parent
+
+ call l:newRoot.open()
+ call l:newRoot.transplantChild(l:oldRoot)
+
+ if !a:preserveState
+ call l:oldRoot.close()
+ endif
+
+ call b:NERDTree.changeRoot(l:newRoot)
+ call l:oldRoot.putCursorHere(0, 0)
+endfunction
+
+" FUNCTION: s:upDirCurrentRootOpen() {{{1
+function! s:upDirCurrentRootOpen()
+ call nerdtree#ui_glue#upDir(1)
+endfunction
+
+" FUNCTION: s:upDirCurrentRootClosed() {{{1
+function! s:upDirCurrentRootClosed()
+ call nerdtree#ui_glue#upDir(0)
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/doc/NERDTree.txt b/vim/.vim/plugged/nerdtree/doc/NERDTree.txt
new file mode 100644
index 0000000..b86cdf1
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/doc/NERDTree.txt
@@ -0,0 +1,1392 @@
+*NERDTree.txt* A tree explorer plugin to rule the Vim world. Bwahahaha!!
+
+ # #### #### ~
+ ### \/#|### |/#### ~
+ d8 888 ##\/#/ \||/##/_/##/_# ~
+ d88 888 ee ,e e, ### \/###|/ \/ # ### ~
+ d88888 888 88b d88 88b ##_\_#\_\## | #/###_/_#### ~
+ 888 888 888 888 , ## #### # \ #| / #### ##/## ~
+ 888 888 888 "YeeP" __#_--###`. |{,###---###-~ ~
+ \ % @% ~
+ Y88b Y88 888'Y88 888 88e 888 88e \%@% 88P'888'Y88 ~
+ Y88b Y8 888 ,'Y 888 888D 888 888b %o% P' 888 'Y 888,8, ,e e, ,e e, ~
+ b Y88b Y 888C8 888 88" 888 8888D %@% 888 888 " d88 88b d88 88b ~
+ 8b Y88b 888 ",d 888 b, 888 888P %@% 888 888 888 , 888 , ~
+ 88b Y88b 888,d88 888 88b, 888 88" %@% 888 888 "YeeP" "YeeP" ~
+ , -=-%{@%-^- _ ~
+ ejm `} Reference Manual ~
+ { ~
+==============================================================================
+CONTENTS *NERDTree-contents*
+
+ 1.Intro...................................|NERDTree|
+ 2.Functionality provided..................|NERDTreeFunctionality|
+ 2.1.Global commands...................|NERDTreeGlobalCommands|
+ 2.2.Bookmarks.........................|NERDTreeBookmarks|
+ 2.2.1.The bookmark table..........|NERDTreeBookmarkTable|
+ 2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
+ 2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
+ 2.3.NERD tree mappings................|NERDTreeMappings|
+ 2.4.The NERD tree menu................|NERDTreeMenu|
+ 3.Settings................................|NERDTreeSettings|
+ 3.1.Settings summary..................|NERDTreeSettingsSummary|
+ 3.2.Settings details..................|NERDTreeSettingsDetails|
+ 4.The NERD tree API.......................|NERDTreeAPI|
+ 4.1.Key map API.......................|NERDTreeKeymapAPI|
+ 4.2.Menu API..........................|NERDTreeMenuAPI|
+ 4.3.Menu API..........................|NERDTreeAddPathFilter()|
+ 4.4.Path Listener API.................|NERDTreePathListenerAPI|
+ 5.About...................................|NERDTreeAbout|
+ 6.License.................................|NERDTreeLicense|
+
+==============================================================================
+1. Intro *NERDTree*
+
+What is this "NERD tree"??
+
+The NERD tree allows you to explore your filesystem and to open files and
+directories. It presents the filesystem to you in the form of a tree which you
+manipulate with the keyboard and/or mouse. It also allows you to perform
+simple filesystem operations.
+
+The following features and functionality are provided by the NERD tree:
+ * Files and directories are displayed in a hierarchical tree structure
+ * Different highlighting is provided for the following types of nodes:
+ * files
+ * directories
+ * sym-links
+ * windows .lnk files
+ * read-only files
+ * executable files
+ * Many (customisable) mappings are provided to manipulate the tree:
+ * Mappings to open/close/explore directory nodes
+ * Mappings to open files in new/existing windows/tabs
+ * Mappings to change the current root of the tree
+ * Mappings to navigate around the tree
+ * ...
+ * Directories and files can be bookmarked.
+ * Most NERD tree navigation can also be done with the mouse
+ * Filtering of tree content (can be toggled at runtime)
+ * custom file filters to prevent e.g. vim backup files being displayed
+ * optional displaying of hidden files (. files)
+ * files can be "turned off" so that only directories are displayed
+ * The position and size of the NERD tree window can be customised
+ * The order in which the nodes in the tree are listed can be customised.
+ * A model of your filesystem is created/maintained as you explore it. This
+ has several advantages:
+ * All filesystem information is cached and is only re-read on demand
+ * If you revisit a part of the tree that you left earlier in your
+ session, the directory nodes will be opened/closed as you left them
+ * The script remembers the cursor position and window position in the NERD
+ tree so you can toggle it off (or just close the tree window) and then
+ reopen it (with NERDTreeToggle) the NERD tree window will appear exactly
+ as you left it
+ * You can have a separate NERD tree for each tab, share trees across tabs,
+ or a mix of both.
+ * By default the script overrides the default file browser (netrw), so if
+ you :edit a directory a (slightly modified) NERD tree will appear in the
+ current window
+ * A programmable menu system is provided (simulates right clicking on a
+ node)
+ * one default menu plugin is provided to perform basic filesystem
+ operations (create/delete/move/copy files/directories)
+ * There's an API for adding your own keymappings
+
+
+==============================================================================
+2. Functionality provided *NERDTreeFunctionality*
+
+------------------------------------------------------------------------------
+2.1. Global Commands *NERDTreeGlobalCommands*
+
+:NERDTree [<start-directory> | <bookmark>] *:NERDTree*
+ Opens a fresh NERD tree. The root of the tree depends on the argument
+ given. There are 3 cases: If no argument is given, the current directory
+ will be used. If a directory is given, that will be used. If a bookmark
+ name is given, the corresponding directory will be used. For example: >
+ :NERDTree /home/marty/vim7/src
+ :NERDTree foo (foo is the name of a bookmark)
+<
+:NERDTreeVCS [<start-directory> | <bookmark>] *:NERDTreeVCS*
+ Like |:NERDTree|, but searches up the directory tree to find the top of
+ the version control system repository, and roots the NERD tree there. It
+ works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
+ couple of examples: >
+ :NERDTreeVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
+ :NERDTreeVCS (opens root of repository containing CWD)
+<
+:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
+ Opens a fresh NERD tree with the root initialized to the dir for
+ <bookmark>. The only reason to use this command over :NERDTree is for
+ the completion (which is for bookmarks rather than directories).
+
+:NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle*
+ If a NERD tree already exists for this tab, it is reopened and rendered
+ again. If no NERD tree exists for this tab then this command acts the
+ same as the |:NERDTree| command.
+
+:NERDTreeFocus *:NERDTreeFocus*
+ Opens (or reopens) the NERD Tree if it is not currently visible;
+ otherwise, the cursor is moved to the already-open NERD Tree.
+
+:NERDTreeMirror *:NERDTreeMirror*
+ Shares an existing NERD tree, from another tab, in the current tab.
+ Changes made to one tree are reflected in both as they are actually the
+ same buffer.
+
+ If only one other NERD tree exists, that tree is automatically mirrored.
+ If more than one exists, the script will ask which tree to mirror.
+
+:NERDTreeClose *:NERDTreeClose*
+ Close the NERD tree in this tab.
+
+:NERDTreeFind [<path>] *:NERDTreeFind*
+ Without the optional argument, find and reveal the file for the active
+ buffer in the NERDTree window. With the <path> argument, find and
+ reveal the specified path.
+
+ Focus will be shifted to the NERDTree window, and the cursor will be
+ placed on the tree node for the determined path. If a NERDTree for the
+ current tab does not exist, a new one will be initialized.
+
+:NERDTreeCWD *:NERDTreeCWD*
+ Change the NERDTree root to the current working directory. If no
+ NERDTree exists for this tab, a new one is opened.
+
+:NERDTreeRefreshRoot *:NERDTreeRefreshRoot*
+ Refreshes the NERD tree root node.
+
+------------------------------------------------------------------------------
+2.2. Bookmarks *NERDTreeBookmarks*
+
+Bookmarks in the NERD tree are a way to tag files or directories of interest.
+For example, you could use bookmarks to tag all of your project directories.
+
+------------------------------------------------------------------------------
+2.2.1. The Bookmark Table *NERDTreeBookmarkTable*
+
+If the bookmark table is active (see |NERDTree-B| and
+|NERDTreeShowBookmarks|), it will be rendered above the tree. You can double
+click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
+|NERDTree-t| and |NERDTree-T|
+
+------------------------------------------------------------------------------
+2.2.2. Bookmark commands *NERDTreeBookmarkCommands*
+
+Note: The following commands are only available within the NERDTree buffer.
+
+:Bookmark [<name>]
+ Bookmark the current node as <name>. If there is already a <name>
+ bookmark, it is overwritten. <name> must not contain spaces.
+ If <name> is not provided, it defaults to the file or directory name.
+ For directories, a trailing slash is present.
+
+:BookmarkToRoot <bookmark>
+ Make the directory corresponding to <bookmark> the new root. If a treenode
+ corresponding to <bookmark> is already cached somewhere in the tree then
+ the current tree will be used, otherwise a fresh tree will be opened.
+ Note that if <bookmark> points to a file then its parent will be used
+ instead.
+
+:RevealBookmark <bookmark>
+ If the node is cached under the current root then it will be revealed
+ (i.e. directory nodes above it will be opened) and the cursor will be
+ placed on it.
+
+:OpenBookmark <name>
+ The Bookmark named <name> is opened as if |NERDTree-o| was applied to
+ its entry in the Bookmark table. If the Bookmark points to a directory,
+ it is made the new root of the current NERDTree. If the Bookmark points
+ to a file, that file is opened for editing in another window.
+
+:ClearBookmarks [<bookmarks>]
+ Remove all the given bookmarks. If no bookmarks are given then remove all
+ bookmarks on the current node.
+
+:ClearAllBookmarks
+ Remove all bookmarks.
+
+:ReadBookmarks
+ Re-read the bookmarks in the |NERDTreeBookmarksFile|.
+
+See also |:NERDTree| and |:NERDTreeFromBookmark|.
+
+------------------------------------------------------------------------------
+2.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks*
+
+If invalid bookmarks are detected, the script will issue an error message and
+the invalid bookmarks will become unavailable for use.
+
+These bookmarks will still be stored in the bookmarks file (see
+|NERDTreeBookmarksFile|), down the bottom. There will always be a blank line
+after the valid bookmarks but before the invalid ones.
+
+Each line in the bookmarks file represents one bookmark. The proper format is:
+<bookmark name><space><full path to the bookmark location>
+
+After you have corrected any invalid bookmarks, either restart vim, or go
+:ReadBookmarks from the NERD tree window.
+
+------------------------------------------------------------------------------
+2.3. NERD tree Mappings *NERDTreeMappings*
+
+Default~
+Key Description help-tag~
+
+o........Open files, directories and bookmarks......................|NERDTree-o|
+go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
+t........Open selected node/bookmark in a new tab...................|NERDTree-t|
+T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
+i........Open selected file in a split window.......................|NERDTree-i|
+gi.......Same as i, but leave the cursor on the NERDTree...........|NERDTree-gi|
+s........Open selected file in a new vsplit.........................|NERDTree-s|
+gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs|
+O........Recursively open the selected directory....................|NERDTree-O|
+x........Close the current nodes parent.............................|NERDTree-x|
+X........Recursively close all children of the current node.........|NERDTree-X|
+e........Edit the current dir.......................................|NERDTree-e|
+
+<CR>............same as |NERDTree-o|.
+double-click....same as |NERDTree-o|.
+middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs.
+
+D........Delete the current bookmark ...............................|NERDTree-D|
+
+P........Jump to the root node......................................|NERDTree-P|
+p........Jump to current nodes parent...............................|NERDTree-p|
+K........Jump up inside directories at the current tree depth.......|NERDTree-K|
+J........Jump down inside directories at the current tree depth.....|NERDTree-J|
+<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
+<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
+
+C........Change the tree root to the selected dir...................|NERDTree-C|
+u........Move the tree root up one directory........................|NERDTree-u|
+U........Same as 'u' except the old root node is left open..........|NERDTree-U|
+r........Recursively refresh the current directory..................|NERDTree-r|
+R........Recursively refresh the current root.......................|NERDTree-R|
+m........Display the NERD tree menu.................................|NERDTree-m|
+cd.......Change the CWD to the dir of the selected node............|NERDTree-cd|
+CD.......Change tree root to the CWD...............................|NERDTree-CD|
+
+I........Toggle whether hidden files displayed......................|NERDTree-I|
+f........Toggle whether the file filters are used...................|NERDTree-f|
+F........Toggle whether files are displayed.........................|NERDTree-F|
+B........Toggle whether the bookmark table is displayed.............|NERDTree-B|
+
+q........Close the NERDTree window..................................|NERDTree-q|
+A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A|
+?........Toggle the display of the quick help.......................|NERDTree-?|
+
+------------------------------------------------------------------------------
+ *NERDTree-o*
+Default key: o
+Map setting: NERDTreeMapActivateNode
+Applies to: files and directories.
+
+If a file node is selected, it is opened in the previous window.
+
+If a directory is selected it is opened or closed depending on its current
+state.
+
+If a bookmark that links to a directory is selected then that directory
+becomes the new root.
+
+If a bookmark that links to a file is selected then that file is opened in the
+previous window.
+
+------------------------------------------------------------------------------
+ *NERDTree-go*
+Default key: go
+Map setting: NERDTreeMapPreview
+Applies to: files.
+
+If a file node is selected, it is opened in the previous window, but the
+cursor does not move.
+
+The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
+|NERDTree-o|).
+
+------------------------------------------------------------------------------
+ *NERDTree-t*
+Default key: t
+Map setting: NERDTreeMapOpenInTab
+Applies to: files and directories.
+
+Opens the selected file in a new tab. If a directory is selected, a fresh
+NERD Tree for that directory is opened in a new tab.
+
+If a bookmark which points to a directory is selected, open a NERD tree for
+that directory in a new tab. If the bookmark points to a file, open that file
+in a new tab.
+
+------------------------------------------------------------------------------
+ *NERDTree-T*
+Default key: T
+Map setting: NERDTreeMapOpenInTabSilent
+Applies to: files and directories.
+
+The same as |NERDTree-t| except that the focus is kept in the current tab.
+
+------------------------------------------------------------------------------
+ *NERDTree-i*
+Default key: i
+Map setting: NERDTreeMapOpenSplit
+Applies to: files.
+
+Opens the selected file in a new split window and puts the cursor in the new
+window.
+
+------------------------------------------------------------------------------
+ *NERDTree-gi*
+Default key: gi
+Map setting: NERDTreeMapPreviewSplit
+Applies to: files.
+
+The same as |NERDTree-i| except that the cursor is not moved.
+
+The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
+|NERDTree-i|).
+
+------------------------------------------------------------------------------
+ *NERDTree-s*
+Default key: s
+Map setting: NERDTreeMapOpenVSplit
+Applies to: files.
+
+Opens the selected file in a new vertically split window and puts the cursor
+in the new window.
+
+------------------------------------------------------------------------------
+ *NERDTree-gs*
+Default key: gs
+Map setting: NERDTreeMapPreviewVSplit
+Applies to: files.
+
+The same as |NERDTree-s| except that the cursor is not moved.
+
+The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see
+|NERDTree-s|).
+
+------------------------------------------------------------------------------
+ *NERDTree-O*
+Default key: O
+Map setting: NERDTreeMapOpenRecursively
+Applies to: directories.
+
+Recursively opens the selected directory.
+
+All files and directories are cached, but if a directory would not be
+displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the
+hidden file filter (see |NERDTreeShowHidden|) then its contents are not
+cached. This is handy, especially if you have .svn directories.
+
+------------------------------------------------------------------------------
+ *NERDTree-x*
+Default key: x
+Map setting: NERDTreeMapCloseDir
+Applies to: files and directories.
+
+Closes the parent of the selected node.
+
+------------------------------------------------------------------------------
+ *NERDTree-X*
+Default key: X
+Map setting: NERDTreeMapCloseChildren
+Applies to: directories.
+
+Recursively closes all children of the selected directory.
+
+Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping.
+
+------------------------------------------------------------------------------
+ *NERDTree-e*
+Default key: e
+Map setting: NERDTreeMapOpenExpl
+Applies to: files and directories.
+
+|:edit|s the selected directory, or the selected file's directory. This could
+result in a NERD tree or a netrw being opened, depending on
+|NERDTreeHijackNetrw|.
+
+------------------------------------------------------------------------------
+ *NERDTree-D*
+Default key: D
+Map setting: NERDTreeMapDeleteBookmark
+Applies to: lines in the bookmarks table
+
+Deletes the currently selected bookmark.
+
+------------------------------------------------------------------------------
+ *NERDTree-P*
+Default key: P
+Map setting: NERDTreeMapJumpRoot
+Applies to: no restrictions.
+
+Jump to the tree root.
+
+------------------------------------------------------------------------------
+ *NERDTree-p*
+Default key: p
+Map setting: NERDTreeMapJumpParent
+Applies to: files and directories.
+
+Jump to the parent node of the selected node.
+
+------------------------------------------------------------------------------
+ *NERDTree-K*
+Default key: K
+Map setting: NERDTreeMapJumpFirstChild
+Applies to: files and directories.
+
+Jump to the first child of the current nodes parent.
+
+If the cursor is already on the first node then do the following:
+ * loop back thru the siblings of the current nodes parent until we find an
+ open dir with children
+ * go to the first child of that node
+
+------------------------------------------------------------------------------
+ *NERDTree-J*
+Default key: J
+Map setting: NERDTreeMapJumpLastChild
+Applies to: files and directories.
+
+Jump to the last child of the current nodes parent.
+
+If the cursor is already on the last node then do the following:
+ * loop forward thru the siblings of the current nodes parent until we find
+ an open dir with children
+ * go to the last child of that node
+
+------------------------------------------------------------------------------
+ *NERDTree-C-J*
+Default key: <C-J>
+Map setting: NERDTreeMapJumpNextSibling
+Applies to: files and directories.
+
+Jump to the next sibling of the selected node.
+
+------------------------------------------------------------------------------
+ *NERDTree-C-K*
+Default key: <C-K>
+Map setting: NERDTreeMapJumpPrevSibling
+Applies to: files and directories.
+
+Jump to the previous sibling of the selected node.
+
+------------------------------------------------------------------------------
+ *NERDTree-C*
+Default key: C
+Map setting: NERDTreeMapChangeRoot
+Applies to: files and directories.
+
+Make the selected directory node the new tree root. If a file is selected, its
+parent is used.
+
+------------------------------------------------------------------------------
+ *NERDTree-u*
+Default key: u
+Map setting: NERDTreeMapUpdir
+Applies to: no restrictions.
+
+Move the tree root up a dir (like doing a "cd ..").
+
+------------------------------------------------------------------------------
+ *NERDTree-U*
+Default key: U
+Map setting: NERDTreeMapUpdirKeepOpen
+Applies to: no restrictions.
+
+Like |NERDTree-u| except that the old tree root is kept open.
+
+------------------------------------------------------------------------------
+ *NERDTree-r*
+Default key: r
+Map setting: NERDTreeMapRefresh
+Applies to: files and directories.
+
+If a dir is selected, recursively refresh that dir, i.e. scan the filesystem
+for changes and represent them in the tree.
+
+If a file node is selected then the above is done on it's parent.
+
+------------------------------------------------------------------------------
+ *NERDTree-R*
+Default key: R
+Map setting: NERDTreeMapRefreshRoot
+Applies to: no restrictions.
+
+Recursively refresh the tree root.
+
+------------------------------------------------------------------------------
+ *NERDTree-m*
+Default key: m
+Map setting: NERDTreeMapMenu
+Applies to: files and directories.
+
+Display the NERD tree menu. See |NERDTreeMenu| for details.
+
+------------------------------------------------------------------------------
+ *NERDTree-cd*
+Default key: cd
+Map setting: NERDTreeMapChdir
+Applies to: files and directories.
+
+Change Vim's current working directory to that of the selected node.
+
+------------------------------------------------------------------------------
+ *NERDTree-CD*
+Default key: CD
+Map setting: NERDTreeMapCWD
+Applies to: no restrictions.
+
+Change the NERDTree root to Vim's current working directory.
+
+------------------------------------------------------------------------------
+ *NERDTree-I*
+Default key: I
+Map setting: NERDTreeMapToggleHidden
+Applies to: no restrictions.
+
+Toggles whether hidden files (i.e. "dot files") are displayed.
+
+------------------------------------------------------------------------------
+ *NERDTree-f*
+Default key: f
+Map setting: NERDTreeMapToggleFilters
+Applies to: no restrictions.
+
+Toggles whether file filters are used. See |NERDTreeIgnore| for details.
+
+------------------------------------------------------------------------------
+ *NERDTree-F*
+Default key: F
+Map setting: NERDTreeMapToggleFiles
+Applies to: no restrictions.
+
+Toggles whether file nodes are displayed.
+
+------------------------------------------------------------------------------
+ *NERDTree-B*
+Default key: B
+Map setting: NERDTreeMapToggleBookmarks
+Applies to: no restrictions.
+
+Toggles whether the bookmarks table is displayed.
+
+------------------------------------------------------------------------------
+ *NERDTree-q*
+Default key: q
+Map setting: NERDTreeMapQuit
+Applies to: no restrictions.
+
+Closes the NERDTree window.
+
+------------------------------------------------------------------------------
+ *NERDTree-A*
+Default key: A
+Map setting: NERDTreeMapToggleZoom
+Applies to: no restrictions.
+
+Maximize (zoom) and minimize the NERDTree window.
+
+------------------------------------------------------------------------------
+ *NERDTree-?*
+Default key: ?
+Map setting: NERDTreeMapHelp
+Applies to: no restrictions.
+
+Toggles whether the quickhelp is displayed.
+
+------------------------------------------------------------------------------
+2.3. The NERD tree menu *NERDTreeMenu*
+
+The NERD tree has a menu that can be programmed via the an API (see
+|NERDTreeMenuAPI|). The idea is to simulate the "right click" menus that most
+file explorers have.
+
+The script comes with two default menu plugins: exec_menuitem.vim and
+fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
+creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
+menu item to execute executable files.
+
+Related tags: |NERDTree-m| |NERDTreeApi|
+
+------------------------------------------------------------------------------
+ *NERDTreeMenu-j*
+Default key: j
+Map option: NERDTreeMenuDown
+Applies to: The NERD tree menu.
+
+Moves the cursor down.
+
+------------------------------------------------------------------------------
+ *NERDTreeMenu-k*
+Default key: k
+Map option: NERDTreeMenuUp
+Applies to: The NERD tree menu.
+
+Moves the cursor up.
+
+==============================================================================
+3. Customisation *NERDTreeSettings*
+
+
+------------------------------------------------------------------------------
+3.1. Customisation summary *NERDTreeSettingsSummary*
+
+The plugin provides the following settings that can customise the behaviour
+the NERD tree. These settings should be set in your vimrc, using `:let`.
+
+|loaded_nerd_tree| Turns off the script.
+
+|NERDTreeAutoCenter| Controls whether the NERD tree window centers
+ when the cursor moves within a specified
+ distance to the top/bottom of the window.
+
+|NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering.
+
+|NERDTreeCaseSensitiveSort| Tells the NERD tree whether to be case
+ sensitive or not when sorting nodes.
+
+|NERDTreeNaturalSort| Tells the NERD tree whether to use natural sort
+ order or not when sorting nodes.
+
+|NERDTreeSortHiddenFirst| Tells the NERD tree whether to take the dot at
+ the beginning of the hidden file names into
+ account when sorting nodes.
+
+|NERDTreeChDirMode| Tells the NERD tree if/when it should change
+ vim's current working directory.
+
+|NERDTreeHighlightCursorline| Tell the NERD tree whether to highlight the
+ current cursor line.
+
+|NERDTreeHijackNetrw| Tell the NERD tree whether to replace the netrw
+ autocommands for exploring local directories.
+
+|NERDTreeIgnore| Tells the NERD tree which files to ignore.
+
+|NERDTreeRespectWildIgnore| Tells the NERD tree to respect `'wildignore'`.
+
+|NERDTreeBookmarksFile| Where the bookmarks are stored.
+
+|NERDTreeBookmarksSort| Control how the Bookmark table is sorted.
+
+|NERDTreeMarkBookmarks| Render bookmarked nodes with markers.
+
+|NERDTreeMouseMode| Manage the interpretation of mouse clicks.
+
+|NERDTreeQuitOnOpen| Closes the tree window after opening a file.
+
+|NERDTreeShowBookmarks| Tells the NERD tree whether to display the
+ bookmarks table on startup.
+
+|NERDTreeShowFiles| Tells the NERD tree whether to display files in
+ the tree on startup.
+
+|NERDTreeShowHidden| Tells the NERD tree whether to display hidden
+ files on startup.
+
+|NERDTreeShowLineNumbers| Tells the NERD tree whether to display line
+ numbers in the tree window.
+
+|NERDTreeSortOrder| Tell the NERD tree how to sort the nodes in the
+ tree.
+
+|NERDTreeStatusline| Set a statusline for NERD tree windows.
+
+|NERDTreeWinPos| Tells the script where to put the NERD tree
+ window.
+
+|NERDTreeWinSize| Sets the window size when the NERD tree is
+ opened.
+
+|NERDTreeMinimalUI| Disables display of the 'Bookmarks' label and
+ 'Press ? for help' text.
+
+|NERDTreeCascadeSingleChildDir|
+ Collapses on the same line directories that have
+ only one child directory.
+
+|NERDTreeCascadeOpenSingleChildDir|
+ Cascade open while selected directory has only
+ one child that also is a directory.
+
+|NERDTreeAutoDeleteBuffer| Tells the NERD tree to automatically remove a
+ buffer when a file is being deleted or renamed
+ via a context menu command.
+
+|NERDTreeCreatePrefix| Specify a prefix to be used when creating the
+ NERDTree window.
+
+|NERDTreeRemoveFileCmd| Specify a custom shell command to be used when
+ deleting files. Note that it should include one
+ space character at the end of the command and it
+ applies only to files.
+
+|NERDTreeRemoveDirCmd| Specify a custom shell command to be used when
+ deleting directories. Note that it should
+ include one space character at the end of the
+ command and it applies only to directories.
+
+|NERDTreeNodeDelimiter| A single character that is used to separate the
+ file or directory name from the rest of the
+ characters on the line of text.
+
+------------------------------------------------------------------------------
+3.2. Customisation details *NERDTreeSettingsDetails*
+
+To enable any of the below settings you should put an appropriate >
+ let <setting>=<value>
+<line in your ~/.vimrc.
+
+ *loaded_nerd_tree*
+If this plugin is making you feel homicidal, it may be a good idea to turn it
+off with this line in your vimrc: >
+ let loaded_nerd_tree=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeAutoCenter*
+Values: 0 or 1.
+Default: 1
+
+If set to 1, the NERD tree window will center around the cursor if it moves to
+within |NERDTreeAutoCenterThreshold| lines of the top/bottom of the window.
+
+This is ONLY done in response to tree navigation mappings,
+i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
+|NERDTree-P|
+
+The centering is done with a |zz| operation.
+
+------------------------------------------------------------------------------
+ *NERDTreeAutoCenterThreshold*
+Values: Any natural number.
+Default: 3
+
+This setting controls the "sensitivity" of the NERD tree auto centering. See
+|NERDTreeAutoCenter| for details.
+
+------------------------------------------------------------------------------
+ *NERDTreeCaseSensitiveSort*
+Values: 0 or 1.
+Default: 0.
+
+By default the NERD tree does not sort nodes case sensitively, i.e. nodes
+could appear like this: >
+ bar.c
+ Baz.c
+ blarg.c
+ boner.c
+ Foo.c
+<
+But, if you set this setting to 1 then the case of the nodes will be taken
+into account. The above nodes would then be sorted like this: >
+ Baz.c
+ Foo.c
+ bar.c
+ blarg.c
+ boner.c
+<
+------------------------------------------------------------------------------
+ *NERDTreeNaturalSort*
+Values: 0 or 1.
+Default: 0.
+
+By default the NERD tree does not sort nodes in natural sort order, i.e. nodes
+could appear like this: >
+ z1.txt
+ z10.txt
+ z100.txt
+ z11.txt
+ z110.txt
+ z2.txt
+ z20.txt
+ z3.txt
+<
+But if you set this setting to 1 then the natural sort order will be used. The
+above nodes would then be sorted like this: >
+ z1.txt
+ z2.txt
+ z3.txt
+ z10.txt
+ z11.txt
+ z20.txt
+ z100.txt
+ z110.txt
+<
+------------------------------------------------------------------------------
+ *NERDTreeChDirMode*
+
+Values: 0, 1 or 2.
+Default: 0.
+
+Use this setting to tell the script when (if at all) to change the current
+working directory (CWD) for vim.
+
+If it is set to 0 then the CWD is never changed by the NERD tree.
+
+If set to 1 then the CWD is changed when the NERD tree is first loaded to the
+directory it is initialized in. For example, if you start the NERD tree with >
+ :NERDTree /home/marty/foobar
+<
+then the CWD will be changed to /home/marty/foobar and will not be changed
+again unless you init another NERD tree with a similar command.
+
+If the setting is set to 2 then it behaves the same as if set to 1 except that
+the CWD is changed whenever the tree root is changed. For example, if the CWD
+is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
+root then the CWD will become /home/marty/foobar/baz.
+
+------------------------------------------------------------------------------
+ *NERDTreeHighlightCursorline*
+Values: 0 or 1.
+Default: 1.
+
+If set to 1, the current cursor line in the NERD tree buffer will be
+highlighted. This is done using the `'cursorline'` Vim option.
+
+------------------------------------------------------------------------------
+ *NERDTreeHijackNetrw*
+Values: 0 or 1.
+Default: 1.
+
+If set to 1, doing a >
+ :edit <some directory>
+<
+will open up a window level NERD tree instead of a netrw in the target window.
+
+Window level trees behaves slightly different from a regular trees in the
+following respects:
+ 1. 'o' will open the selected file in the same window as the tree,
+ replacing it.
+ 2. you can have one tree per window - instead of per tab.
+
+------------------------------------------------------------------------------
+ *NERDTreeIgnore*
+Values: a list of regular expressions.
+Default: ['\~$'].
+
+This setting is used to specify which files the NERD tree should ignore. It
+must be a list of regular expressions. When the NERD tree is rendered, any
+files/dirs that match any of the regex's in NERDTreeIgnore won't be
+displayed.
+
+For example if you put the following line in your vimrc: >
+ let NERDTreeIgnore=['\.vim$', '\~$']
+<
+then all files ending in .vim or ~ will be ignored.
+
+There are 2 magic flags that can be appended to the end of each regular
+expression to specify that the regex should match only files or only dirs.
+These flags are "[[dir]]" and "[[file]]". Example: >
+ let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]']
+<
+This will cause all dirs ending in ".d" to be ignored and all files ending in
+".o" to be ignored.
+
+Note: to tell the NERD tree not to ignore any files you must use the following
+line: >
+ let NERDTreeIgnore=[]
+<
+
+The file filters can be turned on and off dynamically with the |NERDTree-f|
+mapping.
+
+------------------------------------------------------------------------------
+ *NERDTreeRespectWildIgnore*
+Values: 0 or 1.
+Default: 0.
+
+If set to 1, the `'wildignore'` setting is respected.
+
+------------------------------------------------------------------------------
+ *NERDTreeBookmarksFile*
+Values: a path
+Default: $HOME/.NERDTreeBookmarks
+
+This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
+
+------------------------------------------------------------------------------
+ *NERDTreeBookmarksSort*
+Values: 0, 1, or 2
+Default: 1
+
+This setting controls the method by which the list of user bookmarks is
+sorted. When sorted, bookmarks will render in alphabetical order by name.
+
+If set to 0, the bookmarks list is not sorted.
+If set to 1, the bookmarks list is sorted in a case-insensitive manner.
+If set to 2, the bookmarks list is sorted in a case-sensitive manner.
+
+------------------------------------------------------------------------------
+ *NERDTreeMarkBookmarks*
+Values: 0 or 1
+Default: 1
+
+If set to 1, Bookmarks will be specially marked whenever the NERDTree is
+rendered. Users of the |NERDTreeMinimalUI| setting may prefer to disable
+this setting for even less visual clutter.
+
+------------------------------------------------------------------------------
+ *NERDTreeMouseMode*
+Values: 1, 2 or 3.
+Default: 1.
+
+If set to 1 then a double click on a node is required to open it.
+If set to 2 then a single click will open directory nodes, while a double
+click will still be required for file nodes.
+If set to 3 then a single click will open any node.
+
+Note: a double click anywhere on a line that a tree node is on will
+activate it, but all single-click activations must be done on name of the node
+itself. For example, if you have the following node: >
+ | | |-application.rb
+<
+then (to single click activate it) you must click somewhere in
+'application.rb'.
+
+------------------------------------------------------------------------------
+ *NERDTreeQuitOnOpen*
+
+Values: 0 or 1.
+Default: 0
+
+If set to 1, the NERD tree window will close after opening a file with the
+|NERDTree-o|, |NERDTree-i|, |NERDTree-t| and |NERDTree-T| mappings.
+
+------------------------------------------------------------------------------
+ *NERDTreeShowBookmarks*
+Values: 0 or 1.
+Default: 0.
+
+If this setting is set to 1 then the bookmarks table will be displayed.
+
+This setting can be toggled dynamically, per tree, with the |NERDTree-B|
+mapping.
+
+------------------------------------------------------------------------------
+ *NERDTreeShowFiles*
+Values: 0 or 1.
+Default: 1.
+
+If this setting is set to 1 then files are displayed in the NERD tree. If it
+is set to 0 then only directories are displayed.
+
+This setting can be toggled dynamically, per tree, with the |NERDTree-F|
+mapping and is useful for drastically shrinking the tree when you are
+navigating to a different part of the tree.
+
+------------------------------------------------------------------------------
+ *NERDTreeShowHidden*
+Values: 0 or 1.
+Default: 0.
+
+This setting tells vim whether to display hidden files by default. This
+setting can be dynamically toggled, per tree, with the |NERDTree-I| mapping.
+Use one of the follow lines for this setting: >
+ let NERDTreeShowHidden=0
+ let NERDTreeShowHidden=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeShowLineNumbers*
+Values: 0 or 1.
+Default: 0.
+
+This setting tells vim whether to display line numbers for the NERD tree
+window. Use one of the follow lines for this setting: >
+ let NERDTreeShowLineNumbers=0
+ let NERDTreeShowLineNumbers=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeSortOrder*
+Values: a list of regular expressions.
+Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$']
+
+This setting is a list of regular expressions which are used to specify the
+order of nodes under their parent.
+
+For example, if the setting is: >
+ ['\.vim$', '\.c$', '\.h$', '*', 'foobar']
+<
+then all .vim files will be placed at the top, followed by all .c files then
+all .h files. All files containing the string 'foobar' will be placed at the
+end. The star is a special flag: it tells the script that every node that
+doesn't match any of the other regexps should be placed here.
+
+If no star is present in NERDTreeSortOrder then one is automatically
+appended to the array.
+
+The regex '\/$' should be used to match directory nodes.
+
+A special flag can be used to sort by the modification timestamps of files and
+directories. It is either '[[timestamp]]' for ascending, or '[[-timestamp]]'
+for descending. If placed at the beginning of the list, files and directories
+are sorted by timestamp, and then by the remaining items in the sort order
+list. If this flag is in any other position of the list, timestamp sorting is
+done secondarily. See examples 4, 5, and 6 below.
+
+After this sorting is done, the files in each group are sorted alphabetically.
+
+Examples: >
+ (1) ['*', '\/$']
+ (2) []
+ (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$']
+ (4) ['[[timestamp]]']
+ (5) ['\/$', '*', '[[-timestamp]]']
+ (6) ['\.md$', '\.c$', '[[-timestamp]]', '*']
+<
+1. Directories will appear last, everything else will appear above.
+2. Everything will simply appear in alphabetical order.
+3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
+ backup files will appear last with everything else preceding them.
+4. All files and directories are sorted by timestamp, oldest first. If any
+ files have identical timestamps, they are sorted alphabetically.
+5. Directories are first, newest to oldest, then everything else, newest to
+ oldest.
+6. Markdown files first, followed by C source files, then everything else.
+ Each group is shown newest to oldest.
+
+------------------------------------------------------------------------------
+ *NERDTreeStatusline*
+Values: Any valid `'statusline'` setting.
+Default: %{exists('b:NERDTree')?b:NERDTree.root.path.str():''}
+
+Defines the value for the `'statusline'` setting in NERDTree windows.
+
+Note: The setting is actually applied using |:let-&|, not |:set|, so
+escaping spaces is not necessary.
+
+Setting this to -1 will deactivate it so that your global `'statusline'`
+setting is used.
+
+------------------------------------------------------------------------------
+ *NERDTreeWinPos*
+Values: "left" or "right"
+Default: "left".
+
+This setting is used to determine where NERD tree window is placed on the
+screen.
+
+This setting makes it possible to use two different explorer plugins
+simultaneously. For example, you could have the taglist plugin on the left of
+the window and the NERD tree on the right.
+
+------------------------------------------------------------------------------
+ *NERDTreeWinSize*
+Values: a positive integer.
+Default: 31.
+
+This setting is used to change the size of the NERD tree when it is loaded.
+
+------------------------------------------------------------------------------
+ *NERDTreeMinimalUI*
+Values: 0 or 1
+Default: 0
+
+This setting disables the 'Bookmarks' label 'Press ? for help' text. Use one
+of the following lines for this setting: >
+ let NERDTreeMinimalUI=0
+ let NERDTreeMinimalUI=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeCascadeSingleChildDir*
+Values: 0 or 1
+Default: 1.
+
+When displaying dir nodes, this setting tells NERDTree to collapse dirs that
+have only one child. Use one of the following lines for this setting: >
+ let NERDTreeCascadeSingleChildDir=0
+ let NERDTreeCascadeSingleChildDir=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeCascadeOpenSingleChildDir*
+Values: 0 or 1
+Default: 1.
+
+When opening dir nodes, this setting tells NERDTree to recursively open dirs
+that have only one child which is also a dir. NERDTree will stop when it finds
+a dir that contains anything but another single dir. This setting also causes
+the |NERDTree-x| mapping to close dirs in the same manner. This setting may be
+useful for Java projects. Use one of the following lines for this setting: >
+ let NERDTreeCascadeOpenSingleChildDir=0
+ let NERDTreeCascadeOpenSingleChildDir=1
+<
+
+------------------------------------------------------------------------------
+ *NERDTreeAutoDeleteBuffer*
+Values: 0 or 1
+Default: 0.
+
+When using a context menu to delete or rename a file you may also want to
+delete the buffer which is no more valid. If the setting is not set you will
+see a confirmation if you really want to delete an old buffer. If you always
+press 'y' then it's worth it to set this setting to 1. Use one of the
+following lines for this setting: >
+ let NERDTreeAutoDeleteBuffer=0
+ let NERDTreeAutoDeleteBuffer=1
+<
+------------------------------------------------------------------------------
+ *NERDTreeCreatePrefix*
+Values: Any valid command prefix.
+Default: "silent".
+
+Internally, NERDTree uses the |:edit| command to create a buffer in which to
+display its tree view. You can augment this behavior by specifying a prefix
+string such as "keepalt" or similar. For example, to have NERDTree create its
+tree window using `silent keepalt keepjumps edit`: >
+ let NERDTreeCreatePrefix='silent keepalt keepjumps'
+<
+------------------------------------------------------------------------------
+ *NERDTreeNodeDelimiter*
+Values: Any single character.
+Default: "\x07" - the non-printable character BELL.
+
+This character is used to separate the file or directory name from the rest of
+the characters in the line of text. It allows filenames to contain special
+characters that are otherwise used in the NERDTree, such as square brackets,
+braces, trailing asterisk, and leading space. For more details, see the
+resoponsible pull request: https://github.com/scrooloose/nerdtree/pull/868.
+
+The default should work in nearly every situation, but this setting exists for
+those very rare cases where it doesn't. "\x07" was chosen because it's
+non-printable, and very unlikely to be used purposefully in a filename or as a
+flag by other NERDTree plugins. If you need to change the delimiter, be sure
+to choose a character that won't appear in your filenames or any of the flags
+set by your installed NERDTree plugins. The suggestions below are but a few of
+the many possibilities. Remember to use double quotes when specifying by hex
+or Unicode. >
+ let NERDTreeNodeDelimiter='😀'
+ let NERDTreeNodeDelimiter="\u00a0"
+ let NERDTreeNodeDelimiter="\xFF"
+<
+
+==============================================================================
+4. The NERD tree API *NERDTreeAPI*
+
+The NERD tree script allows you to add custom key mappings and menu items via
+a set of API calls. Any scripts that use this API should be placed in
+~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
+
+The script exposes some prototype objects that can be used to manipulate the
+tree and/or get information from it: >
+ g:NERDTreePath
+ g:NERDTreeDirNode
+ g:NERDTreeFileNode
+ g:NERDTreeBookmark
+<
+See the code/comments in NERD_tree.vim to find how to use these objects. The
+following code conventions are used:
+ * class members start with a capital letter
+ * instance members start with a lower case letter
+ * private members start with an underscore
+
+See this blog post for more details:
+ http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
+
+------------------------------------------------------------------------------
+4.1. Key map API *NERDTreeKeymapAPI*
+
+NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
+ Adds a new keymapping for all NERD tree buffers.
+ {options} must be a dictionary, and must contain the following keys:
+ "key" - the trigger key for the new mapping
+ "callback" - the function the new mapping will be bound to
+ "quickhelpText" - the text that will appear in the quickhelp (see
+ |NERDTree-?|)
+ "override" - if 1 then this new mapping will override whatever previous
+ mapping was defined for the key/scope combo. Useful for overriding the
+ default mappings.
+
+ Additionally, a "scope" argument may be supplied. This constrains the
+ mapping so that it is only activated if the cursor is on a certain object.
+ That object is then passed into the handling method. Possible values are:
+
+ "FileNode" .... a file node
+ "DirNode" ..... a directory node
+ "Node" ........ a file node OR a directory node
+ "Bookmark" .... a bookmark
+ "all" ......... global scope; handler receives no arguments (default)
+
+ Example: >
+ call NERDTreeAddKeyMap({
+ \ 'key': 'foo',
+ \ 'callback': 'NERDTreeCDHandler',
+ \ 'quickhelpText': 'echo full path of current node',
+ \ 'scope': 'DirNode' })
+
+ function! NERDTreeCDHandler(dirnode)
+ call a:dirnode.changeToDir()
+ endfunction
+<
+ This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
+ It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
+ the current dir node. Note this mapping will only fire when the cursor is
+ on a directory node.
+
+------------------------------------------------------------------------------
+4.2. Menu API *NERDTreeMenuAPI*
+
+NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()*
+ Creates and returns a new submenu.
+
+ {options} must be a dictionary and must contain the following keys:
+ "text" - the text of the submenu that the user will see
+ "shortcut" - a shortcut key for the submenu (need not be unique)
+
+ The following keys are optional:
+ "isActiveCallback" - a function that will be called to determine whether
+ this submenu item will be displayed or not. The callback function must
+ return 0 or 1.
+ "parent" - the parent submenu of the new submenu (returned from a previous
+ invocation of NERDTreeAddSubmenu()). If this key is left out then the new
+ submenu will sit under the top level menu.
+
+ See below for an example.
+
+NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()*
+ Adds a new menu item to the NERD tree menu (see |NERDTreeMenu|).
+
+ {options} must be a dictionary and must contain the
+ following keys:
+ "text" - the text of the menu item which the user will see
+ "shortcut" - a shortcut key for the menu item (need not be unique)
+ "callback" - the function that will be called when the user activates the
+ menu item.
+
+ The following keys are optional:
+ "isActiveCallback" - a function that will be called to determine whether
+ this menu item will be displayed or not. The callback function must return
+ 0 or 1.
+ "parent" - if the menu item belongs under a submenu then this key must be
+ specified. This value for this key will be the object that
+ was returned when the submenu was created with |NERDTreeAddSubmenu()|.
+
+ See below for an example.
+
+NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()*
+ Adds a menu separator (a row of dashes).
+
+ {options} is an optional dictionary that may contain the following keys:
+ "isActiveCallback" - see description in |NERDTreeAddMenuItem()|.
+
+Below is an example of the menu API in action. >
+ call NERDTreeAddMenuSeparator()
+
+ call NERDTreeAddMenuItem({
+ \ 'text': 'a (t)op level menu item',
+ \ 'shortcut': 't',
+ \ 'callback': 'SomeFunction' })
+
+ let submenu = NERDTreeAddSubmenu({
+ \ 'text': 'a (s)ub menu',
+ \ 'shortcut': 's' })
+
+ call NERDTreeAddMenuItem({
+ \ 'text': '(n)ested item 1',
+ \ 'shortcut': 'n',
+ \ 'callback': 'SomeFunction',
+ \ 'parent': submenu })
+
+ call NERDTreeAddMenuItem({
+ \ 'text': '(n)ested item 2',
+ \ 'shortcut': 'n',
+ \ 'callback': 'SomeFunction',
+ \ 'parent': submenu })
+<
+This will create the following menu: >
+ --------------------
+ a (t)op level menu item
+ a (s)ub menu
+<
+Where selecting "a (s)ub menu" will lead to a second menu: >
+ (n)ested item 1
+ (n)ested item 2
+<
+When any of the 3 concrete menu items are selected the function "SomeFunction"
+will be called.
+
+------------------------------------------------------------------------------
+4.3 NERDTreeAddPathFilter(callback) *NERDTreeAddPathFilter()*
+
+Path filters are essentially a more powerful version of |NERDTreeIgnore|.
+If the simple regex matching in |NERDTreeIgnore| is not enough then use
+|NERDTreeAddPathFilter()| to add a callback function that paths will be
+checked against when the decision to ignore them is made. Example >
+
+ call NERDTreeAddPathFilter('MyFilter')
+
+ function! MyFilter(params)
+ "params is a dict containing keys: 'nerdtree' and 'path' which are
+ "g:NERDTree and g:NERDTreePath objects
+
+ "return 1 to ignore params['path'] or 0 otherwise
+ endfunction
+<
+------------------------------------------------------------------------------
+4.4 Path Listener API *NERDTreePathListenerAPI*
+
+Use this API if you want to run a callback for events on Path objects. E.G >
+
+ call g:NERDTreePathNotifier.AddListener("init", "MyListener")
+
+ "....
+
+ function! MyListener(event)
+ "This function will be called whenever a Path object is created.
+
+ "a:event is an object that contains a bunch of relevant info -
+ "including the affected path. See lib/nerdtree/event.vim for details.
+ endfunction
+<
+Current events supported:
+ init ~
+ refresh ~
+ refreshFlags ~
+
+------------------------------------------------------------------------------
+NERDTreeRender() *NERDTreeRender()*
+ Re-renders the NERD tree buffer. Useful if you change the state of the
+ tree and you want to it to be reflected in the UI.
+
+==============================================================================
+5. About *NERDTreeAbout*
+
+The author of the NERD tree is a terrible terrible monster called Martyzilla
+who gobbles up small children with milk and sugar for breakfast.
+
+He can be reached at martin.grenfell at gmail dot com. He would love to hear
+from you, so feel free to send him suggestions and/or comments about this
+plugin. Don't be shy --- the worst he can do is slaughter you and stuff you
+in the fridge for later ;)
+
+Martyzilla recruited two other unwitting accomplices to become his minions in
+his quest to conquer the Vim plugin world. While he may still love to receive
+your emails, the best way to send suggestions, bug reports, and questions is
+to submit an issue at http://github.com/scrooloose/nerdtree/issues.
+
+The latest stable and development versions are on Github.
+ Stable: http://github.com/scrooloose/nerdtree (master branch)
+ Development: http://github.com/scrooloose/nerdtree/branches
+
+Title Credit:
+ * http://ascii.co.uk/art/tree
+
+ * Patrick Gillespie's Text ASCII Art Generator
+ http://patorjk.com/software/taag
+ http://patorjk.com/software/taag/#p=display&f=Rozzo&t=the%20NERD%20Tree
+
+==============================================================================
+6. License *NERDTreeLicense*
+
+The NERD tree is released under the wtfpl.
+See http://sam.zoy.org/wtfpl/COPYING.
+
+------------------------------------------------------------------------------
+ vim:tw=78:ts=8:ft=help:noet:nospell
diff --git a/vim/.vim/plugged/nerdtree/doc/tags b/vim/.vim/plugged/nerdtree/doc/tags
new file mode 100644
index 0000000..3efffd4
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/doc/tags
@@ -0,0 +1,101 @@
+:NERDTree NERDTree.txt /*:NERDTree*
+:NERDTreeCWD NERDTree.txt /*:NERDTreeCWD*
+:NERDTreeClose NERDTree.txt /*:NERDTreeClose*
+:NERDTreeFind NERDTree.txt /*:NERDTreeFind*
+:NERDTreeFocus NERDTree.txt /*:NERDTreeFocus*
+:NERDTreeFromBookmark NERDTree.txt /*:NERDTreeFromBookmark*
+:NERDTreeMirror NERDTree.txt /*:NERDTreeMirror*
+:NERDTreeRefreshRoot NERDTree.txt /*:NERDTreeRefreshRoot*
+:NERDTreeToggle NERDTree.txt /*:NERDTreeToggle*
+:NERDTreeVCS NERDTree.txt /*:NERDTreeVCS*
+NERDTree NERDTree.txt /*NERDTree*
+NERDTree-? NERDTree.txt /*NERDTree-?*
+NERDTree-A NERDTree.txt /*NERDTree-A*
+NERDTree-B NERDTree.txt /*NERDTree-B*
+NERDTree-C NERDTree.txt /*NERDTree-C*
+NERDTree-C-J NERDTree.txt /*NERDTree-C-J*
+NERDTree-C-K NERDTree.txt /*NERDTree-C-K*
+NERDTree-CD NERDTree.txt /*NERDTree-CD*
+NERDTree-D NERDTree.txt /*NERDTree-D*
+NERDTree-F NERDTree.txt /*NERDTree-F*
+NERDTree-I NERDTree.txt /*NERDTree-I*
+NERDTree-J NERDTree.txt /*NERDTree-J*
+NERDTree-K NERDTree.txt /*NERDTree-K*
+NERDTree-O NERDTree.txt /*NERDTree-O*
+NERDTree-P NERDTree.txt /*NERDTree-P*
+NERDTree-R NERDTree.txt /*NERDTree-R*
+NERDTree-T NERDTree.txt /*NERDTree-T*
+NERDTree-U NERDTree.txt /*NERDTree-U*
+NERDTree-X NERDTree.txt /*NERDTree-X*
+NERDTree-cd NERDTree.txt /*NERDTree-cd*
+NERDTree-contents NERDTree.txt /*NERDTree-contents*
+NERDTree-e NERDTree.txt /*NERDTree-e*
+NERDTree-f NERDTree.txt /*NERDTree-f*
+NERDTree-gi NERDTree.txt /*NERDTree-gi*
+NERDTree-go NERDTree.txt /*NERDTree-go*
+NERDTree-gs NERDTree.txt /*NERDTree-gs*
+NERDTree-i NERDTree.txt /*NERDTree-i*
+NERDTree-m NERDTree.txt /*NERDTree-m*
+NERDTree-o NERDTree.txt /*NERDTree-o*
+NERDTree-p NERDTree.txt /*NERDTree-p*
+NERDTree-q NERDTree.txt /*NERDTree-q*
+NERDTree-r NERDTree.txt /*NERDTree-r*
+NERDTree-s NERDTree.txt /*NERDTree-s*
+NERDTree-t NERDTree.txt /*NERDTree-t*
+NERDTree-u NERDTree.txt /*NERDTree-u*
+NERDTree-x NERDTree.txt /*NERDTree-x*
+NERDTree.txt NERDTree.txt /*NERDTree.txt*
+NERDTreeAPI NERDTree.txt /*NERDTreeAPI*
+NERDTreeAbout NERDTree.txt /*NERDTreeAbout*
+NERDTreeAddKeyMap() NERDTree.txt /*NERDTreeAddKeyMap()*
+NERDTreeAddMenuItem() NERDTree.txt /*NERDTreeAddMenuItem()*
+NERDTreeAddMenuSeparator() NERDTree.txt /*NERDTreeAddMenuSeparator()*
+NERDTreeAddPathFilter() NERDTree.txt /*NERDTreeAddPathFilter()*
+NERDTreeAddSubmenu() NERDTree.txt /*NERDTreeAddSubmenu()*
+NERDTreeAutoCenter NERDTree.txt /*NERDTreeAutoCenter*
+NERDTreeAutoCenterThreshold NERDTree.txt /*NERDTreeAutoCenterThreshold*
+NERDTreeAutoDeleteBuffer NERDTree.txt /*NERDTreeAutoDeleteBuffer*
+NERDTreeBookmarkCommands NERDTree.txt /*NERDTreeBookmarkCommands*
+NERDTreeBookmarkTable NERDTree.txt /*NERDTreeBookmarkTable*
+NERDTreeBookmarks NERDTree.txt /*NERDTreeBookmarks*
+NERDTreeBookmarksFile NERDTree.txt /*NERDTreeBookmarksFile*
+NERDTreeBookmarksSort NERDTree.txt /*NERDTreeBookmarksSort*
+NERDTreeCascadeOpenSingleChildDir NERDTree.txt /*NERDTreeCascadeOpenSingleChildDir*
+NERDTreeCascadeSingleChildDir NERDTree.txt /*NERDTreeCascadeSingleChildDir*
+NERDTreeCaseSensitiveSort NERDTree.txt /*NERDTreeCaseSensitiveSort*
+NERDTreeChDirMode NERDTree.txt /*NERDTreeChDirMode*
+NERDTreeCreatePrefix NERDTree.txt /*NERDTreeCreatePrefix*
+NERDTreeFunctionality NERDTree.txt /*NERDTreeFunctionality*
+NERDTreeGlobalCommands NERDTree.txt /*NERDTreeGlobalCommands*
+NERDTreeHighlightCursorline NERDTree.txt /*NERDTreeHighlightCursorline*
+NERDTreeHijackNetrw NERDTree.txt /*NERDTreeHijackNetrw*
+NERDTreeIgnore NERDTree.txt /*NERDTreeIgnore*
+NERDTreeInvalidBookmarks NERDTree.txt /*NERDTreeInvalidBookmarks*
+NERDTreeKeymapAPI NERDTree.txt /*NERDTreeKeymapAPI*
+NERDTreeLicense NERDTree.txt /*NERDTreeLicense*
+NERDTreeMappings NERDTree.txt /*NERDTreeMappings*
+NERDTreeMarkBookmarks NERDTree.txt /*NERDTreeMarkBookmarks*
+NERDTreeMenu NERDTree.txt /*NERDTreeMenu*
+NERDTreeMenu-j NERDTree.txt /*NERDTreeMenu-j*
+NERDTreeMenu-k NERDTree.txt /*NERDTreeMenu-k*
+NERDTreeMenuAPI NERDTree.txt /*NERDTreeMenuAPI*
+NERDTreeMinimalUI NERDTree.txt /*NERDTreeMinimalUI*
+NERDTreeMouseMode NERDTree.txt /*NERDTreeMouseMode*
+NERDTreeNaturalSort NERDTree.txt /*NERDTreeNaturalSort*
+NERDTreeNodeDelimiter NERDTree.txt /*NERDTreeNodeDelimiter*
+NERDTreePathListenerAPI NERDTree.txt /*NERDTreePathListenerAPI*
+NERDTreeQuitOnOpen NERDTree.txt /*NERDTreeQuitOnOpen*
+NERDTreeRender() NERDTree.txt /*NERDTreeRender()*
+NERDTreeRespectWildIgnore NERDTree.txt /*NERDTreeRespectWildIgnore*
+NERDTreeSettings NERDTree.txt /*NERDTreeSettings*
+NERDTreeSettingsDetails NERDTree.txt /*NERDTreeSettingsDetails*
+NERDTreeSettingsSummary NERDTree.txt /*NERDTreeSettingsSummary*
+NERDTreeShowBookmarks NERDTree.txt /*NERDTreeShowBookmarks*
+NERDTreeShowFiles NERDTree.txt /*NERDTreeShowFiles*
+NERDTreeShowHidden NERDTree.txt /*NERDTreeShowHidden*
+NERDTreeShowLineNumbers NERDTree.txt /*NERDTreeShowLineNumbers*
+NERDTreeSortOrder NERDTree.txt /*NERDTreeSortOrder*
+NERDTreeStatusline NERDTree.txt /*NERDTreeStatusline*
+NERDTreeWinPos NERDTree.txt /*NERDTreeWinPos*
+NERDTreeWinSize NERDTree.txt /*NERDTreeWinSize*
+loaded_nerd_tree NERDTree.txt /*loaded_nerd_tree*
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim
new file mode 100644
index 0000000..2e0aab0
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim
@@ -0,0 +1,354 @@
+" ============================================================================
+" CLASS: Bookmark
+"
+" The Bookmark class serves two purposes:
+" (1) It is the top-level prototype for new, concrete Bookmark objects.
+" (2) It provides an interface for client code to query and manipulate the
+" global list of Bookmark objects within the current Vim session.
+" ============================================================================
+
+
+let s:Bookmark = {}
+let g:NERDTreeBookmark = s:Bookmark
+
+" FUNCTION: Bookmark.activate(nerdtree) {{{1
+function! s:Bookmark.activate(nerdtree, ...)
+ call self.open(a:nerdtree, a:0 ? a:1 : {})
+endfunction
+
+" FUNCTION: Bookmark.AddBookmark(name, path) {{{1
+" Class method to add a new bookmark to the list, if a previous bookmark exists
+" with the same name, just update the path for that bookmark
+function! s:Bookmark.AddBookmark(name, path)
+ for i in s:Bookmark.Bookmarks()
+ if i.name ==# a:name
+ let i.path = a:path
+ return
+ endif
+ endfor
+ call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path))
+endfunction
+
+" FUNCTION: Bookmark.Bookmarks() {{{1
+" Class method to get all bookmarks. Lazily initializes the bookmarks global
+" variable
+function! s:Bookmark.Bookmarks()
+ if !exists("g:NERDTreeBookmarks")
+ let g:NERDTreeBookmarks = []
+ endif
+ return g:NERDTreeBookmarks
+endfunction
+
+" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1
+" class method that returns 1 if a bookmark with the given name is found, 0
+" otherwise
+function! s:Bookmark.BookmarkExistsFor(name)
+ try
+ call s:Bookmark.BookmarkFor(a:name)
+ return 1
+ catch /^NERDTree.BookmarkNotFoundError/
+ return 0
+ endtry
+endfunction
+
+" FUNCTION: Bookmark.BookmarkFor(name) {{{1
+" Class method that returns the Bookmark object having the specified name.
+" Throws "NERDTree.BookmarkNotFoundError" if no Bookmark is found.
+function! s:Bookmark.BookmarkFor(name)
+ let l:result = {}
+ for l:bookmark in s:Bookmark.Bookmarks()
+ if l:bookmark.name ==# a:name
+ let l:result = l:bookmark
+ break
+ endif
+ endfor
+ if empty(l:result)
+ throw 'NERDTree.BookmarkNotFoundError: "' . a:name . '" not found'
+ endif
+ return l:result
+endfunction
+
+" FUNCTION: Bookmark.BookmarkNames() {{{1
+" Class method to return an array of all bookmark names
+function! s:Bookmark.BookmarkNames()
+ let names = []
+ for i in s:Bookmark.Bookmarks()
+ call add(names, i.name)
+ endfor
+ return names
+endfunction
+
+" FUNCTION: Bookmark.CacheBookmarks(silent) {{{1
+" Class method to read all bookmarks from the bookmarks file initialize
+" bookmark objects for each one.
+"
+" Args:
+" silent - dont echo an error msg if invalid bookmarks are found
+function! s:Bookmark.CacheBookmarks(silent)
+ if filereadable(g:NERDTreeBookmarksFile)
+ let g:NERDTreeBookmarks = []
+ let g:NERDTreeInvalidBookmarks = []
+ let bookmarkStrings = readfile(g:NERDTreeBookmarksFile)
+ let invalidBookmarksFound = 0
+ for i in bookmarkStrings
+
+ "ignore blank lines
+ if i != ''
+
+ let name = substitute(i, '^\(.\{-}\) .*$', '\1', '')
+ let path = substitute(i, '^.\{-} \(.*\)$', '\1', '')
+ let path = fnamemodify(path, ':p')
+
+ try
+ let bookmark = s:Bookmark.New(name, g:NERDTreePath.New(path))
+ call add(g:NERDTreeBookmarks, bookmark)
+ catch /^NERDTree.InvalidArgumentsError/
+ call add(g:NERDTreeInvalidBookmarks, i)
+ let invalidBookmarksFound += 1
+ endtry
+ endif
+ endfor
+ if invalidBookmarksFound
+ call s:Bookmark.Write()
+ if !a:silent
+ call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.")
+ endif
+ endif
+ endif
+endfunction
+
+" FUNCTION: Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark) {{{1
+" Class method that indicates the relative position of two bookmarks when
+" placed in alphabetical order by name. Case-sensitivity is determined by an
+" option. Supports the "s:Bookmark.SortBookmarksList()" method.
+function! s:Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark)
+ let l:result = 0
+ if g:NERDTreeBookmarksSort == 1
+ if a:firstBookmark.name <? a:secondBookmark.name
+ let l:result = -1
+ elseif a:firstBookmark.name >? a:secondBookmark.name
+ let l:result = 1
+ endif
+ elseif g:NERDTreeBookmarksSort == 2
+ if a:firstBookmark.name <# a:secondBookmark.name
+ let l:result = -1
+ elseif a:firstBookmark.name ># a:secondBookmark.name
+ let l:result = 1
+ endif
+ endif
+ return l:result
+endfunction
+
+" FUNCTION: Bookmark.ClearAll() {{{1
+" Class method to delete all bookmarks.
+function! s:Bookmark.ClearAll()
+ for i in s:Bookmark.Bookmarks()
+ call i.delete()
+ endfor
+ call s:Bookmark.Write()
+endfunction
+
+" FUNCTION: Bookmark.delete() {{{1
+" Delete this bookmark. If the node for this bookmark is under the current
+" root, then recache bookmarks for its Path object
+function! s:Bookmark.delete()
+ call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self))
+ call s:Bookmark.Write()
+endfunction
+
+" FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1
+" Returns the tree node object associated with this Bookmark.
+" Throws "NERDTree.BookmarkedNodeNotFoundError" if the node is not found.
+"
+" Args:
+" searchFromAbsoluteRoot: boolean flag, search from the highest cached node
+" if true and from the current tree root if false
+function! s:Bookmark.getNode(nerdtree, searchFromAbsoluteRoot)
+ if a:searchFromAbsoluteRoot
+ let l:searchRoot = a:nerdtree.root.AbsoluteTreeRoot()
+ else
+ let l:searchRoot = a:nerdtree.root
+ endif
+ let l:targetNode = l:searchRoot.findNode(self.path)
+ if empty(l:targetNode)
+ throw 'NERDTree.BookmarkedNodeNotFoundError: node for bookmark "' . self.name . '" not found'
+ endif
+ return l:targetNode
+endfunction
+
+" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1
+" Class method that returns the tree node object for the Bookmark with the
+" given name. Throws "NERDTree.BookmarkNotFoundError" if a Bookmark with the
+" name does not exist. Throws "NERDTree.BookmarkedNodeNotFoundError" if a
+" tree node for the named Bookmark could not be found.
+function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree)
+ let l:bookmark = s:Bookmark.BookmarkFor(a:name)
+ return l:bookmark.getNode(a:nerdtree, a:searchFromAbsoluteRoot)
+endfunction
+
+" FUNCTION: Bookmark.GetSelected() {{{1
+" returns the Bookmark the cursor is over, or {}
+function! s:Bookmark.GetSelected()
+ let line = getline(".")
+ let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '')
+ if name != line
+ try
+ return s:Bookmark.BookmarkFor(name)
+ catch /^NERDTree.BookmarkNotFoundError/
+ return {}
+ endtry
+ endif
+ return {}
+endfunction
+
+" FUNCTION: Bookmark.InvalidBookmarks() {{{1
+" Class method to get all invalid bookmark strings read from the bookmarks
+" file
+function! s:Bookmark.InvalidBookmarks()
+ if !exists("g:NERDTreeInvalidBookmarks")
+ let g:NERDTreeInvalidBookmarks = []
+ endif
+ return g:NERDTreeInvalidBookmarks
+endfunction
+
+" FUNCTION: Bookmark.mustExist() {{{1
+function! s:Bookmark.mustExist()
+ if !self.path.exists()
+ call s:Bookmark.CacheBookmarks(1)
+ throw "NERDTree.BookmarkPointsToInvalidLocationError: the bookmark \"".
+ \ self.name ."\" points to a non existing location: \"". self.path.str()
+ endif
+endfunction
+
+" FUNCTION: Bookmark.New(name, path) {{{1
+" Create a new bookmark object with the given name and path object
+function! s:Bookmark.New(name, path)
+ if a:name =~# ' '
+ throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name
+ endif
+
+ let newBookmark = copy(self)
+ let newBookmark.name = a:name
+ let newBookmark.path = a:path
+ return newBookmark
+endfunction
+
+" FUNCTION: Bookmark.open(nerdtree, [options]) {{{1
+"Args:
+"
+"nerdtree: the tree to load open the bookmark in
+"
+"A dictionary containing the following keys (all optional):
+" 'where': Specifies whether the node should be opened in new split/tab or in
+" the previous window. Can be either 'v' (vertical split), 'h'
+" (horizontal split), 't' (new tab) or 'p' (previous window).
+" 'reuse': if a window is displaying the file then jump the cursor there
+" 'keepopen': dont close the tree window
+" 'stay': open the file, but keep the cursor in the tree win
+"
+function! s:Bookmark.open(nerdtree, ...)
+ let opts = a:0 ? a:1 : {}
+
+ if self.path.isDirectory && !has_key(opts, 'where')
+ call self.toRoot(a:nerdtree)
+ else
+ let opener = g:NERDTreeOpener.New(self.path, opts)
+ call opener.open(self)
+ endif
+endfunction
+
+" FUNCTION: Bookmark.openInNewTab(options) {{{1
+" Create a new bookmark object with the given name and path object
+function! s:Bookmark.openInNewTab(options)
+ call nerdtree#deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead')
+ call self.open(a:options)
+endfunction
+
+" FUNCTION: Bookmark.setPath(path) {{{1
+" makes this bookmark point to the given path
+function! s:Bookmark.setPath(path)
+ let self.path = a:path
+endfunction
+
+" FUNCTION: Bookmark.SortBookmarksList() {{{1
+" Class method that sorts the global list of bookmarks alphabetically by name.
+" Note that case-sensitivity is determined by a user option.
+function! s:Bookmark.SortBookmarksList()
+ call sort(s:Bookmark.Bookmarks(), s:Bookmark.CompareBookmarksByName, s:Bookmark)
+endfunction
+
+" FUNCTION: Bookmark.str() {{{1
+" Get the string that should be rendered in the view for this bookmark
+function! s:Bookmark.str()
+ let pathStrMaxLen = winwidth(g:NERDTree.GetWinNum()) - 4 - strdisplaywidth(self.name)
+ if &nu
+ let pathStrMaxLen = pathStrMaxLen - &numberwidth
+ endif
+
+ let pathStr = self.path.str({'format': 'UI'})
+ if strdisplaywidth(pathStr) > pathStrMaxLen
+ while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
+ let pathStr = substitute(pathStr, '^.', '', '')
+ endwhile
+ let pathStr = '<' . pathStr
+ endif
+ return '>' . self.name . ' ' . pathStr
+endfunction
+
+" FUNCTION: Bookmark.toRoot(nerdtree) {{{1
+" Set the root of the given NERDTree to the node for this Bookmark. If a node
+" for this Bookmark does not exist, a new one is initialized.
+function! s:Bookmark.toRoot(nerdtree)
+ if self.validate()
+ try
+ let l:targetNode = self.getNode(a:nerdtree, 1)
+ call l:targetNode.closeChildren()
+ catch /^NERDTree.BookmarkedNodeNotFoundError/
+ let l:targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree)
+ endtry
+ call a:nerdtree.changeRoot(l:targetNode)
+ endif
+endfunction
+
+" FUNCTION: Bookmark.ToRoot(name, nerdtree) {{{1
+" Class method that makes the Bookmark with the given name the root of
+" specified NERDTree.
+function! s:Bookmark.ToRoot(name, nerdtree)
+ let l:bookmark = s:Bookmark.BookmarkFor(a:name)
+ call l:bookmark.toRoot(a:nerdtree)
+endfunction
+
+" FUNCTION: Bookmark.validate() {{{1
+function! s:Bookmark.validate()
+ if self.path.exists()
+ return 1
+ else
+ call s:Bookmark.CacheBookmarks(1)
+ call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.")
+ return 0
+ endif
+endfunction
+
+" FUNCTION: Bookmark.Write() {{{1
+" Class method to write all bookmarks to the bookmarks file
+function! s:Bookmark.Write()
+ let bookmarkStrings = []
+ for i in s:Bookmark.Bookmarks()
+ call add(bookmarkStrings, i.name . ' ' . fnamemodify(i.path.str(), ':~'))
+ endfor
+
+ "add a blank line before the invalid ones
+ call add(bookmarkStrings, "")
+
+ for j in s:Bookmark.InvalidBookmarks()
+ call add(bookmarkStrings, j)
+ endfor
+
+ try
+ call writefile(bookmarkStrings, g:NERDTreeBookmarksFile)
+ catch
+ call nerdtree#echoError("Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.")
+ endtry
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/creator.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/creator.vim
new file mode 100644
index 0000000..1afd056
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/creator.vim
@@ -0,0 +1,389 @@
+" ============================================================================
+" CLASS: Creator
+"
+" This class is responsible for creating NERDTree instances. The new NERDTree
+" may be a tab tree, a window tree, or a mirrored tree. In the process of
+" creating a NERDTree, it sets up all of the window and buffer options and key
+" mappings etc.
+" ============================================================================
+
+
+let s:Creator = {}
+let g:NERDTreeCreator = s:Creator
+
+" FUNCTION: s:Creator._bindMappings() {{{1
+function! s:Creator._bindMappings()
+ "make <cr> do the same as the activate node mapping
+ nnoremap <silent> <buffer> <cr> :call nerdtree#ui_glue#invokeKeyMap(g:NERDTreeMapActivateNode)<cr>
+
+ call g:NERDTreeKeyMap.BindAll()
+
+ command! -buffer -nargs=? Bookmark :call nerdtree#ui_glue#bookmarkNode('<args>')
+ command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('<args>')
+ command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark call nerdtree#ui_glue#openBookmark('<args>')
+ command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('<args>')
+ command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('<args>', b:NERDTree)
+ command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() <bar> call b:NERDTree.render()
+ command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) <bar> call b:NERDTree.render()
+ command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write()
+endfunction
+
+" FUNCTION: s:Creator._broadcastInitEvent() {{{1
+function! s:Creator._broadcastInitEvent()
+ silent doautocmd User NERDTreeInit
+endfunction
+
+" FUNCTION: s:Creator.BufNamePrefix() {{{1
+function! s:Creator.BufNamePrefix()
+ return 'NERD_tree_'
+endfunction
+
+" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
+function! s:Creator.CreateTabTree(name)
+ let creator = s:Creator.New()
+ call creator.createTabTree(a:name)
+endfunction
+
+" FUNCTION: s:Creator.createTabTree(a:name) {{{1
+" name: the name of a bookmark or a directory
+function! s:Creator.createTabTree(name)
+ let l:path = self._pathForString(a:name)
+
+ " Abort if an exception was thrown (i.e., if the bookmark or directory
+ " does not exist).
+ if empty(l:path)
+ return
+ endif
+
+ " Obey the user's preferences for changing the working directory.
+ if g:NERDTreeChDirMode != 0
+ call l:path.changeToDir()
+ endif
+
+ if g:NERDTree.ExistsForTab()
+ call g:NERDTree.Close()
+ call self._removeTreeBufForTab()
+ endif
+
+ call self._createTreeWin()
+ call self._createNERDTree(l:path, 'tab')
+ call b:NERDTree.render()
+ call b:NERDTree.root.putCursorHere(0, 0)
+
+ call self._broadcastInitEvent()
+endfunction
+
+" FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
+function! s:Creator.CreateWindowTree(dir)
+ let creator = s:Creator.New()
+ call creator.createWindowTree(a:dir)
+endfunction
+
+" FUNCTION: s:Creator.createWindowTree(dir) {{{1
+function! s:Creator.createWindowTree(dir)
+ try
+ let path = g:NERDTreePath.New(a:dir)
+ catch /^NERDTree.InvalidArgumentsError/
+ call nerdtree#echo("Invalid directory name:" . a:name)
+ return
+ endtry
+
+ "we want the directory buffer to disappear when we do the :edit below
+ setlocal bufhidden=wipe
+
+ let previousBuf = expand("#")
+
+ "we need a unique name for each window tree buffer to ensure they are
+ "all independent
+ exec g:NERDTreeCreatePrefix . " edit " . self._nextBufferName()
+
+ call self._createNERDTree(path, "window")
+ let b:NERDTree._previousBuf = bufnr(previousBuf)
+ call self._setCommonBufOptions()
+
+ call b:NERDTree.render()
+
+ call self._broadcastInitEvent()
+endfunction
+
+" FUNCTION: s:Creator._createNERDTree(path) {{{1
+function! s:Creator._createNERDTree(path, type)
+ let b:NERDTree = g:NERDTree.New(a:path, a:type)
+
+ " TODO: This assignment is kept for compatibility reasons. Many other
+ " plugins use "b:NERDTreeRoot" instead of "b:NERDTree.root". Remove this
+ " assignment in the future.
+ let b:NERDTreeRoot = b:NERDTree.root
+
+ call b:NERDTree.root.open()
+endfunction
+
+" FUNCTION: s:Creator.CreateMirror() {{{1
+function! s:Creator.CreateMirror()
+ let creator = s:Creator.New()
+ call creator.createMirror()
+endfunction
+
+" FUNCTION: s:Creator.createMirror() {{{1
+function! s:Creator.createMirror()
+ "get the names off all the nerd tree buffers
+ let treeBufNames = []
+ for i in range(1, tabpagenr("$"))
+ let nextName = self._tabpagevar(i, 'NERDTreeBufName')
+ if nextName != -1 && (!exists("t:NERDTreeBufName") || nextName != t:NERDTreeBufName)
+ call add(treeBufNames, nextName)
+ endif
+ endfor
+ let treeBufNames = self._uniq(treeBufNames)
+
+ "map the option names (that the user will be prompted with) to the nerd
+ "tree buffer names
+ let options = {}
+ let i = 0
+ while i < len(treeBufNames)
+ let bufName = treeBufNames[i]
+ let treeRoot = getbufvar(bufName, "NERDTree").root
+ let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName
+ let i = i + 1
+ endwhile
+
+ "work out which tree to mirror, if there is more than 1 then ask the user
+ let bufferName = ''
+ if len(keys(options)) > 1
+ let choices = ["Choose a tree to mirror"]
+ let choices = extend(choices, sort(keys(options)))
+ let choice = inputlist(choices)
+ if choice < 1 || choice > len(options) || choice ==# ''
+ return
+ endif
+
+ let bufferName = options[sort(keys(options))[choice-1]]
+ elseif len(keys(options)) ==# 1
+ let bufferName = values(options)[0]
+ else
+ call nerdtree#echo("No trees to mirror")
+ return
+ endif
+
+ if g:NERDTree.ExistsForTab() && g:NERDTree.IsOpen()
+ call g:NERDTree.Close()
+ endif
+
+ let t:NERDTreeBufName = bufferName
+ call self._createTreeWin()
+ exec 'buffer ' . bufferName
+ if !&hidden
+ call b:NERDTree.render()
+ endif
+endfunction
+
+" FUNCTION: s:Creator._createTreeWin() {{{1
+" Initialize the NERDTree window. Open the window, size it properly, set all
+" local options, etc.
+function! s:Creator._createTreeWin()
+ let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright '
+ let l:splitSize = g:NERDTreeWinSize
+
+ if !g:NERDTree.ExistsForTab()
+ let t:NERDTreeBufName = self._nextBufferName()
+ silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
+ silent! execute 'edit ' . t:NERDTreeBufName
+ else
+ silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
+ silent! execute 'buffer ' . t:NERDTreeBufName
+ endif
+
+ call self._setCommonBufOptions()
+
+ if has('patch-7.4.1925')
+ clearjumps
+ endif
+
+ setlocal winfixwidth
+endfunction
+
+" FUNCTION: s:Creator._isBufHidden(nr) {{{1
+function! s:Creator._isBufHidden(nr)
+ redir => bufs
+ silent ls!
+ redir END
+
+ return bufs =~ a:nr . '..h'
+endfunction
+
+" FUNCTION: s:Creator.New() {{{1
+function! s:Creator.New()
+ let newCreator = copy(self)
+ return newCreator
+endfunction
+
+" FUNCTION: s:Creator._nextBufferName() {{{2
+" returns the buffer name for the next nerd tree
+function! s:Creator._nextBufferName()
+ let name = s:Creator.BufNamePrefix() . self._nextBufferNumber()
+ return name
+endfunction
+
+" FUNCTION: s:Creator._nextBufferNumber() {{{2
+" the number to add to the nerd tree buffer name to make the buf name unique
+function! s:Creator._nextBufferNumber()
+ if !exists("s:Creator._NextBufNum")
+ let s:Creator._NextBufNum = 1
+ else
+ let s:Creator._NextBufNum += 1
+ endif
+
+ return s:Creator._NextBufNum
+endfunction
+
+" FUNCTION: s:Creator._pathForString(str) {{{1
+" find a bookmark or adirectory for the given string
+function! s:Creator._pathForString(str)
+ let path = {}
+ if g:NERDTreeBookmark.BookmarkExistsFor(a:str)
+ let path = g:NERDTreeBookmark.BookmarkFor(a:str).path
+ else
+ let dir = a:str ==# '' ? getcwd() : a:str
+
+ "hack to get an absolute path if a relative path is given
+ if dir =~# '^\.'
+ let dir = getcwd() . g:NERDTreePath.Slash() . dir
+ endif
+ let dir = g:NERDTreePath.Resolve(dir)
+
+ try
+ let path = g:NERDTreePath.New(dir)
+ catch /^NERDTree.InvalidArgumentsError/
+ call nerdtree#echo("No bookmark or directory found for: " . a:str)
+ return {}
+ endtry
+ endif
+ if !path.isDirectory
+ let path = path.getParent()
+ endif
+
+ return path
+endfunction
+
+" Function: s:Creator._removeTreeBufForTab() {{{1
+function! s:Creator._removeTreeBufForTab()
+ let buf = bufnr(t:NERDTreeBufName)
+
+ "if &hidden is not set then it will already be gone
+ if buf != -1
+
+ "nerdtree buf may be mirrored/displayed elsewhere
+ if self._isBufHidden(buf)
+ exec "bwipeout " . buf
+ endif
+
+ endif
+
+ unlet t:NERDTreeBufName
+endfunction
+
+" FUNCTION: s:Creator._setCommonBufOptions() {{{1
+function! s:Creator._setCommonBufOptions()
+
+ " Options for a non-file/control buffer.
+ setlocal bufhidden=hide
+ setlocal buftype=nofile
+ setlocal noswapfile
+
+ " Options for controlling buffer/window appearance.
+ setlocal foldcolumn=0
+ setlocal foldmethod=manual
+ setlocal nobuflisted
+ setlocal nofoldenable
+ setlocal nolist
+ setlocal nospell
+ setlocal nowrap
+
+ if g:NERDTreeShowLineNumbers
+ setlocal nu
+ else
+ setlocal nonu
+ if v:version >= 703
+ setlocal nornu
+ endif
+ endif
+
+ iabc <buffer>
+
+ if g:NERDTreeHighlightCursorline
+ setlocal cursorline
+ endif
+
+ call self._setupStatusline()
+ call self._bindMappings()
+
+ setlocal filetype=nerdtree
+endfunction
+
+" FUNCTION: s:Creator._setupStatusline() {{{1
+function! s:Creator._setupStatusline()
+ if g:NERDTreeStatusline != -1
+ let &l:statusline = g:NERDTreeStatusline
+ endif
+endfunction
+
+" FUNCTION: s:Creator._tabpagevar(tabnr, var) {{{1
+function! s:Creator._tabpagevar(tabnr, var)
+ let currentTab = tabpagenr()
+ let old_ei = &ei
+ set ei=all
+
+ exec "tabnext " . a:tabnr
+ let v = -1
+ if exists('t:' . a:var)
+ exec 'let v = t:' . a:var
+ endif
+ exec "tabnext " . currentTab
+
+ let &ei = old_ei
+
+ return v
+endfunction
+
+" FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
+function! s:Creator.ToggleTabTree(dir)
+ let creator = s:Creator.New()
+ call creator.toggleTabTree(a:dir)
+endfunction
+
+" FUNCTION: s:Creator.toggleTabTree(dir) {{{1
+" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is
+" closed it is restored or initialized (if it doesnt exist)
+"
+" Args:
+" dir: the full path for the root node (is only used if the NERD tree is being
+" initialized.
+function! s:Creator.toggleTabTree(dir)
+ if g:NERDTree.ExistsForTab()
+ if !g:NERDTree.IsOpen()
+ call self._createTreeWin()
+ if !&hidden
+ call b:NERDTree.render()
+ endif
+ call b:NERDTree.ui.restoreScreenState()
+ else
+ call g:NERDTree.Close()
+ endif
+ else
+ call self.createTabTree(a:dir)
+ endif
+endfunction
+
+" Function: s:Creator._uniq(list) {{{1
+" returns a:list without duplicates
+function! s:Creator._uniq(list)
+ let uniqlist = []
+ for elem in a:list
+ if index(uniqlist, elem) ==# -1
+ let uniqlist += [elem]
+ endif
+ endfor
+ return uniqlist
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/event.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/event.vim
new file mode 100644
index 0000000..964e8ff
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/event.vim
@@ -0,0 +1,13 @@
+"CLASS: Event
+"============================================================
+let s:Event = {}
+let g:NERDTreeEvent = s:Event
+
+function! s:Event.New(nerdtree, subject, action, params) abort
+ let newObj = copy(self)
+ let newObj.nerdtree = a:nerdtree
+ let newObj.subject = a:subject
+ let newObj.action = a:action
+ let newObj.params = a:params
+ return newObj
+endfunction
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim
new file mode 100644
index 0000000..bc6e887
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim
@@ -0,0 +1,58 @@
+"CLASS: FlagSet
+"============================================================
+let s:FlagSet = {}
+let g:NERDTreeFlagSet = s:FlagSet
+
+"FUNCTION: FlagSet.addFlag(scope, flag) {{{1
+function! s:FlagSet.addFlag(scope, flag)
+ let flags = self._flagsForScope(a:scope)
+ if index(flags, a:flag) == -1
+ call add(flags, a:flag)
+ end
+endfunction
+
+"FUNCTION: FlagSet.clearFlags(scope) {{{1
+function! s:FlagSet.clearFlags(scope)
+ let self._flags[a:scope] = []
+endfunction
+
+"FUNCTION: FlagSet._flagsForScope(scope) {{{1
+function! s:FlagSet._flagsForScope(scope)
+ if !has_key(self._flags, a:scope)
+ let self._flags[a:scope] = []
+ endif
+ return self._flags[a:scope]
+endfunction
+
+"FUNCTION: FlagSet.New() {{{1
+function! s:FlagSet.New()
+ let newObj = copy(self)
+ let newObj._flags = {}
+ return newObj
+endfunction
+
+"FUNCTION: FlagSet.removeFlag(scope, flag) {{{1
+function! s:FlagSet.removeFlag(scope, flag)
+ let flags = self._flagsForScope(a:scope)
+
+ let i = index(flags, a:flag)
+ if i >= 0
+ call remove(flags, i)
+ endif
+endfunction
+
+"FUNCTION: FlagSet.renderToString() {{{1
+function! s:FlagSet.renderToString()
+ let flagstring = ""
+ for i in values(self._flags)
+ let flagstring .= join(i)
+ endfor
+
+ if len(flagstring) == 0
+ return ""
+ endif
+
+ return '[' . flagstring . ']'
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim
new file mode 100644
index 0000000..1ca478d
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim
@@ -0,0 +1,163 @@
+"CLASS: KeyMap
+"============================================================
+let s:KeyMap = {}
+let g:NERDTreeKeyMap = s:KeyMap
+let s:keyMaps = {}
+
+"FUNCTION: KeyMap.All() {{{1
+function! s:KeyMap.All()
+ let sortedKeyMaps = values(s:keyMaps)
+ call sort(sortedKeyMaps, s:KeyMap.Compare, s:KeyMap)
+
+ return sortedKeyMaps
+endfunction
+
+"FUNCTION: KeyMap.Compare(keyMap1, keyMap2) {{{1
+function! s:KeyMap.Compare(keyMap1, keyMap2)
+
+ if a:keyMap1.key >? a:keyMap2.key
+ return 1
+ endif
+
+ if a:keyMap1.key <? a:keyMap2.key
+ return -1
+ endif
+
+ return 0
+endfunction
+
+"FUNCTION: KeyMap.FindFor(key, scope) {{{1
+function! s:KeyMap.FindFor(key, scope)
+ return get(s:keyMaps, a:key . a:scope, {})
+endfunction
+
+"FUNCTION: KeyMap.BindAll() {{{1
+function! s:KeyMap.BindAll()
+ for i in values(s:keyMaps)
+ call i.bind()
+ endfor
+endfunction
+
+"FUNCTION: KeyMap.bind() {{{1
+function! s:KeyMap.bind()
+ " If the key sequence we're trying to map contains any '<>' notation, we
+ " must replace each of the '<' characters with '<lt>' to ensure the string
+ " is not translated into its corresponding keycode during the later part
+ " of the map command below
+ " :he <>
+ let specialNotationRegex = '\m<\([[:alnum:]_-]\+>\)'
+ if self.key =~# specialNotationRegex
+ let keymapInvokeString = substitute(self.key, specialNotationRegex, '<lt>\1', 'g')
+ else
+ let keymapInvokeString = self.key
+ endif
+
+ let premap = self.key == "<LeftRelease>" ? " <LeftRelease>" : " "
+
+ exec 'nnoremap <buffer> <silent> '. self.key . premap . ':call nerdtree#ui_glue#invokeKeyMap("'. keymapInvokeString .'")<cr>'
+endfunction
+
+"FUNCTION: KeyMap.Remove(key, scope) {{{1
+function! s:KeyMap.Remove(key, scope)
+ return remove(s:keyMaps, a:key . a:scope)
+endfunction
+
+"FUNCTION: KeyMap.invoke() {{{1
+"Call the KeyMaps callback function
+function! s:KeyMap.invoke(...)
+ let Callback = function(self.callback)
+ if a:0
+ call Callback(a:1)
+ else
+ call Callback()
+ endif
+endfunction
+
+"FUNCTION: KeyMap.Invoke() {{{1
+"Find a keymapping for a:key and the current scope invoke it.
+"
+"Scope is determined as follows:
+" * if the cursor is on a dir node then "DirNode"
+" * if the cursor is on a file node then "FileNode"
+" * if the cursor is on a bookmark then "Bookmark"
+"
+"If a keymap has the scope of "all" then it will be called if no other keymap
+"is found for a:key and the scope.
+function! s:KeyMap.Invoke(key)
+
+ "required because clicking the command window below another window still
+ "invokes the <LeftRelease> mapping - but changes the window cursor
+ "is in first
+ "
+ "TODO: remove this check when the vim bug is fixed
+ if !g:NERDTree.ExistsForBuf()
+ return {}
+ endif
+
+ let node = g:NERDTreeFileNode.GetSelected()
+ if !empty(node)
+
+ "try file node
+ if !node.path.isDirectory
+ let km = s:KeyMap.FindFor(a:key, "FileNode")
+ if !empty(km)
+ return km.invoke(node)
+ endif
+ endif
+
+ "try dir node
+ if node.path.isDirectory
+ let km = s:KeyMap.FindFor(a:key, "DirNode")
+ if !empty(km)
+ return km.invoke(node)
+ endif
+ endif
+
+ "try generic node
+ let km = s:KeyMap.FindFor(a:key, "Node")
+ if !empty(km)
+ return km.invoke(node)
+ endif
+
+ endif
+
+ "try bookmark
+ let bm = g:NERDTreeBookmark.GetSelected()
+ if !empty(bm)
+ let km = s:KeyMap.FindFor(a:key, "Bookmark")
+ if !empty(km)
+ return km.invoke(bm)
+ endif
+ endif
+
+ "try all
+ let km = s:KeyMap.FindFor(a:key, "all")
+ if !empty(km)
+ return km.invoke()
+ endif
+endfunction
+
+"FUNCTION: KeyMap.Create(options) {{{1
+function! s:KeyMap.Create(options)
+ let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options))
+
+ "dont override other mappings unless the 'override' option is given
+ if get(opts, 'override', 0) == 0 && !empty(s:KeyMap.FindFor(opts['key'], opts['scope']))
+ return
+ end
+
+ let newKeyMap = copy(self)
+ let newKeyMap.key = opts['key']
+ let newKeyMap.quickhelpText = opts['quickhelpText']
+ let newKeyMap.callback = opts['callback']
+ let newKeyMap.scope = opts['scope']
+
+ call s:KeyMap.Add(newKeyMap)
+endfunction
+
+"FUNCTION: KeyMap.Add(keymap) {{{1
+function! s:KeyMap.Add(keymap)
+ let s:keyMaps[a:keymap.key . a:keymap.scope] = a:keymap
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim
new file mode 100644
index 0000000..84bdb26
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim
@@ -0,0 +1,186 @@
+"CLASS: MenuController
+"============================================================
+let s:MenuController = {}
+let g:NERDTreeMenuController = s:MenuController
+
+"FUNCTION: MenuController.New(menuItems) {{{1
+"create a new menu controller that operates on the given menu items
+function! s:MenuController.New(menuItems)
+ let newMenuController = copy(self)
+ if a:menuItems[0].isSeparator()
+ let newMenuController.menuItems = a:menuItems[1:-1]
+ else
+ let newMenuController.menuItems = a:menuItems
+ endif
+ return newMenuController
+endfunction
+
+" FUNCTION: MenuController.showMenu() {{{1
+" Enter the main loop of the NERDTree menu, prompting the user to select
+" a menu item.
+function! s:MenuController.showMenu()
+ call self._saveOptions()
+
+ try
+ let self.selection = 0
+ let l:done = 0
+
+ while !l:done
+ redraw!
+ call self._echoPrompt()
+
+ let l:key = nr2char(getchar())
+ let l:done = self._handleKeypress(l:key)
+ endwhile
+ finally
+ call self._restoreOptions()
+
+ " Redraw when "Ctrl-C" or "Esc" is received.
+ if !l:done || self.selection == -1
+ redraw!
+ endif
+ endtry
+
+ if self.selection != -1
+ let l:m = self._current()
+ call l:m.execute()
+ endif
+endfunction
+
+"FUNCTION: MenuController._echoPrompt() {{{1
+function! s:MenuController._echoPrompt()
+ echo "NERDTree Menu. Use " . g:NERDTreeMenuDown . "/" . g:NERDTreeMenuUp . "/enter and the shortcuts indicated"
+ echo "=========================================================="
+
+ for i in range(0, len(self.menuItems)-1)
+ if self.selection == i
+ echo "> " . self.menuItems[i].text
+ else
+ echo " " . self.menuItems[i].text
+ endif
+ endfor
+endfunction
+
+"FUNCTION: MenuController._current(key) {{{1
+"get the MenuItem that is currently selected
+function! s:MenuController._current()
+ return self.menuItems[self.selection]
+endfunction
+
+"FUNCTION: MenuController._handleKeypress(key) {{{1
+"change the selection (if appropriate) and return 1 if the user has made
+"their choice, 0 otherwise
+function! s:MenuController._handleKeypress(key)
+ if a:key == g:NERDTreeMenuDown
+ call self._cursorDown()
+ elseif a:key == g:NERDTreeMenuUp
+ call self._cursorUp()
+ elseif a:key == nr2char(27) "escape
+ let self.selection = -1
+ return 1
+ elseif a:key == "\r" || a:key == "\n" "enter and ctrl-j
+ return 1
+ else
+ let index = self._nextIndexFor(a:key)
+ if index != -1
+ let self.selection = index
+ if len(self._allIndexesFor(a:key)) == 1
+ return 1
+ endif
+ endif
+ endif
+
+ return 0
+endfunction
+
+"FUNCTION: MenuController._allIndexesFor(shortcut) {{{1
+"get indexes to all menu items with the given shortcut
+function! s:MenuController._allIndexesFor(shortcut)
+ let toReturn = []
+
+ for i in range(0, len(self.menuItems)-1)
+ if self.menuItems[i].shortcut == a:shortcut
+ call add(toReturn, i)
+ endif
+ endfor
+
+ return toReturn
+endfunction
+
+"FUNCTION: MenuController._nextIndexFor(shortcut) {{{1
+"get the index to the next menu item with the given shortcut, starts from the
+"current cursor location and wraps around to the top again if need be
+function! s:MenuController._nextIndexFor(shortcut)
+ for i in range(self.selection+1, len(self.menuItems)-1)
+ if self.menuItems[i].shortcut == a:shortcut
+ return i
+ endif
+ endfor
+
+ for i in range(0, self.selection)
+ if self.menuItems[i].shortcut == a:shortcut
+ return i
+ endif
+ endfor
+
+ return -1
+endfunction
+
+"FUNCTION: MenuController._setCmdheight() {{{1
+"sets &cmdheight to whatever is needed to display the menu
+function! s:MenuController._setCmdheight()
+ let &cmdheight = len(self.menuItems) + 3
+endfunction
+
+"FUNCTION: MenuController._saveOptions() {{{1
+"set any vim options that are required to make the menu work (saving their old
+"values)
+function! s:MenuController._saveOptions()
+ let self._oldLazyredraw = &lazyredraw
+ let self._oldCmdheight = &cmdheight
+ set nolazyredraw
+ call self._setCmdheight()
+endfunction
+
+"FUNCTION: MenuController._restoreOptions() {{{1
+"restore the options we saved in _saveOptions()
+function! s:MenuController._restoreOptions()
+ let &cmdheight = self._oldCmdheight
+ let &lazyredraw = self._oldLazyredraw
+endfunction
+
+"FUNCTION: MenuController._cursorDown() {{{1
+"move the cursor to the next menu item, skipping separators
+function! s:MenuController._cursorDown()
+ let done = 0
+ while !done
+ if self.selection < len(self.menuItems)-1
+ let self.selection += 1
+ else
+ let self.selection = 0
+ endif
+
+ if !self._current().isSeparator()
+ let done = 1
+ endif
+ endwhile
+endfunction
+
+"FUNCTION: MenuController._cursorUp() {{{1
+"move the cursor to the previous menu item, skipping separators
+function! s:MenuController._cursorUp()
+ let done = 0
+ while !done
+ if self.selection > 0
+ let self.selection -= 1
+ else
+ let self.selection = len(self.menuItems)-1
+ endif
+
+ if !self._current().isSeparator()
+ let done = 1
+ endif
+ endwhile
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim
new file mode 100644
index 0000000..92c1bbb
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim
@@ -0,0 +1,114 @@
+"CLASS: MenuItem
+"============================================================
+let s:MenuItem = {}
+let g:NERDTreeMenuItem = s:MenuItem
+
+"FUNCTION: MenuItem.All() {{{1
+"get all top level menu items
+function! s:MenuItem.All()
+ if !exists("s:menuItems")
+ let s:menuItems = []
+ endif
+ return s:menuItems
+endfunction
+
+"FUNCTION: MenuItem.AllEnabled() {{{1
+"get all top level menu items that are currently enabled
+function! s:MenuItem.AllEnabled()
+ let toReturn = []
+ for i in s:MenuItem.All()
+ if i.enabled()
+ call add(toReturn, i)
+ endif
+ endfor
+ return toReturn
+endfunction
+
+"FUNCTION: MenuItem.Create(options) {{{1
+"make a new menu item and add it to the global list
+function! s:MenuItem.Create(options)
+ let newMenuItem = copy(self)
+
+ let newMenuItem.text = a:options['text']
+ let newMenuItem.shortcut = a:options['shortcut']
+ let newMenuItem.children = []
+
+ let newMenuItem.isActiveCallback = -1
+ if has_key(a:options, 'isActiveCallback')
+ let newMenuItem.isActiveCallback = a:options['isActiveCallback']
+ endif
+
+ let newMenuItem.callback = -1
+ if has_key(a:options, 'callback')
+ let newMenuItem.callback = a:options['callback']
+ endif
+
+ if has_key(a:options, 'parent')
+ call add(a:options['parent'].children, newMenuItem)
+ else
+ call add(s:MenuItem.All(), newMenuItem)
+ endif
+
+ return newMenuItem
+endfunction
+
+"FUNCTION: MenuItem.CreateSeparator(options) {{{1
+"make a new separator menu item and add it to the global list
+function! s:MenuItem.CreateSeparator(options)
+ let standard_options = { 'text': '--------------------',
+ \ 'shortcut': -1,
+ \ 'callback': -1 }
+ let options = extend(a:options, standard_options, "force")
+
+ return s:MenuItem.Create(options)
+endfunction
+
+"FUNCTION: MenuItem.CreateSubmenu(options) {{{1
+"make a new submenu and add it to global list
+function! s:MenuItem.CreateSubmenu(options)
+ let standard_options = { 'callback': -1 }
+ let options = extend(a:options, standard_options, "force")
+
+ return s:MenuItem.Create(options)
+endfunction
+
+"FUNCTION: MenuItem.enabled() {{{1
+"return 1 if this menu item should be displayed
+"
+"delegates off to the isActiveCallback, and defaults to 1 if no callback was
+"specified
+function! s:MenuItem.enabled()
+ if self.isActiveCallback != -1
+ return {self.isActiveCallback}()
+ endif
+ return 1
+endfunction
+
+"FUNCTION: MenuItem.execute() {{{1
+"perform the action behind this menu item, if this menuitem has children then
+"display a new menu for them, otherwise deletegate off to the menuitem's
+"callback
+function! s:MenuItem.execute()
+ if len(self.children)
+ let mc = g:NERDTreeMenuController.New(self.children)
+ call mc.showMenu()
+ else
+ if self.callback != -1
+ call {self.callback}()
+ endif
+ endif
+endfunction
+
+"FUNCTION: MenuItem.isSeparator() {{{1
+"return 1 if this menuitem is a separator
+function! s:MenuItem.isSeparator()
+ return self.callback == -1 && self.children == []
+endfunction
+
+"FUNCTION: MenuItem.isSubmenu() {{{1
+"return 1 if this menuitem is a submenu
+function! s:MenuItem.isSubmenu()
+ return self.callback == -1 && !empty(self.children)
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim
new file mode 100644
index 0000000..fcabcb9
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim
@@ -0,0 +1,208 @@
+"CLASS: NERDTree
+"============================================================
+let s:NERDTree = {}
+let g:NERDTree = s:NERDTree
+
+"FUNCTION: s:NERDTree.AddPathFilter() {{{1
+function! s:NERDTree.AddPathFilter(callback)
+ call add(s:NERDTree.PathFilters(), a:callback)
+endfunction
+
+"FUNCTION: s:NERDTree.changeRoot(node) {{{1
+function! s:NERDTree.changeRoot(node)
+ if a:node.path.isDirectory
+ let self.root = a:node
+ else
+ call a:node.cacheParent()
+ let self.root = a:node.parent
+ endif
+
+ call self.root.open()
+
+ "change dir to the dir of the new root if instructed to
+ if g:NERDTreeChDirMode ==# 2
+ call self.root.path.changeToDir()
+ endif
+
+ call self.render()
+ call self.root.putCursorHere(0, 0)
+
+ silent doautocmd User NERDTreeNewRoot
+endfunction
+
+"FUNCTION: s:NERDTree.Close() {{{1
+"Closes the tab tree window for this tab
+function! s:NERDTree.Close()
+ if !s:NERDTree.IsOpen()
+ return
+ endif
+
+ if winnr("$") != 1
+ " Use the window ID to identify the currently active window or fall
+ " back on the buffer ID if win_getid/win_gotoid are not available, in
+ " which case we'll focus an arbitrary window showing the buffer.
+ let l:useWinId = exists('*win_getid') && exists('*win_gotoid')
+
+ if winnr() == s:NERDTree.GetWinNum()
+ call nerdtree#exec("wincmd p")
+ let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("")
+ call nerdtree#exec("wincmd p")
+ else
+ let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("")
+ endif
+
+ call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w")
+ close
+ if l:useWinId
+ call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")")
+ else
+ call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w")
+ endif
+ else
+ close
+ endif
+endfunction
+
+"FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1
+"Closes the NERD tree window if the close on open option is set
+function! s:NERDTree.CloseIfQuitOnOpen()
+ if g:NERDTreeQuitOnOpen && s:NERDTree.IsOpen()
+ call s:NERDTree.Close()
+ endif
+endfunction
+
+"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
+"Places the cursor at the top of the bookmarks table
+function! s:NERDTree.CursorToBookmarkTable()
+ if !b:NERDTree.ui.getShowBookmarks()
+ throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active"
+ endif
+
+ if g:NERDTreeMinimalUI
+ return cursor(1, 2)
+ endif
+
+ let rootNodeLine = b:NERDTree.ui.getRootLineNum()
+
+ let line = 1
+ while getline(line) !~# '^>-\+Bookmarks-\+$'
+ let line = line + 1
+ if line >= rootNodeLine
+ throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table"
+ endif
+ endwhile
+ call cursor(line, 2)
+endfunction
+
+"FUNCTION: s:NERDTree.CursorToTreeWin(){{{1
+"Places the cursor in the nerd tree window
+function! s:NERDTree.CursorToTreeWin()
+ call g:NERDTree.MustBeOpen()
+ call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
+endfunction
+
+" Function: s:NERDTree.ExistsForBuffer() {{{1
+" Returns 1 if a nerd tree root exists in the current buffer
+function! s:NERDTree.ExistsForBuf()
+ return exists("b:NERDTree")
+endfunction
+
+" Function: s:NERDTree.ExistsForTab() {{{1
+" Returns 1 if a nerd tree root exists in the current tab
+function! s:NERDTree.ExistsForTab()
+ if !exists("t:NERDTreeBufName")
+ return
+ end
+
+ "check b:NERDTree is still there and hasn't been e.g. :bdeleted
+ return !empty(getbufvar(bufnr(t:NERDTreeBufName), 'NERDTree'))
+endfunction
+
+function! s:NERDTree.ForCurrentBuf()
+ if s:NERDTree.ExistsForBuf()
+ return b:NERDTree
+ else
+ return {}
+ endif
+endfunction
+
+"FUNCTION: s:NERDTree.ForCurrentTab() {{{1
+function! s:NERDTree.ForCurrentTab()
+ if !s:NERDTree.ExistsForTab()
+ return
+ endif
+
+ let bufnr = bufnr(t:NERDTreeBufName)
+ return getbufvar(bufnr, "NERDTree")
+endfunction
+
+"FUNCTION: s:NERDTree.getRoot() {{{1
+function! s:NERDTree.getRoot()
+ return self.root
+endfunction
+
+"FUNCTION: s:NERDTree.GetWinNum() {{{1
+"gets the nerd tree window number for this tab
+function! s:NERDTree.GetWinNum()
+ if exists("t:NERDTreeBufName")
+ return bufwinnr(t:NERDTreeBufName)
+ endif
+
+ return -1
+endfunction
+
+"FUNCTION: s:NERDTree.IsOpen() {{{1
+function! s:NERDTree.IsOpen()
+ return s:NERDTree.GetWinNum() != -1
+endfunction
+
+"FUNCTION: s:NERDTree.isTabTree() {{{1
+function! s:NERDTree.isTabTree()
+ return self._type == "tab"
+endfunction
+
+"FUNCTION: s:NERDTree.isWinTree() {{{1
+function! s:NERDTree.isWinTree()
+ return self._type == "window"
+endfunction
+
+"FUNCTION: s:NERDTree.MustBeOpen() {{{1
+function! s:NERDTree.MustBeOpen()
+ if !s:NERDTree.IsOpen()
+ throw "NERDTree.TreeNotOpen"
+ endif
+endfunction
+
+"FUNCTION: s:NERDTree.New() {{{1
+function! s:NERDTree.New(path, type)
+ let newObj = copy(self)
+ let newObj.ui = g:NERDTreeUI.New(newObj)
+ let newObj.root = g:NERDTreeDirNode.New(a:path, newObj)
+ let newObj._type = a:type
+ return newObj
+endfunction
+
+"FUNCTION: s:NERDTree.PathFilters() {{{1
+function! s:NERDTree.PathFilters()
+ if !exists('s:NERDTree._PathFilters')
+ let s:NERDTree._PathFilters = []
+ endif
+ return s:NERDTree._PathFilters
+endfunction
+
+"FUNCTION: s:NERDTree.previousBuf() {{{1
+function! s:NERDTree.previousBuf()
+ return self._previousBuf
+endfunction
+
+function! s:NERDTree.setPreviousBuf(bnum)
+ let self._previousBuf = a:bnum
+endfunction
+
+"FUNCTION: s:NERDTree.render() {{{1
+"A convenience function - since this is called often
+function! s:NERDTree.render()
+ call self.ui.render()
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim
new file mode 100644
index 0000000..d24fc8f
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim
@@ -0,0 +1,34 @@
+"CLASS: Notifier
+"============================================================
+let s:Notifier = {}
+
+function! s:Notifier.AddListener(event, funcname)
+ let listeners = s:Notifier.GetListenersForEvent(a:event)
+ if listeners == []
+ let listenersMap = s:Notifier.GetListenersMap()
+ let listenersMap[a:event] = listeners
+ endif
+ call add(listeners, a:funcname)
+endfunction
+
+function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
+ let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
+
+ for listener in s:Notifier.GetListenersForEvent(a:event)
+ call {listener}(event)
+ endfor
+endfunction
+
+function! s:Notifier.GetListenersMap()
+ if !exists("s:refreshListenersMap")
+ let s:refreshListenersMap = {}
+ endif
+ return s:refreshListenersMap
+endfunction
+
+function! s:Notifier.GetListenersForEvent(name)
+ let listenersMap = s:Notifier.GetListenersMap()
+ return get(listenersMap, a:name, [])
+endfunction
+
+let g:NERDTreePathNotifier = deepcopy(s:Notifier)
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/opener.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/opener.vim
new file mode 100644
index 0000000..ef357ef
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/opener.vim
@@ -0,0 +1,352 @@
+" ============================================================================
+" CLASS: Opener
+"
+" The Opener class defines an API for "opening" operations.
+" ============================================================================
+
+
+let s:Opener = {}
+let g:NERDTreeOpener = s:Opener
+
+" FUNCTION: s:Opener._bufInWindows(bnum) {{{1
+" [[STOLEN FROM VTREEEXPLORER.VIM]]
+" Determine the number of windows open to this buffer number.
+" Care of Yegappan Lakshman. Thanks!
+"
+" Args:
+" bnum: the subject buffers buffer number
+function! s:Opener._bufInWindows(bnum)
+ let cnt = 0
+ let winnum = 1
+ while 1
+ let bufnum = winbufnr(winnum)
+ if bufnum < 0
+ break
+ endif
+ if bufnum ==# a:bnum
+ let cnt = cnt + 1
+ endif
+ let winnum = winnum + 1
+ endwhile
+
+ return cnt
+endfunction
+
+" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
+" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
+" if the tree should be closed now.
+"
+" Args:
+" a:newtab - boolean. If set, only close the tree now if we are opening the
+" target in a new tab. This is needed because we have to close tree before we
+" leave the tab
+function! s:Opener._checkToCloseTree(newtab)
+ if self._keepopen
+ return
+ endif
+
+ if (a:newtab && self._where == 't') || !a:newtab
+ call g:NERDTree.CloseIfQuitOnOpen()
+ endif
+endfunction
+
+" FUNCTION: s:Opener._firstUsableWindow() {{{1
+" find the window number of the first normal window
+function! s:Opener._firstUsableWindow()
+ let i = 1
+ while i <= winnr("$")
+ let bnum = winbufnr(i)
+ if bnum != -1 && getbufvar(bnum, '&buftype') ==# ''
+ \ && !getwinvar(i, '&previewwindow')
+ \ && (!getbufvar(bnum, '&modified') || &hidden)
+ return i
+ endif
+
+ let i += 1
+ endwhile
+ return -1
+endfunction
+
+" FUNCTION: Opener._gotoTargetWin() {{{1
+function! s:Opener._gotoTargetWin()
+ if b:NERDTree.isWinTree()
+ if self._where == 'v'
+ vsplit
+ elseif self._where == 'h'
+ split
+ elseif self._where == 't'
+ tabnew
+ endif
+ else
+ call self._checkToCloseTree(1)
+
+ if self._where == 'v'
+ call self._newVSplit()
+ elseif self._where == 'h'
+ call self._newSplit()
+ elseif self._where == 't'
+ tabnew
+ elseif self._where == 'p'
+ call self._previousWindow()
+ endif
+
+ call self._checkToCloseTree(0)
+ endif
+endfunction
+
+" FUNCTION: s:Opener._isWindowUsable(winnumber) {{{1
+" Returns 0 if opening a file from the tree in the given window requires it to
+" be split, 1 otherwise
+"
+" Args:
+" winnumber: the number of the window in question
+function! s:Opener._isWindowUsable(winnumber)
+ "gotta split if theres only one window (i.e. the NERD tree)
+ if winnr("$") ==# 1
+ return 0
+ endif
+
+ let oldwinnr = winnr()
+ call nerdtree#exec(a:winnumber . "wincmd p")
+ let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow')
+ let modified = &modified
+ call nerdtree#exec(oldwinnr . "wincmd p")
+
+ "if its a special window e.g. quickfix or another explorer plugin then we
+ "have to split
+ if specialWindow
+ return 0
+ endif
+
+ if &hidden
+ return 1
+ endif
+
+ return !modified || self._bufInWindows(winbufnr(a:winnumber)) >= 2
+endfunction
+
+" FUNCTION: Opener.New(path, opts) {{{1
+" Instantiate a new NERDTreeOpener object.
+" Args:
+" a:path: the path object that is to be opened
+" a:opts: a dictionary containing the following optional keys...
+" 'where': specifies whether the node should be opened in new split, in
+" a new tab or, in the last window; takes values "v", "h", or "t"
+" 'reuse': if file is already shown in a window, jump there; takes values
+" "all", "currenttab", or empty
+" 'keepopen': boolean (0 or 1); if true, the tree window will not be closed
+" 'stay': boolean (0 or 1); if true, remain in tree window after opening
+function! s:Opener.New(path, opts)
+ let l:newOpener = copy(self)
+
+ let l:newOpener._keepopen = nerdtree#has_opt(a:opts, 'keepopen')
+ let l:newOpener._nerdtree = b:NERDTree
+ let l:newOpener._path = a:path
+ let l:newOpener._reuse = has_key(a:opts, 'reuse') ? a:opts['reuse'] : ''
+ let l:newOpener._stay = nerdtree#has_opt(a:opts, 'stay')
+ let l:newOpener._where = has_key(a:opts, 'where') ? a:opts['where'] : ''
+
+ call l:newOpener._saveCursorPos()
+
+ return l:newOpener
+endfunction
+
+" FUNCTION: Opener._newSplit() {{{1
+function! s:Opener._newSplit()
+ " Save the user's settings for splitbelow and splitright
+ let savesplitbelow=&splitbelow
+ let savesplitright=&splitright
+
+ " 'there' will be set to a command to move from the split window
+ " back to the explorer window
+ "
+ " 'back' will be set to a command to move from the explorer window
+ " back to the newly split window
+ "
+ " 'right' and 'below' will be set to the settings needed for
+ " splitbelow and splitright IF the explorer is the only window.
+ "
+ let there= g:NERDTreeWinPos ==# "left" ? "wincmd h" : "wincmd l"
+ let back = g:NERDTreeWinPos ==# "left" ? "wincmd l" : "wincmd h"
+ let right= g:NERDTreeWinPos ==# "left"
+ let below=0
+
+ " Attempt to go to adjacent window
+ call nerdtree#exec(back)
+
+ let onlyOneWin = (winnr("$") ==# 1)
+
+ " If no adjacent window, set splitright and splitbelow appropriately
+ if onlyOneWin
+ let &splitright=right
+ let &splitbelow=below
+ else
+ " found adjacent window - invert split direction
+ let &splitright=!right
+ let &splitbelow=!below
+ endif
+
+ let splitMode = onlyOneWin ? "vertical" : ""
+
+ " Open the new window
+ try
+ exec(splitMode." sp ")
+ catch /^Vim\%((\a\+)\)\=:E37/
+ call g:NERDTree.CursorToTreeWin()
+ throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified."
+ catch /^Vim\%((\a\+)\)\=:/
+ "do nothing
+ endtry
+
+ "resize the tree window if no other window was open before
+ if onlyOneWin
+ let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
+ call nerdtree#exec(there)
+ exec("silent ". splitMode ." resize ". size)
+ call nerdtree#exec('wincmd p')
+ endif
+
+ " Restore splitmode settings
+ let &splitbelow=savesplitbelow
+ let &splitright=savesplitright
+endfunction
+
+" FUNCTION: Opener._newVSplit() {{{1
+function! s:Opener._newVSplit()
+ let l:winwidth = winwidth('.')
+
+ if winnr('$') == 1
+ let l:winwidth = g:NERDTreeWinSize
+ endif
+
+ call nerdtree#exec('wincmd p')
+ vnew
+
+ let l:currentWindowNumber = winnr()
+
+ " Restore the NERDTree to its original width.
+ call g:NERDTree.CursorToTreeWin()
+ execute 'silent vertical resize ' . l:winwidth
+
+ call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
+endfunction
+
+" FUNCTION: Opener.open(target) {{{1
+function! s:Opener.open(target)
+ if self._path.isDirectory
+ call self._openDirectory(a:target)
+ return
+ endif
+
+ call self._openFile()
+endfunction
+
+" FUNCTION: Opener._openFile() {{{1
+function! s:Opener._openFile()
+ if !self._stay && !g:NERDTreeQuitOnOpen && exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
+ call b:NERDTree.ui.toggleZoom()
+ endif
+
+ if self._reuseWindow()
+ return
+ endif
+
+ call self._gotoTargetWin()
+
+ if self._stay
+ silent call self._path.edit()
+ call self._restoreCursorPos()
+ return
+ endif
+
+ call self._path.edit()
+endfunction
+
+" FUNCTION: Opener._openDirectory(node) {{{1
+function! s:Opener._openDirectory(node)
+ call self._gotoTargetWin()
+
+ if self._nerdtree.isWinTree()
+ call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
+ else
+ if empty(self._where)
+ call b:NERDTree.changeRoot(a:node)
+ elseif self._where == 't'
+ call g:NERDTreeCreator.CreateTabTree(a:node.path.str())
+ else
+ call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
+ endif
+ endif
+
+ if self._stay
+ call self._restoreCursorPos()
+ endif
+endfunction
+
+" FUNCTION: Opener._previousWindow() {{{1
+function! s:Opener._previousWindow()
+ if !self._isWindowUsable(winnr("#")) && self._firstUsableWindow() ==# -1
+ call self._newSplit()
+ else
+ try
+ if !self._isWindowUsable(winnr("#"))
+ call nerdtree#exec(self._firstUsableWindow() . "wincmd w")
+ else
+ call nerdtree#exec('wincmd p')
+ endif
+ catch /^Vim\%((\a\+)\)\=:E37/
+ call g:NERDTree.CursorToTreeWin()
+ throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified."
+ catch /^Vim\%((\a\+)\)\=:/
+ echo v:exception
+ endtry
+ endif
+endfunction
+
+" FUNCTION: Opener._restoreCursorPos() {{{1
+function! s:Opener._restoreCursorPos()
+ call nerdtree#exec(self._tabnr . 'tabnext')
+ call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w')
+endfunction
+
+" FUNCTION: Opener._reuseWindow() {{{1
+" put the cursor in the first window we find for this file
+"
+" return 1 if we were successful
+function! s:Opener._reuseWindow()
+ if empty(self._reuse)
+ return 0
+ endif
+
+ "check the current tab for the window
+ let winnr = bufwinnr('^' . self._path.str() . '$')
+ if winnr != -1
+ call nerdtree#exec(winnr . "wincmd w")
+ call self._checkToCloseTree(0)
+ return 1
+ endif
+
+ if self._reuse == 'currenttab'
+ return 0
+ endif
+
+ "check other tabs
+ let tabnr = self._path.tabnr()
+ if tabnr
+ call self._checkToCloseTree(1)
+ call nerdtree#exec(tabnr . 'tabnext')
+ let winnr = bufwinnr('^' . self._path.str() . '$')
+ call nerdtree#exec(winnr . "wincmd w")
+ return 1
+ endif
+
+ return 0
+endfunction
+
+" FUNCTION: Opener._saveCursorPos() {{{1
+function! s:Opener._saveCursorPos()
+ let self._bufnr = bufnr("")
+ let self._tabnr = tabpagenr()
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/path.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/path.vim
new file mode 100644
index 0000000..b92eb6f
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/path.vim
@@ -0,0 +1,875 @@
+" ============================================================================
+" CLASS: Path
+"
+" The Path class provides an abstracted representation of a file system
+" pathname. Various operations on pathnames are provided and a number of
+" representations of a given path name can be accessed here.
+" ============================================================================
+
+
+let s:Path = {}
+let g:NERDTreePath = s:Path
+
+" FUNCTION: Path.AbsolutePathFor(pathStr) {{{1
+function! s:Path.AbsolutePathFor(pathStr)
+ let l:prependWorkingDir = 0
+
+ if nerdtree#runningWindows()
+ let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)\?' && a:pathStr !~# '^\(\\\\\|\/\/\)'
+ else
+ let l:prependWorkingDir = a:pathStr !~# '^/'
+ endif
+
+ let l:result = a:pathStr
+
+ if l:prependWorkingDir
+ let l:result = getcwd()
+
+ if l:result[-1:] == s:Path.Slash()
+ let l:result = l:result . a:pathStr
+ else
+ let l:result = l:result . s:Path.Slash() . a:pathStr
+ endif
+ endif
+
+ return l:result
+endfunction
+
+" FUNCTION: Path.bookmarkNames() {{{1
+function! s:Path.bookmarkNames()
+ if !exists("self._bookmarkNames")
+ call self.cacheDisplayString()
+ endif
+ return self._bookmarkNames
+endfunction
+
+" FUNCTION: Path.cacheDisplayString() {{{1
+function! s:Path.cacheDisplayString() abort
+ let self.cachedDisplayString = g:NERDTreeNodeDelimiter . self.getLastPathComponent(1)
+
+ if self.isExecutable
+ let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . '*'
+ endif
+
+ let self._bookmarkNames = []
+ for i in g:NERDTreeBookmark.Bookmarks()
+ if i.path.equals(self)
+ call add(self._bookmarkNames, i.name)
+ endif
+ endfor
+ if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks == 1
+ let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' {' . join(self._bookmarkNames) . '}'
+ endif
+
+ if self.isSymLink
+ let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
+ endif
+
+ if self.isReadOnly
+ let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']'
+ endif
+endfunction
+
+" FUNCTION: Path.addDelimiter() {{{1
+function! s:Path.addDelimiter(line)
+ if a:line =~# '\(.*' . g:NERDTreeNodeDelimiter . '\)\{2}'
+ return a:line
+ else
+ return a:line . g:NERDTreeNodeDelimiter
+ endif
+endfunction
+
+" FUNCTION: Path.changeToDir() {{{1
+function! s:Path.changeToDir()
+ let dir = self.str({'format': 'Cd'})
+ if self.isDirectory ==# 0
+ let dir = self.getParent().str({'format': 'Cd'})
+ endif
+
+ try
+ execute "cd " . dir
+ call nerdtree#echo("CWD is now: " . getcwd())
+ catch
+ throw "NERDTree.PathChangeError: cannot change CWD to " . dir
+ endtry
+endfunction
+
+" FUNCTION: Path.compareTo() {{{1
+"
+" Compares this Path to the given path and returns 0 if they are equal, -1 if
+" this Path is "less than" the given path, or 1 if it is "greater".
+"
+" Args:
+" path: the path object to compare this to
+"
+" Return:
+" 1, -1 or 0
+function! s:Path.compareTo(path)
+ let thisPath = self.getLastPathComponent(1)
+ let thatPath = a:path.getLastPathComponent(1)
+
+ "if the paths are the same then clearly we return 0
+ if thisPath ==# thatPath
+ return 0
+ endif
+
+ let thisSS = self.getSortOrderIndex()
+ let thatSS = a:path.getSortOrderIndex()
+
+ "compare the sort sequences, if they are different then the return
+ "value is easy
+ if thisSS < thatSS
+ return -1
+ elseif thisSS > thatSS
+ return 1
+ else
+ if !g:NERDTreeSortHiddenFirst
+ let thisPath = substitute(thisPath, '^[._]', '', '')
+ let thatPath = substitute(thatPath, '^[._]', '', '')
+ endif
+ "if the sort sequences are the same then compare the paths
+ "alphabetically
+ let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
+ if pathCompare
+ return -1
+ else
+ return 1
+ endif
+ endif
+endfunction
+
+" FUNCTION: Path.Create(fullpath) {{{1
+"
+" Factory method.
+"
+" Creates a path object with the given path. The path is also created on the
+" filesystem. If the path already exists, a NERDTree.Path.Exists exception is
+" thrown. If any other errors occur, a NERDTree.Path exception is thrown.
+"
+" Args:
+" fullpath: the full filesystem path to the file/dir to create
+function! s:Path.Create(fullpath)
+ "bail if the a:fullpath already exists
+ if isdirectory(a:fullpath) || filereadable(a:fullpath)
+ throw "NERDTree.CreatePathError: Directory Exists: '" . a:fullpath . "'"
+ endif
+
+ try
+
+ "if it ends with a slash, assume its a dir create it
+ if a:fullpath =~# '\(\\\|\/\)$'
+ "whack the trailing slash off the end if it exists
+ let fullpath = substitute(a:fullpath, '\(\\\|\/\)$', '', '')
+
+ call mkdir(fullpath, 'p')
+
+ "assume its a file and create
+ else
+ call s:Path.createParentDirectories(a:fullpath)
+ call writefile([], a:fullpath)
+ endif
+ catch
+ throw "NERDTree.CreatePathError: Could not create path: '" . a:fullpath . "'"
+ endtry
+
+ return s:Path.New(a:fullpath)
+endfunction
+
+" FUNCTION: Path.copy(dest) {{{1
+"
+" Copies the file/dir represented by this Path to the given location
+"
+" Args:
+" dest: the location to copy this dir/file to
+function! s:Path.copy(dest)
+ if !s:Path.CopyingSupported()
+ throw "NERDTree.CopyingNotSupportedError: Copying is not supported on this OS"
+ endif
+
+ call s:Path.createParentDirectories(a:dest)
+
+ if exists('g:NERDTreeCopyCmd')
+ let cmd_prefix = g:NERDTreeCopyCmd
+ else
+ let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
+ endif
+
+ let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars())
+ let success = system(cmd)
+ if v:shell_error != 0
+ throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'"
+ endif
+endfunction
+
+" FUNCTION: Path.CopyingSupported() {{{1
+"
+" returns 1 if copying is supported for this OS
+function! s:Path.CopyingSupported()
+ return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
+endfunction
+
+" FUNCTION: Path.copyingWillOverwrite(dest) {{{1
+"
+" returns 1 if copy this path to the given location will cause files to
+" overwritten
+"
+" Args:
+" dest: the location this path will be copied to
+function! s:Path.copyingWillOverwrite(dest)
+ if filereadable(a:dest)
+ return 1
+ endif
+
+ if isdirectory(a:dest)
+ let path = s:Path.JoinPathStrings(a:dest, self.getLastPathComponent(0))
+ if filereadable(path)
+ return 1
+ endif
+ endif
+endfunction
+
+" FUNCTION: Path.createParentDirectories(path) {{{1
+"
+" create parent directories for this path if needed
+" without throwing any errors if those directories already exist
+"
+" Args:
+" path: full path of the node whose parent directories may need to be created
+function! s:Path.createParentDirectories(path)
+ let dir_path = fnamemodify(a:path, ':h')
+ if !isdirectory(dir_path)
+ call mkdir(dir_path, 'p')
+ endif
+endfunction
+
+" FUNCTION: Path.delete() {{{1
+"
+" Deletes the file or directory represented by this path.
+"
+" Throws NERDTree.Path.Deletion exceptions
+function! s:Path.delete()
+ if self.isDirectory
+
+ let cmd = g:NERDTreeRemoveDirCmd . self.str({'escape': 1})
+ let success = system(cmd)
+
+ if v:shell_error != 0
+ throw "NERDTree.PathDeletionError: Could not delete directory: '" . self.str() . "'"
+ endif
+ else
+ if exists('g:NERDTreeRemoveFileCmd')
+ let cmd = g:NERDTreeRemoveFileCmd . self.str({'escape': 1})
+ let success = system(cmd)
+ else
+ let success = delete(self.str())
+ endif
+
+ if success != 0
+ throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str() . "'"
+ endif
+ endif
+
+ "delete all bookmarks for this path
+ for i in self.bookmarkNames()
+ let bookmark = g:NERDTreeBookmark.BookmarkFor(i)
+ call bookmark.delete()
+ endfor
+endfunction
+
+" FUNCTION: Path.displayString() {{{1
+"
+" Returns a string that specifies how the path should be represented as a
+" string
+function! s:Path.displayString()
+ if self.cachedDisplayString ==# ""
+ call self.cacheDisplayString()
+ endif
+
+ return self.cachedDisplayString
+endfunction
+
+" FUNCTION: Path.edit() {{{1
+function! s:Path.edit()
+ exec "edit " . self.str({'format': 'Edit'})
+endfunction
+
+" FUNCTION: Path.extractDriveLetter(fullpath) {{{1
+"
+" If running windows, cache the drive letter for this path
+function! s:Path.extractDriveLetter(fullpath)
+ if nerdtree#runningWindows()
+ if a:fullpath =~ '^\(\\\\\|\/\/\)'
+ "For network shares, the 'drive' consists of the first two parts of the path, i.e. \\boxname\share
+ let self.drive = substitute(a:fullpath, '^\(\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\).*', '\1', '')
+ let self.drive = substitute(self.drive, '/', '\', "g")
+ else
+ let self.drive = substitute(a:fullpath, '\(^[a-zA-Z]:\).*', '\1', '')
+ endif
+ else
+ let self.drive = ''
+ endif
+
+endfunction
+
+" FUNCTION: Path.exists() {{{1
+" return 1 if this path points to a location that is readable or is a directory
+function! s:Path.exists()
+ let p = self.str()
+ return filereadable(p) || isdirectory(p)
+endfunction
+
+" FUNCTION: Path._escChars() {{{1
+function! s:Path._escChars()
+ if nerdtree#runningWindows()
+ return " `\|\"#%&,?()\*^<>$"
+ endif
+
+ return " \\`\|\"#%&,?()\*^<>[]$"
+endfunction
+
+" FUNCTION: Path.getDir() {{{1
+"
+" Returns this path if it is a directory, else this paths parent.
+"
+" Return:
+" a Path object
+function! s:Path.getDir()
+ if self.isDirectory
+ return self
+ else
+ return self.getParent()
+ endif
+endfunction
+
+" FUNCTION: Path.getParent() {{{1
+"
+" Returns a new path object for this paths parent
+"
+" Return:
+" a new Path object
+function! s:Path.getParent()
+ if nerdtree#runningWindows()
+ let path = self.drive . '\' . join(self.pathSegments[0:-2], '\')
+ else
+ let path = '/'. join(self.pathSegments[0:-2], '/')
+ endif
+
+ return s:Path.New(path)
+endfunction
+
+" FUNCTION: Path.getLastPathComponent(dirSlash) {{{1
+"
+" Gets the last part of this path.
+"
+" Args:
+" dirSlash: if 1 then a trailing slash will be added to the returned value for
+" directory nodes.
+function! s:Path.getLastPathComponent(dirSlash)
+ if empty(self.pathSegments)
+ return ''
+ endif
+ let toReturn = self.pathSegments[-1]
+ if a:dirSlash && self.isDirectory
+ let toReturn = toReturn . '/'
+ endif
+ return toReturn
+endfunction
+
+" FUNCTION: Path.getSortOrderIndex() {{{1
+" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
+function! s:Path.getSortOrderIndex()
+ let i = 0
+ while i < len(g:NERDTreeSortOrder)
+ if self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
+ return i
+ endif
+ let i = i + 1
+ endwhile
+
+ return index(g:NERDTreeSortOrder, '*')
+endfunction
+
+" FUNCTION: Path._splitChunks(path) {{{1
+" returns a list of path chunks
+function! s:Path._splitChunks(path)
+ let chunks = split(a:path, '\(\D\+\|\d\+\)\zs')
+ let i = 0
+ while i < len(chunks)
+ "convert number literals to numbers
+ if match(chunks[i], '^\d\+$') == 0
+ let chunks[i] = str2nr(chunks[i])
+ endif
+ let i = i + 1
+ endwhile
+ return chunks
+endfunction
+
+" FUNCTION: Path.getSortKey() {{{1
+" returns a key used in compare function for sorting
+function! s:Path.getSortKey()
+ let l:ascending = index(g:NERDTreeSortOrder,'[[timestamp]]')
+ let l:descending = index(g:NERDTreeSortOrder,'[[-timestamp]]')
+ if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder || l:ascending >= 0 || l:descending >= 0
+ let self._sortKey = [self.getSortOrderIndex()]
+
+ if l:descending >= 0
+ call insert(self._sortKey, -getftime(self.str()), l:descending == 0 ? 0 : len(self._sortKey))
+ elseif l:ascending >= 0
+ call insert(self._sortKey, getftime(self.str()), l:ascending == 0 ? 0 : len(self._sortKey))
+ endif
+
+ let path = self.getLastPathComponent(1)
+ if !g:NERDTreeSortHiddenFirst
+ let path = substitute(path, '^[._]', '', '')
+ endif
+ if !g:NERDTreeCaseSensitiveSort
+ let path = tolower(path)
+ endif
+
+ call extend(self._sortKey, (g:NERDTreeNaturalSort ? self._splitChunks(path) : [path]))
+ endif
+ return self._sortKey
+endfunction
+
+" FUNCTION: Path.isHiddenUnder(path) {{{1
+function! s:Path.isHiddenUnder(path)
+
+ if !self.isUnder(a:path)
+ return 0
+ endif
+
+ let l:startIndex = len(a:path.pathSegments)
+ let l:segments = self.pathSegments[l:startIndex : ]
+
+ for l:segment in l:segments
+
+ if l:segment =~# '^\.'
+ return 1
+ endif
+ endfor
+
+ return 0
+endfunction
+
+" FUNCTION: Path.isUnixHiddenFile() {{{1
+" check for unix hidden files
+function! s:Path.isUnixHiddenFile()
+ return self.getLastPathComponent(0) =~# '^\.'
+endfunction
+
+" FUNCTION: Path.isUnixHiddenPath() {{{1
+" check for unix path with hidden components
+function! s:Path.isUnixHiddenPath()
+ if self.getLastPathComponent(0) =~# '^\.'
+ return 1
+ else
+ for segment in self.pathSegments
+ if segment =~# '^\.'
+ return 1
+ endif
+ endfor
+ return 0
+ endif
+endfunction
+
+" FUNCTION: Path.ignore(nerdtree) {{{1
+" returns true if this path should be ignored
+function! s:Path.ignore(nerdtree)
+ "filter out the user specified paths to ignore
+ if a:nerdtree.ui.isIgnoreFilterEnabled()
+ for i in g:NERDTreeIgnore
+ if self._ignorePatternMatches(i)
+ return 1
+ endif
+ endfor
+
+ for callback in g:NERDTree.PathFilters()
+ if {callback}({'path': self, 'nerdtree': a:nerdtree})
+ return 1
+ endif
+ endfor
+ endif
+
+ "dont show hidden files unless instructed to
+ if !a:nerdtree.ui.getShowHidden() && self.isUnixHiddenFile()
+ return 1
+ endif
+
+ if a:nerdtree.ui.getShowFiles() ==# 0 && self.isDirectory ==# 0
+ return 1
+ endif
+
+ return 0
+endfunction
+
+" FUNCTION: Path._ignorePatternMatches(pattern) {{{1
+" returns true if this path matches the given ignore pattern
+function! s:Path._ignorePatternMatches(pattern)
+ let pat = a:pattern
+ if strpart(pat,len(pat)-7) == '[[dir]]'
+ if !self.isDirectory
+ return 0
+ endif
+ let pat = strpart(pat,0, len(pat)-7)
+ elseif strpart(pat,len(pat)-8) == '[[file]]'
+ if self.isDirectory
+ return 0
+ endif
+ let pat = strpart(pat,0, len(pat)-8)
+ endif
+
+ return self.getLastPathComponent(0) =~# pat
+endfunction
+
+" FUNCTION: Path.isAncestor(path) {{{1
+" return 1 if this path is somewhere above the given path in the filesystem.
+"
+" a:path should be a dir
+function! s:Path.isAncestor(path)
+ if !self.isDirectory
+ return 0
+ endif
+
+ let this = self.str()
+ let that = a:path.str()
+ return stridx(that, this) == 0
+endfunction
+
+" FUNCTION: Path.isUnder(path) {{{1
+" return 1 if this path is somewhere under the given path in the filesystem.
+function! s:Path.isUnder(path)
+ if a:path.isDirectory == 0
+ return 0
+ endif
+
+ let this = self.str()
+ let that = a:path.str()
+ return stridx(this, that . s:Path.Slash()) == 0
+endfunction
+
+" FUNCTION: Path.JoinPathStrings(...) {{{1
+function! s:Path.JoinPathStrings(...)
+ let components = []
+ for i in a:000
+ let components = extend(components, split(i, '/'))
+ endfor
+ return '/' . join(components, '/')
+endfunction
+
+" FUNCTION: Path.equals() {{{1
+"
+" Determines whether 2 path objects are "equal".
+" They are equal if the paths they represent are the same
+"
+" Args:
+" path: the other path obj to compare this with
+function! s:Path.equals(path)
+ return self.str() ==# a:path.str()
+endfunction
+
+" FUNCTION: Path.New(pathStr) {{{1
+function! s:Path.New(pathStr)
+ let l:newPath = copy(self)
+
+ call l:newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:pathStr))
+
+ let l:newPath.cachedDisplayString = ''
+ let l:newPath.flagSet = g:NERDTreeFlagSet.New()
+
+ return l:newPath
+endfunction
+
+" FUNCTION: Path.Slash() {{{1
+" Return the path separator used by the underlying file system. Special
+" consideration is taken for the use of the 'shellslash' option on Windows
+" systems.
+function! s:Path.Slash()
+
+ if nerdtree#runningWindows()
+ if exists('+shellslash') && &shellslash
+ return '/'
+ endif
+
+ return '\'
+ endif
+
+ return '/'
+endfunction
+
+" FUNCTION: Path.Resolve() {{{1
+" Invoke the vim resolve() function and return the result
+" This is necessary because in some versions of vim resolve() removes trailing
+" slashes while in other versions it doesn't. This always removes the trailing
+" slash
+function! s:Path.Resolve(path)
+ let tmp = resolve(a:path)
+ return tmp =~# '.\+/$' ? substitute(tmp, '/$', '', '') : tmp
+endfunction
+
+" FUNCTION: Path.readInfoFromDisk(fullpath) {{{1
+"
+"
+" Throws NERDTree.Path.InvalidArguments exception.
+function! s:Path.readInfoFromDisk(fullpath)
+ call self.extractDriveLetter(a:fullpath)
+
+ let fullpath = s:Path.WinToUnixPath(a:fullpath)
+
+ if getftype(fullpath) ==# "fifo"
+ throw "NERDTree.InvalidFiletypeError: Cant handle FIFO files: " . a:fullpath
+ endif
+
+ let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
+
+ let self.isReadOnly = 0
+ if isdirectory(a:fullpath)
+ let self.isDirectory = 1
+ elseif filereadable(a:fullpath)
+ let self.isDirectory = 0
+ let self.isReadOnly = filewritable(a:fullpath) ==# 0
+ else
+ throw "NERDTree.InvalidArgumentsError: Invalid path = " . a:fullpath
+ endif
+
+ let self.isExecutable = 0
+ if !self.isDirectory
+ let self.isExecutable = getfperm(a:fullpath) =~# 'x'
+ endif
+
+ "grab the last part of the path (minus the trailing slash)
+ let lastPathComponent = self.getLastPathComponent(0)
+
+ "get the path to the new node with the parent dir fully resolved
+ let hardPath = s:Path.Resolve(self.strTrunk()) . '/' . lastPathComponent
+
+ "if the last part of the path is a symlink then flag it as such
+ let self.isSymLink = (s:Path.Resolve(hardPath) != hardPath)
+ if self.isSymLink
+ let self.symLinkDest = s:Path.Resolve(fullpath)
+
+ "if the link is a dir then slap a / on the end of its dest
+ if isdirectory(self.symLinkDest)
+
+ "we always wanna treat MS windows shortcuts as files for
+ "simplicity
+ if hardPath !~# '\.lnk$'
+
+ let self.symLinkDest = self.symLinkDest . '/'
+ endif
+ endif
+ endif
+endfunction
+
+" FUNCTION: Path.refresh(nerdtree) {{{1
+function! s:Path.refresh(nerdtree)
+ call self.readInfoFromDisk(self.str())
+ call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {})
+ call self.cacheDisplayString()
+endfunction
+
+" FUNCTION: Path.refreshFlags(nerdtree) {{{1
+function! s:Path.refreshFlags(nerdtree)
+ call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {})
+ call self.cacheDisplayString()
+endfunction
+
+" FUNCTION: Path.rename() {{{1
+"
+" Renames this node on the filesystem
+function! s:Path.rename(newPath)
+ if a:newPath ==# ''
+ throw "NERDTree.InvalidArgumentsError: Invalid newPath for renaming = ". a:newPath
+ endif
+
+ call s:Path.createParentDirectories(a:newPath)
+
+ let success = rename(self.str(), a:newPath)
+ if success != 0
+ throw "NERDTree.PathRenameError: Could not rename: '" . self.str() . "'" . 'to:' . a:newPath
+ endif
+ call self.readInfoFromDisk(a:newPath)
+
+ for i in self.bookmarkNames()
+ let b = g:NERDTreeBookmark.BookmarkFor(i)
+ call b.setPath(copy(self))
+ endfor
+ call g:NERDTreeBookmark.Write()
+endfunction
+
+" FUNCTION: Path.str() {{{1
+" Return a string representation of this Path object.
+"
+" Args:
+" This function takes a single dictionary (optional) with keys and values that
+" specify how the returned pathname should be formatted.
+"
+" The dictionary may have the following keys:
+" 'format'
+" 'escape'
+" 'truncateTo'
+"
+" The 'format' key may have a value of:
+" 'Cd' - a string to be used with ":cd" and similar commands
+" 'Edit' - a string to be used with ":edit" and similar commands
+" 'UI' - a string to be displayed in the NERDTree user interface
+"
+" The 'escape' key, if specified, will cause the output to be escaped with
+" Vim's internal "shellescape()" function.
+"
+" The 'truncateTo' key shortens the length of the path to that given by the
+" value associated with 'truncateTo'. A '<' is prepended.
+function! s:Path.str(...)
+ let options = a:0 ? a:1 : {}
+ let toReturn = ""
+
+ if has_key(options, 'format')
+ let format = options['format']
+ if has_key(self, '_strFor' . format)
+ exec 'let toReturn = self._strFor' . format . '()'
+ else
+ throw 'NERDTree.UnknownFormatError: unknown format "'. format .'"'
+ endif
+ else
+ let toReturn = self._str()
+ endif
+
+ if nerdtree#has_opt(options, 'escape')
+ let toReturn = shellescape(toReturn)
+ endif
+
+ if has_key(options, 'truncateTo')
+ let limit = options['truncateTo']
+ if strdisplaywidth(toReturn) > limit-1
+ while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
+ let toReturn = substitute(toReturn, '^.', '', '')
+ endwhile
+ if len(split(toReturn, '/')) > 1
+ let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
+ else
+ let toReturn = '<' . toReturn
+ endif
+ endif
+ endif
+
+ return toReturn
+endfunction
+
+" FUNCTION: Path._strForUI() {{{1
+function! s:Path._strForUI()
+ let toReturn = '/' . join(self.pathSegments, '/')
+ if self.isDirectory && toReturn != '/'
+ let toReturn = toReturn . '/'
+ endif
+ return toReturn
+endfunction
+
+" FUNCTION: Path._strForCd() {{{1
+" Return a string representation of this Path that is suitable for use as an
+" argument to Vim's internal ":cd" command.
+function! s:Path._strForCd()
+ return fnameescape(self.str())
+endfunction
+
+" FUNCTION: Path._strForEdit() {{{1
+" Return a string representation of this Path that is suitable for use as an
+" argument to Vim's internal ":edit" command.
+function! s:Path._strForEdit()
+
+ " Make the path relative to the current working directory, if possible.
+ let l:result = fnamemodify(self.str(), ':.')
+
+ " On Windows, the drive letter may be removed by "fnamemodify()". Add it
+ " back, if necessary.
+ if nerdtree#runningWindows() && l:result[0] == s:Path.Slash()
+ let l:result = self.drive . l:result
+ endif
+
+ let l:result = fnameescape(l:result)
+
+ if empty(l:result)
+ let l:result = '.'
+ endif
+
+ return l:result
+endfunction
+
+" FUNCTION: Path._strForGlob() {{{1
+function! s:Path._strForGlob()
+ let lead = s:Path.Slash()
+
+ "if we are running windows then slap a drive letter on the front
+ if nerdtree#runningWindows()
+ let lead = self.drive . '\'
+ endif
+
+ let toReturn = lead . join(self.pathSegments, s:Path.Slash())
+
+ if !nerdtree#runningWindows()
+ let toReturn = escape(toReturn, self._escChars())
+ endif
+ return toReturn
+endfunction
+
+" FUNCTION: Path._str() {{{1
+" Return the absolute pathname associated with this Path object. The pathname
+" returned is appropriate for the underlying file system.
+function! s:Path._str()
+ let l:separator = s:Path.Slash()
+ let l:leader = l:separator
+
+ if nerdtree#runningWindows()
+ let l:leader = self.drive . l:separator
+ endif
+
+ return l:leader . join(self.pathSegments, l:separator)
+endfunction
+
+" FUNCTION: Path.strTrunk() {{{1
+" Gets the path without the last segment on the end.
+function! s:Path.strTrunk()
+ return self.drive . '/' . join(self.pathSegments[0:-2], '/')
+endfunction
+
+" FUNCTION: Path.tabnr() {{{1
+" return the number of the first tab that is displaying this file
+"
+" return 0 if no tab was found
+function! s:Path.tabnr()
+ let str = self.str()
+ for t in range(tabpagenr('$'))
+ for b in tabpagebuflist(t+1)
+ if str ==# expand('#' . b . ':p')
+ return t+1
+ endif
+ endfor
+ endfor
+ return 0
+endfunction
+
+" FUNCTION: Path.WinToUnixPath(pathstr){{{1
+" Takes in a windows path and returns the unix equiv
+"
+" A class level method
+"
+" Args:
+" pathstr: the windows path to convert
+function! s:Path.WinToUnixPath(pathstr)
+ if !nerdtree#runningWindows()
+ return a:pathstr
+ endif
+
+ let toReturn = a:pathstr
+
+ "remove the x:\ of the front
+ let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', "")
+
+ "remove the \\ network share from the front
+ let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', "")
+
+ "convert all \ chars to /
+ let toReturn = substitute(toReturn, '\', '/', "g")
+
+ return toReturn
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim
new file mode 100644
index 0000000..658ff09
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim
@@ -0,0 +1,700 @@
+" ============================================================================
+" CLASS: TreeDirNode
+"
+" A subclass of NERDTreeFileNode.
+"
+" The 'composite' part of the file/dir composite.
+" ============================================================================
+
+
+let s:TreeDirNode = copy(g:NERDTreeFileNode)
+let g:NERDTreeDirNode = s:TreeDirNode
+
+" FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
+" Class method that returns the highest cached ancestor of the current root.
+function! s:TreeDirNode.AbsoluteTreeRoot()
+ let currentNode = b:NERDTree.root
+ while currentNode.parent != {}
+ let currentNode = currentNode.parent
+ endwhile
+ return currentNode
+endfunction
+
+" FUNCTION: TreeDirNode.activate([options]) {{{1
+function! s:TreeDirNode.activate(...)
+ let l:options = (a:0 > 0) ? a:1 : {}
+
+ call self.toggleOpen(l:options)
+
+ " Note that we only re-render the NERDTree for this node if we did NOT
+ " create a new node and render it in a new window or tab. In the latter
+ " case, rendering the NERDTree for this node could overwrite the text of
+ " the new NERDTree!
+ if !has_key(l:options, 'where') || empty(l:options['where'])
+ call self.getNerdtree().render()
+ call self.putCursorHere(0, 0)
+ endif
+endfunction
+
+" FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1
+" Adds the given treenode to the list of children for this node
+"
+" Args:
+" -treenode: the node to add
+" -inOrder: 1 if the new node should be inserted in sorted order
+function! s:TreeDirNode.addChild(treenode, inOrder)
+ call add(self.children, a:treenode)
+ let a:treenode.parent = self
+
+ if a:inOrder
+ call self.sortChildren()
+ endif
+endfunction
+
+" FUNCTION: TreeDirNode.close() {{{1
+" Mark this TreeDirNode as closed.
+function! s:TreeDirNode.close()
+
+ " Close all directories in this directory node's cascade. This is
+ " necessary to ensure consistency when cascades are rendered.
+ for l:dirNode in self.getCascade()
+ let l:dirNode.isOpen = 0
+ endfor
+endfunction
+
+" FUNCTION: TreeDirNode.closeChildren() {{{1
+" Recursively close any directory nodes that are descendants of this node.
+function! s:TreeDirNode.closeChildren()
+ for l:child in self.children
+ if l:child.path.isDirectory
+ call l:child.close()
+ call l:child.closeChildren()
+ endif
+ endfor
+endfunction
+
+" FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1
+" Instantiates a new child node for this node with the given path. The new
+" nodes parent is set to this node.
+"
+" Args:
+" path: a Path object that this node will represent/contain
+" inOrder: 1 if the new node should be inserted in sorted order
+"
+" Returns:
+" the newly created node
+function! s:TreeDirNode.createChild(path, inOrder)
+ let newTreeNode = g:NERDTreeFileNode.New(a:path, self.getNerdtree())
+ call self.addChild(newTreeNode, a:inOrder)
+ return newTreeNode
+endfunction
+
+" FUNCTION: TreeDirNode.displayString() {{{1
+" Assemble and return a string that can represent this TreeDirNode object in
+" the NERDTree window.
+function! s:TreeDirNode.displayString()
+ let l:result = ''
+
+ " Build a label that identifies this TreeDirNode.
+ let l:label = ''
+ let l:cascade = self.getCascade()
+ for l:dirNode in l:cascade
+ let l:next = l:dirNode.path.displayString()
+ let l:label .= l:label == '' ? l:next : substitute(l:next,'^.','','')
+ endfor
+
+ " Select the appropriate open/closed status indicator symbol.
+ if l:cascade[-1].isOpen
+ let l:symbol = g:NERDTreeDirArrowCollapsible
+ else
+ let l:symbol = g:NERDTreeDirArrowExpandable
+ endif
+
+ let l:flags = l:cascade[-1].path.flagSet.renderToString()
+
+ let l:result = l:symbol . ' ' . l:flags . l:label
+ return l:result
+endfunction
+
+" FUNCTION: TreeDirNode.findNode(path) {{{1
+" Will find one of the children (recursively) that has the given path
+"
+" Args:
+" path: a path object
+unlet s:TreeDirNode.findNode
+function! s:TreeDirNode.findNode(path)
+ if a:path.equals(self.path)
+ return self
+ endif
+ if stridx(a:path.str(), self.path.str(), 0) ==# -1
+ return {}
+ endif
+
+ if self.path.isDirectory
+ for i in self.children
+ let retVal = i.findNode(a:path)
+ if retVal != {}
+ return retVal
+ endif
+ endfor
+ endif
+ return {}
+endfunction
+
+" FUNCTION: TreeDirNode.getCascade() {{{1
+" Return an array of dir nodes (starting from self) that can be cascade opened.
+function! s:TreeDirNode.getCascade()
+ if !self.isCascadable()
+ return [self]
+ endif
+
+ let vc = self.getVisibleChildren()
+ let visChild = vc[0]
+
+ return [self] + visChild.getCascade()
+endfunction
+
+" FUNCTION: TreeDirNode.getCascadeRoot() {{{1
+" Return the first directory node in the cascade in which this directory node
+" is rendered.
+function! s:TreeDirNode.getCascadeRoot()
+
+ " Don't search above the current NERDTree root node.
+ if self.isRoot()
+ return self
+ endif
+
+ let l:cascadeRoot = self
+ let l:parent = self.parent
+
+ while !empty(l:parent) && !l:parent.isRoot()
+
+ if index(l:parent.getCascade(), self) == -1
+ break
+ endif
+
+ let l:cascadeRoot = l:parent
+ let l:parent = l:parent.parent
+ endwhile
+
+ return l:cascadeRoot
+endfunction
+
+" FUNCTION: TreeDirNode.getChildCount() {{{1
+" Returns the number of children this node has
+function! s:TreeDirNode.getChildCount()
+ return len(self.children)
+endfunction
+
+" FUNCTION: TreeDirNode.getChild(path) {{{1
+" Returns child node of this node that has the given path or {} if no such node
+" exists.
+"
+" This function doesnt not recurse into child dir nodes
+"
+" Args:
+" path: a path object
+function! s:TreeDirNode.getChild(path)
+ if stridx(a:path.str(), self.path.str(), 0) ==# -1
+ return {}
+ endif
+
+ let index = self.getChildIndex(a:path)
+ if index ==# -1
+ return {}
+ else
+ return self.children[index]
+ endif
+
+endfunction
+
+" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
+" returns the child at the given index
+"
+" Args:
+" indx: the index to get the child from
+" visible: 1 if only the visible children array should be used, 0 if all the
+" children should be searched.
+function! s:TreeDirNode.getChildByIndex(indx, visible)
+ let array_to_search = a:visible? self.getVisibleChildren() : self.children
+ if a:indx > len(array_to_search)
+ throw "NERDTree.InvalidArgumentsError: Index is out of bounds."
+ endif
+ return array_to_search[a:indx]
+endfunction
+
+" FUNCTION: TreeDirNode.getChildIndex(path) {{{1
+" Returns the index of the child node of this node that has the given path or
+" -1 if no such node exists.
+"
+" This function doesnt not recurse into child dir nodes
+"
+" Args:
+" path: a path object
+function! s:TreeDirNode.getChildIndex(path)
+ if stridx(a:path.str(), self.path.str(), 0) ==# -1
+ return -1
+ endif
+
+ "do a binary search for the child
+ let a = 0
+ let z = self.getChildCount()
+ while a < z
+ let mid = (a+z)/2
+ let diff = a:path.compareTo(self.children[mid].path)
+
+ if diff ==# -1
+ let z = mid
+ elseif diff ==# 1
+ let a = mid+1
+ else
+ return mid
+ endif
+ endwhile
+ return -1
+endfunction
+
+" FUNCTION: TreeDirNode.getDirChildren() {{{1
+" Return a list of all child nodes from "self.children" that are of type
+" TreeDirNode. This function supports http://github.com/scrooloose/nerdtree-project-plugin.git.
+function! s:TreeDirNode.getDirChildren()
+ return filter(copy(self.children), 'v:val.path.isDirectory == 1')
+endfunction
+
+" FUNCTION: TreeDirNode._glob(pattern, all) {{{1
+" Return a list of strings naming the descendants of the directory in this
+" TreeDirNode object that match the specified glob pattern.
+"
+" Args:
+" pattern: (string) the glob pattern to apply
+" all: (0 or 1) if 1, include "." and ".." if they match "pattern"; if 0,
+" always exclude them
+"
+" Note: If the pathnames in the result list are below the working directory,
+" they are returned as pathnames relative to that directory. This is because
+" this function, internally, attempts to obey 'wildignore' rules that use
+" relative paths.
+function! s:TreeDirNode._glob(pattern, all)
+
+ " Construct a path specification such that "globpath()" will return
+ " relative pathnames, if possible.
+ if self.path.str() == getcwd()
+ let l:pathSpec = ','
+ else
+ let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
+
+ " On Windows, the drive letter may be removed by "fnamemodify()".
+ if nerdtree#runningWindows() && l:pathSpec[0] == g:NERDTreePath.Slash()
+ let l:pathSpec = self.path.drive . l:pathSpec
+ endif
+ endif
+
+ let l:globList = []
+
+ " See ":h version7.txt" and ":h version8.txt" for details on the
+ " development of the "glob()" and "globpath()" functions.
+ if v:version > 704 || (v:version == 704 && has('patch654'))
+ let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
+ elseif v:version == 704 && has('patch279')
+ let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
+ elseif v:version > 702 || (v:version == 702 && has('patch051'))
+ let l:globString = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore)
+ let l:globList = split(l:globString, "\n")
+ else
+ let l:globString = globpath(l:pathSpec, a:pattern)
+ let l:globList = split(l:globString, "\n")
+ endif
+
+ " If "a:all" is false, filter "." and ".." from the output.
+ if !a:all
+ let l:toRemove = []
+
+ for l:file in l:globList
+ let l:tail = fnamemodify(l:file, ':t')
+
+ " If l:file has a trailing slash, then its :tail will be ''. Use
+ " :h to drop the slash and the empty string after it; then use :t
+ " to get the directory name.
+ if l:tail == ''
+ let l:tail = fnamemodify(l:file, ':h:t')
+ endif
+
+ if l:tail == '.' || l:tail == '..'
+ call add(l:toRemove, l:file)
+ if len(l:toRemove) == 2
+ break
+ endif
+ endif
+ endfor
+
+ for l:file in l:toRemove
+ call remove(l:globList, index(l:globList, l:file))
+ endfor
+ endif
+
+ return l:globList
+endfunction
+
+" FUNCTION: TreeDirNode.GetSelected() {{{1
+" Returns the current node if it is a dir node, or else returns the current
+" nodes parent
+unlet s:TreeDirNode.GetSelected
+function! s:TreeDirNode.GetSelected()
+ let currentDir = g:NERDTreeFileNode.GetSelected()
+ if currentDir != {} && !currentDir.isRoot()
+ if currentDir.path.isDirectory ==# 0
+ let currentDir = currentDir.parent
+ endif
+ endif
+ return currentDir
+endfunction
+
+" FUNCTION: TreeDirNode.getVisibleChildCount() {{{1
+" Returns the number of visible children this node has
+function! s:TreeDirNode.getVisibleChildCount()
+ return len(self.getVisibleChildren())
+endfunction
+
+" FUNCTION: TreeDirNode.getVisibleChildren() {{{1
+" Returns a list of children to display for this node, in the correct order
+"
+" Return:
+" an array of treenodes
+function! s:TreeDirNode.getVisibleChildren()
+ let toReturn = []
+ for i in self.children
+ if i.path.ignore(self.getNerdtree()) ==# 0
+ call add(toReturn, i)
+ endif
+ endfor
+ return toReturn
+endfunction
+
+" FUNCTION: TreeDirNode.hasVisibleChildren() {{{1
+" returns 1 if this node has any childre, 0 otherwise..
+function! s:TreeDirNode.hasVisibleChildren()
+ return self.getVisibleChildCount() != 0
+endfunction
+
+" FUNCTION: TreeDirNode.isCascadable() {{{1
+" true if this dir has only one visible child that is also a dir
+" false if this dir is bookmarked or symlinked. Why? Two reasons:
+" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
+" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
+" text, and NERDTree cannot get the path of any child node.
+function! s:TreeDirNode.isCascadable()
+ if g:NERDTreeCascadeSingleChildDir == 0
+ return 0
+ endif
+
+ if self.path.isSymLink
+ return 0
+ endif
+
+ for i in g:NERDTreeBookmark.Bookmarks()
+ if i.path.equals(self.path)
+ return 0
+ endif
+ endfor
+
+ let c = self.getVisibleChildren()
+ return len(c) == 1 && c[0].path.isDirectory
+endfunction
+
+" FUNCTION: TreeDirNode._initChildren() {{{1
+" Removes all childen from this node and re-reads them
+"
+" Args:
+" silent: 1 if the function should not echo any "please wait" messages for
+" large directories
+"
+" Return: the number of child nodes read
+function! s:TreeDirNode._initChildren(silent)
+ "remove all the current child nodes
+ let self.children = []
+
+ let files = self._glob('*', 1) + self._glob('.*', 0)
+
+ if !a:silent && len(files) > g:NERDTreeNotificationThreshold
+ call nerdtree#echo("Please wait, caching a large dir ...")
+ endif
+
+ let invalidFilesFound = 0
+ for i in files
+ try
+ let path = g:NERDTreePath.New(i)
+ call self.createChild(path, 0)
+ call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
+ catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
+ let invalidFilesFound += 1
+ endtry
+ endfor
+
+ call self.sortChildren()
+
+ if !a:silent && len(files) > g:NERDTreeNotificationThreshold
+ call nerdtree#echo("Please wait, caching a large dir ... DONE (". self.getChildCount() ." nodes cached).")
+ endif
+
+ if invalidFilesFound
+ call nerdtree#echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree")
+ endif
+ return self.getChildCount()
+endfunction
+
+" FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
+" Return a new TreeDirNode object with the given path and parent.
+"
+" Args:
+" path: dir that the node represents
+" nerdtree: the tree the node belongs to
+function! s:TreeDirNode.New(path, nerdtree)
+ if a:path.isDirectory != 1
+ throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object."
+ endif
+
+ let newTreeNode = copy(self)
+ let newTreeNode.path = a:path
+
+ let newTreeNode.isOpen = 0
+ let newTreeNode.children = []
+
+ let newTreeNode.parent = {}
+ let newTreeNode._nerdtree = a:nerdtree
+
+ return newTreeNode
+endfunction
+
+" FUNCTION: TreeDirNode.open([options]) {{{1
+" Open this directory node in the current tree or elsewhere if special options
+" are provided. Return 0 if options were processed. Otherwise, return the
+" number of new cached nodes.
+function! s:TreeDirNode.open(...)
+ let l:options = a:0 ? a:1 : {}
+
+ " If special options were specified, process them and return.
+ if has_key(l:options, 'where') && !empty(l:options['where'])
+ let l:opener = g:NERDTreeOpener.New(self.path, l:options)
+ call l:opener.open(self)
+ return 0
+ endif
+
+ " Open any ancestors of this node that render within the same cascade.
+ let l:parent = self.parent
+ while !empty(l:parent) && !l:parent.isRoot()
+ if index(l:parent.getCascade(), self) >= 0
+ let l:parent.isOpen = 1
+ let l:parent = l:parent.parent
+ else
+ break
+ endif
+ endwhile
+
+ let self.isOpen = 1
+
+ let l:numChildrenCached = 0
+ if empty(self.children)
+ let l:numChildrenCached = self._initChildren(0)
+ endif
+
+ return l:numChildrenCached
+endfunction
+
+" FUNCTION: TreeDirNode.openAlong([opts]) {{{1
+" recursive open the dir if it has only one directory child.
+"
+" return the level of opened directories.
+function! s:TreeDirNode.openAlong(...)
+ let opts = a:0 ? a:1 : {}
+ let level = 0
+
+ let node = self
+ while node.path.isDirectory
+ call node.open(opts)
+ let level += 1
+ if node.getVisibleChildCount() == 1
+ let node = node.getChildByIndex(0, 1)
+ else
+ break
+ endif
+ endwhile
+ return level
+endfunction
+
+" FUNCTION: TreeDirNode.openExplorer() {{{1
+" Open an explorer window for this node in the previous window. The explorer
+" can be a NERDTree window or a netrw window.
+function! s:TreeDirNode.openExplorer()
+ call self.open({'where': 'p'})
+endfunction
+
+" FUNCTION: TreeDirNode.openInNewTab(options) {{{1
+unlet s:TreeDirNode.openInNewTab
+function! s:TreeDirNode.openInNewTab(options)
+ call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead')
+ call self.open({'where': 't'})
+endfunction
+
+" FUNCTION: TreeDirNode._openInNewTab() {{{1
+function! s:TreeDirNode._openInNewTab()
+ tabnew
+ call g:NERDTreeCreator.CreateTabTree(self.path.str())
+endfunction
+
+" FUNCTION: TreeDirNode.openRecursively() {{{1
+" Open this directory node and any descendant directory nodes whose pathnames
+" are not ignored.
+function! s:TreeDirNode.openRecursively()
+ silent call self.open()
+
+ for l:child in self.children
+ if l:child.path.isDirectory && !l:child.path.ignore(l:child.getNerdtree())
+ call l:child.openRecursively()
+ endif
+ endfor
+endfunction
+
+" FUNCTION: TreeDirNode.refresh() {{{1
+function! s:TreeDirNode.refresh()
+ call self.path.refresh(self.getNerdtree())
+
+ "if this node was ever opened, refresh its children
+ if self.isOpen || !empty(self.children)
+ let files = self._glob('*', 1) + self._glob('.*', 0)
+ let newChildNodes = []
+ let invalidFilesFound = 0
+ for i in files
+ try
+ "create a new path and see if it exists in this nodes children
+ let path = g:NERDTreePath.New(i)
+ let newNode = self.getChild(path)
+ if newNode != {}
+ call newNode.refresh()
+ call add(newChildNodes, newNode)
+
+ "the node doesnt exist so create it
+ else
+ let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
+ let newNode.parent = self
+ call add(newChildNodes, newNode)
+ endif
+ catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
+ let invalidFilesFound = 1
+ endtry
+ endfor
+
+ "swap this nodes children out for the children we just read/refreshed
+ let self.children = newChildNodes
+ call self.sortChildren()
+
+ if invalidFilesFound
+ call nerdtree#echoWarning("some files could not be loaded into the NERD tree")
+ endif
+ endif
+endfunction
+
+" FUNCTION: TreeDirNode.refreshFlags() {{{1
+unlet s:TreeDirNode.refreshFlags
+function! s:TreeDirNode.refreshFlags()
+ call self.path.refreshFlags(self.getNerdtree())
+ for i in self.children
+ call i.refreshFlags()
+ endfor
+endfunction
+
+" FUNCTION: TreeDirNode.refreshDirFlags() {{{1
+function! s:TreeDirNode.refreshDirFlags()
+ call self.path.refreshFlags(self.getNerdtree())
+endfunction
+
+" FUNCTION: TreeDirNode.reveal(path) {{{1
+" reveal the given path, i.e. cache and open all treenodes needed to display it
+" in the UI
+" Returns the revealed node
+function! s:TreeDirNode.reveal(path, ...)
+ let opts = a:0 ? a:1 : {}
+
+ if !a:path.isUnder(self.path)
+ throw "NERDTree.InvalidArgumentsError: " . a:path.str() . " should be under " . self.path.str()
+ endif
+
+ call self.open()
+
+ if self.path.equals(a:path.getParent())
+ let n = self.findNode(a:path)
+ if has_key(opts, "open")
+ call n.open()
+ endif
+ return n
+ endif
+
+ let p = a:path
+ while !p.getParent().equals(self.path)
+ let p = p.getParent()
+ endwhile
+
+ let n = self.findNode(p)
+ return n.reveal(a:path, opts)
+endfunction
+
+" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
+" Remove the given treenode from "self.children".
+" Throws "NERDTree.ChildNotFoundError" if the node is not found.
+"
+" Args:
+" treenode: the node object to remove
+function! s:TreeDirNode.removeChild(treenode)
+ for i in range(0, self.getChildCount()-1)
+ if self.children[i].equals(a:treenode)
+ call remove(self.children, i)
+ return
+ endif
+ endfor
+
+ throw "NERDTree.ChildNotFoundError: child node was not found"
+endfunction
+
+" FUNCTION: TreeDirNode.sortChildren() {{{1
+" Sort "self.children" by alphabetical order and directory priority.
+function! s:TreeDirNode.sortChildren()
+ if count(g:NERDTreeSortOrder, '*') < 1
+ call add(g:NERDTreeSortOrder, '*')
+ endif
+ let CompareFunc = function("nerdtree#compareNodesBySortKey")
+ call sort(self.children, CompareFunc)
+ let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
+endfunction
+
+" FUNCTION: TreeDirNode.toggleOpen([options]) {{{1
+" Opens this directory if it is closed and vice versa
+function! s:TreeDirNode.toggleOpen(...)
+ let opts = a:0 ? a:1 : {}
+ if self.isOpen ==# 1
+ call self.close()
+ else
+ if g:NERDTreeCascadeOpenSingleChildDir == 0
+ call self.open(opts)
+ else
+ call self.openAlong(opts)
+ endif
+ endif
+endfunction
+
+" FUNCTION: TreeDirNode.transplantChild(newNode) {{{1
+" Replaces the child of this with the given node (where the child node's full
+" path matches a:newNode's fullpath). The search for the matching node is
+" non-recursive
+"
+" Arg:
+" newNode: the node to graft into the tree
+function! s:TreeDirNode.transplantChild(newNode)
+ for i in range(0, self.getChildCount()-1)
+ if self.children[i].equals(a:newNode)
+ let self.children[i] = a:newNode
+ let a:newNode.parent = self
+ break
+ endif
+ endfor
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim
new file mode 100644
index 0000000..d4c060f
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim
@@ -0,0 +1,347 @@
+" ============================================================================
+" CLASS: TreeFileNode
+"
+" This class is the parent of the "TreeDirNode" class and is the "Component"
+" part of the composite design pattern between the NERDTree node classes.
+" ============================================================================
+
+
+let s:TreeFileNode = {}
+let g:NERDTreeFileNode = s:TreeFileNode
+
+" FUNCTION: TreeFileNode.activate(...) {{{1
+function! s:TreeFileNode.activate(...)
+ call self.open(a:0 ? a:1 : {})
+endfunction
+
+" FUNCTION: TreeFileNode.bookmark(name) {{{1
+" bookmark this node with a:name
+function! s:TreeFileNode.bookmark(name)
+
+ " if a bookmark exists with the same name and the node is cached then save
+ " it so we can update its display string
+ let oldMarkedNode = {}
+ try
+ let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1, self.getNerdtree())
+ catch /^NERDTree.BookmarkNotFoundError/
+ catch /^NERDTree.BookmarkedNodeNotFoundError/
+ endtry
+
+ call g:NERDTreeBookmark.AddBookmark(a:name, self.path)
+ call self.path.cacheDisplayString()
+ call g:NERDTreeBookmark.Write()
+
+ if !empty(oldMarkedNode)
+ call oldMarkedNode.path.cacheDisplayString()
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.cacheParent() {{{1
+" initializes self.parent if it isnt already
+function! s:TreeFileNode.cacheParent()
+ if empty(self.parent)
+ let parentPath = self.path.getParent()
+ if parentPath.equals(self.path)
+ throw "NERDTree.CannotCacheParentError: already at root"
+ endif
+ let self.parent = s:TreeFileNode.New(parentPath, self.getNerdtree())
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.clearBookmarks() {{{1
+function! s:TreeFileNode.clearBookmarks()
+ for i in g:NERDTreeBookmark.Bookmarks()
+ if i.path.equals(self.path)
+ call i.delete()
+ end
+ endfor
+ call self.path.cacheDisplayString()
+endfunction
+
+" FUNCTION: TreeFileNode.copy(dest) {{{1
+function! s:TreeFileNode.copy(dest)
+ call self.path.copy(a:dest)
+ let newPath = g:NERDTreePath.New(a:dest)
+ let parent = self.getNerdtree().root.findNode(newPath.getParent())
+ if !empty(parent)
+ call parent.refresh()
+ return parent.findNode(newPath)
+ else
+ return {}
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.delete {{{1
+" Removes this node from the tree and calls the Delete method for its path obj
+function! s:TreeFileNode.delete()
+ call self.path.delete()
+ call self.parent.removeChild(self)
+endfunction
+
+" FUNCTION: TreeFileNode.displayString() {{{1
+"
+" Returns a string that specifies how the node should be represented as a
+" string
+"
+" Return:
+" a string that can be used in the view to represent this node
+function! s:TreeFileNode.displayString()
+ return self.path.flagSet.renderToString() . self.path.displayString()
+endfunction
+
+" FUNCTION: TreeFileNode.equals(treenode) {{{1
+"
+" Compares this treenode to the input treenode and returns 1 if they are the
+" same node.
+"
+" Use this method instead of == because sometimes when the treenodes contain
+" many children, vim seg faults when doing ==
+"
+" Args:
+" treenode: the other treenode to compare to
+function! s:TreeFileNode.equals(treenode)
+ return self.path.str() ==# a:treenode.path.str()
+endfunction
+
+" FUNCTION: TreeFileNode.findNode(path) {{{1
+" Returns self if this node.path.Equals the given path.
+" Returns {} if not equal.
+"
+" Args:
+" path: the path object to compare against
+function! s:TreeFileNode.findNode(path)
+ if a:path.equals(self.path)
+ return self
+ endif
+ return {}
+endfunction
+
+" FUNCTION: TreeFileNode.findSibling(direction) {{{1
+" Find the next or previous sibling of this node.
+"
+" Args:
+" direction: 0 for previous, 1 for next
+"
+" Return:
+" The next/previous TreeFileNode object or an empty dictionary if not found.
+function! s:TreeFileNode.findSibling(direction)
+
+ " There can be no siblings if there is no parent.
+ if empty(self.parent)
+ return {}
+ endif
+
+ let l:nodeIndex = self.parent.getChildIndex(self.path)
+
+ if l:nodeIndex == -1
+ return {}
+ endif
+
+ " Get the next index to begin the search.
+ let l:nodeIndex += a:direction ? 1 : -1
+
+ while 0 <= l:nodeIndex && l:nodeIndex < self.parent.getChildCount()
+
+ " Return the next node if it is not ignored.
+ if !self.parent.children[l:nodeIndex].path.ignore(self.getNerdtree())
+ return self.parent.children[l:nodeIndex]
+ endif
+
+ let l:nodeIndex += a:direction ? 1 : -1
+ endwhile
+
+ return {}
+endfunction
+
+" FUNCTION: TreeFileNode.getNerdtree(){{{1
+function! s:TreeFileNode.getNerdtree()
+ return self._nerdtree
+endfunction
+
+" FUNCTION: TreeFileNode.GetRootForTab(){{{1
+" get the root node for this tab
+function! s:TreeFileNode.GetRootForTab()
+ if g:NERDTree.ExistsForTab()
+ return getbufvar(t:NERDTreeBufName, 'NERDTree').root
+ end
+ return {}
+endfunction
+
+" FUNCTION: TreeFileNode.GetSelected() {{{1
+" If the cursor is currently positioned on a tree node, return the node.
+" Otherwise, return the empty dictionary.
+function! s:TreeFileNode.GetSelected()
+
+ try
+ let l:path = b:NERDTree.ui.getPath(line('.'))
+
+ if empty(l:path)
+ return {}
+ endif
+
+ return b:NERDTree.root.findNode(l:path)
+ catch
+ return {}
+ endtry
+endfunction
+
+" FUNCTION: TreeFileNode.isVisible() {{{1
+" returns 1 if this node should be visible according to the tree filters and
+" hidden file filters (and their on/off status)
+function! s:TreeFileNode.isVisible()
+ return !self.path.ignore(self.getNerdtree())
+endfunction
+
+" FUNCTION: TreeFileNode.isRoot() {{{1
+function! s:TreeFileNode.isRoot()
+ if !g:NERDTree.ExistsForBuf()
+ throw "NERDTree.NoTreeError: No tree exists for the current buffer"
+ endif
+
+ return self.equals(self.getNerdtree().root)
+endfunction
+
+" FUNCTION: TreeFileNode.New(path, nerdtree) {{{1
+" Returns a new TreeNode object with the given path and parent
+"
+" Args:
+" path: file/dir that the node represents
+" nerdtree: the tree the node belongs to
+function! s:TreeFileNode.New(path, nerdtree)
+ if a:path.isDirectory
+ return g:NERDTreeDirNode.New(a:path, a:nerdtree)
+ else
+ let newTreeNode = copy(self)
+ let newTreeNode.path = a:path
+ let newTreeNode.parent = {}
+ let newTreeNode._nerdtree = a:nerdtree
+ return newTreeNode
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.open() {{{1
+function! s:TreeFileNode.open(...)
+ let opts = a:0 ? a:1 : {}
+ let opener = g:NERDTreeOpener.New(self.path, opts)
+ call opener.open(self)
+endfunction
+
+" FUNCTION: TreeFileNode.openSplit() {{{1
+" Open this node in a new window
+function! s:TreeFileNode.openSplit()
+ call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.')
+ call self.open({'where': 'h'})
+endfunction
+
+" FUNCTION: TreeFileNode.openVSplit() {{{1
+" Open this node in a new vertical window
+function! s:TreeFileNode.openVSplit()
+ call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.')
+ call self.open({'where': 'v'})
+endfunction
+
+" FUNCTION: TreeFileNode.openInNewTab(options) {{{1
+function! s:TreeFileNode.openInNewTab(options)
+ call nerdtree#deprecated('TreeFileNode.openinNewTab', 'is deprecated, use .open() instead.')
+ call self.open(extend({'where': 't'}, a:options))
+endfunction
+
+" FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
+" Places the cursor on the line number this node is rendered on
+"
+" Args:
+" isJump: 1 if this cursor movement should be counted as a jump by vim
+" recurseUpward: try to put the cursor on the parent if the this node isnt
+" visible
+function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
+ let ln = self.getNerdtree().ui.getLineNum(self)
+ if ln != -1
+ if a:isJump
+ mark '
+ endif
+ call cursor(ln, col("."))
+ else
+ if a:recurseUpward
+ let node = self
+ while node != {} && self.getNerdtree().ui.getLineNum(node) ==# -1
+ let node = node.parent
+ call node.open()
+ endwhile
+ call self._nerdtree.render()
+ call node.putCursorHere(a:isJump, 0)
+ endif
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.refresh() {{{1
+function! s:TreeFileNode.refresh()
+ call self.path.refresh(self.getNerdtree())
+endfunction
+
+" FUNCTION: TreeFileNode.refreshFlags() {{{1
+function! s:TreeFileNode.refreshFlags()
+ call self.path.refreshFlags(self.getNerdtree())
+endfunction
+
+" FUNCTION: TreeFileNode.rename() {{{1
+" Calls the rename method for this nodes path obj
+function! s:TreeFileNode.rename(newName)
+ let newName = substitute(a:newName, '\(\\\|\/\)$', '', '')
+ call self.path.rename(newName)
+ call self.parent.removeChild(self)
+
+ let parentPath = self.path.getParent()
+ let newParent = self.getNerdtree().root.findNode(parentPath)
+
+ if newParent != {}
+ call newParent.createChild(self.path, 1)
+ call newParent.refresh()
+ endif
+endfunction
+
+" FUNCTION: TreeFileNode.renderToString {{{1
+" returns a string representation for this tree to be rendered in the view
+function! s:TreeFileNode.renderToString()
+ return self._renderToString(0, 0)
+endfunction
+
+" Args:
+" depth: the current depth in the tree for this call
+" drawText: 1 if we should actually draw the line for this node (if 0 then the
+" child nodes are rendered only)
+" for each depth in the tree
+function! s:TreeFileNode._renderToString(depth, drawText)
+ let output = ""
+ if a:drawText ==# 1
+
+ let treeParts = repeat(' ', a:depth - 1)
+
+ if !self.path.isDirectory
+ let treeParts = treeParts . ' '
+ endif
+
+ let line = treeParts . self.displayString()
+
+ let output = output . line . "\n"
+ endif
+
+ " if the node is an open dir, draw its children
+ if self.path.isDirectory ==# 1 && self.isOpen ==# 1
+
+ let childNodesToDraw = self.getVisibleChildren()
+
+ if self.isCascadable() && a:depth > 0
+
+ let output = output . childNodesToDraw[0]._renderToString(a:depth, 0)
+
+ elseif len(childNodesToDraw) > 0
+ for i in childNodesToDraw
+ let output = output . i._renderToString(a:depth + 1, 1)
+ endfor
+ endif
+ endif
+
+ return output
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/lib/nerdtree/ui.vim b/vim/.vim/plugged/nerdtree/lib/nerdtree/ui.vim
new file mode 100644
index 0000000..32d96d9
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/lib/nerdtree/ui.vim
@@ -0,0 +1,516 @@
+" ============================================================================
+" CLASS: UI
+" ============================================================================
+
+
+let s:UI = {}
+let g:NERDTreeUI = s:UI
+
+" FUNCTION: s:UI.centerView() {{{2
+" centers the nerd tree window around the cursor (provided the nerd tree
+" options permit)
+function! s:UI.centerView()
+ if g:NERDTreeAutoCenter
+ let current_line = winline()
+ let lines_to_top = current_line
+ let lines_to_bottom = winheight(g:NERDTree.GetWinNum()) - current_line
+ if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold
+ normal! zz
+ endif
+ endif
+endfunction
+
+" FUNCTION: s:UI._dumpHelp {{{1
+" prints out the quick help
+function! s:UI._dumpHelp()
+ if self.getShowHelp()
+ let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n"
+ let help .= "\" ============================\n"
+ let help .= "\" File node mappings~\n"
+ let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n"
+ let help .= "\" <CR>,\n"
+ if self.nerdtree.isTabTree()
+ let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
+ else
+ let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n"
+ endif
+ if self.nerdtree.isTabTree()
+ let help .= "\" ". g:NERDTreeMapPreview .": preview\n"
+ endif
+ let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
+ let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
+ let help .= "\" middle-click,\n"
+ let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n"
+ let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
+ let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n"
+ let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Directory node mappings~\n"
+ let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n"
+ let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n"
+ let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n"
+ let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
+ let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
+ let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n"
+ let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n"
+ let help .= "\" current node recursively\n"
+ let help .= "\" middle-click,\n"
+ let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n"
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Bookmark table mappings~\n"
+ let help .= "\" double-click,\n"
+ let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
+ let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
+ let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
+ let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Tree navigation mappings~\n"
+ let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n"
+ let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n"
+ let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n"
+ let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n"
+ let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
+ let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Filesystem mappings~\n"
+ let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
+ let help .= "\" selected dir\n"
+ let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n"
+ let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
+ let help .= "\" but leave old root open\n"
+ let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n"
+ let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n"
+ let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n"
+ let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
+ let help .= "\" selected dir\n"
+ let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n"
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Tree filtering mappings~\n"
+ let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n"
+ let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n"
+ let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
+ let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
+
+ " add quickhelp entries for each custom key map
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Custom mappings~\n"
+ for i in g:NERDTreeKeyMap.All()
+ if !empty(i.quickhelpText)
+ let help .= "\" ". i.key .": ". i.quickhelpText ."\n"
+ endif
+ endfor
+
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Other mappings~\n"
+ let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
+ let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
+ let help .= "\" the NERDTree window\n"
+ let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n"
+ let help .= "\"\n\" ----------------------------\n"
+ let help .= "\" Bookmark commands~\n"
+ let help .= "\" :Bookmark [<name>]\n"
+ let help .= "\" :BookmarkToRoot <name>\n"
+ let help .= "\" :RevealBookmark <name>\n"
+ let help .= "\" :OpenBookmark <name>\n"
+ let help .= "\" :ClearBookmarks [<names>]\n"
+ let help .= "\" :ClearAllBookmarks\n"
+ silent! put =help
+ elseif !self.isMinimal()
+ let help ="\" Press ". g:NERDTreeMapHelp ." for help\n"
+ silent! put =help
+ endif
+endfunction
+
+
+" FUNCTION: s:UI.new(nerdtree) {{{1
+function! s:UI.New(nerdtree)
+ let newObj = copy(self)
+ let newObj.nerdtree = a:nerdtree
+ let newObj._showHelp = 0
+ let newObj._ignoreEnabled = 1
+ let newObj._showFiles = g:NERDTreeShowFiles
+ let newObj._showHidden = g:NERDTreeShowHidden
+ let newObj._showBookmarks = g:NERDTreeShowBookmarks
+
+ return newObj
+endfunction
+
+" FUNCTION: s:UI.getPath(ln) {{{1
+" Return the "Path" object for the node that is rendered on the given line
+" number. If the "up a dir" line is selected, return the "Path" object for
+" the parent of the root. Return the empty dictionary if the given line
+" does not reference a tree node.
+function! s:UI.getPath(ln)
+ let line = getline(a:ln)
+
+ let rootLine = self.getRootLineNum()
+
+ if a:ln == rootLine
+ return self.nerdtree.root.path
+ endif
+
+ if line ==# s:UI.UpDirLine()
+ return self.nerdtree.root.path.getParent()
+ endif
+
+ if a:ln < rootLine
+ return {}
+ endif
+
+ let indent = self._indentLevelFor(line)
+
+ " remove the tree parts and the leading space
+ let curFile = self._stripMarkup(line)
+
+ let dir = ""
+ let lnum = a:ln
+ while lnum > 0
+ let lnum = lnum - 1
+ let curLine = getline(lnum)
+ let curLineStripped = self._stripMarkup(curLine)
+
+ " have we reached the top of the tree?
+ if lnum == rootLine
+ let dir = self.nerdtree.root.path.str({'format': 'UI'}) . dir
+ break
+ endif
+ if curLineStripped =~# '/$'
+ let lpindent = self._indentLevelFor(curLine)
+ if lpindent < indent
+ let indent = indent - 1
+
+ let dir = substitute (curLineStripped,'^\\', "", "") . dir
+ continue
+ endif
+ endif
+ endwhile
+ let curFile = self.nerdtree.root.path.drive . dir . curFile
+ let toReturn = g:NERDTreePath.New(curFile)
+ return toReturn
+endfunction
+
+" FUNCTION: s:UI.getLineNum(node) {{{1
+" Return the line number where the given node is rendered. Return -1 if the
+" given node is not visible.
+function! s:UI.getLineNum(node)
+
+ if a:node.isRoot()
+ return self.getRootLineNum()
+ endif
+
+ let l:pathComponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/\s*$', '', '')]
+ let l:currentPathComponent = 1
+
+ let l:fullPath = a:node.path.str({'format': 'UI'})
+
+ for l:lineNumber in range(self.getRootLineNum() + 1, line('$'))
+ let l:currentLine = getline(l:lineNumber)
+ let l:indentLevel = self._indentLevelFor(l:currentLine)
+
+ if l:indentLevel != l:currentPathComponent
+ continue
+ endif
+
+ let l:currentLine = self._stripMarkup(l:currentLine)
+ let l:currentPath = join(l:pathComponents, '/') . '/' . l:currentLine
+
+ " Directories: If the current path "starts with" the full path, then
+ " either the paths are equal or the line is a cascade containing the
+ " full path.
+ if l:fullPath[-1:] == '/' && stridx(l:currentPath, l:fullPath) == 0
+ return l:lineNumber
+ endif
+
+ " Files: The paths must exactly match.
+ if l:fullPath ==# l:currentPath
+ return l:lineNumber
+ endif
+
+ " Otherwise: If the full path starts with the current path and the
+ " current path is a directory, we add a new path component.
+ if stridx(l:fullPath, l:currentPath) == 0 && l:currentPath[-1:] == '/'
+ let l:currentLine = substitute(l:currentLine, '/\s*$', '', '')
+ call add(l:pathComponents, l:currentLine)
+ let l:currentPathComponent += 1
+ endif
+ endfor
+
+ return -1
+endfunction
+
+" FUNCTION: s:UI.getRootLineNum(){{{1
+" gets the line number of the root node
+function! s:UI.getRootLineNum()
+ let rootLine = 1
+ while getline(rootLine) !~# '^\(/\|<\)'
+ let rootLine = rootLine + 1
+ endwhile
+ return rootLine
+endfunction
+
+" FUNCTION: s:UI.getShowBookmarks() {{{1
+function! s:UI.getShowBookmarks()
+ return self._showBookmarks
+endfunction
+
+" FUNCTION: s:UI.getShowFiles() {{{1
+function! s:UI.getShowFiles()
+ return self._showFiles
+endfunction
+
+" FUNCTION: s:UI.getShowHelp() {{{1
+function! s:UI.getShowHelp()
+ return self._showHelp
+endfunction
+
+" FUNCTION: s:UI.getShowHidden() {{{1
+function! s:UI.getShowHidden()
+ return self._showHidden
+endfunction
+
+" FUNCTION: s:UI._indentLevelFor(line) {{{1
+function! s:UI._indentLevelFor(line)
+ " have to do this work around because match() returns bytes, not chars
+ let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
+ " The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+
+ let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs'))
+
+ return leadChars / s:UI.IndentWid()
+endfunction
+
+" FUNCTION: s:UI.IndentWid() {{{1
+function! s:UI.IndentWid()
+ return 2
+endfunction
+
+" FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1
+function! s:UI.isIgnoreFilterEnabled()
+ return self._ignoreEnabled == 1
+endfunction
+
+" FUNCTION: s:UI.isMinimal() {{{1
+function! s:UI.isMinimal()
+ return g:NERDTreeMinimalUI
+endfunction
+
+" FUNCTION: s:UI.MarkupReg() {{{1
+function! s:UI.MarkupReg()
+ return '^ *['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']\? '
+endfunction
+
+" FUNCTION: s:UI._renderBookmarks {{{1
+function! s:UI._renderBookmarks()
+
+ if !self.isMinimal()
+ call setline(line(".")+1, ">----------Bookmarks----------")
+ call cursor(line(".")+1, col("."))
+ endif
+
+ if g:NERDTreeBookmarksSort == 1 || g:NERDTreeBookmarksSort == 2
+ call g:NERDTreeBookmark.SortBookmarksList()
+ endif
+
+ for i in g:NERDTreeBookmark.Bookmarks()
+ call setline(line(".")+1, i.str())
+ call cursor(line(".")+1, col("."))
+ endfor
+
+ call setline(line(".")+1, '')
+ call cursor(line(".")+1, col("."))
+endfunction
+
+" FUNCTION: s:UI.restoreScreenState() {{{1
+"
+" Sets the screen state back to what it was when nerdtree#saveScreenState was last
+" called.
+"
+" Assumes the cursor is in the NERDTree window
+function! s:UI.restoreScreenState()
+ if !has_key(self, '_screenState')
+ return
+ endif
+ exec("silent vertical resize " . self._screenState['oldWindowSize'])
+
+ let old_scrolloff=&scrolloff
+ let &scrolloff=0
+ call cursor(self._screenState['oldTopLine'], 0)
+ normal! zt
+ call setpos(".", self._screenState['oldPos'])
+ let &scrolloff=old_scrolloff
+endfunction
+
+" FUNCTION: s:UI.saveScreenState() {{{1
+" Saves the current cursor position in the current buffer and the window
+" scroll position
+function! s:UI.saveScreenState()
+ let win = winnr()
+ call g:NERDTree.CursorToTreeWin()
+ let self._screenState = {}
+ let self._screenState['oldPos'] = getpos(".")
+ let self._screenState['oldTopLine'] = line("w0")
+ let self._screenState['oldWindowSize']= winwidth("")
+ call nerdtree#exec(win . "wincmd w")
+endfunction
+
+" FUNCTION: s:UI.setShowHidden(val) {{{1
+function! s:UI.setShowHidden(val)
+ let self._showHidden = a:val
+endfunction
+
+" FUNCTION: s:UI._stripMarkup(line){{{1
+" find the filename in the given line, and return it.
+"
+" Args:
+" line: the subject line
+function! s:UI._stripMarkup(line)
+ let l:line = substitute(a:line, '^.\{-}' . g:NERDTreeNodeDelimiter, '', '')
+ return substitute(l:line, g:NERDTreeNodeDelimiter.'.*$', '', '')
+endfunction
+
+" FUNCTION: s:UI.render() {{{1
+function! s:UI.render()
+ setlocal noreadonly modifiable
+
+ " remember the top line of the buffer and the current line so we can
+ " restore the view exactly how it was
+ let curLine = line(".")
+ let curCol = col(".")
+ let topLine = line("w0")
+
+ " delete all lines in the buffer (being careful not to clobber a register)
+ silent 1,$delete _
+
+ call self._dumpHelp()
+
+ " delete the blank line before the help and add one after it
+ if !self.isMinimal()
+ call setline(line(".")+1, "")
+ call cursor(line(".")+1, col("."))
+ endif
+
+ if self.getShowBookmarks()
+ call self._renderBookmarks()
+ endif
+
+ " add the 'up a dir' line
+ if !self.isMinimal()
+ call setline(line(".")+1, s:UI.UpDirLine())
+ call cursor(line(".")+1, col("."))
+ endif
+
+ " draw the header line
+ let header = self.nerdtree.root.path.str({'format': 'UI', 'truncateTo': winwidth(0)})
+ call setline(line(".")+1, header)
+ call cursor(line(".")+1, col("."))
+
+ " draw the tree
+ silent put =self.nerdtree.root.renderToString()
+
+ " delete the blank line at the top of the buffer
+ silent 1,1delete _
+
+ " restore the view
+ let old_scrolloff=&scrolloff
+ let &scrolloff=0
+ call cursor(topLine, 1)
+ normal! zt
+ call cursor(curLine, curCol)
+ let &scrolloff = old_scrolloff
+
+ setlocal readonly nomodifiable
+endfunction
+
+
+" FUNCTION: UI.renderViewSavingPosition {{{1
+" Renders the tree and ensures the cursor stays on the current node or the
+" current nodes parent if it is no longer available upon re-rendering
+function! s:UI.renderViewSavingPosition()
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+
+ " go up the tree till we find a node that will be visible or till we run
+ " out of nodes
+ while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot()
+ let currentNode = currentNode.parent
+ endwhile
+
+ call self.render()
+
+ if currentNode != {}
+ call currentNode.putCursorHere(0, 0)
+ endif
+endfunction
+
+" FUNCTION: s:UI.toggleHelp() {{{1
+function! s:UI.toggleHelp()
+ let self._showHelp = !self._showHelp
+endfunction
+
+" FUNCTION: s:UI.toggleIgnoreFilter() {{{1
+" toggles the use of the NERDTreeIgnore option
+function! s:UI.toggleIgnoreFilter()
+ let self._ignoreEnabled = !self._ignoreEnabled
+ call self.renderViewSavingPosition()
+ call self.centerView()
+endfunction
+
+" FUNCTION: s:UI.toggleShowBookmarks() {{{1
+" Toggle the visibility of the Bookmark table.
+function! s:UI.toggleShowBookmarks()
+ let self._showBookmarks = !self._showBookmarks
+
+ if self.getShowBookmarks()
+ call self.nerdtree.render()
+ call g:NERDTree.CursorToBookmarkTable()
+ else
+
+ if empty(g:NERDTreeFileNode.GetSelected())
+ call b:NERDTree.root.putCursorHere(0, 0)
+ normal! 0
+ endif
+
+ call self.renderViewSavingPosition()
+ endif
+
+ call self.centerView()
+endfunction
+
+" FUNCTION: s:UI.toggleShowFiles() {{{1
+" toggles the display of hidden files
+function! s:UI.toggleShowFiles()
+ let self._showFiles = !self._showFiles
+ call self.renderViewSavingPosition()
+ call self.centerView()
+endfunction
+
+" FUNCTION: s:UI.toggleShowHidden() {{{1
+" toggles the display of hidden files
+function! s:UI.toggleShowHidden()
+ let self._showHidden = !self._showHidden
+ call self.renderViewSavingPosition()
+ call self.centerView()
+endfunction
+
+" FUNCTION: s:UI.toggleZoom() {{{1
+" zoom (maximize/minimize) the NERDTree window
+function! s:UI.toggleZoom()
+ if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
+ let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
+ exec "silent vertical resize ". size
+ let b:NERDTreeZoomed = 0
+ else
+ exec "vertical resize"
+ let b:NERDTreeZoomed = 1
+ endif
+endfunction
+
+" FUNCTION: s:UI.UpDirLine() {{{1
+function! s:UI.UpDirLine()
+ return '.. (up a dir)'
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim b/vim/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim
new file mode 100644
index 0000000..c53650a
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim
@@ -0,0 +1,40 @@
+" ============================================================================
+" File: exec_menuitem.vim
+" Description: plugin for NERD Tree that provides an execute file menu item
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+if exists("g:loaded_nerdtree_exec_menuitem")
+ finish
+endif
+let g:loaded_nerdtree_exec_menuitem = 1
+
+call NERDTreeAddMenuItem({
+ \ 'text': '(!)Execute file',
+ \ 'shortcut': '!',
+ \ 'callback': 'NERDTreeExecFile',
+ \ 'isActiveCallback': 'NERDTreeExecFileActive' })
+
+function! NERDTreeExecFileActive()
+ let node = g:NERDTreeFileNode.GetSelected()
+ return !node.path.isDirectory && node.path.isExecutable
+endfunction
+
+function! NERDTreeExecFile()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ echo "==========================================================\n"
+ echo "Complete the command to execute (add arguments etc):\n"
+ let cmd = treenode.path.str({'escape': 1})
+ let cmd = input(':!', cmd . ' ')
+
+ if cmd != ''
+ exec ':!' . cmd
+ else
+ echo "Aborted"
+ endif
+endfunction
diff --git a/vim/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim b/vim/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim
new file mode 100644
index 0000000..ef261ca
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim
@@ -0,0 +1,368 @@
+" ============================================================================
+" File: fs_menu.vim
+" Description: plugin for the NERD Tree that provides a file system menu
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+if exists("g:loaded_nerdtree_fs_menu")
+ finish
+endif
+let g:loaded_nerdtree_fs_menu = 1
+
+"Automatically delete the buffer after deleting or renaming a file
+if !exists("g:NERDTreeAutoDeleteBuffer")
+ let g:NERDTreeAutoDeleteBuffer = 0
+endif
+
+call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
+call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
+call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
+
+if has("gui_mac") || has("gui_macvim") || has("mac")
+ call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
+ call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
+ call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
+endif
+
+if executable("xdg-open")
+ call NERDTreeAddMenuItem({'text': '(r)eveal the current node in file manager', 'shortcut': 'r', 'callback': 'NERDTreeRevealFileLinux'})
+ call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
+endif
+
+if g:NERDTreePath.CopyingSupported()
+ call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
+endif
+
+if has("unix") || has("osx")
+ call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'})
+else
+ call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
+endif
+
+"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
+"prints out the given msg and, if the user responds by pushing 'y' then the
+"buffer with the given bufnum is deleted
+"
+"Args:
+"bufnum: the buffer that may be deleted
+"msg: a message that will be echoed to the user asking them if they wish to
+" del the buffer
+function! s:promptToDelBuffer(bufnum, msg)
+ echo a:msg
+ if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
+ " 1. ensure that all windows which display the just deleted filename
+ " now display an empty buffer (so a layout is preserved).
+ " Is not it better to close single tabs with this file only ?
+ let s:originalTabNumber = tabpagenr()
+ let s:originalWindowNumber = winnr()
+ " Go to the next buffer in buffer list if at least one extra buffer is listed
+ " Otherwise open a new empty buffer
+ if v:version >= 800
+ let l:listedBufferCount = len(getbufinfo({'buflisted':1}))
+ elseif v:version >= 702
+ let l:listedBufferCount = len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
+ else
+ " Ignore buffer count in this case to make sure we keep the old
+ " behavior
+ let l:listedBufferCount = 0
+ endif
+ if l:listedBufferCount > 1
+ exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif"
+ else
+ exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
+ endif
+ exec "tabnext " . s:originalTabNumber
+ exec s:originalWindowNumber . "wincmd w"
+ " 3. We don't need a previous buffer anymore
+ exec "bwipeout! " . a:bufnum
+ endif
+endfunction
+
+"FUNCTION: s:renameBuffer(bufNum, newNodeName, isDirectory){{{1
+"The buffer with the given bufNum is replaced with a new one
+"
+"Args:
+"bufNum: the buffer that may be deleted
+"newNodeName: the name given to the renamed node
+"isDirectory: determines how to do the create the new filenames
+function! s:renameBuffer(bufNum, newNodeName, isDirectory)
+ if a:isDirectory
+ let quotedFileName = fnameescape(a:newNodeName . '/' . fnamemodify(bufname(a:bufNum),':t'))
+ let editStr = g:NERDTreePath.New(a:newNodeName . '/' . fnamemodify(bufname(a:bufNum),':t')).str({'format': 'Edit'})
+ else
+ let quotedFileName = fnameescape(a:newNodeName)
+ let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'})
+ endif
+ " 1. ensure that a new buffer is loaded
+ exec "badd " . quotedFileName
+ " 2. ensure that all windows which display the just deleted filename
+ " display a buffer for a new filename.
+ let s:originalTabNumber = tabpagenr()
+ let s:originalWindowNumber = winnr()
+ exec "tabdo windo if winbufnr(0) == " . a:bufNum . " | exec ':e! " . editStr . "' | endif"
+ exec "tabnext " . s:originalTabNumber
+ exec s:originalWindowNumber . "wincmd w"
+ " 3. We don't need a previous buffer anymore
+ exec "bwipeout! " . a:bufNum
+endfunction
+"FUNCTION: NERDTreeAddNode(){{{1
+function! NERDTreeAddNode()
+ let curDirNode = g:NERDTreeDirNode.GetSelected()
+
+ let newNodeName = input("Add a childnode\n".
+ \ "==========================================================\n".
+ \ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
+ \ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
+
+ if newNodeName ==# ''
+ call nerdtree#echo("Node Creation Aborted.")
+ return
+ endif
+
+ try
+ let newPath = g:NERDTreePath.Create(newNodeName)
+ let parentNode = b:NERDTree.root.findNode(newPath.getParent())
+
+ let newTreeNode = g:NERDTreeFileNode.New(newPath, b:NERDTree)
+ " Emptying g:NERDTreeOldSortOrder forces the sort to
+ " recalculate the cached sortKey so nodes sort correctly.
+ let g:NERDTreeOldSortOrder = []
+ if empty(parentNode)
+ call b:NERDTree.root.refresh()
+ call b:NERDTree.render()
+ elseif parentNode.isOpen || !empty(parentNode.children)
+ call parentNode.addChild(newTreeNode, 1)
+ call NERDTreeRender()
+ call newTreeNode.putCursorHere(1, 0)
+ endif
+ catch /^NERDTree/
+ call nerdtree#echoWarning("Node Not Created.")
+ endtry
+endfunction
+
+"FUNCTION: NERDTreeMoveNode(){{{1
+function! NERDTreeMoveNode()
+ let curNode = g:NERDTreeFileNode.GetSelected()
+ let newNodePath = input("Rename the current node\n" .
+ \ "==========================================================\n" .
+ \ "Enter the new path for the node: \n" .
+ \ "", curNode.path.str(), "file")
+
+ if newNodePath ==# ''
+ call nerdtree#echo("Node Renaming Aborted.")
+ return
+ endif
+
+ try
+ if curNode.path.isDirectory
+ let l:openBuffers = filter(range(1,bufnr("$")),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"')
+ else
+ let l:openBuffers = filter(range(1,bufnr("$")),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()')
+ endif
+
+ call curNode.rename(newNodePath)
+ " Emptying g:NERDTreeOldSortOrder forces the sort to
+ " recalculate the cached sortKey so nodes sort correctly.
+ let g:NERDTreeOldSortOrder = []
+ call b:NERDTree.root.refresh()
+ call NERDTreeRender()
+
+ " If the file node is open, or files under the directory node are
+ " open, ask the user if they want to replace the file(s) with the
+ " renamed files.
+ if !empty(l:openBuffers)
+ if curNode.path.isDirectory
+ echo "\nDirectory renamed.\n\nFiles with the old directory name are open in buffers " . join(l:openBuffers, ', ') . ". Replace these buffers with the new files? (yN)"
+ else
+ echo "\nFile renamed.\n\nThe old file is open in buffer " . l:openBuffers[0] . ". Replace this buffer with the new file? (yN)"
+ endif
+ if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
+ for bufNum in l:openBuffers
+ call s:renameBuffer(bufNum, newNodePath, curNode.path.isDirectory)
+ endfor
+ endif
+ endif
+
+ call curNode.putCursorHere(1, 0)
+
+ redraw
+ catch /^NERDTree/
+ call nerdtree#echoWarning("Node Not Renamed.")
+ endtry
+endfunction
+
+" FUNCTION: NERDTreeDeleteNode() {{{1
+function! NERDTreeDeleteNode()
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+ let confirmed = 0
+
+ if currentNode.path.isDirectory && ((currentNode.isOpen && currentNode.getChildCount() > 0) ||
+ \ (len(currentNode._glob('*', 1)) > 0))
+ let choice =input("Delete the current node\n" .
+ \ "==========================================================\n" .
+ \ "STOP! Directory is not empty! To delete, type 'yes'\n" .
+ \ "" . currentNode.path.str() . ": ")
+ let confirmed = choice ==# 'yes'
+ else
+ echo "Delete the current node\n" .
+ \ "==========================================================\n".
+ \ "Are you sure you wish to delete the node:\n" .
+ \ "" . currentNode.path.str() . " (yN):"
+ let choice = nr2char(getchar())
+ let confirmed = choice ==# 'y'
+ endif
+
+
+ if confirmed
+ try
+ call currentNode.delete()
+ call NERDTreeRender()
+
+ "if the node is open in a buffer, ask the user if they want to
+ "close that buffer
+ let bufnum = bufnr("^".currentNode.path.str()."$")
+ if buflisted(bufnum)
+ let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
+ call s:promptToDelBuffer(bufnum, prompt)
+ endif
+
+ redraw
+ catch /^NERDTree/
+ call nerdtree#echoWarning("Could not remove node")
+ endtry
+ else
+ call nerdtree#echo("delete aborted")
+ endif
+
+endfunction
+
+" FUNCTION: NERDTreeListNode() {{{1
+function! NERDTreeListNode()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ if !empty(treenode)
+ let s:uname = system("uname")
+ let stat_cmd = 'stat -c "%s" '
+
+ if s:uname =~? "Darwin"
+ let stat_cmd = 'stat -f "%z" '
+ endif
+
+ let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' .
+ \ 'size_with_commas=$(echo $size | sed -e :a -e "s/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta") && ' .
+ \ 'ls -ld ' . shellescape(treenode.path.str()) . ' | sed -e "s/ $size / $size_with_commas /"'
+
+ let metadata = split(system(cmd),'\n')
+ call nerdtree#echo(metadata[0])
+ else
+ call nerdtree#echo("No information available")
+ endif
+endfunction
+
+" FUNCTION: NERDTreeListNodeWin32() {{{1
+function! NERDTreeListNodeWin32()
+ let l:node = g:NERDTreeFileNode.GetSelected()
+
+ if !empty(l:node)
+ let l:path = l:node.path.str()
+ call nerdtree#echo(printf("%s:%s MOD:%s BYTES:%d PERMISSIONS:%s",
+ \ toupper(getftype(l:path)),
+ \ fnamemodify(l:path, ':t'),
+ \ strftime("%c", getftime(l:path)),
+ \ getfsize(l:path),
+ \ getfperm(l:path)))
+ return
+ endif
+
+ call nerdtree#echo('node not recognized')
+endfunction
+
+" FUNCTION: NERDTreeCopyNode() {{{1
+function! NERDTreeCopyNode()
+ let currentNode = g:NERDTreeFileNode.GetSelected()
+ let newNodePath = input("Copy the current node\n" .
+ \ "==========================================================\n" .
+ \ "Enter the new path to copy the node to: \n" .
+ \ "", currentNode.path.str(), "file")
+
+ if newNodePath != ""
+ "strip trailing slash
+ let newNodePath = substitute(newNodePath, '\/$', '', '')
+
+ let confirmed = 1
+ if currentNode.path.copyingWillOverwrite(newNodePath)
+ call nerdtree#echo("Warning: copying may overwrite files! Continue? (yN)")
+ let choice = nr2char(getchar())
+ let confirmed = choice ==# 'y'
+ endif
+
+ if confirmed
+ try
+ let newNode = currentNode.copy(newNodePath)
+ " Emptying g:NERDTreeOldSortOrder forces the sort to
+ " recalculate the cached sortKey so nodes sort correctly.
+ let g:NERDTreeOldSortOrder = []
+ if empty(newNode)
+ call b:NERDTree.root.refresh()
+ call b:NERDTree.render()
+ else
+ call NERDTreeRender()
+ call newNode.putCursorHere(0, 0)
+ endif
+ catch /^NERDTree/
+ call nerdtree#echoWarning("Could not copy node")
+ endtry
+ endif
+ else
+ call nerdtree#echo("Copy aborted.")
+ endif
+ redraw
+endfunction
+
+" FUNCTION: NERDTreeQuickLook() {{{1
+function! NERDTreeQuickLook()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ if treenode != {}
+ call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
+ endif
+endfunction
+
+" FUNCTION: NERDTreeRevealInFinder() {{{1
+function! NERDTreeRevealInFinder()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ if treenode != {}
+ call system("open -R '" . treenode.path.str() . "'")
+ endif
+endfunction
+
+" FUNCTION: NERDTreeExecuteFile() {{{1
+function! NERDTreeExecuteFile()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ if treenode != {}
+ call system("open '" . treenode.path.str() . "'")
+ endif
+endfunction
+
+" FUNCTION: NERDTreeRevealFileLinux() {{{1
+function! NERDTreeRevealFileLinux()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ let parentnode = treenode.parent
+ if parentnode != {}
+ call system("xdg-open '" . parentnode.path.str() . "' &")
+ endif
+endfunction
+
+" FUNCTION: NERDTreeExecuteFileLinux() {{{1
+function! NERDTreeExecuteFileLinux()
+ let treenode = g:NERDTreeFileNode.GetSelected()
+ if treenode != {}
+ call system("xdg-open '" . treenode.path.str() . "' &")
+ endif
+endfunction
+
+" vim: set sw=4 sts=4 et fdm=marker:
+
diff --git a/vim/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim b/vim/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim
new file mode 100644
index 0000000..c30579a
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim
@@ -0,0 +1,38 @@
+" ============================================================================
+" File: vcs.vim
+" Description: NERDTree plugin that provides a command to open on the root of
+" a version control system repository.
+" Maintainer: Phil Runninger
+" License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
+
+" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
+function! s:CreateTabTreeVCS(name)
+ let l:path = g:NERDTreeCreator._pathForString(a:name)
+ let l:path = s:FindParentVCSRoot(l:path)
+ call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
+endfunction
+
+" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
+" Finds the root version control system folder of the given path. If a:path is
+" not part of a repository, return the original path.
+function! s:FindParentVCSRoot(path)
+ let l:path = a:path
+ while !empty(l:path) &&
+ \ l:path._str() !~ '^\(\a:\\\|\/\)$' &&
+ \ !isdirectory(l:path._str() . '/.git') &&
+ \ !isdirectory(l:path._str() . '/.svn') &&
+ \ !isdirectory(l:path._str() . '/.hg') &&
+ \ !isdirectory(l:path._str() . '/.bzr') &&
+ \ !isdirectory(l:path._str() . '/_darcs')
+ let l:path = l:path.getParent()
+ endwhile
+ return (empty(l:path) || l:path._str() =~ '^\(\a:\\\|\/\)$') ? a:path : l:path
+endfunction
+
diff --git a/vim/.vim/plugged/nerdtree/plugin/NERD_tree.vim b/vim/.vim/plugged/nerdtree/plugin/NERD_tree.vim
new file mode 100644
index 0000000..c3de3f2
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/plugin/NERD_tree.vim
@@ -0,0 +1,244 @@
+" ============================================================================
+" File: NERD_tree.vim
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+"
+" SECTION: Script init stuff {{{1
+"============================================================
+if exists("loaded_nerd_tree")
+ finish
+endif
+if v:version < 700
+ echoerr "NERDTree: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!"
+ finish
+endif
+let loaded_nerd_tree = 1
+
+"for line continuation - i.e dont want C in &cpo
+let s:old_cpo = &cpo
+set cpo&vim
+
+"Function: s:initVariable() function {{{2
+"This function is used to initialise a given variable to a given value. The
+"variable is only initialised if it does not exist prior
+"
+"Args:
+"var: the name of the var to be initialised
+"value: the value to initialise var to
+"
+"Returns:
+"1 if the var is set, 0 otherwise
+function! s:initVariable(var, value)
+ if !exists(a:var)
+ exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", "g") . "'"
+ return 1
+ endif
+ return 0
+endfunction
+
+"SECTION: Init variable calls and other random constants {{{2
+call s:initVariable("g:NERDTreeAutoCenter", 1)
+call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
+call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
+call s:initVariable("g:NERDTreeNaturalSort", 0)
+call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
+call s:initVariable("g:NERDTreeChDirMode", 0)
+call s:initVariable("g:NERDTreeCreatePrefix", "silent")
+call s:initVariable("g:NERDTreeMinimalUI", 0)
+if !exists("g:NERDTreeIgnore")
+ let g:NERDTreeIgnore = ['\~$']
+endif
+call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks')
+call s:initVariable("g:NERDTreeBookmarksSort", 1)
+call s:initVariable("g:NERDTreeHighlightCursorline", 1)
+call s:initVariable("g:NERDTreeHijackNetrw", 1)
+call s:initVariable('g:NERDTreeMarkBookmarks', 1)
+call s:initVariable("g:NERDTreeMouseMode", 1)
+call s:initVariable("g:NERDTreeNotificationThreshold", 100)
+call s:initVariable("g:NERDTreeQuitOnOpen", 0)
+call s:initVariable("g:NERDTreeRespectWildIgnore", 0)
+call s:initVariable("g:NERDTreeShowBookmarks", 0)
+call s:initVariable("g:NERDTreeShowFiles", 1)
+call s:initVariable("g:NERDTreeShowHidden", 0)
+call s:initVariable("g:NERDTreeShowLineNumbers", 0)
+call s:initVariable("g:NERDTreeSortDirs", 1)
+
+if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
+ call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
+ call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
+else
+ call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
+ call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
+endif
+call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
+call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
+
+if !exists("g:NERDTreeSortOrder")
+ let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
+endif
+let g:NERDTreeOldSortOrder = []
+
+call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
+
+" ASCII 7: bell non-printing character used to delimit items in the tree's nodes.
+call s:initVariable("g:NERDTreeNodeDelimiter", "\x07")
+
+if !exists('g:NERDTreeStatusline')
+
+ "the exists() crap here is a hack to stop vim spazzing out when
+ "loading a session that was created with an open nerd tree. It spazzes
+ "because it doesnt store b:NERDTree(its a b: var, and its a hash)
+ let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}"
+
+endif
+call s:initVariable("g:NERDTreeWinPos", "left")
+call s:initVariable("g:NERDTreeWinSize", 31)
+
+"init the shell commands that will be used to copy nodes, and remove dir trees
+"
+"Note: the space after the command is important
+if nerdtree#runningWindows()
+ call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
+ call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
+ call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
+else
+ call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
+ call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
+endif
+
+
+"SECTION: Init variable calls for key mappings {{{2
+call s:initVariable("g:NERDTreeMapActivateNode", "o")
+call s:initVariable("g:NERDTreeMapChangeRoot", "C")
+call s:initVariable("g:NERDTreeMapChdir", "cd")
+call s:initVariable("g:NERDTreeMapCloseChildren", "X")
+call s:initVariable("g:NERDTreeMapCloseDir", "x")
+call s:initVariable("g:NERDTreeMapDeleteBookmark", "D")
+call s:initVariable("g:NERDTreeMapMenu", "m")
+call s:initVariable("g:NERDTreeMapHelp", "?")
+call s:initVariable("g:NERDTreeMapJumpFirstChild", "K")
+call s:initVariable("g:NERDTreeMapJumpLastChild", "J")
+call s:initVariable("g:NERDTreeMapJumpNextSibling", "<C-j>")
+call s:initVariable("g:NERDTreeMapJumpParent", "p")
+call s:initVariable("g:NERDTreeMapJumpPrevSibling", "<C-k>")
+call s:initVariable("g:NERDTreeMapJumpRoot", "P")
+call s:initVariable("g:NERDTreeMapOpenExpl", "e")
+call s:initVariable("g:NERDTreeMapOpenInTab", "t")
+call s:initVariable("g:NERDTreeMapOpenInTabSilent", "T")
+call s:initVariable("g:NERDTreeMapOpenRecursively", "O")
+call s:initVariable("g:NERDTreeMapOpenSplit", "i")
+call s:initVariable("g:NERDTreeMapOpenVSplit", "s")
+call s:initVariable("g:NERDTreeMapPreview", "g" . NERDTreeMapActivateNode)
+call s:initVariable("g:NERDTreeMapPreviewSplit", "g" . NERDTreeMapOpenSplit)
+call s:initVariable("g:NERDTreeMapPreviewVSplit", "g" . NERDTreeMapOpenVSplit)
+call s:initVariable("g:NERDTreeMapQuit", "q")
+call s:initVariable("g:NERDTreeMapRefresh", "r")
+call s:initVariable("g:NERDTreeMapRefreshRoot", "R")
+call s:initVariable("g:NERDTreeMapToggleBookmarks", "B")
+call s:initVariable("g:NERDTreeMapToggleFiles", "F")
+call s:initVariable("g:NERDTreeMapToggleFilters", "f")
+call s:initVariable("g:NERDTreeMapToggleHidden", "I")
+call s:initVariable("g:NERDTreeMapToggleZoom", "A")
+call s:initVariable("g:NERDTreeMapUpdir", "u")
+call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
+call s:initVariable("g:NERDTreeMapCWD", "CD")
+call s:initVariable("g:NERDTreeMenuDown", "j")
+call s:initVariable("g:NERDTreeMenuUp", "k")
+
+"SECTION: Load class files{{{2
+call nerdtree#loadClassFiles()
+
+" SECTION: Commands {{{1
+"============================================================
+call nerdtree#ui_glue#setupCommands()
+
+" SECTION: Auto commands {{{1
+"============================================================
+augroup NERDTree
+ "Save the cursor position whenever we close the nerd tree
+ exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
+
+ "disallow insert mode in the NERDTree
+ exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
+augroup END
+
+if g:NERDTreeHijackNetrw
+ augroup NERDTreeHijackNetrw
+ autocmd VimEnter * silent! autocmd! FileExplorer
+ au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand("<amatch>"))
+ augroup END
+endif
+
+" SECTION: Public API {{{1
+"============================================================
+function! NERDTreeAddMenuItem(options)
+ call g:NERDTreeMenuItem.Create(a:options)
+endfunction
+
+function! NERDTreeAddMenuSeparator(...)
+ let opts = a:0 ? a:1 : {}
+ call g:NERDTreeMenuItem.CreateSeparator(opts)
+endfunction
+
+function! NERDTreeAddSubmenu(options)
+ return g:NERDTreeMenuItem.Create(a:options)
+endfunction
+
+function! NERDTreeAddKeyMap(options)
+ call g:NERDTreeKeyMap.Create(a:options)
+endfunction
+
+function! NERDTreeRender()
+ call nerdtree#renderView()
+endfunction
+
+function! NERDTreeFocus()
+ if g:NERDTree.IsOpen()
+ call g:NERDTree.CursorToTreeWin()
+ else
+ call g:NERDTreeCreator.ToggleTabTree("")
+ endif
+endfunction
+
+function! NERDTreeCWD()
+
+ if empty(getcwd())
+ call nerdtree#echoWarning('current directory does not exist')
+ return
+ endif
+
+ try
+ let l:cwdPath = g:NERDTreePath.New(getcwd())
+ catch /^NERDTree.InvalidArgumentsError/
+ call nerdtree#echoWarning('current directory does not exist')
+ return
+ endtry
+
+ call NERDTreeFocus()
+
+ if b:NERDTree.root.path.equals(l:cwdPath)
+ return
+ endif
+
+ let l:newRoot = g:NERDTreeFileNode.New(l:cwdPath, b:NERDTree)
+ call b:NERDTree.changeRoot(l:newRoot)
+ normal! ^
+endfunction
+
+function! NERDTreeAddPathFilter(callback)
+ call g:NERDTree.AddPathFilter(a:callback)
+endfunction
+
+" SECTION: Post Source Actions {{{1
+call nerdtree#postSourceActions()
+
+"reset &cpo back to users setting
+let &cpo = s:old_cpo
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/.vim/plugged/nerdtree/screenshot.png b/vim/.vim/plugged/nerdtree/screenshot.png
new file mode 100644
index 0000000..c410c5d
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/screenshot.png
Binary files differ
diff --git a/vim/.vim/plugged/nerdtree/syntax/nerdtree.vim b/vim/.vim/plugged/nerdtree/syntax/nerdtree.vim
new file mode 100644
index 0000000..99773bf
--- /dev/null
+++ b/vim/.vim/plugged/nerdtree/syntax/nerdtree.vim
@@ -0,0 +1,91 @@
+let s:tree_up_dir_line = '.. (up a dir)'
+syn match NERDTreeIgnore #\~#
+exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
+
+"highlighting for the .. (up dir) line at the top of the tree
+execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
+
+"quickhelp syntax elements
+syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
+syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
+syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1
+syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
+syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
+syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
+syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
+
+"highlighting for sym links
+syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
+syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
+syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
+
+"highlighing for directory nodes and file nodes
+syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
+
+exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
+exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
+
+let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
+exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
+syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
+exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
+
+"highlighting for readonly files
+exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
+
+syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
+syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
+
+"highlighing to conceal the delimiter around the file/dir name
+if has("conceal")
+ exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
+ setlocal conceallevel=3 concealcursor=nvic
+else
+ exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
+ hi! link NERDTreeNodeDelimiters Ignore
+endif
+
+syn match NERDTreeCWD #^[</].*$#
+
+"highlighting for bookmarks
+syn match NERDTreeBookmark # {.*}#hs=s+1
+
+"highlighting for the bookmarks table
+syn match NERDTreeBookmarksLeader #^>#
+syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
+syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
+syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
+
+hi def link NERDTreePart Special
+hi def link NERDTreePartFile Type
+hi def link NERDTreeExecFile Title
+hi def link NERDTreeDirSlash Identifier
+
+hi def link NERDTreeBookmarksHeader statement
+hi def link NERDTreeBookmarksLeader ignore
+hi def link NERDTreeBookmarkName Identifier
+hi def link NERDTreeBookmark normal
+
+hi def link NERDTreeHelp String
+hi def link NERDTreeHelpKey Identifier
+hi def link NERDTreeHelpCommand Identifier
+hi def link NERDTreeHelpTitle Macro
+hi def link NERDTreeToggleOn Question
+hi def link NERDTreeToggleOff WarningMsg
+
+hi def link NERDTreeLinkTarget Type
+hi def link NERDTreeLinkFile Macro
+hi def link NERDTreeLinkDir Macro
+
+hi def link NERDTreeDir Directory
+hi def link NERDTreeUp Directory
+hi def link NERDTreeFile Normal
+hi def link NERDTreeCWD Statement
+hi def link NERDTreeOpenable Directory
+hi def link NERDTreeClosable Directory
+hi def link NERDTreeIgnore ignore
+hi def link NERDTreeRO WarningMsg
+hi def link NERDTreeBookmark Statement
+hi def link NERDTreeFlags Number
+
+hi def link NERDTreeCurrentNode Search
diff --git a/vim/.vim/plugged/vim-gitgutter/LICENCE b/vim/.vim/plugged/vim-gitgutter/LICENCE
new file mode 100644
index 0000000..38e2dc2
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/LICENCE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) Andrew Stewart
+
+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.
+
diff --git a/vim/.vim/plugged/vim-gitgutter/README.mkd b/vim/.vim/plugged/vim-gitgutter/README.mkd
new file mode 100644
index 0000000..a08507b
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/README.mkd
@@ -0,0 +1,582 @@
+## vim-gitgutter
+
+A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks. The plugin also provides a hunk text object.
+
+The signs are always up to date and the plugin never saves your buffer.
+
+Features:
+
+* Shows signs for added, modified, and removed lines.
+* Runs the diffs asynchronously where possible.
+* Ensures signs are always up to date.
+* Never saves the buffer.
+* Quick jumping between blocks of changed lines ("hunks").
+* Stage/undo/preview individual hunks.
+* Provides a hunk text object.
+* Diffs against index (default) or any commit.
+* Allows folding all unchanged text.
+* Handles line endings correctly, even with repos that do CRLF conversion.
+* Optional line highlighting.
+* Fully customisable (signs, sign column, line highlights, mappings, extra git-diff arguments, etc).
+* Can be toggled on/off, globally or per buffer.
+* Preserves signs from other plugins.
+* Easy to integrate diff stats into status line; built-in integration with [vim-airline](https://github.com/bling/vim-airline/).
+* Works with fish shell (in addition to the usual shells).
+
+Constraints:
+
+* Supports git only. If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify).
+* Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`.
+
+
+### Screenshot
+
+![screenshot](https://raw.github.com/airblade/vim-gitgutter/master/screenshot.png)
+
+In the screenshot above you can see:
+
+* Line 15 has been modified.
+* Lines 21-24 are new.
+* A line or lines were removed between lines 25 and 26.
+
+
+### Installation
+
+Before installation, please check your Vim supports signs by running `:echo has('signs')`. `1` means you're all set; `0` means you need to install a Vim with signs support. If you're compiling Vim yourself you need the 'big' or 'huge' feature set. MacVim supports signs.
+
+You install vim-gitgutter like any other vim plugin.
+
+##### Pathogen
+
+```
+cd ~/.vim/bundle
+git clone git://github.com/airblade/vim-gitgutter.git
+```
+
+##### Voom
+
+Edit your plugin manifest (`voom edit`) and add:
+
+```
+airblade/vim-gitgutter
+```
+
+##### VimPlug
+
+Place this in your .vimrc:
+
+```viml
+Plug 'airblade/vim-gitgutter'
+```
+
+Then run the following in Vim:
+
+```
+:source %
+:PlugInstall
+```
+
+##### NeoBundle
+
+Place this in your .vimrc:
+
+```viml
+NeoBundle 'airblade/vim-gitgutter'
+```
+
+Then run the following in Vim:
+
+```
+:source %
+:NeoBundleInstall
+```
+
+##### No plugin manager
+
+Copy vim-gitgutter's subdirectories into your vim configuration directory:
+
+```
+cd /tmp && git clone git://github.com/airblade/vim-gitgutter.git
+cp -r vim-gitgutter/* ~/.vim/
+```
+
+See `:help add-global-plugin`.
+
+
+### Getting started
+
+When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is `4000`, i.e. 4 seconds, but I suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc).
+
+You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `<leader>hp`, `<leader>hs`, and `<leader>hu` respectively.
+
+You cannot unstage a staged hunk.
+
+
+#### Activation
+
+You can explicitly turn vim-gitgutter off and on (defaults to on):
+
+* turn off with `:GitGutterDisable`
+* turn on with `:GitGutterEnable`
+* toggle with `:GitGutterToggle`.
+
+To toggle vim-gitgutter per buffer:
+
+* turn off with `:GitGutterBufferDisable`
+* turn on with `:GitGutterBufferEnable`
+* toggle with `:GitGutterBufferToggle`
+
+You can turn the signs on and off (defaults to on):
+
+* turn on with `:GitGutterSignsEnable`
+* turn off with `:GitGutterSignsDisable`
+* toggle with `:GitGutterSignsToggle`.
+
+And you can turn line highlighting on and off (defaults to off):
+
+* turn on with `:GitGutterLineHighlightsEnable`
+* turn off with `:GitGutterLineHighlightsDisable`
+* toggle with `:GitGutterLineHighlightsToggle`.
+
+Note that if you have line highlighting on and signs off, you will have an empty sign column – more accurately, a sign column with invisible signs. This is because line highlighting requires signs and Vim always shows the sign column even if the signs are invisible.
+
+If you switch off both line highlighting and signs, you won't see the sign column. That is unless you configure the sign column always to be there (see Sign Column section).
+
+To keep your Vim snappy, vim-gitgutter will suppress the signs when a file has more than 500 changes. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with:
+
+```viml
+let g:gitgutter_max_signs = 500 " default value
+```
+
+#### Hunks
+
+You can jump between hunks:
+
+* jump to next hunk (change): `]c`
+* jump to previous hunk (change): `[c`.
+
+Both of those take a preceding count.
+
+To set your own mappings for these, for example `]h` and `[h`:
+
+```viml
+nmap ]h <Plug>GitGutterNextHunk
+nmap [h <Plug>GitGutterPrevHunk
+```
+
+You can stage or undo an individual hunk when your cursor is in it:
+
+* stage the hunk with `<Leader>hs` or
+* undo it with `<Leader>hu`.
+
+See the FAQ if you want to unstage staged changes.
+
+The `.` command will work with both these if you install [repeat.vim](https://github.com/tpope/vim-repeat).
+
+To set your own mappings for these, for example if you prefer the mnemonics hunk-add and hunk-revert:
+
+```viml
+nmap <Leader>ha <Plug>GitGutterStageHunk
+nmap <Leader>hr <Plug>GitGutterUndoHunk
+```
+
+And you can preview a hunk's changes with `<Leader>hp`. You can of course change this mapping, e.g:
+
+```viml
+nmap <Leader>hv <Plug>GitGutterPreviewHunk
+```
+
+A hunk text object is provided which works in visual and operator-pending modes.
+
+- `ic` operates on all lines in the current hunk.
+- `ac` operates on all lines in the current hunk and any trailing empty lines.
+
+To re-map these, for example to `ih` and `ah`:
+
+```viml
+omap ih <Plug>GitGutterTextObjectInnerPending
+omap ah <Plug>GitGutterTextObjectOuterPending
+xmap ih <Plug>GitGutterTextObjectInnerVisual
+xmap ah <Plug>GitGutterTextObjectOuterVisual
+```
+
+If you don't want vim-gitgutter to set up any mappings at all, use this:
+
+```viml
+let g:gitgutter_map_keys = 0
+```
+
+Finally, you can force vim-gitgutter to update its signs across all visible buffers with `:GitGutterAll`.
+
+See the customisation section below for how to change the defaults.
+
+
+### Folding
+
+Use the `GitGutterFold` command to fold all unchanged lines, leaving just the hunks visible. Use `zr` to unfold 3 lines of context above and below a hunk.
+
+Execute `GitGutterFold` a second time to restore the previous view.
+
+
+### Customisation
+
+You can customise:
+
+* The sign column's colours
+* Whether or not the sign column is shown when there aren't any signs (defaults to no)
+* The signs' colours and symbols
+* Line highlights
+* The base of the diff
+* Extra arguments for `git` when running `git diff`
+* Extra arguments for `git diff`
+* Key mappings
+* Whether or not vim-gitgutter is on initially (defaults to on)
+* Whether or not signs are shown (defaults to yes)
+* Whether or not line highlighting is on initially (defaults to off)
+* Whether or not vim-gitgutter runs in "realtime" (defaults to yes)
+* Whether or not vim-gitgutter runs eagerly (defaults to yes)
+* Whether or not vim-gitgutter runs asynchronously (defaults to yes)
+
+Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
+
+
+#### Sign column
+
+By default vim-gitgutter will make the sign column look like the line number column.
+
+To customise your sign column's background color, first tell vim-gitgutter to leave it alone:
+
+```viml
+let g:gitgutter_override_sign_column_highlight = 0
+```
+
+And then either update your colorscheme's `SignColumn` highlight group or set it in your vimrc:
+
+```viml
+highlight SignColumn ctermbg=whatever " terminal Vim
+highlight SignColumn guibg=whatever " gVim/MacVim
+```
+
+By default the sign column will appear when there are signs to show and disappear when there aren't. To always have the sign column, add to your vimrc:
+
+```viml
+if exists('&signcolumn') " Vim 7.4.2201
+ set signcolumn=yes
+else
+ let g:gitgutter_sign_column_always = 1
+endif
+```
+
+
+#### Signs' colours and symbols
+
+By default vim-gitgutter uses your colourscheme's `Diff*` highlight groups' foreground colours for the signs' foreground colours. For example, your `DiffAdd` foreground colour will be used for the `+` sign's foreground colour.
+
+The signs' background colours will all be set to the sign column's background colour.
+
+If you don't like the default colours, you can either fix your colourscheme's `Diff*` highlights or configure your own `GitGutter*` highlight groups. These groups are:
+
+```viml
+GitGutterAdd " an added line (default: links to DiffAdd)
+GitGutterChange " a changed line (default: links to DiffChange)
+GitGutterDelete " at least one removed line (default: links to DiffDelete)
+GitGutterChangeDelete " a changed line followed by at least one removed line (default: links to GitGutterChange)
+```
+
+You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd MyDiffAdd`.
+
+To get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
+
+```viml
+highlight GitGutterAdd guifg=#009900 guibg=<X> ctermfg=2 ctermbg=<Y>
+highlight GitGutterChange guifg=#bbbb00 guibg=<X> ctermfg=3 ctermbg=<Y>
+highlight GitGutterDelete guifg=#ff2222 guibg=<X> ctermfg=1 ctermbg=<Y>
+```
+
+– where you would replace `<X>` and `<Y>` with the background colour of your `SignColumn` in the gui and the terminal respectively. For example, with the solarized colorscheme and a dark background, `guibg=#073642` and `ctermbg=0`.
+
+To customise the symbols, add the following to your `~/.vimrc`:
+
+```viml
+let g:gitgutter_sign_added = 'xx'
+let g:gitgutter_sign_modified = 'yy'
+let g:gitgutter_sign_removed = 'zz'
+let g:gitgutter_sign_removed_first_line = '^^'
+let g:gitgutter_sign_modified_removed = 'ww'
+```
+
+
+#### Line highlights
+
+Similarly to the signs' colours, set up the following highlight groups in your colorscheme or `~/.vimrc`:
+
+```viml
+GitGutterAddLine " default: links to DiffAdd
+GitGutterChangeLine " default: links to DiffChange
+GitGutterDeleteLine " default: links to DiffDelete
+GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange
+```
+
+For example, in some colorschemes the `DiffText` highlight group is easier to read than `DiffChange`. You could use it like this:
+
+```viml
+highlight link GitGutterChangeLine DiffText
+```
+
+
+#### The base of the diff
+
+By default buffers are diffed against the index. However you can diff against any commit by setting:
+
+```viml
+let g:gitgutter_diff_base = '<commit SHA>'
+```
+
+
+#### Extra arguments for `git` when running `git diff`
+
+If you want to pass extra arguments to `git` when running `git diff`, do so like this:
+
+```viml
+let g:gitgutter_git_args = '--git-dir-""'
+```
+
+#### Extra arguments for `git diff`
+
+If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this:
+
+```viml
+let g:gitgutter_diff_args = '-w'
+```
+
+#### Key mappings
+
+To disable all key mappings:
+
+```viml
+let g:gitgutter_map_keys = 0
+```
+
+See above for configuring maps for hunk-jumping and staging/undoing.
+
+
+#### Use a custom `grep` command
+
+If you use an alternative to grep, you can tell vim-gitgutter to use it here.
+
+```viml
+" Default:
+let g:gitgutter_grep = 'grep'
+```
+
+#### To turn off vim-gitgutter by default
+
+Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
+
+
+#### To turn off signs by default
+
+Add `let g:gitgutter_signs = 0` to your `~/.vimrc`.
+
+
+#### To turn on line highlighting by default
+
+Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.
+
+
+#### To turn off asynchronous updates
+
+By default diffs are run asynchronously. To run diffs synchronously instead:
+
+```viml
+let g:gitgutter_async = 0
+```
+
+
+### Extensions
+
+#### Operate on every line in a hunk
+
+You can map an operator to do whatever you want to every line in a hunk.
+
+Let's say, for example, you want to remove trailing whitespace.
+
+```viml
+function! CleanUp(...)
+ if a:0 " opfunc
+ let [first, last] = [line("'["), line("']")]
+ else
+ let [first, last] = [line("'<"), line("'>")]
+ endif
+ for lnum in range(first, last)
+ let line = getline(lnum)
+
+ " clean up the text, e.g.:
+ let line = substitute(line, '\s\+$', '', '')
+
+ call setline(lnum, line)
+ endfor
+endfunction
+
+nmap <silent> <Leader>x :set opfunc=CleanUp<CR>g@
+```
+
+Then place your cursor in a hunk and type `\xic` (assuming a leader of `\`).
+
+Alternatively you could place your cursor in a hunk, type `vic` to select it, then `:call CleanUp()`.
+
+
+#### Operate on every changed line in a file
+
+You can write a command to do whatever you want to every changed line in a file.
+
+```viml
+function! GlobalChangedLines(ex_cmd)
+ for hunk in GitGutterGetHunks()
+ for lnum in range(hunk[2], hunk[2]+hunk[3]-1)
+ let cursor = getcurpos()
+ silent! execute lnum.a:ex_cmd
+ call setpos('.', cursor)
+ endfor
+ endfor
+endfunction
+
+command -nargs=1 Glines call GlobalChangedLines(<q-args>)
+```
+
+Let's say, for example, you want to remove trailing whitespace from all changed lines:
+
+```viml
+:Glines s/\s\+$//
+```
+
+
+#### Cycle through hunks in all buffers
+
+`]c` and `[c` jump from one hunk to the next in the current buffer. You can use this code to jump to the next hunk no matter which buffer it's in.
+
+```viml
+function! NextHunkAllBuffers()
+ let line = line('.')
+ GitGutterNextHunk
+ if line('.') != line
+ return
+ endif
+
+ let bufnr = bufnr('')
+ while 1
+ bnext
+ if bufnr('') == bufnr
+ return
+ endif
+ if !empty(GitGutterGetHunks())
+ normal! 1G
+ GitGutterNextHunk
+ return
+ endif
+ endwhile
+endfunction
+
+function! PrevHunkAllBuffers()
+ let line = line('.')
+ GitGutterPrevHunk
+ if line('.') != line
+ return
+ endif
+
+ let bufnr = bufnr('')
+ while 1
+ bprevious
+ if bufnr('') == bufnr
+ return
+ endif
+ if !empty(GitGutterGetHunks())
+ normal! G
+ GitGutterPrevHunk
+ return
+ endif
+ endwhile
+endfunction
+
+nmap <silent> ]c :call NextHunkAllBuffers()<CR>
+nmap <silent> [c :call PrevHunkAllBuffers()<CR>
+```
+
+
+### FAQ
+
+> How can I turn off realtime updates?
+
+Add this to your vim configuration (in an `/after/plugin` directory):
+
+```viml
+" .vim/after/plugin/gitgutter.vim
+autocmd! gitgutter CursorHold,CursorHoldI
+```
+
+> I turned off realtime updates, how can I have signs updated when I save a file?
+
+If you really want to update the signs when you save a file, add this to your vimrc:
+
+```viml
+autocmd BufWritePost * GitGutter
+```
+
+> Why can't I unstage staged changes?
+
+This plugin is for showing changes between the working tree and the index (and staging/undoing those changes). Unstaging a staged hunk would require showing changes between the index and HEAD, which is out of scope.
+
+> Why are the colours in the sign column weird?
+
+Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
+
+> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
+
+Vim only allows one sign per line. Before adding a sign to a line, vim-gitgutter checks whether a sign has already been added by somebody else. If so it doesn't do anything. In other words vim-gitgutter won't overwrite another plugin's signs. It also won't remove another plugin's signs.
+
+
+### Troubleshooting
+
+#### When no signs are showing at all
+
+Here are some things you can check:
+
+* Try adding `let g:gitgutter_grep=''` to your vimrc. If it works, the problem is grep producing non-plain output; e.g. ANSI escape codes or colours.
+* Verify `:echo system("git --version")` succeeds.
+* Verify your git config is compatible with the version of git returned by the command above.
+* Verify your Vim supports signs (`:echo has('signs')` should give `1`).
+* Verify your file is being tracked by git and has unstaged changes.
+
+#### When the whole file is marked as added
+
+* If you use zsh, and you set `CDPATH`, make sure `CDPATH` doesn't include the current directory.
+
+#### When signs take a few seconds to appear
+
+* Try reducing `updatetime`, e.g. `set updatetime=100`.
+
+#### When signs don't update after focusing Vim
+
+* Your terminal probably isn't reporting focus events. Either try installing [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`.
+
+
+### Shameless Plug
+
+If this plugin has helped you, or you'd like to learn more about Vim, why not check out this screencast I wrote for PeepCode:
+
+* [Smash Into Vim][siv]
+
+This was one of PeepCode's all-time top three bestsellers and is now available at Pluralsight.
+
+You can read reviews on my [website][airblade].
+
+
+### Intellectual Property
+
+Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence.
+
+
+ [pathogen]: https://github.com/tpope/vim-pathogen
+ [siv]: http://pluralsight.com/training/Courses/TableOfContents/smash-into-vim
+ [airblade]: http://airbladesoftware.com/peepcode-vim
+ [terminus]: https://github.com/wincent/terminus
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter.vim
new file mode 100644
index 0000000..2e17fdb
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter.vim
@@ -0,0 +1,160 @@
+let s:t_string = type('')
+
+" Primary functions {{{
+
+function! gitgutter#all(force) abort
+ let visible = tabpagebuflist()
+
+ for bufnr in range(1, bufnr('$') + 1)
+ if buflisted(bufnr)
+ let file = expand('#'.bufnr.':p')
+ if !empty(file)
+ if index(visible, bufnr) != -1
+ call gitgutter#init_buffer(bufnr)
+ call gitgutter#process_buffer(bufnr, a:force)
+ elseif a:force
+ call s:reset_tick(bufnr)
+ endif
+ endif
+ endif
+ endfor
+endfunction
+
+
+" Finds the file's path relative to the repo root.
+function! gitgutter#init_buffer(bufnr)
+ if gitgutter#utility#is_active(a:bufnr)
+ let p = gitgutter#utility#repo_path(a:bufnr, 0)
+ if type(p) != s:t_string || empty(p)
+ call gitgutter#utility#set_repo_path(a:bufnr)
+ call s:setup_maps()
+ endif
+ endif
+endfunction
+
+
+function! gitgutter#process_buffer(bufnr, force) abort
+ " NOTE a:bufnr is not necessarily the current buffer.
+
+ if gitgutter#utility#is_active(a:bufnr)
+ if a:force || s:has_fresh_changes(a:bufnr)
+
+ let diff = ''
+ try
+ let diff = gitgutter#diff#run_diff(a:bufnr, 'index', 0)
+ catch /gitgutter not tracked/
+ call gitgutter#debug#log('Not tracked: '.gitgutter#utility#file(a:bufnr))
+ catch /gitgutter diff failed/
+ call gitgutter#debug#log('Diff failed: '.gitgutter#utility#file(a:bufnr))
+ call gitgutter#hunk#reset(a:bufnr)
+ endtry
+
+ if diff != 'async'
+ call gitgutter#diff#handler(a:bufnr, diff)
+ endif
+
+ endif
+ endif
+endfunction
+
+
+function! gitgutter#disable() abort
+ " get list of all buffers (across all tabs)
+ for bufnr in range(1, bufnr('$') + 1)
+ if buflisted(bufnr)
+ let file = expand('#'.bufnr.':p')
+ if !empty(file)
+ call s:clear(bufnr)
+ endif
+ endif
+ endfor
+
+ let g:gitgutter_enabled = 0
+endfunction
+
+function! gitgutter#enable() abort
+ let g:gitgutter_enabled = 1
+ call gitgutter#all(1)
+endfunction
+
+function! gitgutter#toggle() abort
+ if g:gitgutter_enabled
+ call gitgutter#disable()
+ else
+ call gitgutter#enable()
+ endif
+endfunction
+
+
+function! gitgutter#buffer_disable() abort
+ let bufnr = bufnr('')
+ call gitgutter#utility#setbufvar(bufnr, 'enabled', 0)
+ call s:clear(bufnr)
+endfunction
+
+function! gitgutter#buffer_enable() abort
+ let bufnr = bufnr('')
+ call gitgutter#utility#setbufvar(bufnr, 'enabled', 1)
+ call gitgutter#process_buffer(bufnr, 1)
+endfunction
+
+function! gitgutter#buffer_toggle() abort
+ if gitgutter#utility#getbufvar(bufnr(''), 'enabled', 1)
+ call gitgutter#buffer_disable()
+ else
+ call gitgutter#buffer_enable()
+ endif
+endfunction
+
+" }}}
+
+function! s:setup_maps()
+ if !g:gitgutter_map_keys
+ return
+ endif
+
+ if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
+ nmap <buffer> [c <Plug>GitGutterPrevHunk
+ endif
+ if !hasmapto('<Plug>GitGutterNextHunk') && maparg(']c', 'n') ==# ''
+ nmap <buffer> ]c <Plug>GitGutterNextHunk
+ endif
+
+ if !hasmapto('<Plug>GitGutterStageHunk') && maparg('<Leader>hs', 'n') ==# ''
+ nmap <buffer> <Leader>hs <Plug>GitGutterStageHunk
+ endif
+ if !hasmapto('<Plug>GitGutterUndoHunk') && maparg('<Leader>hu', 'n') ==# ''
+ nmap <buffer> <Leader>hu <Plug>GitGutterUndoHunk
+ endif
+ if !hasmapto('<Plug>GitGutterPreviewHunk') && maparg('<Leader>hp', 'n') ==# ''
+ nmap <buffer> <Leader>hp <Plug>GitGutterPreviewHunk
+ endif
+
+ if !hasmapto('<Plug>GitGutterTextObjectInnerPending') && maparg('ic', 'o') ==# ''
+ omap <buffer> ic <Plug>GitGutterTextObjectInnerPending
+ endif
+ if !hasmapto('<Plug>GitGutterTextObjectOuterPending') && maparg('ac', 'o') ==# ''
+ omap <buffer> ac <Plug>GitGutterTextObjectOuterPending
+ endif
+ if !hasmapto('<Plug>GitGutterTextObjectInnerVisual') && maparg('ic', 'x') ==# ''
+ xmap <buffer> ic <Plug>GitGutterTextObjectInnerVisual
+ endif
+ if !hasmapto('<Plug>GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# ''
+ xmap <buffer> ac <Plug>GitGutterTextObjectOuterVisual
+ endif
+endfunction
+
+function! s:has_fresh_changes(bufnr) abort
+ return getbufvar(a:bufnr, 'changedtick') != gitgutter#utility#getbufvar(a:bufnr, 'tick')
+endfunction
+
+function! s:reset_tick(bufnr) abort
+ call gitgutter#utility#setbufvar(a:bufnr, 'tick', 0)
+endfunction
+
+function! s:clear(bufnr)
+ call gitgutter#sign#clear_signs(a:bufnr)
+ call gitgutter#sign#remove_dummy_sign(a:bufnr, 1)
+ call gitgutter#hunk#reset(a:bufnr)
+ call s:reset_tick(a:bufnr)
+endfunction
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/async.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/async.vim
new file mode 100644
index 0000000..40f2ad2
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/async.vim
@@ -0,0 +1,95 @@
+let s:available = has('nvim') || (
+ \ has('job') && (
+ \ (has('patch-7-4-1826') && !has('gui_running')) ||
+ \ (has('patch-7-4-1850') && has('gui_running')) ||
+ \ (has('patch-7-4-1832') && has('gui_macvim'))
+ \ )
+ \ )
+
+function! gitgutter#async#available()
+ return s:available
+endfunction
+
+
+function! gitgutter#async#execute(cmd, bufnr, handler) abort
+ call gitgutter#debug#log('[async] '.a:cmd)
+
+ let options = {
+ \ 'stdoutbuffer': [],
+ \ 'buffer': a:bufnr,
+ \ 'handler': a:handler
+ \ }
+ let command = s:build_command(a:cmd)
+
+ if has('nvim')
+ call jobstart(command, extend(options, {
+ \ 'on_stdout': function('s:on_stdout_nvim'),
+ \ 'on_stderr': function('s:on_stderr_nvim'),
+ \ 'on_exit': function('s:on_exit_nvim')
+ \ }))
+ else
+ call job_start(command, {
+ \ 'out_cb': function('s:on_stdout_vim', options),
+ \ 'err_cb': function('s:on_stderr_vim', options),
+ \ 'close_cb': function('s:on_exit_vim', options)
+ \ })
+ endif
+endfunction
+
+
+function! s:build_command(cmd)
+ if has('unix')
+ return ['sh', '-c', a:cmd]
+ endif
+
+ if has('win32')
+ return has('nvim') ? ['cmd.exe', '/c', a:cmd] : 'cmd.exe /c '.a:cmd
+ endif
+
+ throw 'unknown os'
+endfunction
+
+
+function! s:on_stdout_nvim(_job_id, data, _event) dict abort
+ if empty(self.stdoutbuffer)
+ let self.stdoutbuffer = a:data
+ else
+ let self.stdoutbuffer = self.stdoutbuffer[:-2] +
+ \ [self.stdoutbuffer[-1] . a:data[0]] +
+ \ a:data[1:]
+ endif
+endfunction
+
+function! s:on_stderr_nvim(_job_id, _data, _event) dict abort
+ call self.handler.err(self.buffer)
+endfunction
+
+function! s:on_exit_nvim(_job_id, exit_code, _event) dict abort
+ if !a:exit_code
+ call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n"))
+ endif
+endfunction
+
+
+function! s:on_stdout_vim(_channel, data) dict abort
+ call add(self.stdoutbuffer, a:data)
+endfunction
+
+function! s:on_stderr_vim(channel, _data) dict abort
+ call self.handler.err(self.buffer)
+endfunction
+
+function! s:on_exit_vim(channel) dict abort
+ let job = ch_getjob(a:channel)
+ while 1
+ if job_status(job) == 'dead'
+ let exit_code = job_info(job).exitval
+ break
+ endif
+ sleep 5m
+ endwhile
+
+ if !exit_code
+ call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n"))
+ endif
+endfunction
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/debug.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/debug.vim
new file mode 100644
index 0000000..79d197e
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/debug.vim
@@ -0,0 +1,119 @@
+let s:plugin_dir = expand('<sfile>:p:h:h:h').'/'
+let s:log_file = s:plugin_dir.'gitgutter.log'
+let s:channel_log = s:plugin_dir.'channel.log'
+let s:new_log_session = 1
+
+
+function! gitgutter#debug#debug()
+ " Open a scratch buffer
+ vsplit __GitGutter_Debug__
+ normal! ggdG
+ setlocal buftype=nofile
+ setlocal bufhidden=delete
+ setlocal noswapfile
+
+ call s:vim_version()
+ call s:separator()
+
+ call s:git_version()
+ call s:separator()
+
+ call s:grep_version()
+ call s:separator()
+
+ call s:option('updatetime')
+ call s:option('shell')
+ call s:option('shellcmdflag')
+ call s:option('shellpipe')
+ call s:option('shellquote')
+ call s:option('shellredir')
+ call s:option('shellslash')
+ call s:option('shelltemp')
+ call s:option('shelltype')
+ call s:option('shellxescape')
+ call s:option('shellxquote')
+endfunction
+
+
+function! s:separator()
+ call s:output('')
+endfunction
+
+function! s:vim_version()
+ redir => version_info
+ silent execute 'version'
+ redir END
+ call s:output(split(version_info, '\n')[0:2])
+endfunction
+
+function! s:git_version()
+ let v = system(g:gitgutter_git_executable.' --version')
+ call s:output( substitute(v, '\n$', '', '') )
+endfunction
+
+function! s:grep_version()
+ let v = system('grep --version')
+ call s:output( substitute(v, '\n$', '', '') )
+
+ let v = system('grep --help')
+ call s:output( substitute(v, '\%x00', '', 'g') )
+endfunction
+
+function! s:option(name)
+ if exists('+' . a:name)
+ let v = eval('&' . a:name)
+ call s:output(a:name . '=' . v)
+ " redir => output
+ " silent execute "verbose set " . a:name . "?"
+ " redir END
+ " call s:output(a:name . '=' . output)
+ else
+ call s:output(a:name . ' [n/a]')
+ end
+endfunction
+
+function! s:output(text)
+ call append(line('$'), a:text)
+endfunction
+
+" assumes optional args are calling function's optional args
+function! gitgutter#debug#log(message, ...) abort
+ if g:gitgutter_log
+ if s:new_log_session && gitgutter#async#available()
+ if exists('*ch_logfile')
+ call ch_logfile(s:channel_log, 'w')
+ endif
+ endif
+
+ execute 'redir >> '.s:log_file
+ if s:new_log_session
+ let s:start = reltime()
+ silent echo "\n==== start log session ===="
+ endif
+
+ let elapsed = reltimestr(reltime(s:start)).' '
+ silent echo ''
+ " callers excluding this function
+ silent echo elapsed.expand('<sfile>')[:-22].':'
+ silent echo elapsed.s:format_for_log(a:message)
+ if a:0 && !empty(a:1)
+ for msg in a:000
+ silent echo elapsed.s:format_for_log(msg)
+ endfor
+ endif
+ redir END
+
+ let s:new_log_session = 0
+ endif
+endfunction
+
+function! s:format_for_log(data) abort
+ if type(a:data) == 1
+ return join(split(a:data,'\n'),"\n")
+ elseif type(a:data) == 3
+ return '['.join(a:data,"\n").']'
+ else
+ return a:data
+ endif
+endfunction
+
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/diff.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/diff.vim
new file mode 100644
index 0000000..b270db7
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/diff.vim
@@ -0,0 +1,405 @@
+let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '<nomodeline>' : ''
+
+let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
+
+" True for git v1.7.2+.
+function! s:git_supports_command_line_config_override() abort
+ call system(g:gitgutter_git_executable.' -c foo.bar=baz --version')
+ return !v:shell_error
+endfunction
+
+let s:c_flag = s:git_supports_command_line_config_override()
+
+
+let s:temp_from = tempname()
+let s:temp_buffer = tempname()
+let s:counter = 0
+
+" Returns a diff of the buffer against the index or the working tree.
+"
+" After running the diff we pass it through grep where available to reduce
+" subsequent processing by the plugin. If grep is not available the plugin
+" does the filtering instead.
+"
+" When diffing against the index:
+"
+" The buffer contents is not the same as the file on disk so we need to pass
+" two instances of the file to git-diff:
+"
+" git diff myfileA myfileB
+"
+" where myfileA comes from
+"
+" git show :myfile > myfileA
+"
+" and myfileB is the buffer contents.
+"
+" Regarding line endings:
+"
+" git-show does not convert line endings.
+" git-diff FILE FILE does convert line endings for the given files.
+"
+" If a file has CRLF line endings and git's core.autocrlf is true,
+" the file in git's object store will have LF line endings. Writing
+" it out via git-show will produce a file with LF line endings.
+"
+" If this last file is one of the files passed to git-diff, git-diff will
+" convert its line endings to CRLF before diffing -- which is what we want --
+" but also by default output a warning on stderr.
+"
+" warning: LF will be replace by CRLF in <temp file>.
+" The file will have its original line endings in your working directory.
+"
+" When running the diff asynchronously, the warning message triggers the stderr
+" callbacks which assume the overall command has failed and reset all the
+" signs. As this is not what we want, and we can safely ignore the warning,
+" we turn it off by passing the '-c "core.safecrlf=false"' argument to
+" git-diff.
+"
+" When writing the temporary files we preserve the original file's extension
+" so that repos using .gitattributes to control EOL conversion continue to
+" convert correctly.
+"
+" Arguments:
+"
+" bufnr - the number of the buffer to be diffed
+" from - 'index' or 'working_tree'; what the buffer is diffed against
+" preserve_full_diff - truthy to return the full diff or falsey to return only
+" the hunk headers (@@ -x,y +m,n @@); only possible if
+" grep is available.
+function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
+ while gitgutter#utility#repo_path(a:bufnr, 0) == -1
+ sleep 5m
+ endwhile
+
+ if gitgutter#utility#repo_path(a:bufnr, 0) == -2
+ throw 'gitgutter not tracked'
+ endif
+
+ " Wrap compound commands in parentheses to make Windows happy.
+ " bash doesn't mind the parentheses.
+ let cmd = '('
+
+ " Append buffer number to temp filenames to avoid race conditions between
+ " writing and reading the files when asynchronously processing multiple
+ " buffers.
+
+ " Without the buffer number, buff_file would have a race between the
+ " second gitgutter#process_buffer() writing the file (synchronously, below)
+ " and the first gitgutter#process_buffer()'s async job reading it (with
+ " git-diff).
+ let buff_file = s:temp_buffer.'.'.a:bufnr
+
+ " Add a counter to avoid a similar race with two quick writes of the same buffer.
+ " Use a modulus greater than a maximum reasonable number of visible buffers.
+ let s:counter = (s:counter + 1) % 20
+ let buff_file .= '.'.s:counter
+
+ let extension = gitgutter#utility#extension(a:bufnr)
+ if !empty(extension)
+ let buff_file .= '.'.extension
+ endif
+
+ " Write buffer to temporary file.
+ " Note: this is synchronous.
+ call s:write_buffer(a:bufnr, buff_file)
+
+ if a:from ==# 'index'
+ " Without the buffer number, from_file would have a race in the shell
+ " between the second process writing it (with git-show) and the first
+ " reading it (with git-diff).
+ let from_file = s:temp_from.'.'.a:bufnr
+
+ " Add a counter to avoid a similar race with two quick writes of the same buffer.
+ let from_file .= '.'.s:counter
+
+ if !empty(extension)
+ let from_file .= '.'.extension
+ endif
+
+ " Write file from index to temporary file.
+ let index_name = g:gitgutter_diff_base.':'.gitgutter#utility#repo_path(a:bufnr, 1)
+ let cmd .= g:gitgutter_git_executable.' --no-pager show '.index_name.' > '.from_file.' && '
+
+ elseif a:from ==# 'working_tree'
+ let from_file = gitgutter#utility#repo_path(a:bufnr, 1)
+ endif
+
+ " Call git-diff.
+ let cmd .= g:gitgutter_git_executable.' --no-pager '.g:gitgutter_git_args
+ if s:c_flag
+ let cmd .= ' -c "diff.autorefreshindex=0"'
+ let cmd .= ' -c "diff.noprefix=false"'
+ let cmd .= ' -c "core.safecrlf=false"'
+ endif
+ let cmd .= ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' -- '.from_file.' '.buff_file
+
+ " Pipe git-diff output into grep.
+ if !a:preserve_full_diff && !empty(g:gitgutter_grep)
+ let cmd .= ' | '.g:gitgutter_grep.' '.gitgutter#utility#shellescape('^@@ ')
+ endif
+
+ " grep exits with 1 when no matches are found; git-diff exits with 1 when
+ " differences are found. However we want to treat non-matches and
+ " differences as non-erroneous behaviour; so we OR the command with one
+ " which always exits with success (0).
+ let cmd .= ' || exit 0'
+
+ let cmd .= ')'
+
+ let cmd = gitgutter#utility#cd_cmd(a:bufnr, cmd)
+
+ if g:gitgutter_async && gitgutter#async#available()
+ call gitgutter#async#execute(cmd, a:bufnr, {
+ \ 'out': function('gitgutter#diff#handler'),
+ \ 'err': function('gitgutter#hunk#reset'),
+ \ })
+ return 'async'
+
+ else
+ let diff = gitgutter#utility#system(cmd)
+
+ if v:shell_error
+ call gitgutter#debug#log(diff)
+ throw 'gitgutter diff failed'
+ endif
+
+ return diff
+ endif
+endfunction
+
+
+function! gitgutter#diff#handler(bufnr, diff) abort
+ call gitgutter#debug#log(a:diff)
+
+ if !bufexists(a:bufnr)
+ return
+ endif
+
+ call gitgutter#hunk#set_hunks(a:bufnr, gitgutter#diff#parse_diff(a:diff))
+ let modified_lines = gitgutter#diff#process_hunks(a:bufnr, gitgutter#hunk#hunks(a:bufnr))
+
+ let signs_count = len(modified_lines)
+ if signs_count > g:gitgutter_max_signs
+ call gitgutter#utility#warn_once(a:bufnr, printf(
+ \ 'exceeded maximum number of signs (%d > %d, configured by g:gitgutter_max_signs).',
+ \ signs_count, g:gitgutter_max_signs), 'max_signs')
+ call gitgutter#sign#clear_signs(a:bufnr)
+
+ else
+ if g:gitgutter_signs || g:gitgutter_highlight_lines
+ call gitgutter#sign#update_signs(a:bufnr, modified_lines)
+ endif
+ endif
+
+ call s:save_last_seen_change(a:bufnr)
+ if exists('#User#GitGutter')
+ let g:gitgutter_hook_context = {'bufnr': a:bufnr}
+ execute 'doautocmd' s:nomodeline 'User GitGutter'
+ unlet g:gitgutter_hook_context
+ endif
+endfunction
+
+
+function! gitgutter#diff#parse_diff(diff) abort
+ let hunks = []
+ for line in split(a:diff, '\n')
+ let hunk_info = gitgutter#diff#parse_hunk(line)
+ if len(hunk_info) == 4
+ call add(hunks, hunk_info)
+ endif
+ endfor
+ return hunks
+endfunction
+
+function! gitgutter#diff#parse_hunk(line) abort
+ let matches = matchlist(a:line, s:hunk_re)
+ if len(matches) > 0
+ let from_line = str2nr(matches[1])
+ let from_count = (matches[2] == '') ? 1 : str2nr(matches[2])
+ let to_line = str2nr(matches[3])
+ let to_count = (matches[4] == '') ? 1 : str2nr(matches[4])
+ return [from_line, from_count, to_line, to_count]
+ else
+ return []
+ end
+endfunction
+
+" This function is public so it may be used by other plugins
+" e.g. vim-signature.
+function! gitgutter#diff#process_hunks(bufnr, hunks) abort
+ let modified_lines = []
+ for hunk in a:hunks
+ call extend(modified_lines, s:process_hunk(a:bufnr, hunk))
+ endfor
+ return modified_lines
+endfunction
+
+" Returns [ [<line_number (number)>, <name (string)>], ...]
+function! s:process_hunk(bufnr, hunk) abort
+ let modifications = []
+ let from_line = a:hunk[0]
+ let from_count = a:hunk[1]
+ let to_line = a:hunk[2]
+ let to_count = a:hunk[3]
+
+ if s:is_added(from_count, to_count)
+ call s:process_added(modifications, from_count, to_count, to_line)
+ call gitgutter#hunk#increment_lines_added(a:bufnr, to_count)
+
+ elseif s:is_removed(from_count, to_count)
+ call s:process_removed(modifications, from_count, to_count, to_line)
+ call gitgutter#hunk#increment_lines_removed(a:bufnr, from_count)
+
+ elseif s:is_modified(from_count, to_count)
+ call s:process_modified(modifications, from_count, to_count, to_line)
+ call gitgutter#hunk#increment_lines_modified(a:bufnr, to_count)
+
+ elseif s:is_modified_and_added(from_count, to_count)
+ call s:process_modified_and_added(modifications, from_count, to_count, to_line)
+ call gitgutter#hunk#increment_lines_added(a:bufnr, to_count - from_count)
+ call gitgutter#hunk#increment_lines_modified(a:bufnr, from_count)
+
+ elseif s:is_modified_and_removed(from_count, to_count)
+ call s:process_modified_and_removed(modifications, from_count, to_count, to_line)
+ call gitgutter#hunk#increment_lines_modified(a:bufnr, to_count)
+ call gitgutter#hunk#increment_lines_removed(a:bufnr, from_count - to_count)
+
+ endif
+ return modifications
+endfunction
+
+function! s:is_added(from_count, to_count) abort
+ return a:from_count == 0 && a:to_count > 0
+endfunction
+
+function! s:is_removed(from_count, to_count) abort
+ return a:from_count > 0 && a:to_count == 0
+endfunction
+
+function! s:is_modified(from_count, to_count) abort
+ return a:from_count > 0 && a:to_count > 0 && a:from_count == a:to_count
+endfunction
+
+function! s:is_modified_and_added(from_count, to_count) abort
+ return a:from_count > 0 && a:to_count > 0 && a:from_count < a:to_count
+endfunction
+
+function! s:is_modified_and_removed(from_count, to_count) abort
+ return a:from_count > 0 && a:to_count > 0 && a:from_count > a:to_count
+endfunction
+
+function! s:process_added(modifications, from_count, to_count, to_line) abort
+ let offset = 0
+ while offset < a:to_count
+ let line_number = a:to_line + offset
+ call add(a:modifications, [line_number, 'added'])
+ let offset += 1
+ endwhile
+endfunction
+
+function! s:process_removed(modifications, from_count, to_count, to_line) abort
+ if a:to_line == 0
+ call add(a:modifications, [1, 'removed_first_line'])
+ else
+ call add(a:modifications, [a:to_line, 'removed'])
+ endif
+endfunction
+
+function! s:process_modified(modifications, from_count, to_count, to_line) abort
+ let offset = 0
+ while offset < a:to_count
+ let line_number = a:to_line + offset
+ call add(a:modifications, [line_number, 'modified'])
+ let offset += 1
+ endwhile
+endfunction
+
+function! s:process_modified_and_added(modifications, from_count, to_count, to_line) abort
+ let offset = 0
+ while offset < a:from_count
+ let line_number = a:to_line + offset
+ call add(a:modifications, [line_number, 'modified'])
+ let offset += 1
+ endwhile
+ while offset < a:to_count
+ let line_number = a:to_line + offset
+ call add(a:modifications, [line_number, 'added'])
+ let offset += 1
+ endwhile
+endfunction
+
+function! s:process_modified_and_removed(modifications, from_count, to_count, to_line) abort
+ let offset = 0
+ while offset < a:to_count
+ let line_number = a:to_line + offset
+ call add(a:modifications, [line_number, 'modified'])
+ let offset += 1
+ endwhile
+ let a:modifications[-1] = [a:to_line + offset - 1, 'modified_removed']
+endfunction
+
+
+" Returns a diff for the current hunk.
+" Assumes there is only 1 current hunk unless the optional argument is given,
+" in which case the cursor is in two hunks and the argument specifies the one
+" to choose.
+"
+" Optional argument: 0 (to use the first hunk) or 1 (to use the second).
+function! gitgutter#diff#hunk_diff(bufnr, full_diff, ...)
+ let modified_diff = []
+ let hunk_index = 0
+ let keep_line = 1
+ " Don't keepempty when splitting because the diff we want may not be the
+ " final one. Instead add trailing NL at end of function.
+ for line in split(a:full_diff, '\n')
+ let hunk_info = gitgutter#diff#parse_hunk(line)
+ if len(hunk_info) == 4 " start of new hunk
+ let keep_line = gitgutter#hunk#cursor_in_hunk(hunk_info)
+
+ if a:0 && hunk_index != a:1
+ let keep_line = 0
+ endif
+
+ let hunk_index += 1
+ endif
+ if keep_line
+ call add(modified_diff, line)
+ endif
+ endfor
+ return join(modified_diff, "\n")."\n"
+endfunction
+
+
+function! s:write_buffer(bufnr, file)
+ let bufcontents = getbufline(a:bufnr, 1, '$')
+
+ if bufcontents == [''] && line2byte(1) == -1
+ " Special case: completely empty buffer.
+ " A nearly empty buffer of only a newline has line2byte(1) == 1.
+ call writefile([], a:file)
+ return
+ endif
+
+ if getbufvar(a:bufnr, '&fileformat') ==# 'dos'
+ call map(bufcontents, 'v:val."\r"')
+ endif
+
+ let fenc = getbufvar(a:bufnr, '&fileencoding')
+ if fenc !=# &encoding
+ call map(bufcontents, 'iconv(v:val, &encoding, "'.fenc.'")')
+ endif
+
+ if getbufvar(a:bufnr, '&bomb')
+ let bufcontents[0]=''.bufcontents[0]
+ endif
+
+ call writefile(bufcontents, a:file)
+endfunction
+
+
+function! s:save_last_seen_change(bufnr) abort
+ call gitgutter#utility#setbufvar(a:bufnr, 'tick', getbufvar(a:bufnr, 'changedtick'))
+endfunction
+
+
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/fold.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/fold.vim
new file mode 100644
index 0000000..ffc7691
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/fold.vim
@@ -0,0 +1,84 @@
+function! gitgutter#fold#enable()
+ call s:save_fold_state()
+
+ call s:set_fold_levels()
+ setlocal foldexpr=gitgutter#fold#level(v:lnum)
+ setlocal foldmethod=expr
+ setlocal foldlevel=0
+ setlocal foldenable
+
+ call gitgutter#utility#setbufvar(bufnr(''), 'folded', 1)
+endfunction
+
+
+function! gitgutter#fold#disable()
+ call s:restore_fold_state()
+ call gitgutter#utility#setbufvar(bufnr(''), 'folded', 0)
+endfunction
+
+
+function! gitgutter#fold#toggle()
+ if s:folded()
+ call gitgutter#fold#disable()
+ else
+ call gitgutter#fold#enable()
+ endif
+endfunction
+
+
+function! gitgutter#fold#level(lnum)
+ return gitgutter#utility#getbufvar(bufnr(''), 'fold_levels')[a:lnum]
+endfunction
+
+
+" A line in a hunk has a fold level of 0.
+" A line within 3 lines of a hunk has a fold level of 1.
+" All other lines have a fold level of 2.
+function! s:set_fold_levels()
+ let fold_levels = ['']
+
+ for lnum in range(1, line('$'))
+ let in_hunk = gitgutter#hunk#in_hunk(lnum)
+ call add(fold_levels, (in_hunk ? 0 : 2))
+ endfor
+
+ let lines_of_context = 3
+
+ for lnum in range(1, line('$'))
+ if fold_levels[lnum] == 2
+ let pre = lnum >= 3 ? lnum - lines_of_context : 0
+ let post = lnum + lines_of_context
+ if index(fold_levels[pre:post], 0) != -1
+ let fold_levels[lnum] = 1
+ endif
+ endif
+ endfor
+
+ call gitgutter#utility#setbufvar(bufnr(''), 'fold_levels', fold_levels)
+endfunction
+
+
+function! s:save_fold_state()
+ let bufnr = bufnr('')
+ call gitgutter#utility#setbufvar(bufnr, 'foldlevel', &foldlevel)
+ call gitgutter#utility#setbufvar(bufnr, 'foldmethod', &foldmethod)
+ if &foldmethod ==# 'manual'
+ mkview
+ endif
+endfunction
+
+function! s:restore_fold_state()
+ let bufnr = bufnr('')
+ let &foldlevel = gitgutter#utility#getbufvar(bufnr, 'foldlevel')
+ let &foldmethod = gitgutter#utility#getbufvar(bufnr, 'foldmethod')
+ if &foldmethod ==# 'manual'
+ loadview
+ else
+ normal! zx
+ endif
+endfunction
+
+function! s:folded()
+ return gitgutter#utility#getbufvar(bufnr(''), 'folded')
+endfunction
+
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim
new file mode 100644
index 0000000..160856f
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim
@@ -0,0 +1,170 @@
+function! gitgutter#highlight#line_disable() abort
+ let g:gitgutter_highlight_lines = 0
+ call s:define_sign_line_highlights()
+
+ if !g:gitgutter_signs
+ call gitgutter#sign#clear_signs(bufnr(''))
+ call gitgutter#sign#remove_dummy_sign(bufnr(''), 0)
+ endif
+
+ redraw!
+endfunction
+
+function! gitgutter#highlight#line_enable() abort
+ let old_highlight_lines = g:gitgutter_highlight_lines
+
+ let g:gitgutter_highlight_lines = 1
+ call s:define_sign_line_highlights()
+
+ if !old_highlight_lines && !g:gitgutter_signs
+ call gitgutter#all(1)
+ endif
+
+ redraw!
+endfunction
+
+function! gitgutter#highlight#line_toggle() abort
+ if g:gitgutter_highlight_lines
+ call gitgutter#highlight#line_disable()
+ else
+ call gitgutter#highlight#line_enable()
+ endif
+endfunction
+
+
+function! gitgutter#highlight#define_sign_column_highlight() abort
+ if g:gitgutter_override_sign_column_highlight
+ highlight! link SignColumn LineNr
+ else
+ highlight default link SignColumn LineNr
+ endif
+endfunction
+
+function! gitgutter#highlight#define_highlights() abort
+ let [guibg, ctermbg] = s:get_background_colors('SignColumn')
+
+ " Highlights used by the signs.
+
+ " When they are invisible.
+ execute "highlight GitGutterAddInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg
+ execute "highlight GitGutterChangeInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg
+ execute "highlight GitGutterDeleteInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg
+ highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible
+
+ " When they are visible.
+ " By default use Diff* foreground colors with SignColumn's background.
+ for type in ['Add', 'Change', 'Delete']
+ let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type)
+ execute "highlight GitGutter".type."Default guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg
+ execute "highlight default link GitGutter".type." GitGutter".type."Default"
+ endfor
+ highlight default link GitGutterChangeDelete GitGutterChange
+
+ " Highlights used for the whole line.
+
+ highlight default link GitGutterAddLine DiffAdd
+ highlight default link GitGutterChangeLine DiffChange
+ highlight default link GitGutterDeleteLine DiffDelete
+ highlight default link GitGutterChangeDeleteLine GitGutterChangeLine
+endfunction
+
+function! gitgutter#highlight#define_signs() abort
+ sign define GitGutterLineAdded
+ sign define GitGutterLineModified
+ sign define GitGutterLineRemoved
+ sign define GitGutterLineRemovedFirstLine
+ sign define GitGutterLineRemovedAboveAndBelow
+ sign define GitGutterLineModifiedRemoved
+ sign define GitGutterDummy
+
+ call s:define_sign_text()
+ call gitgutter#highlight#define_sign_text_highlights()
+ call s:define_sign_line_highlights()
+endfunction
+
+function! s:define_sign_text() abort
+ execute "sign define GitGutterLineAdded text=" . g:gitgutter_sign_added
+ execute "sign define GitGutterLineModified text=" . g:gitgutter_sign_modified
+ execute "sign define GitGutterLineRemoved text=" . g:gitgutter_sign_removed
+ execute "sign define GitGutterLineRemovedFirstLine text=" . g:gitgutter_sign_removed_first_line
+ execute "sign define GitGutterLineRemovedAboveAndBelow text=" . g:gitgutter_sign_removed_above_and_below
+ execute "sign define GitGutterLineModifiedRemoved text=" . g:gitgutter_sign_modified_removed
+endfunction
+
+function! gitgutter#highlight#define_sign_text_highlights() abort
+ " Once a sign's text attribute has been defined, it cannot be undefined or
+ " set to an empty value. So to make signs' text disappear (when toggling
+ " off or disabling) we make them invisible by setting their foreground colours
+ " to the background's.
+ if g:gitgutter_signs
+ sign define GitGutterLineAdded texthl=GitGutterAdd
+ sign define GitGutterLineModified texthl=GitGutterChange
+ sign define GitGutterLineRemoved texthl=GitGutterDelete
+ sign define GitGutterLineRemovedFirstLine texthl=GitGutterDelete
+ sign define GitGutterLineRemovedAboveAndBelow texthl=GitGutterDelete
+ sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDelete
+ else
+ sign define GitGutterLineAdded texthl=GitGutterAddInvisible
+ sign define GitGutterLineModified texthl=GitGutterChangeInvisible
+ sign define GitGutterLineRemoved texthl=GitGutterDeleteInvisible
+ sign define GitGutterLineRemovedFirstLine texthl=GitGutterDeleteInvisible
+ sign define GitGutterLineRemovedAboveAndBelow texthl=GitGutterDeleteInvisible
+ sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDeleteInvisible
+ endif
+endfunction
+
+function! s:define_sign_line_highlights() abort
+ if g:gitgutter_highlight_lines
+ sign define GitGutterLineAdded linehl=GitGutterAddLine
+ sign define GitGutterLineModified linehl=GitGutterChangeLine
+ sign define GitGutterLineRemoved linehl=GitGutterDeleteLine
+ sign define GitGutterLineRemovedFirstLine linehl=GitGutterDeleteLine
+ sign define GitGutterLineRemovedAboveAndBelow linehl=GitGutterDeleteLine
+ sign define GitGutterLineModifiedRemoved linehl=GitGutterChangeDeleteLine
+ else
+ sign define GitGutterLineAdded linehl=
+ sign define GitGutterLineModified linehl=
+ sign define GitGutterLineRemoved linehl=
+ sign define GitGutterLineRemovedFirstLine linehl=
+ sign define GitGutterLineRemovedAboveAndBelow linehl=
+ sign define GitGutterLineModifiedRemoved linehl=
+ endif
+endfunction
+
+function! s:get_foreground_colors(group) abort
+ redir => highlight
+ silent execute 'silent highlight ' . a:group
+ redir END
+
+ let link_matches = matchlist(highlight, 'links to \(\S\+\)')
+ if len(link_matches) > 0 " follow the link
+ return s:get_foreground_colors(link_matches[1])
+ endif
+
+ let ctermfg = s:match_highlight(highlight, 'ctermfg=\([0-9A-Za-z]\+\)')
+ let guifg = s:match_highlight(highlight, 'guifg=\([#0-9A-Za-z]\+\)')
+ return [guifg, ctermfg]
+endfunction
+
+function! s:get_background_colors(group) abort
+ redir => highlight
+ silent execute 'silent highlight ' . a:group
+ redir END
+
+ let link_matches = matchlist(highlight, 'links to \(\S\+\)')
+ if len(link_matches) > 0 " follow the link
+ return s:get_background_colors(link_matches[1])
+ endif
+
+ let ctermbg = s:match_highlight(highlight, 'ctermbg=\([0-9A-Za-z]\+\)')
+ let guibg = s:match_highlight(highlight, 'guibg=\([#0-9A-Za-z]\+\)')
+ return [guibg, ctermbg]
+endfunction
+
+function! s:match_highlight(highlight, pattern) abort
+ let matches = matchlist(a:highlight, a:pattern)
+ if len(matches) == 0
+ return 'NONE'
+ endif
+ return matches[1]
+endfunction
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/hunk.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/hunk.vim
new file mode 100644
index 0000000..50ea5f4
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/hunk.vim
@@ -0,0 +1,332 @@
+function! gitgutter#hunk#set_hunks(bufnr, hunks) abort
+ call gitgutter#utility#setbufvar(a:bufnr, 'hunks', a:hunks)
+ call s:reset_summary(a:bufnr)
+endfunction
+
+function! gitgutter#hunk#hunks(bufnr) abort
+ return gitgutter#utility#getbufvar(a:bufnr, 'hunks', [])
+endfunction
+
+function! gitgutter#hunk#reset(bufnr) abort
+ call gitgutter#utility#setbufvar(a:bufnr, 'hunks', [])
+ call s:reset_summary(a:bufnr)
+endfunction
+
+
+function! gitgutter#hunk#summary(bufnr) abort
+ return gitgutter#utility#getbufvar(a:bufnr, 'summary', [0,0,0])
+endfunction
+
+function! s:reset_summary(bufnr) abort
+ call gitgutter#utility#setbufvar(a:bufnr, 'summary', [0,0,0])
+endfunction
+
+function! gitgutter#hunk#increment_lines_added(bufnr, count) abort
+ let summary = gitgutter#hunk#summary(a:bufnr)
+ let summary[0] += a:count
+ call gitgutter#utility#setbufvar(a:bufnr, 'summary', summary)
+endfunction
+
+function! gitgutter#hunk#increment_lines_modified(bufnr, count) abort
+ let summary = gitgutter#hunk#summary(a:bufnr)
+ let summary[1] += a:count
+ call gitgutter#utility#setbufvar(a:bufnr, 'summary', summary)
+endfunction
+
+function! gitgutter#hunk#increment_lines_removed(bufnr, count) abort
+ let summary = gitgutter#hunk#summary(a:bufnr)
+ let summary[2] += a:count
+ call gitgutter#utility#setbufvar(a:bufnr, 'summary', summary)
+endfunction
+
+
+function! gitgutter#hunk#next_hunk(count) abort
+ let bufnr = bufnr('')
+ if gitgutter#utility#is_active(bufnr)
+ let current_line = line('.')
+ let hunk_count = 0
+ for hunk in gitgutter#hunk#hunks(bufnr)
+ if hunk[2] > current_line
+ let hunk_count += 1
+ if hunk_count == a:count
+ execute 'normal!' hunk[2] . 'Gzv'
+ return
+ endif
+ endif
+ endfor
+ call gitgutter#utility#warn('No more hunks')
+ endif
+endfunction
+
+function! gitgutter#hunk#prev_hunk(count) abort
+ let bufnr = bufnr('')
+ if gitgutter#utility#is_active(bufnr)
+ let current_line = line('.')
+ let hunk_count = 0
+ for hunk in reverse(copy(gitgutter#hunk#hunks(bufnr)))
+ if hunk[2] < current_line
+ let hunk_count += 1
+ if hunk_count == a:count
+ let target = hunk[2] == 0 ? 1 : hunk[2]
+ execute 'normal!' target . 'Gzv'
+ return
+ endif
+ endif
+ endfor
+ call gitgutter#utility#warn('No previous hunks')
+ endif
+endfunction
+
+" Returns the hunk the cursor is currently in or an empty list if the cursor
+" isn't in a hunk.
+function! s:current_hunk() abort
+ let bufnr = bufnr('')
+ let current_hunk = []
+
+ for hunk in gitgutter#hunk#hunks(bufnr)
+ if gitgutter#hunk#cursor_in_hunk(hunk)
+ let current_hunk = hunk
+ break
+ endif
+ endfor
+
+ return current_hunk
+endfunction
+
+" Returns truthy if the cursor is in two hunks (which can only happen if the
+" cursor is on the first line and lines above have been deleted and lines
+" immediately below have been deleted) or falsey otherwise.
+function! s:cursor_in_two_hunks()
+ let hunks = gitgutter#hunk#hunks(bufnr(''))
+
+ if line('.') == 1 && len(hunks) > 1 && hunks[0][2:3] == [0, 0] && hunks[1][2:3] == [1, 0]
+ return 1
+ endif
+
+ return 0
+endfunction
+
+" A line can be in 0 or 1 hunks, with the following exception: when the first
+" line(s) of a file has been deleted, and the new second line (and
+" optionally below) has been deleted, the new first line is in two hunks.
+function! gitgutter#hunk#cursor_in_hunk(hunk) abort
+ let current_line = line('.')
+
+ if current_line == 1 && a:hunk[2] == 0
+ return 1
+ endif
+
+ if current_line >= a:hunk[2] && current_line < a:hunk[2] + (a:hunk[3] == 0 ? 1 : a:hunk[3])
+ return 1
+ endif
+
+ return 0
+endfunction
+
+
+function! gitgutter#hunk#in_hunk(lnum)
+ " Hunks are sorted in the order they appear in the buffer.
+ for hunk in gitgutter#hunk#hunks(bufnr(''))
+ " if in a hunk on first line of buffer
+ if a:lnum == 1 && hunk[2] == 0
+ return 1
+ endif
+
+ " if in a hunk generally
+ if a:lnum >= hunk[2] && a:lnum < hunk[2] + (hunk[3] == 0 ? 1 : hunk[3])
+ return 1
+ endif
+
+ " if hunk starts after the given line
+ if a:lnum < hunk[2]
+ return 0
+ endif
+ endfor
+
+ return 0
+endfunction
+
+
+function! gitgutter#hunk#text_object(inner) abort
+ let hunk = s:current_hunk()
+
+ if empty(hunk)
+ return
+ endif
+
+ let [first_line, last_line] = [hunk[2], hunk[2] + hunk[3] - 1]
+
+ if ! a:inner
+ let lnum = last_line
+ let eof = line('$')
+ while lnum < eof && empty(getline(lnum + 1))
+ let lnum +=1
+ endwhile
+ let last_line = lnum
+ endif
+
+ execute 'normal! 'first_line.'GV'.last_line.'G'
+endfunction
+
+
+function! gitgutter#hunk#stage() abort
+ call s:hunk_op(function('s:stage'))
+ silent! call repeat#set("\<Plug>GitGutterStageHunk", -1)<CR>
+endfunction
+
+function! gitgutter#hunk#undo() abort
+ call s:hunk_op(function('s:undo'))
+ silent! call repeat#set("\<Plug>GitGutterUndoHunk", -1)<CR>
+endfunction
+
+function! gitgutter#hunk#preview() abort
+ call s:hunk_op(function('s:preview'))
+ silent! call repeat#set("\<Plug>GitGutterPreviewHunk", -1)<CR>
+endfunction
+
+
+function! s:hunk_op(op)
+ let bufnr = bufnr('')
+
+ if gitgutter#utility#is_active(bufnr)
+ " Get a (synchronous) diff.
+ let [async, g:gitgutter_async] = [g:gitgutter_async, 0]
+ let diff = gitgutter#diff#run_diff(bufnr, 'index', 1)
+ let g:gitgutter_async = async
+
+ call gitgutter#hunk#set_hunks(bufnr, gitgutter#diff#parse_diff(diff))
+
+ if empty(s:current_hunk())
+ call gitgutter#utility#warn('cursor is not in a hunk')
+ elseif s:cursor_in_two_hunks()
+ let choice = input('Choose hunk: upper or lower (u/l)? ')
+ " Clear input
+ normal! :<ESC>
+ if choice =~ 'u'
+ call a:op(gitgutter#diff#hunk_diff(bufnr, diff, 0))
+ elseif choice =~ 'l'
+ call a:op(gitgutter#diff#hunk_diff(bufnr, diff, 1))
+ else
+ call gitgutter#utility#warn('did not recognise your choice')
+ endif
+ else
+ call a:op(gitgutter#diff#hunk_diff(bufnr, diff))
+ endif
+ endif
+endfunction
+
+
+function! s:stage(hunk_diff)
+ let bufnr = bufnr('')
+ let diff = s:adjust_header(bufnr, a:hunk_diff)
+ " Apply patch to index.
+ call gitgutter#utility#system(
+ \ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' apply --cached --unidiff-zero - '),
+ \ diff)
+
+ " Refresh gitgutter's view of buffer.
+ call gitgutter#process_buffer(bufnr, 1)
+endfunction
+
+
+function! s:undo(hunk_diff)
+ " Apply reverse patch to buffer.
+ let hunk = gitgutter#diff#parse_hunk(split(a:hunk_diff, '\n')[4])
+ let lines = map(split(a:hunk_diff, '\n')[5:], 'v:val[1:]')
+ let lnum = hunk[2]
+ let added_only = hunk[1] == 0 && hunk[3] > 0
+ let removed_only = hunk[1] > 0 && hunk[3] == 0
+
+ if removed_only
+ call append(lnum, lines)
+ elseif added_only
+ execute lnum .','. (lnum+len(lines)-1) .'d'
+ else
+ call append(lnum-1, lines[0:hunk[1]])
+ execute (lnum+hunk[1]) .','. (lnum+hunk[1]+hunk[3]) .'d'
+ endif
+endfunction
+
+
+function! s:preview(hunk_diff)
+ let hunk_lines = split(s:discard_header(a:hunk_diff), "\n")
+ let hunk_lines_length = len(hunk_lines)
+ let previewheight = min([hunk_lines_length, &previewheight])
+
+ silent! wincmd P
+ if !&previewwindow
+ noautocmd execute 'bo' previewheight 'new'
+ set previewwindow
+ else
+ execute 'resize' previewheight
+ endif
+
+ setlocal noreadonly modifiable filetype=diff buftype=nofile bufhidden=delete noswapfile
+ execute "%delete_"
+ call append(0, hunk_lines)
+ normal! gg
+ setlocal readonly nomodifiable
+
+ noautocmd wincmd p
+endfunction
+
+
+function! s:adjust_header(bufnr, hunk_diff)
+ let filepath = gitgutter#utility#repo_path(a:bufnr, 0)
+ return s:adjust_hunk_summary(s:fix_file_references(filepath, a:hunk_diff))
+endfunction
+
+
+" Replaces references to temp files with the actual file.
+function! s:fix_file_references(filepath, hunk_diff)
+ let lines = split(a:hunk_diff, '\n')
+
+ let left_prefix = matchstr(lines[2], '[abciow12]').'/'
+ let right_prefix = matchstr(lines[3], '[abciow12]').'/'
+ let quote = lines[0][11] == '"' ? '"' : ''
+
+ let left_file = quote.left_prefix.a:filepath.quote
+ let right_file = quote.right_prefix.a:filepath.quote
+
+ let lines[0] = 'diff --git '.left_file.' '.right_file
+ let lines[2] = '--- '.left_file
+ let lines[3] = '+++ '.right_file
+
+ return join(lines, "\n")."\n"
+endfunction
+
+if $VIM_GITGUTTER_TEST
+ function! gitgutter#hunk#fix_file_references(filepath, hunk_diff)
+ return s:fix_file_references(a:filepath, a:hunk_diff)
+ endfunction
+endif
+
+
+function! s:adjust_hunk_summary(hunk_diff) abort
+ let line_adjustment = s:line_adjustment_for_current_hunk()
+ let diff = split(a:hunk_diff, '\n', 1)
+ let diff[4] = substitute(diff[4], '+\@<=\(\d\+\)', '\=submatch(1)+line_adjustment', '')
+ return join(diff, "\n")
+endfunction
+
+
+function! s:discard_header(hunk_diff)
+ return join(split(a:hunk_diff, '\n', 1)[5:], "\n")
+endfunction
+
+
+" Returns the number of lines the current hunk is offset from where it would
+" be if any changes above it in the file didn't exist.
+function! s:line_adjustment_for_current_hunk() abort
+ let bufnr = bufnr('')
+ let adj = 0
+ for hunk in gitgutter#hunk#hunks(bufnr)
+ if gitgutter#hunk#cursor_in_hunk(hunk)
+ break
+ else
+ let adj += hunk[1] - hunk[3]
+ endif
+ endfor
+ return adj
+endfunction
+
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/sign.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/sign.vim
new file mode 100644
index 0000000..4c23dbe
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/sign.vim
@@ -0,0 +1,230 @@
+" Vim doesn't namespace sign ids so every plugin shares the same
+" namespace. Sign ids are simply integers so to avoid clashes with other
+" signs we guess at a clear run.
+"
+" Note also we currently never reset s:next_sign_id.
+let s:first_sign_id = 3000
+let s:next_sign_id = s:first_sign_id
+let s:dummy_sign_id = s:first_sign_id - 1
+" Remove-all-signs optimisation requires Vim 7.3.596+.
+let s:supports_star = v:version > 703 || (v:version == 703 && has("patch596"))
+
+
+function! gitgutter#sign#enable() abort
+ let old_signs = g:gitgutter_signs
+
+ let g:gitgutter_signs = 1
+ call gitgutter#highlight#define_sign_text_highlights()
+
+ if !old_signs && !g:gitgutter_highlight_lines
+ call gitgutter#all(1)
+ endif
+endfunction
+
+function! gitgutter#sign#disable() abort
+ let g:gitgutter_signs = 0
+ call gitgutter#highlight#define_sign_text_highlights()
+
+ if !g:gitgutter_highlight_lines
+ call gitgutter#sign#clear_signs(bufnr(''))
+ call gitgutter#sign#remove_dummy_sign(bufnr(''), 0)
+ endif
+endfunction
+
+function! gitgutter#sign#toggle() abort
+ if g:gitgutter_signs
+ call gitgutter#sign#disable()
+ else
+ call gitgutter#sign#enable()
+ endif
+endfunction
+
+
+" Removes gitgutter's signs (excluding dummy sign) from the buffer being processed.
+function! gitgutter#sign#clear_signs(bufnr) abort
+ call s:find_current_signs(a:bufnr)
+
+ let sign_ids = map(values(gitgutter#utility#getbufvar(a:bufnr, 'gitgutter_signs')), 'v:val.id')
+ call s:remove_signs(a:bufnr, sign_ids, 1)
+ call gitgutter#utility#setbufvar(a:bufnr, 'gitgutter_signs', {})
+endfunction
+
+
+" Updates gitgutter's signs in the buffer being processed.
+"
+" modified_lines: list of [<line_number (number)>, <name (string)>]
+" where name = 'added|removed|modified|modified_removed'
+function! gitgutter#sign#update_signs(bufnr, modified_lines) abort
+ call s:find_current_signs(a:bufnr)
+
+ let new_gitgutter_signs_line_numbers = map(copy(a:modified_lines), 'v:val[0]')
+ let obsolete_signs = s:obsolete_gitgutter_signs_to_remove(a:bufnr, new_gitgutter_signs_line_numbers)
+
+ let flicker_possible = s:remove_all_old_signs && !empty(a:modified_lines)
+ if flicker_possible
+ call s:add_dummy_sign(a:bufnr)
+ endif
+
+ call s:remove_signs(a:bufnr, obsolete_signs, s:remove_all_old_signs)
+ call s:upsert_new_gitgutter_signs(a:bufnr, a:modified_lines)
+
+ if flicker_possible
+ call gitgutter#sign#remove_dummy_sign(a:bufnr, 0)
+ endif
+endfunction
+
+
+function! s:add_dummy_sign(bufnr) abort
+ if !gitgutter#utility#getbufvar(a:bufnr, 'dummy_sign')
+ execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . a:bufnr
+ call gitgutter#utility#setbufvar(a:bufnr, 'dummy_sign', 1)
+ endif
+endfunction
+
+function! gitgutter#sign#remove_dummy_sign(bufnr, force) abort
+ if gitgutter#utility#getbufvar(a:bufnr, 'dummy_sign') && (a:force || !g:gitgutter_sign_column_always)
+ execute "sign unplace" s:dummy_sign_id "buffer=" . a:bufnr
+ call gitgutter#utility#setbufvar(a:bufnr, 'dummy_sign', 0)
+ endif
+endfunction
+
+
+"
+" Internal functions
+"
+
+
+function! s:find_current_signs(bufnr) abort
+ let gitgutter_signs = {} " <line_number (string)>: {'id': <id (number)>, 'name': <name (string)>}
+ let other_signs = [] " [<line_number (number),...]
+ let dummy_sign_placed = 0
+
+ redir => signs
+ silent execute "sign place buffer=" . a:bufnr
+ redir END
+
+ for sign_line in filter(split(signs, '\n')[2:], 'v:val =~# "="')
+ " Typical sign line: line=88 id=1234 name=GitGutterLineAdded
+ " We assume splitting is faster than a regexp.
+ let components = split(sign_line)
+ let name = split(components[2], '=')[1]
+ if name =~# 'GitGutterDummy'
+ let dummy_sign_placed = 1
+ else
+ let line_number = str2nr(split(components[0], '=')[1])
+ if name =~# 'GitGutter'
+ let id = str2nr(split(components[1], '=')[1])
+ " Remove orphaned signs (signs placed on lines which have been deleted).
+ " (When a line is deleted its sign lingers. Subsequent lines' signs'
+ " line numbers are decremented appropriately.)
+ if has_key(gitgutter_signs, line_number)
+ execute "sign unplace" gitgutter_signs[line_number].id
+ endif
+ let gitgutter_signs[line_number] = {'id': id, 'name': name}
+ else
+ call add(other_signs, line_number)
+ endif
+ end
+ endfor
+
+ call gitgutter#utility#setbufvar(a:bufnr, 'dummy_sign', dummy_sign_placed)
+ call gitgutter#utility#setbufvar(a:bufnr, 'gitgutter_signs', gitgutter_signs)
+ call gitgutter#utility#setbufvar(a:bufnr, 'other_signs', other_signs)
+endfunction
+
+
+" Returns a list of [<id (number)>, ...]
+" Sets `s:remove_all_old_signs` as a side-effect.
+function! s:obsolete_gitgutter_signs_to_remove(bufnr, new_gitgutter_signs_line_numbers) abort
+ let signs_to_remove = [] " list of [<id (number)>, ...]
+ let remove_all_signs = 1
+ let old_gitgutter_signs = gitgutter#utility#getbufvar(a:bufnr, 'gitgutter_signs')
+ for line_number in keys(old_gitgutter_signs)
+ if index(a:new_gitgutter_signs_line_numbers, str2nr(line_number)) == -1
+ call add(signs_to_remove, old_gitgutter_signs[line_number].id)
+ else
+ let remove_all_signs = 0
+ endif
+ endfor
+ let s:remove_all_old_signs = remove_all_signs
+ return signs_to_remove
+endfunction
+
+
+function! s:remove_signs(bufnr, sign_ids, all_signs) abort
+ if a:all_signs && s:supports_star && empty(gitgutter#utility#getbufvar(a:bufnr, 'other_signs'))
+ let dummy_sign_present = gitgutter#utility#getbufvar(a:bufnr, 'dummy_sign')
+ execute "sign unplace * buffer=" . a:bufnr
+ if dummy_sign_present
+ execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . a:bufnr
+ endif
+ else
+ for id in a:sign_ids
+ execute "sign unplace" id
+ endfor
+ endif
+endfunction
+
+
+function! s:upsert_new_gitgutter_signs(bufnr, modified_lines) abort
+ let other_signs = gitgutter#utility#getbufvar(a:bufnr, 'other_signs')
+ let old_gitgutter_signs = gitgutter#utility#getbufvar(a:bufnr, 'gitgutter_signs')
+
+ " Handle special case where the first line is the site of two hunks:
+ " lines deleted above at the start of the file, and lines deleted
+ " immediately below.
+ if a:modified_lines[0:1] == [[1, 'removed_first_line'], [1, 'removed']]
+ let modified_lines = [[1, 'removed_above_and_below']] + a:modified_lines[2:]
+ else
+ let modified_lines = a:modified_lines
+ endif
+
+ for line in modified_lines
+ let line_number = line[0] " <number>
+ if index(other_signs, line_number) == -1 " don't clobber others' signs
+ let name = s:highlight_name_for_change(line[1])
+ if !has_key(old_gitgutter_signs, line_number) " insert
+ let id = s:next_sign_id()
+ execute "sign place" id "line=" . line_number "name=" . name "buffer=" . a:bufnr
+ else " update if sign has changed
+ let old_sign = old_gitgutter_signs[line_number]
+ if old_sign.name !=# name
+ execute "sign place" old_sign.id "name=" . name "buffer=" . a:bufnr
+ end
+ endif
+ endif
+ endfor
+ " At this point b:gitgutter_gitgutter_signs is out of date.
+endfunction
+
+
+function! s:next_sign_id() abort
+ let next_id = s:next_sign_id
+ let s:next_sign_id += 1
+ return next_id
+endfunction
+
+
+" Only for testing.
+function! gitgutter#sign#reset()
+ let s:next_sign_id = s:first_sign_id
+endfunction
+
+
+function! s:highlight_name_for_change(text) abort
+ if a:text ==# 'added'
+ return 'GitGutterLineAdded'
+ elseif a:text ==# 'removed'
+ return 'GitGutterLineRemoved'
+ elseif a:text ==# 'removed_first_line'
+ return 'GitGutterLineRemovedFirstLine'
+ elseif a:text ==# 'modified'
+ return 'GitGutterLineModified'
+ elseif a:text ==# 'modified_removed'
+ return 'GitGutterLineModifiedRemoved'
+ elseif a:text ==# 'removed_above_and_below'
+ return 'GitGutterLineRemovedAboveAndBelow'
+ endif
+endfunction
+
+
diff --git a/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim
new file mode 100644
index 0000000..470f222
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim
@@ -0,0 +1,222 @@
+function! gitgutter#utility#supports_overscore_sign()
+ if gitgutter#utility#windows()
+ return &encoding ==? 'utf-8'
+ else
+ return &termencoding ==? &encoding || &termencoding == ''
+ endif
+endfunction
+
+function! gitgutter#utility#setbufvar(buffer, varname, val)
+ let buffer = +a:buffer
+ " Default value for getbufvar() was introduced in Vim 7.3.831.
+ let bvars = getbufvar(buffer, '')
+ if empty(bvars)
+ let bvars = {}
+ endif
+ let dict = get(bvars, 'gitgutter', {})
+ let needs_setting = empty(dict)
+ let dict[a:varname] = a:val
+ if needs_setting
+ call setbufvar(buffer, 'gitgutter', dict)
+ endif
+endfunction
+
+function! gitgutter#utility#getbufvar(buffer, varname, ...)
+ let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
+ if has_key(dict, a:varname)
+ return dict[a:varname]
+ else
+ if a:0
+ return a:1
+ endif
+ endif
+endfunction
+
+function! gitgutter#utility#warn(message) abort
+ echohl WarningMsg
+ echo 'vim-gitgutter: ' . a:message
+ echohl None
+ let v:warningmsg = a:message
+endfunction
+
+function! gitgutter#utility#warn_once(bufnr, message, key) abort
+ if empty(gitgutter#utility#getbufvar(a:bufnr, a:key))
+ call gitgutter#utility#setbufvar(a:bufnr, a:key, '1')
+ echohl WarningMsg
+ redraw | echom 'vim-gitgutter: ' . a:message
+ echohl None
+ let v:warningmsg = a:message
+ endif
+endfunction
+
+" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't.
+" This function does not and should not make any system calls.
+function! gitgutter#utility#is_active(bufnr) abort
+ return g:gitgutter_enabled &&
+ \ gitgutter#utility#getbufvar(a:bufnr, 'enabled', 1) &&
+ \ !pumvisible() &&
+ \ s:is_file_buffer(a:bufnr) &&
+ \ s:exists_file(a:bufnr) &&
+ \ s:not_git_dir(a:bufnr)
+endfunction
+
+function! s:not_git_dir(bufnr) abort
+ return s:dir(a:bufnr) !~ '[/\\]\.git\($\|[/\\]\)'
+endfunction
+
+function! s:is_file_buffer(bufnr) abort
+ return empty(getbufvar(a:bufnr, '&buftype'))
+endfunction
+
+" From tpope/vim-fugitive
+function! s:winshell()
+ return &shell =~? 'cmd' || exists('+shellslash') && !&shellslash
+endfunction
+
+" From tpope/vim-fugitive
+function! gitgutter#utility#shellescape(arg) abort
+ if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
+ return a:arg
+ elseif s:winshell()
+ return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"'
+ else
+ return shellescape(a:arg)
+ endif
+endfunction
+
+function! gitgutter#utility#file(bufnr)
+ return s:abs_path(a:bufnr, 1)
+endfunction
+
+" Not shellescaped
+function! gitgutter#utility#extension(bufnr) abort
+ return fnamemodify(s:abs_path(a:bufnr, 0), ':e')
+endfunction
+
+function! gitgutter#utility#system(cmd, ...) abort
+ call gitgutter#debug#log(a:cmd, a:000)
+
+ call s:use_known_shell()
+ silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1)
+ call s:restore_shell()
+
+ return output
+endfunction
+
+" Path of file relative to repo root.
+"
+" * empty string - not set
+" * non-empty string - path
+" * -1 - pending
+" * -2 - not tracked by git
+function! gitgutter#utility#repo_path(bufnr, shellesc) abort
+ let p = gitgutter#utility#getbufvar(a:bufnr, 'path')
+ return a:shellesc ? gitgutter#utility#shellescape(p) : p
+endfunction
+
+function! gitgutter#utility#set_repo_path(bufnr) abort
+ " Values of path:
+ " * non-empty string - path
+ " * -1 - pending
+ " * -2 - not tracked by git
+
+ call gitgutter#utility#setbufvar(a:bufnr, 'path', -1)
+ let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -z -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
+
+ if g:gitgutter_async && gitgutter#async#available()
+ if has('lambda')
+ call gitgutter#async#execute(cmd, a:bufnr, {
+ \ 'out': {bufnr, path -> gitgutter#utility#setbufvar(bufnr, 'path', s:strip_trailing_new_line(path))},
+ \ 'err': {bufnr -> gitgutter#utility#setbufvar(bufnr, 'path', -2)},
+ \ })
+ else
+ if has('nvim') && !has('nvim-0.2.0')
+ call gitgutter#async#execute(cmd, a:bufnr, {
+ \ 'out': function('s:set_path'),
+ \ 'err': function('s:not_tracked_by_git')
+ \ })
+ else
+ call gitgutter#async#execute(cmd, a:bufnr, {
+ \ 'out': function('s:set_path'),
+ \ 'err': function('s:set_path', [-2])
+ \ })
+ endif
+ endif
+ else
+ let path = gitgutter#utility#system(cmd)
+ if v:shell_error
+ call gitgutter#utility#setbufvar(a:bufnr, 'path', -2)
+ else
+ call gitgutter#utility#setbufvar(a:bufnr, 'path', s:strip_trailing_new_line(path))
+ endif
+ endif
+endfunction
+
+if has('nvim') && !has('nvim-0.2.0')
+ function! s:not_tracked_by_git(bufnr)
+ call s:set_path(a:bufnr, -2)
+ endfunction
+endif
+
+function! s:set_path(bufnr, path)
+ if a:bufnr == -2
+ let [bufnr, path] = [a:path, a:bufnr]
+ call gitgutter#utility#setbufvar(bufnr, 'path', path)
+ else
+ call gitgutter#utility#setbufvar(a:bufnr, 'path', s:strip_trailing_new_line(a:path))
+ endif
+endfunction
+
+function! gitgutter#utility#cd_cmd(bufnr, cmd) abort
+ let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() ? 'cd /d' : 'cd')
+ return cd.' '.s:dir(a:bufnr).' && '.a:cmd
+endfunction
+
+function! s:unc_path(bufnr)
+ return s:abs_path(a:bufnr, 0) =~ '^\\\\'
+endfunction
+
+function! s:use_known_shell() abort
+ if has('unix') && &shell !=# 'sh'
+ let [s:shell, s:shellcmdflag, s:shellredir] = [&shell, &shellcmdflag, &shellredir]
+ let &shell = 'sh'
+ set shellcmdflag=-c shellredir=>%s\ 2>&1
+ endif
+endfunction
+
+function! s:restore_shell() abort
+ if has('unix') && exists('s:shell')
+ let [&shell, &shellcmdflag, &shellredir] = [s:shell, s:shellcmdflag, s:shellredir]
+ endif
+endfunction
+
+function! s:abs_path(bufnr, shellesc)
+ let p = resolve(expand('#'.a:bufnr.':p'))
+ return a:shellesc ? gitgutter#utility#shellescape(p) : p
+endfunction
+
+function! s:dir(bufnr) abort
+ return gitgutter#utility#shellescape(fnamemodify(s:abs_path(a:bufnr, 0), ':h'))
+endfunction
+
+" Not shellescaped.
+function! s:filename(bufnr) abort
+ return fnamemodify(s:abs_path(a:bufnr, 0), ':t')
+endfunction
+
+function! s:exists_file(bufnr) abort
+ return filereadable(s:abs_path(a:bufnr, 0))
+endfunction
+
+" Get rid of any trailing new line or SOH character.
+"
+" git ls-files -z produces output with null line termination.
+" Vim's system() replaces any null characters in the output
+" with SOH (start of header), i.e. ^A.
+function! s:strip_trailing_new_line(line) abort
+ return substitute(a:line, '[[:cntrl:]]$', '', '')
+endfunction
+
+function! gitgutter#utility#windows()
+ return has('win64') || has('win32') || has('win16')
+endfunction
diff --git a/vim/.vim/plugged/vim-gitgutter/doc/gitgutter.txt b/vim/.vim/plugged/vim-gitgutter/doc/gitgutter.txt
new file mode 100644
index 0000000..87825da
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/doc/gitgutter.txt
@@ -0,0 +1,549 @@
+*gitgutter.txt* A Vim plugin which shows a git diff in the gutter.
+
+
+ Vim Git Gutter
+
+
+Author: Andy Stewart <https://airbladesoftware.com/>
+Plugin Homepage: <https://github.com/airblade/vim-gitgutter>
+
+
+===============================================================================
+CONTENTS *gitgutter*
+
+ Introduction ................. |gitgutter-introduction|
+ Installation ................. |gitgutter-installation|
+ Commands ..................... |gitgutter-commands|
+ Mappings ..................... |gitgutter-mappings|
+ Autocommand .................. |gitgutter-autocommand|
+ Options ...................... |gitgutter-options|
+ Highlights ................... |gitgutter-highlights|
+ FAQ .......................... |gitgutter-faq|
+ TROUBLESHOOTING .............. |gitgutter-troubleshooting|
+
+
+===============================================================================
+INTRODUCTION *gitgutter-introduction*
+
+GitGutter is a Vim plugin which shows a git diff in the 'gutter' (sign column).
+It shows which lines have been added, modified, or removed. You can also
+preview, stage, and undo individual hunks. The plugin also provides a hunk
+text object.
+
+The signs are always up to date and the plugin never saves your buffer.
+
+
+===============================================================================
+INSTALLATION *gitgutter-installation*
+
+Pathogen:~
+>
+ cd ~/.vim/bundle
+ git clone git://github.com/airblade/vim-gitgutter.git
+<
+Voom:~
+
+Edit your plugin manifest (`voom edit`) and add:
+>
+ airblade/vim-gitgutter
+<
+VimPlug:~
+
+Place this in your .vimrc:
+>
+ Plug 'airblade/vim-gitgutter'
+<
+Then run the following in Vim:
+>
+ :source %
+ :PlugInstall
+<
+NeoBundle:~
+
+Place this in your .vimrc:
+>
+ NeoBundle 'airblade/vim-gitgutter'
+<
+Then run the following in Vim:
+>
+ :source %
+ :NeoBundleInstall
+<
+No plugin manager:~
+
+Copy vim-gitgutter's subdirectories into your vim configuration directory:
+>
+ cd tmp && git clone git://github.com/airblade/vim-gitgutter.git
+ cp vim-gitgutter/* ~/.vim/
+<
+See |add-global-plugin|.
+
+
+===============================================================================
+COMMANDS *gitgutter-commands*
+
+Commands for turning vim-gitgutter on and off:~
+
+ *gitgutter-:GitGutterDisable*
+:GitGutterDisable Turn vim-gitgutter off for all buffers.
+
+ *gitgutter-:GitGutterEnable*
+:GitGutterEnable Turn vim-gitgutter on for all buffers.
+
+ *gitgutter-:GitGutterToggle*
+:GitGutterToggle Toggle vim-gitgutter on or off for all buffers.
+
+ *gitgutter-:GitGutter*
+:GitGutter Update signs for the current buffer. You shouldn't
+ need to run this.
+
+ *gitgutter-:GitGutterAll*
+:GitGutterAll Update signs for all buffers. You shouldn't need to
+ run this.
+
+
+Commands for turning signs on and off (defaults to on):~
+
+ *gitgutter-:GitGutterSignsEnable*
+:GitGutterSignsEnable Show signs for the diff.
+
+ *gitgutter-:GitGutterSignsDisable*
+:GitGutterSignsDisable Do not show signs for the diff.
+
+ *gitgutter-:GitGutterSignsToggle*
+:GitGutterSignsToggle Toggle signs on or off.
+
+
+Commands for turning line highlighting on and off (defaults to off):~
+
+ *gitgutter-:GitGutterLineHighlightsEnable*
+:GitGutterLineHighlightsEnable Turn on line highlighting.
+
+ *gitgutter-:GitGutterLineHighlightsDisable*
+:GitGutterLineHighlightsDisable Turn off line highlighting.
+
+ *gitgutter-:GitGutterLineHighlightsToggle*
+:GitGutterLineHighlightsToggle Turn line highlighting on or off.
+
+
+Commands for jumping between hunks:~
+
+ *gitgutter-:GitGutterNextHunk*
+:GitGutterNextHunk Jump to the next [count] hunk.
+
+ *gitgutter-:GitGutterPrevHunk*
+:GitGutterPrevHunk Jump to the previous [count] hunk.
+
+
+Commands for operating on a hunk:~
+
+ *gitgutter-:GitGutterStageHunk*
+:GitGutterStageHunk Stage the hunk the cursor is in.
+
+ *gitgutter-:GitGutterUndoHunk*
+:GitGutterUndoHunk Undo the hunk the cursor is in.
+
+ *gitgutter-:GitGutterPreviewHunk*
+:GitGutterPreviewHunk Preview the hunk the cursor is in.
+ Use |:pclose| or |CTRL-W_CTRL-Z| to close the preview
+ window.
+
+Commands for folds:~
+
+ *gitgutter-:GitGutterFold*
+:GitGutterFold Fold all unchanged lines. Execute again to undo.
+
+
+===============================================================================
+AUTOCOMMAND *gitgutter-autocommand*
+
+User GitGutter~
+
+After updating a buffer's signs vim-gitgutter fires a |User| |autocmd| with the
+event GitGutter. You can listen for this event, for example:
+>
+ autocmd User GitGutter call updateMyStatusLine()
+<
+A dictionary `g:gitgutter_hook_context` is made available during its execution,
+which contains an entry `bufnr` that contains the buffer number being updated.
+
+
+===============================================================================
+MAPPINGS *gitgutter-mappings*
+
+You can disable all these mappings with:
+>
+ let g:gitgutter_map_keys = 0
+<
+
+Hunk operations:~
+
+These can be repeated with `.` if you have vim-repeat installed.
+
+ *gitgutter-<Leader>hp*
+<Leader>hp Preview the hunk under the cursor.
+
+ *gitgutter-<Leader>hs*
+<Leader>hs Stage the hunk under the cursor.
+
+ *gitgutter-<Leader>hu*
+<Leader>hu Undo the hunk under the cursor.
+
+You can change these mappings like this:
+>
+ nmap ghp <Plug>GitGutterPreviewHunk
+ nmap ghs <Plug>GitGutterStageHunk
+ nmap ghu <Plug>GitGutterUndoHunk
+<
+
+Hunk jumping:~
+
+ *gitgutter-]c*
+]c Jump to the next [count] hunk.
+
+ *gitgutter-[c*
+[c Jump to the previous [count] hunk.
+
+You can change these mappings like this:
+>
+ nmap [c <Plug>GitGutterPrevHunk
+ nmap ]c <Plug>GitGutterNextHunk
+<
+
+Hunk text object:~
+
+ *gitgutter-ic* *gitgutter-ac* *gitgutter-text-object*
+"ic" operates on the current hunk's lines. "ac" does the same but also includes
+trailing empty lines.
+>
+ omap ic <Plug>GitGutterTextObjectInnerPending
+ omap ac <Plug>GitGutterTextObjectOuterPending
+ xmap ic <Plug>GitGutterTextObjectInnerVisual
+ xmap ac <Plug>GitGutterTextObjectOuterVisual
+<
+
+
+===============================================================================
+OPTIONS *gitgutter-options*
+
+The most important option is 'updatetime' which determines how long (in
+milliseconds) the plugin will wait after you stop typing before it updates the
+signs. Vim's default is 4000. I recommend 100.
+
+Most important option:~
+
+ 'updatetime'
+
+Git:~
+
+ |g:gitgutter_git_executable|
+ |g:gitgutter_git_args|
+ |g:gitgutter_diff_args|
+ |g:gitgutter_diff_base|
+
+Grep:~
+
+ |g:gitgutter_grep|
+
+Signs:~
+
+ |g:gitgutter_signs|
+ |g:gitgutter_highlight_lines|
+ |g:gitgutter_max_signs|
+ |g:gitgutter_sign_added|
+ |g:gitgutter_sign_modified|
+ |g:gitgutter_sign_removed|
+ |g:gitgutter_sign_removed_first_line|
+ |g:gitgutter_sign_modified_removed|
+ |g:gitgutter_sign_column_always|
+ |g:gitgutter_override_sign_column_highlight|
+
+Terminal:~
+
+ |g:gitgutter_terminal_reports_focus|
+
+General:~
+
+ |g:gitgutter_enabled|
+ |g:gitgutter_map_keys|
+ |g:gitgutter_async|
+ |g:gitgutter_log|
+
+
+ *g:gitgutter_git_executable*
+Default: 'git'
+
+This option determines what git binary to use. Set this if git is not on your
+path.
+
+ *g:gitgutter_git_args*
+Default: empty
+
+Use this option to pass any extra arguments to git when running git-diff.
+For example:
+>
+ let g:gitgutter_git_args = '--git-dir=""'
+<
+
+ *g:gitgutter_diff_args*
+Default: empty
+
+Use this option to pass any extra arguments to git-diff. For example:
+>
+ let g:gitgutter_diff_args = '-w'
+<
+
+ *g:gitgutter_diff_base*
+Default: empty
+
+By default buffers are diffed against the index. Use this option to diff against
+a revision instead. For example:
+>
+ let g:gitgutter_diff_base = '<some commit SHA>'
+<
+
+ *g:gitgutter_grep*
+Default: 'grep'
+
+The plugin pipes the output of git-diff into grep to minimise the amount of data
+vim has to process. Set this option if grep is not on your path.
+
+grep must produce plain-text output without any ANSI escape codes or colours.
+Use this option to turn off colours if necessary.
+>
+ let g:gitgutter_grep = 'grep --color=never'
+<
+If you do not want to use grep at all (perhaps to debug why signs are not
+showing), set this option to an empty string:
+>
+ let g:gitgutter_grep = ''
+<
+
+ *g:gitgutter_signs*
+Default: 1
+
+Determines whether or not to show signs.
+
+ *g:gitgutter_highlight_lines*
+Default: 0
+
+Determines whether or not to show line highlights.
+
+ *g:gitgutter_max_signs*
+Default: 500
+
+Sets the maximum number of signs to show in a buffer. Vim is slow at updating
+signs, so to avoid slowing down the GUI the number of signs is capped. When
+the number of changed lines exceeds this value, the plugin removes all signs
+and displays a warning message.
+
+ *g:gitgutter_sign_added*
+ *g:gitgutter_sign_modified*
+ *g:gitgutter_sign_removed*
+ *g:gitgutter_sign_removed_first_line*
+ *g:gitgutter_sign_modified_removed*
+Defaults:
+>
+ let g:gitgutter_sign_added = '+'
+ let g:gitgutter_sign_modified = '~'
+ let g:gitgutter_sign_removed = '_'
+ let g:gitgutter_sign_removed_first_line = '‾'
+ let g:gitgutter_sign_modified_removed = '~_'
+<
+You can use unicode characters but not images. Signs must not take up more than
+2 columns.
+
+ *g:gitgutter_sign_column_always*
+Default: 0
+
+This legacy option controls whether the sign column should always be shown, even
+if there are no signs to display.
+
+From Vim 7.4.2201, use 'signcolumn' instead:
+>
+ set signcolumn=yes
+<
+
+ *g:gitgutter_override_sign_column_highlight*
+Default: 1
+
+Controls whether to make the sign column look like the line-number column (i.e.
+the |hl-LineNr| highlight group).
+
+To customise your sign column's background color, first tell vim-gitgutter to
+leave it alone:
+>
+ let g:gitgutter_override_sign_column_highlight = 0
+<
+
+And then either update your colorscheme's |hlSignColumn| highlight group or set
+it in your |vimrc|:
+
+ Desired appearance Command ~
+ Same as line-number column highlight clear SignColumn
+ User-defined (terminal Vim) highlight SignColumn ctermbg={whatever}
+ User-defined (graphical Vim) highlight SignColumn guibg={whatever}
+
+
+ *g:gitgutter_terminal_reports_focus*
+Default: 1
+
+Normally the plugin uses |FocusGained| to force-update all buffers when Vim
+receives focus. However some terminals do not report focus events and so the
+|FocusGained| autocommand never fires.
+
+If this applies to you, either install something like Terminus
+(https://github.com/wincent/terminus) to make |FocusGained| work or set this
+option to 0.
+
+When this option is 0, the plugin force-updates the buffer on |BufEnter|
+(instead of only updating if the buffer's contents has changed since the last
+update).
+
+ *g:gitgutter_enabled*
+Default: 1
+
+Controls whether or not the plugin is on at startup.
+
+ *g:gitgutter_map_keys*
+Default: 1
+
+Controls whether or not the plugin provides mappings. See |gitgutter-mapppings|.
+
+ *g:gitgutter_async*
+Default: 1
+
+Controls whether or not diffs are run in the background. This has no effect if
+your Vim does not support background jobs.
+
+ *g:gitgutter_log*
+Default: 0
+
+When switched on, the plugin logs to gitgutter.log in the directory where it is
+installed. Additionally it logs channel activity to channel.log.
+
+
+===============================================================================
+HIGHLIGHTS *gitgutter-highlights*
+
+To change the signs' colours, set up the following highlight groups in your
+colorscheme or |vimrc|:
+>
+ GitGutterAdd " an added line
+ GitGutterChange " a changed line
+ GitGutterDelete " at least one removed line
+ GitGutterChangeDelete " a changed line followed by at least one removed line
+<
+
+You can either set these with `highlight GitGutterAdd {key}={arg}...` or link
+them to existing highlight groups with, say:
+>
+ highlight link GitGutterAdd MyDiffAdd
+<
+
+To change the line highlights, set up the following highlight groups in your
+colorscheme or |vimrc|:
+>
+ GitGutterAddLine " default: links to DiffAdd
+ GitGutterChangeLine " default: links to DiffChange
+ GitGutterDeleteLine " default: links to DiffDelete
+ GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault
+<
+
+For example, to use |hl-DiffText| instead of |hl-DiffChange|:
+>
+ highlight link GitGutterChangeLine DiffChange
+<
+
+
+===============================================================================
+FAQ *gitgutter-faq*
+
+a. How do I turn off realtime updates?
+
+ Add this to your vim configuration in an |after-directory|:
+>
+ autocmd! gitgutter CursorHold,CursorHoldI
+<
+
+b. I turned off realtime updates, how can I have signs updated when I save a
+ file?
+
+ If you really want to update the signs when you save a file, add this to your
+ |vimrc|:
+>
+ autocmd BufWritePost * GitGutter
+<
+
+c. Why can't I unstage staged changes?
+
+ This plugin is for showing changes between the working tree and the index
+ (and staging/undoing those changes). Unstaging a staged hunk would require
+ showing changes between the index and HEAD, which is out of scope.
+
+d. Why are the colours in the sign column weird?
+
+ Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly.
+ Please see |g:gitgutter_override_sign_column_highlight| on customising the
+ sign column.
+
+e. What happens if I also use another plugin which uses signs (e.g. Syntastic)?
+
+ Vim only allows one sign per line. Vim-gitgutter will not interfere with
+ signs it did not add.
+
+
+===============================================================================
+TROUBLESHOOTING *gitgutter-troubleshooting*
+
+When no signs are showing at all:~
+
+1. Try bypassing grep with:
+>
+ let g:gitgutter_grep = ''
+<
+ If it works, the problem is grep outputting ANSI escape codes. Use this
+ option to pass arguments to grep to turn off the escape codes.
+
+2. Verify git is on your path:
+>
+ :echo system('git --version')
+<
+
+3. Verify your git config is compatible with the version of git return by the
+ command above.
+
+4. Verify your Vim supports signs. The following should give 1:
+>
+ :echo has('signs')
+<
+
+5. Check whether the plugin thinks git knows about your file:
+>
+ :echo getbufvar('','gitgutter').path
+<
+ If the result is -2, the plugin thinks your file is not tracked by git.
+
+
+When the whole file is marked as added:~
+
+If you use zsh, and you set "CDPATH", make sure "CDPATH" does not include the
+current directory.
+
+
+When signs take a few seconds to appear:~
+
+Try reducing 'updatetime':
+>
+ set updatetime=100
+<
+
+
+When signs don't update after focusing Vim:~
+
+Your terminal probably isn't reporting focus events. Either try installing
+Terminus (https://github.com/wincent/terminus) or set:
+>
+ let g:gitgutter_terminal_reports_focus = 0
+<
+
diff --git a/vim/.vim/plugged/vim-gitgutter/doc/tags b/vim/.vim/plugged/vim-gitgutter/doc/tags
new file mode 100644
index 0000000..c6dee73
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/doc/tags
@@ -0,0 +1,56 @@
+g:gitgutter_async gitgutter.txt /*g:gitgutter_async*
+g:gitgutter_diff_args gitgutter.txt /*g:gitgutter_diff_args*
+g:gitgutter_diff_base gitgutter.txt /*g:gitgutter_diff_base*
+g:gitgutter_enabled gitgutter.txt /*g:gitgutter_enabled*
+g:gitgutter_git_args gitgutter.txt /*g:gitgutter_git_args*
+g:gitgutter_git_executable gitgutter.txt /*g:gitgutter_git_executable*
+g:gitgutter_grep gitgutter.txt /*g:gitgutter_grep*
+g:gitgutter_highlight_lines gitgutter.txt /*g:gitgutter_highlight_lines*
+g:gitgutter_log gitgutter.txt /*g:gitgutter_log*
+g:gitgutter_map_keys gitgutter.txt /*g:gitgutter_map_keys*
+g:gitgutter_max_signs gitgutter.txt /*g:gitgutter_max_signs*
+g:gitgutter_override_sign_column_highlight gitgutter.txt /*g:gitgutter_override_sign_column_highlight*
+g:gitgutter_sign_added gitgutter.txt /*g:gitgutter_sign_added*
+g:gitgutter_sign_column_always gitgutter.txt /*g:gitgutter_sign_column_always*
+g:gitgutter_sign_modified gitgutter.txt /*g:gitgutter_sign_modified*
+g:gitgutter_sign_modified_removed gitgutter.txt /*g:gitgutter_sign_modified_removed*
+g:gitgutter_sign_removed gitgutter.txt /*g:gitgutter_sign_removed*
+g:gitgutter_sign_removed_first_line gitgutter.txt /*g:gitgutter_sign_removed_first_line*
+g:gitgutter_signs gitgutter.txt /*g:gitgutter_signs*
+g:gitgutter_terminal_reports_focus gitgutter.txt /*g:gitgutter_terminal_reports_focus*
+gitgutter gitgutter.txt /*gitgutter*
+gitgutter-:GitGutter gitgutter.txt /*gitgutter-:GitGutter*
+gitgutter-:GitGutterAll gitgutter.txt /*gitgutter-:GitGutterAll*
+gitgutter-:GitGutterDisable gitgutter.txt /*gitgutter-:GitGutterDisable*
+gitgutter-:GitGutterEnable gitgutter.txt /*gitgutter-:GitGutterEnable*
+gitgutter-:GitGutterFold gitgutter.txt /*gitgutter-:GitGutterFold*
+gitgutter-:GitGutterLineHighlightsDisable gitgutter.txt /*gitgutter-:GitGutterLineHighlightsDisable*
+gitgutter-:GitGutterLineHighlightsEnable gitgutter.txt /*gitgutter-:GitGutterLineHighlightsEnable*
+gitgutter-:GitGutterLineHighlightsToggle gitgutter.txt /*gitgutter-:GitGutterLineHighlightsToggle*
+gitgutter-:GitGutterNextHunk gitgutter.txt /*gitgutter-:GitGutterNextHunk*
+gitgutter-:GitGutterPrevHunk gitgutter.txt /*gitgutter-:GitGutterPrevHunk*
+gitgutter-:GitGutterPreviewHunk gitgutter.txt /*gitgutter-:GitGutterPreviewHunk*
+gitgutter-:GitGutterSignsDisable gitgutter.txt /*gitgutter-:GitGutterSignsDisable*
+gitgutter-:GitGutterSignsEnable gitgutter.txt /*gitgutter-:GitGutterSignsEnable*
+gitgutter-:GitGutterSignsToggle gitgutter.txt /*gitgutter-:GitGutterSignsToggle*
+gitgutter-:GitGutterStageHunk gitgutter.txt /*gitgutter-:GitGutterStageHunk*
+gitgutter-:GitGutterToggle gitgutter.txt /*gitgutter-:GitGutterToggle*
+gitgutter-:GitGutterUndoHunk gitgutter.txt /*gitgutter-:GitGutterUndoHunk*
+gitgutter-<Leader>hp gitgutter.txt /*gitgutter-<Leader>hp*
+gitgutter-<Leader>hs gitgutter.txt /*gitgutter-<Leader>hs*
+gitgutter-<Leader>hu gitgutter.txt /*gitgutter-<Leader>hu*
+gitgutter-[c gitgutter.txt /*gitgutter-[c*
+gitgutter-]c gitgutter.txt /*gitgutter-]c*
+gitgutter-ac gitgutter.txt /*gitgutter-ac*
+gitgutter-autocommand gitgutter.txt /*gitgutter-autocommand*
+gitgutter-commands gitgutter.txt /*gitgutter-commands*
+gitgutter-faq gitgutter.txt /*gitgutter-faq*
+gitgutter-highlights gitgutter.txt /*gitgutter-highlights*
+gitgutter-ic gitgutter.txt /*gitgutter-ic*
+gitgutter-installation gitgutter.txt /*gitgutter-installation*
+gitgutter-introduction gitgutter.txt /*gitgutter-introduction*
+gitgutter-mappings gitgutter.txt /*gitgutter-mappings*
+gitgutter-options gitgutter.txt /*gitgutter-options*
+gitgutter-text-object gitgutter.txt /*gitgutter-text-object*
+gitgutter-troubleshooting gitgutter.txt /*gitgutter-troubleshooting*
+gitgutter.txt gitgutter.txt /*gitgutter.txt*
diff --git a/vim/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim b/vim/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim
new file mode 100644
index 0000000..e0b0b92
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim
@@ -0,0 +1,231 @@
+scriptencoding utf-8
+
+if exists('g:loaded_gitgutter') || !has('signs') || &cp
+ finish
+endif
+let g:loaded_gitgutter = 1
+
+" Initialisation {{{
+
+if v:version < 703 || (v:version == 703 && !has("patch105"))
+ call gitgutter#utility#warn('requires Vim 7.3.105')
+ finish
+endif
+
+function! s:set(var, default) abort
+ if !exists(a:var)
+ if type(a:default)
+ execute 'let' a:var '=' string(a:default)
+ else
+ execute 'let' a:var '=' a:default
+ endif
+ endif
+endfunction
+
+call s:set('g:gitgutter_enabled', 1)
+call s:set('g:gitgutter_max_signs', 500)
+call s:set('g:gitgutter_signs', 1)
+call s:set('g:gitgutter_highlight_lines', 0)
+call s:set('g:gitgutter_sign_column_always', 0)
+if g:gitgutter_sign_column_always && exists('&signcolumn')
+ " Vim 7.4.2201.
+ set signcolumn=yes
+ let g:gitgutter_sign_column_always = 0
+ call gitgutter#utility#warn('please replace "let g:gitgutter_sign_column_always=1" with "set signcolumn=yes"')
+endif
+call s:set('g:gitgutter_override_sign_column_highlight', 1)
+call s:set('g:gitgutter_sign_added', '+')
+call s:set('g:gitgutter_sign_modified', '~')
+call s:set('g:gitgutter_sign_removed', '_')
+
+if gitgutter#utility#supports_overscore_sign()
+ call s:set('g:gitgutter_sign_removed_first_line', '‾')
+else
+ call s:set('g:gitgutter_sign_removed_first_line', '_^')
+endif
+
+call s:set('g:gitgutter_sign_removed_above_and_below', '[')
+call s:set('g:gitgutter_sign_modified_removed', '~_')
+call s:set('g:gitgutter_git_args', '')
+call s:set('g:gitgutter_diff_args', '')
+call s:set('g:gitgutter_diff_base', '')
+call s:set('g:gitgutter_map_keys', 1)
+call s:set('g:gitgutter_terminal_reports_focus', 1)
+call s:set('g:gitgutter_async', 1)
+call s:set('g:gitgutter_log', 0)
+
+call s:set('g:gitgutter_git_executable', 'git')
+if !executable(g:gitgutter_git_executable)
+ call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.')
+endif
+
+let default_grep = 'grep'
+call s:set('g:gitgutter_grep', default_grep)
+if !empty(g:gitgutter_grep)
+ if executable(split(g:gitgutter_grep)[0])
+ if $GREP_OPTIONS =~# '--color=always'
+ let g:gitgutter_grep .= ' --color=never'
+ endif
+ else
+ if g:gitgutter_grep !=# default_grep
+ call gitgutter#utility#warn('cannot find '.g:gitgutter_grep.'. Please check g:gitgutter_grep.')
+ endif
+ let g:gitgutter_grep = ''
+ endif
+endif
+
+call gitgutter#highlight#define_sign_column_highlight()
+call gitgutter#highlight#define_highlights()
+call gitgutter#highlight#define_signs()
+
+" Prevent infinite loop where:
+" - executing a job in the foreground launches a new window which takes the focus;
+" - when the job finishes, focus returns to gvim;
+" - the FocusGained event triggers a new job (see below).
+if gitgutter#utility#windows() && !(g:gitgutter_async && gitgutter#async#available())
+ set noshelltemp
+endif
+
+" }}}
+
+" Primary functions {{{
+
+command! -bar GitGutterAll call gitgutter#all(1)
+command! -bar GitGutter call gitgutter#process_buffer(bufnr(''), 1)
+
+command! -bar GitGutterDisable call gitgutter#disable()
+command! -bar GitGutterEnable call gitgutter#enable()
+command! -bar GitGutterToggle call gitgutter#toggle()
+
+command! -bar GitGutterBufferDisable call gitgutter#buffer_disable()
+command! -bar GitGutterBufferEnable call gitgutter#buffer_enable()
+command! -bar GitGutterBufferToggle call gitgutter#buffer_toggle()
+
+" }}}
+
+" Line highlights {{{
+
+command! -bar GitGutterLineHighlightsDisable call gitgutter#highlight#line_disable()
+command! -bar GitGutterLineHighlightsEnable call gitgutter#highlight#line_enable()
+command! -bar GitGutterLineHighlightsToggle call gitgutter#highlight#line_toggle()
+
+" }}}
+
+" Signs {{{
+
+command! -bar GitGutterSignsEnable call gitgutter#sign#enable()
+command! -bar GitGutterSignsDisable call gitgutter#sign#disable()
+command! -bar GitGutterSignsToggle call gitgutter#sign#toggle()
+
+" }}}
+
+" Hunks {{{
+
+command! -bar -count=1 GitGutterNextHunk call gitgutter#hunk#next_hunk(<count>)
+command! -bar -count=1 GitGutterPrevHunk call gitgutter#hunk#prev_hunk(<count>)
+
+command! -bar GitGutterStageHunk call gitgutter#hunk#stage()
+command! -bar GitGutterUndoHunk call gitgutter#hunk#undo()
+command! -bar GitGutterPreviewHunk call gitgutter#hunk#preview()
+
+" Hunk text object
+onoremap <silent> <Plug>GitGutterTextObjectInnerPending :<C-U>call gitgutter#hunk#text_object(1)<CR>
+onoremap <silent> <Plug>GitGutterTextObjectOuterPending :<C-U>call gitgutter#hunk#text_object(0)<CR>
+xnoremap <silent> <Plug>GitGutterTextObjectInnerVisual :<C-U>call gitgutter#hunk#text_object(1)<CR>
+xnoremap <silent> <Plug>GitGutterTextObjectOuterVisual :<C-U>call gitgutter#hunk#text_object(0)<CR>
+
+
+" Returns the git-diff hunks for the file or an empty list if there
+" aren't any hunks.
+"
+" The return value is a list of lists. There is one inner list per hunk.
+"
+" [
+" [from_line, from_count, to_line, to_count],
+" [from_line, from_count, to_line, to_count],
+" ...
+" ]
+"
+" where:
+"
+" `from` - refers to the staged file
+" `to` - refers to the working tree's file
+" `line` - refers to the line number where the change starts
+" `count` - refers to the number of lines the change covers
+function! GitGutterGetHunks()
+ let bufnr = bufnr('')
+ return gitgutter#utility#is_active(bufnr) ? gitgutter#hunk#hunks(bufnr) : []
+endfunction
+
+" Returns an array that contains a summary of the hunk status for the current
+" window. The format is [ added, modified, removed ], where each value
+" represents the number of lines added/modified/removed respectively.
+function! GitGutterGetHunkSummary()
+ return gitgutter#hunk#summary(winbufnr(0))
+endfunction
+
+" }}}
+
+" Folds {{{
+
+command! -bar GitGutterFold call gitgutter#fold#toggle()
+
+" }}}
+
+command! -bar GitGutterDebug call gitgutter#debug#debug()
+
+" Maps {{{
+
+nnoremap <silent> <expr> <Plug>GitGutterNextHunk &diff ? ']c' : ":\<C-U>execute v:count1 . 'GitGutterNextHunk'\<CR>"
+nnoremap <silent> <expr> <Plug>GitGutterPrevHunk &diff ? '[c' : ":\<C-U>execute v:count1 . 'GitGutterPrevHunk'\<CR>"
+
+nnoremap <silent> <Plug>GitGutterStageHunk :GitGutterStageHunk<CR>
+nnoremap <silent> <Plug>GitGutterUndoHunk :GitGutterUndoHunk<CR>
+nnoremap <silent> <Plug>GitGutterPreviewHunk :GitGutterPreviewHunk<CR>
+
+" }}}
+
+function! s:on_bufenter()
+ if exists('t:gitgutter_didtabenter') && t:gitgutter_didtabenter
+ let t:gitgutter_didtabenter = 0
+ call gitgutter#all(!g:gitgutter_terminal_reports_focus)
+ else
+ call gitgutter#init_buffer(bufnr(''))
+ call gitgutter#process_buffer(bufnr(''), !g:gitgutter_terminal_reports_focus)
+ endif
+endfunction
+
+" Autocommands {{{
+
+augroup gitgutter
+ autocmd!
+
+ autocmd TabEnter * let t:gitgutter_didtabenter = 1
+
+ autocmd BufEnter * call s:on_bufenter()
+
+ autocmd CursorHold,CursorHoldI * call gitgutter#process_buffer(bufnr(''), 0)
+ autocmd FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 1)
+
+ " Ensure that all buffers are processed when opening vim with multiple files, e.g.:
+ "
+ " vim -o file1 file2
+ autocmd VimEnter * if winnr() != winnr('$') | call gitgutter#all(0) | endif
+
+ autocmd FocusGained,ShellCmdPost * call gitgutter#all(1)
+ autocmd WinLeave * if bufname('') =~ '^term://' | call gitgutter#all(1) | endif
+
+ if exists('##VimResume')
+ autocmd VimResume * call gitgutter#all(1)
+ endif
+
+ autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights()
+
+ " Disable during :vimgrep
+ autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0
+ autocmd QuickFixCmdPost *vimgrep* let g:gitgutter_enabled = 1
+augroup END
+
+" }}}
+
+" vim:set et sw=2 fdm=marker:
diff --git a/vim/.vim/plugged/vim-gitgutter/screenshot.png b/vim/.vim/plugged/vim-gitgutter/screenshot.png
new file mode 100644
index 0000000..6b50f83
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/screenshot.png
Binary files differ
diff --git a/vim/.vim/plugged/vim-gitgutter/test/cp932.txt b/vim/.vim/plugged/vim-gitgutter/test/cp932.txt
new file mode 100644
index 0000000..80cb10b
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/test/cp932.txt
@@ -0,0 +1,8 @@
+The quick brown fox jumps
+over the lazy dog
+
+͂ɂقւƂʂ
+킩悽ꂻ‚˂Ȃ
+̂܂ӂ
+߂݂Ђ
+
diff --git a/vim/.vim/plugged/vim-gitgutter/test/fixture.txt b/vim/.vim/plugged/vim-gitgutter/test/fixture.txt
new file mode 100644
index 0000000..f5c6aff
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/test/fixture.txt
@@ -0,0 +1,11 @@
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
+
diff --git a/vim/.vim/plugged/vim-gitgutter/test/runner.vim b/vim/.vim/plugged/vim-gitgutter/test/runner.vim
new file mode 100644
index 0000000..630693c
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/test/runner.vim
@@ -0,0 +1,162 @@
+"
+" Adapted from https://github.com/vim/vim/blob/master/src/testdir/runtest.vim
+"
+" When debugging tests it can help to write debug output:
+" call Log('oh noes')
+"
+
+function RunTest(test)
+ if exists("*SetUp")
+ call SetUp()
+ endif
+
+ try
+ execute 'call '.a:test
+ catch
+ call Exception()
+ let s:errored = 1
+ endtry
+
+ if exists("*TearDown")
+ call TearDown()
+ endif
+endfunction
+
+function Log(msg)
+ if type(a:msg) == type('')
+ call add(s:messages, a:msg)
+ elseif type(a:msg) == type([])
+ call extend(s:messages, a:msg)
+ else
+ call add(v:errors, 'Exception: unsupported type: '.type(a:msg))
+ endif
+endfunction
+
+function Exception()
+ call add(v:errors, v:throwpoint.'..'.'Exception: '.v:exception)
+endfunction
+
+" Shuffles list in place.
+function Shuffle(list)
+ " Fisher-Yates-Durstenfeld-Knuth
+ let n = len(a:list)
+ if n < 2
+ return a:list
+ endif
+ for i in range(0, n-2)
+ let j = Random(0, n-i-1)
+ let e = a:list[i]
+ let a:list[i] = a:list[i+j]
+ let a:list[i+j] = e
+ endfor
+ return a:list
+endfunction
+
+" Returns a pseudorandom integer i such that 0 <= i <= max
+function Random(min, max)
+ if has('unix')
+ let i = system('echo $RANDOM') " 0 <= i <= 32767
+ else
+ let i = system('echo %RANDOM%') " 0 <= i <= 32767
+ endif
+ return i * (a:max - a:min + 1) / 32768 + a:min
+endfunction
+
+function FriendlyName(test_name)
+ return substitute(a:test_name[5:-3], '_', ' ', 'g')
+endfunction
+
+function Align(left, right)
+ if type(a:right) == type([])
+ let result = []
+ for s in a:right
+ if empty(result)
+ call add(result, printf('%-'.s:indent.'S', a:left).s)
+ else
+ call add(result, printf('%-'.s:indent.'S', '').s)
+ endif
+ endfor
+ return result
+ endif
+
+ return printf('%-'.s:indent.'S', a:left).a:right
+endfunction
+
+let g:testname = expand('%')
+let s:errored = 0
+let s:done = 0
+let s:fail = 0
+let s:errors = 0
+let s:messages = []
+let s:indent = ''
+
+call Log(g:testname.':')
+
+" Source the test script.
+try
+ source %
+catch
+ let s:errors += 1
+ call Exception()
+endtry
+
+" Locate the test functions.
+set nomore
+redir @q
+silent function /^Test_
+redir END
+let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
+
+" If there is another argument, filter test-functions' names against it.
+if argc() > 1
+ let s:tests = filter(s:tests, 'v:val =~ argv(1)')
+endif
+
+let s:indent = max(map(copy(s:tests), {_, val -> len(FriendlyName(val))}))
+
+" Run the tests in random order.
+for test in Shuffle(s:tests)
+ call RunTest(test)
+ let s:done += 1
+
+ let friendly_name = FriendlyName(test)
+ if len(v:errors) == 0
+ call Log(Align(friendly_name, ' - ok'))
+ else
+ if s:errored
+ let s:errors += 1
+ let s:errored = 0
+ else
+ let s:fail += 1
+ endif
+ call Log(Align(friendly_name, ' - not ok'))
+
+ let i = 0
+ for error in v:errors
+ if i != 0
+ call Log(Align('',' ! ----'))
+ endif
+ for trace in reverse(split(error, '\.\.'))
+ call Log(Align('', ' ! '.trace))
+ endfor
+ let i += 1
+ endfor
+
+ let v:errors = []
+ endif
+endfor
+
+let summary = [
+ \ s:done.( s:done == 1 ? ' test' : ' tests'),
+ \ s:errors.(s:errors == 1 ? ' error' : ' errors'),
+ \ s:fail.( s:fail == 1 ? ' failure' : ' failures'),
+ \ ]
+call Log('')
+call Log(join(summary, ', '))
+
+split messages.log
+call append(line('$'), s:messages)
+write
+
+qall!
+
diff --git a/vim/.vim/plugged/vim-gitgutter/test/test b/vim/.vim/plugged/vim-gitgutter/test/test
new file mode 100644
index 0000000..4daf052
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/test/test
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+VIM="/Applications/MacVim.app/Contents/MacOS/Vim -v"
+
+export VIM_GITGUTTER_TEST=1
+
+$VIM -u NONE -U NONE -N \
+ --cmd 'set rtp+=../' \
+ --cmd 'let g:gitgutter_async=0' \
+ --cmd 'source ../plugin/gitgutter.vim' \
+ -S runner.vim \
+ test_*.vim \
+ $*
+
+cat messages.log
+
+grep -q "0 errors, 0 failures" messages.log
+status=$?
+rm messages.log
+exit $status
+
diff --git a/vim/.vim/plugged/vim-gitgutter/test/test_gitgutter.vim b/vim/.vim/plugged/vim-gitgutter/test/test_gitgutter.vim
new file mode 100644
index 0000000..855eca3
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/test/test_gitgutter.vim
@@ -0,0 +1,680 @@
+let s:current_dir = expand('%:p:h')
+let s:test_repo = s:current_dir.'/test-repo'
+let s:bufnr = bufnr('')
+
+"
+" Helpers
+"
+
+function s:signs(filename)
+ redir => signs
+ silent execute 'sign place'
+ redir END
+
+ let signs = split(signs, '\n')
+
+ " filter out signs for this test file
+ " assumes a:filename's signs are last set listed
+ let i = index(signs, 'Signs for '.a:filename.':')
+ let signs = (i > -1 ? signs[i+1:] : [])
+
+ call map(signs, {_, v -> substitute(v, ' ', '', '')})
+
+ return signs
+endfunction
+
+function s:git_diff()
+ return split(system('git diff -U0 fixture.txt'), '\n')
+endfunction
+
+function s:git_diff_staged()
+ return split(system('git diff -U0 --staged fixture.txt'), '\n')
+endfunction
+
+function s:trigger_gitgutter()
+ doautocmd CursorHold
+endfunction
+
+
+"
+" SetUp / TearDown
+"
+
+function SetUp()
+ call system("git init ".s:test_repo.
+ \ " && cd ".s:test_repo.
+ \ " && cp ../fixture.txt .".
+ \ " && git add . && git commit -m 'initial'".
+ \ " && git config diff.mnemonicPrefix false")
+ execute ':cd' s:test_repo
+ edit! fixture.txt
+ call gitgutter#sign#reset()
+endfunction
+
+function TearDown()
+ " delete all buffers except this one
+ " TODO: move to runner.vim, accounting for multiple test files
+ if s:bufnr > 1
+ silent! execute '1,'.s:bufnr-1.'bdelete!'
+ endif
+ silent! execute s:bufnr+1.',$bdelete!'
+
+ execute ':cd' s:current_dir
+ call system("rm -rf ".s:test_repo)
+endfunction
+
+"
+" The tests
+"
+
+function Test_add_lines()
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = ["line=2 id=3000 name=GitGutterLineAdded"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_add_lines_fish()
+ let _shell = &shell
+ set shell=/usr/local/bin/fish
+
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = ["line=2 id=3000 name=GitGutterLineAdded"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+
+ let &shell = _shell
+endfunction
+
+
+function Test_modify_lines()
+ normal ggi*
+ call s:trigger_gitgutter()
+
+ let expected = ["line=1 id=3000 name=GitGutterLineModified"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_remove_lines()
+ execute '5d'
+ call s:trigger_gitgutter()
+
+ let expected = ["line=4 id=3000 name=GitGutterLineRemoved"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_remove_first_lines()
+ execute '1d'
+ call s:trigger_gitgutter()
+
+ let expected = ["line=1 id=3000 name=GitGutterLineRemovedFirstLine"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_overlapping_hunks()
+ execute '3d'
+ execute '1d'
+ call s:trigger_gitgutter()
+
+ let expected = ["line=1 id=3000 name=GitGutterLineRemovedAboveAndBelow"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_edit_file_with_same_name_as_a_branch()
+ normal 5Gi*
+ call system('git checkout -b fixture.txt')
+ call s:trigger_gitgutter()
+
+ let expected = ["line=5 id=3000 name=GitGutterLineModified"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_file_added_to_git()
+ let tmpfile = 'fileAddedToGit.tmp'
+ call system('touch '.tmpfile.' && git add '.tmpfile)
+ execute 'edit '.tmpfile
+ normal ihello
+ call s:trigger_gitgutter()
+
+ let expected = ["line=1 id=3000 name=GitGutterLineAdded"]
+ call assert_equal(expected, s:signs('fileAddedToGit.tmp'))
+endfunction
+
+
+function Test_filename_with_equals()
+ call system('touch =fixture=.txt && git add =fixture=.txt')
+ edit =fixture=.txt
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=1 id=3000 name=GitGutterLineAdded',
+ \ 'line=2 id=3001 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('=fixture=.txt'))
+endfunction
+
+
+function Test_filename_with_square_brackets()
+ call system('touch fix[tu]re.txt && git add fix[tu]re.txt')
+ edit fix[tu]re.txt
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=1 id=3000 name=GitGutterLineAdded',
+ \ 'line=2 id=3001 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('fix[tu]re.txt'))
+endfunction
+
+
+function Test_filename_leading_dash()
+ call system('touch -- -fixture.txt && git add -- -fixture.txt')
+ edit -fixture.txt
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=1 id=3000 name=GitGutterLineAdded',
+ \ 'line=2 id=3001 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('-fixture.txt'))
+endfunction
+
+
+function Test_filename_umlaut()
+ call system('touch -- fixtüre.txt && git add -- fixtüre.txt')
+ edit fixtüre.txt
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=1 id=3000 name=GitGutterLineAdded',
+ \ 'line=2 id=3001 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('fixtüre.txt'))
+endfunction
+
+
+" FIXME: this test fails when it is the first (or only) test to be run
+function Test_follow_symlink()
+ let tmp = 'symlink'
+ call system('ln -nfs fixture.txt '.tmp)
+ execute 'edit '.tmp
+ 6d
+ call s:trigger_gitgutter()
+
+ let expected = ['line=5 id=3000 name=GitGutterLineRemoved']
+ call assert_equal(expected, s:signs('symlink'))
+endfunction
+
+
+function Test_keep_alt()
+ enew
+ execute "normal! \<C-^>"
+
+ call assert_equal('fixture.txt', bufname(''))
+ call assert_equal('', bufname('#'))
+
+ normal ggx
+ call s:trigger_gitgutter()
+
+ call assert_equal('', bufname('#'))
+endfunction
+
+
+function Test_keep_modified()
+ normal 5Go*
+ call assert_equal(1, getbufvar('', '&modified'))
+
+ call s:trigger_gitgutter()
+
+ call assert_equal(1, getbufvar('', '&modified'))
+endfunction
+
+
+function Test_keep_op_marks()
+ normal 5Go*
+ call assert_equal([0,6,1,0], getpos("'["))
+ call assert_equal([0,6,2,0], getpos("']"))
+
+ call s:trigger_gitgutter()
+
+ call assert_equal([0,6,1,0], getpos("'["))
+ call assert_equal([0,6,2,0], getpos("']"))
+endfunction
+
+
+function Test_no_modifications()
+ call assert_equal([], s:signs('fixture.txt'))
+endfunction
+
+
+function Test_orphaned_signs()
+ execute "normal 5GoX\<CR>Y"
+ call s:trigger_gitgutter()
+ 6d
+ call s:trigger_gitgutter()
+
+ let expected = ['line=6 id=3001 name=GitGutterLineAdded']
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_untracked_file_outside_repo()
+ let tmp = tempname()
+ call system('touch '.tmp)
+ execute 'edit '.tmp
+
+ call assert_equal([], s:signs(tmp))
+endfunction
+
+
+function Test_untracked_file_within_repo()
+ let tmp = 'untrackedFileWithinRepo.tmp'
+ call system('touch '.tmp)
+ execute 'edit '.tmp
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ call assert_equal([], s:signs(tmp))
+ call assert_equal(-2, b:gitgutter.path)
+
+ call system('rm '.tmp)
+endfunction
+
+
+function Test_untracked_file_square_brackets_within_repo()
+ let tmp = '[un]trackedFileWithinRepo.tmp'
+ call system('touch '.tmp)
+ execute 'edit '.tmp
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ call assert_equal([], s:signs(tmp))
+
+ call system('rm '.tmp)
+endfunction
+
+
+function Test_hunk_outside_noop()
+ normal 5G
+ GitGutterStageHunk
+
+ call assert_equal([], s:signs('fixture.txt'))
+ call assert_equal([], s:git_diff())
+ call assert_equal([], s:git_diff_staged())
+
+ GitGutterUndoHunk
+
+ call assert_equal([], s:signs('fixture.txt'))
+ call assert_equal([], s:git_diff())
+ call assert_equal([], s:git_diff_staged())
+endfunction
+
+
+function Test_hunk_stage()
+ let _shell = &shell
+ set shell=foo
+
+ normal 5Gi*
+ GitGutterStageHunk
+
+ call assert_equal('foo', &shell)
+ let &shell = _shell
+
+ call assert_equal([], s:signs('fixture.txt'))
+
+ " Buffer is unsaved
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index ae8e546..f5c6aff 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -5 +5 @@ d',
+ \ '-*e',
+ \ '+e'
+ \ ]
+ call assert_equal(expected, s:git_diff())
+
+ " Index has been updated
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index f5c6aff..ae8e546 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -5 +5 @@ d',
+ \ '-e',
+ \ '+*e'
+ \ ]
+ call assert_equal(expected, s:git_diff_staged())
+
+ " Save the buffer
+ write
+
+ call assert_equal([], s:git_diff())
+endfunction
+
+
+function Test_hunk_stage_nearby_hunk()
+ execute "normal! 2Gox\<CR>y\<CR>z"
+ normal 2jdd
+ normal k
+ GitGutterStageHunk
+
+ let expected = [
+ \ 'line=3 id=3000 name=GitGutterLineAdded',
+ \ 'line=4 id=3001 name=GitGutterLineAdded',
+ \ 'line=5 id=3002 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('fixture.txt'))
+
+ " Buffer is unsaved
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index 53b13df..f5c6aff 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -3,0 +4 @@ c',
+ \ '+d',
+ \ ]
+ call assert_equal(expected, s:git_diff())
+
+ " Index has been updated
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index f5c6aff..53b13df 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -4 +3,0 @@ c',
+ \ '-d',
+ \ ]
+ call assert_equal(expected, s:git_diff_staged())
+
+ " Save the buffer
+ write
+
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index 53b13df..8fdfda7 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -2,0 +3,3 @@ b',
+ \ '+x',
+ \ '+y',
+ \ '+z',
+ \ ]
+ call assert_equal(expected, s:git_diff())
+endfunction
+
+
+function Test_hunk_undo()
+ let _shell = &shell
+ set shell=foo
+
+ normal 5Gi*
+ GitGutterUndoHunk
+
+ call assert_equal('foo', &shell)
+ let &shell = _shell
+
+ call assert_equal([], s:signs('fixture.txt'))
+ call assert_equal([], s:git_diff())
+ call assert_equal([], s:git_diff_staged())
+endfunction
+
+
+function Test_undo_nearby_hunk()
+ execute "normal! 2Gox\<CR>y\<CR>z"
+ normal 2jdd
+ normal k
+ call s:trigger_gitgutter()
+ GitGutterUndoHunk
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=3 id=3000 name=GitGutterLineAdded',
+ \ 'line=4 id=3001 name=GitGutterLineAdded',
+ \ 'line=5 id=3002 name=GitGutterLineAdded'
+ \ ]
+ call assert_equal(expected, s:signs('fixture.txt'))
+
+ call assert_equal([], s:git_diff())
+
+ call assert_equal([], s:git_diff_staged())
+
+ " Save the buffer
+ write
+
+ let expected = [
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index f5c6aff..3fbde56 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -2,0 +3,3 @@ b',
+ \ '+x',
+ \ '+y',
+ \ '+z',
+ \ ]
+ call assert_equal(expected, s:git_diff())
+
+endfunction
+
+
+function Test_overlapping_hunk_op()
+ func Answer(char)
+ call feedkeys(a:char."\<CR>")
+ endfunc
+
+ " Undo upper
+
+ execute '3d'
+ execute '1d'
+ call s:trigger_gitgutter()
+ normal gg
+ call timer_start(100, {-> Answer('u')} )
+ GitGutterUndoHunk
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=2 id=3000 name=GitGutterLineRemoved',
+ \ ]
+ call assert_equal(expected, s:signs('fixture.txt'))
+
+ " Undo lower
+
+ execute '1d'
+ call s:trigger_gitgutter()
+ normal gg
+ call timer_start(100, {-> Answer('l')} )
+ GitGutterUndoHunk
+ call s:trigger_gitgutter()
+
+ let expected = [
+ \ 'line=1 id=3000 name=GitGutterLineRemovedFirstLine',
+ \ ]
+ call assert_equal(expected, s:signs('fixture.txt'))
+endfunction
+
+
+function Test_write_option()
+ set nowrite
+
+ normal ggo*
+ call s:trigger_gitgutter()
+
+ let expected = ["line=2 id=3000 name=GitGutterLineAdded"]
+ call assert_equal(expected, s:signs('fixture.txt'))
+
+ set write
+endfunction
+
+
+function Test_inner_text_object()
+ execute "normal! 2Gox\<CR>y\<CR>z\<CR>\<CR>"
+ call s:trigger_gitgutter()
+ normal dic
+ call s:trigger_gitgutter()
+
+ call assert_equal([], s:signs('fixture.txt'))
+ call assert_equal(readfile('fixture.txt'), getline(1,'$'))
+
+ " Excludes trailing lines
+ normal 9Gi*
+ normal 10Gi*
+ call s:trigger_gitgutter()
+ execute "normal vic\<Esc>"
+ call assert_equal([9, 10], [line("'<"), line("'>")])
+endfunction
+
+
+function Test_around_text_object()
+ execute "normal! 2Gox\<CR>y\<CR>z\<CR>\<CR>"
+ call s:trigger_gitgutter()
+ normal dac
+ call s:trigger_gitgutter()
+
+ call assert_equal([], s:signs('fixture.txt'))
+ call assert_equal(readfile('fixture.txt'), getline(1,'$'))
+
+ " Includes trailing lines
+ normal 9Gi*
+ normal 10Gi*
+ call s:trigger_gitgutter()
+ execute "normal vac\<Esc>"
+ call assert_equal([9, 11], [line("'<"), line("'>")])
+endfunction
+
+
+function Test_user_autocmd()
+ autocmd User GitGutter let s:autocmd_user = g:gitgutter_hook_context.bufnr
+
+ " Verify not fired when nothing changed.
+ let s:autocmd_user = 0
+ call s:trigger_gitgutter()
+ call assert_equal(0, s:autocmd_user)
+
+ " Verify fired when there was a change.
+ normal ggo*
+ let bufnr = bufnr('')
+ call s:trigger_gitgutter()
+ call assert_equal(bufnr, s:autocmd_user)
+endfunction
+
+
+function Test_fix_file_references()
+ " No special characters
+ let hunk_diff = join([
+ \ 'diff --git a/fixture.txt b/fixture.txt',
+ \ 'index f5c6aff..3fbde56 100644',
+ \ '--- a/fixture.txt',
+ \ '+++ b/fixture.txt',
+ \ '@@ -2,0 +3,1 @@ b',
+ \ '+x'
+ \ ], "\n")."\n"
+ let filepath = 'blah.txt'
+
+ let expected = join([
+ \ 'diff --git a/blah.txt b/blah.txt',
+ \ 'index f5c6aff..3fbde56 100644',
+ \ '--- a/blah.txt',
+ \ '+++ b/blah.txt',
+ \ '@@ -2,0 +3,1 @@ b',
+ \ '+x'
+ \ ], "\n")."\n"
+
+ call assert_equal(expected, gitgutter#hunk#fix_file_references(filepath, hunk_diff))
+
+ " diff.mnemonicPrefix; spaces in filename
+ let hunk_diff = join([
+ \ 'diff --git i/x/cat dog w/x/cat dog',
+ \ 'index f5c6aff..3fbde56 100644',
+ \ '--- i/x/cat dog',
+ \ '+++ w/x/cat dog',
+ \ '@@ -2,0 +3,1 @@ b',
+ \ '+x'
+ \ ], "\n")."\n"
+ let filepath = 'blah.txt'
+
+ let expected = join([
+ \ 'diff --git i/blah.txt w/blah.txt',
+ \ 'index f5c6aff..3fbde56 100644',
+ \ '--- i/blah.txt',
+ \ '+++ w/blah.txt',
+ \ '@@ -2,0 +3,1 @@ b',
+ \ '+x'
+ \ ], "\n")."\n"
+
+ call assert_equal(expected, gitgutter#hunk#fix_file_references(filepath, hunk_diff))
+
+ " Backslashes in filename; quotation marks
+ let hunk_diff = join([
+ \ 'diff --git "a/C:\\Users\\FOO~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim" "b/C:\\Users\\FOO~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\12.1.vim"',
+ \ 'index f42aeb0..4930403 100644',
+ \ '--- "a/C:\\Users\\FOO~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim"',
+ \ '+++ "b/C:\\Users\\FOO~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\12.1.vim"',
+ \ '@@ -172,0 +173 @@ stuff',
+ \ '+x'
+ \ ], "\n")."\n"
+ let filepath = 'init.vim'
+
+ let expected = join([
+ \ 'diff --git "a/init.vim" "b/init.vim"',
+ \ 'index f42aeb0..4930403 100644',
+ \ '--- "a/init.vim"',
+ \ '+++ "b/init.vim"',
+ \ '@@ -172,0 +173 @@ stuff',
+ \ '+x'
+ \ ], "\n")."\n"
+
+ call assert_equal(expected, gitgutter#hunk#fix_file_references(filepath, hunk_diff))
+endfunction
+
+
+function Test_encoding()
+ call system('cp ../cp932.txt . && git add cp932.txt')
+ edit ++enc=cp932 cp932.txt
+
+ call s:trigger_gitgutter()
+
+ call assert_equal([], s:signs('cp932.txt'))
+endfunction
+
+
+function Test_empty_file()
+ " 0-byte file
+ call system('touch empty.txt && git add empty.txt')
+ edit empty.txt
+
+ call s:trigger_gitgutter()
+ call assert_equal([], s:signs('empty.txt'))
+
+
+ " File consisting only of a newline
+ call system('echo "" > newline.txt && git add newline.txt')
+ edit newline.txt
+
+ call s:trigger_gitgutter()
+ call assert_equal([], s:signs('newline.txt'))
+
+
+ " 1 line file without newline
+ " Vim will force a newline unless we tell it not to.
+ call system('echo -n a > oneline.txt && git add oneline.txt')
+ set noeol nofixeol
+ edit! oneline.txt
+
+ call s:trigger_gitgutter()
+ call assert_equal([], s:signs('oneline.txt'))
+
+ set eol fixeol
+endfunction
diff --git a/vim/.vim/plugged/vim-gitgutter/unplace.vim b/vim/.vim/plugged/vim-gitgutter/unplace.vim
new file mode 100644
index 0000000..a97993d
--- /dev/null
+++ b/vim/.vim/plugged/vim-gitgutter/unplace.vim
@@ -0,0 +1,27 @@
+" Measure how long it takes to unplace signs.
+"
+" Source this file with `:source %` or `vim -S unplace.vim`
+
+
+let num = 500
+sign define Foo text=*
+
+new
+
+call append(0, range(1, num))
+
+for i in range(1, num)
+ execute "sign place ".i." line=".i." name=Foo buffer=".bufnr('')
+endfor
+
+let start = reltime()
+for i in range(1, num)
+ execute "sign unplace ".i
+endfor
+let elapsed = reltime(start)
+
+bdelete!
+
+echom split(reltimestr(elapsed))[0]."s to remove ".num." signs"
+echom string(reltimefloat(elapsed) * 1000 / num).' ms/sign'
+echom string(float2nr(num / reltimefloat(elapsed))).' sign/s'
diff --git a/vim/.vim/plugged/vim-pug/README.markdown b/vim/.vim/plugged/vim-pug/README.markdown
new file mode 100644
index 0000000..7665388
--- /dev/null
+++ b/vim/.vim/plugged/vim-pug/README.markdown
@@ -0,0 +1,21 @@
+# vim-pug #
+
+Vim syntax highlighting for Pug (formerly Jade) templates.
+
+For best results consider using this with an (improved) HTML5 syntax plugin.
+
+Installation
+------------
+
+I prefer to install plugins using Tim Pope's
+[pathogen.vim](https://github.com/tpope/vim-pathogen). Installation using
+pathogen is quite simple.
+
+ cd ~/.vim/bundle
+ git clone git://github.com/digitaltoad/vim-pug.git
+
+If you do not want to use pathogen. You can always install vim-pug in the
+normal manner by copying each directory to your ~/.vim directory. Make sure
+not to overwrite any existing directory of the same name and instead copy only
+the contents of the source directory to the directory of the same name in your
+~/.vim directory.
diff --git a/vim/.vim/plugged/vim-pug/ftdetect/pug.vim b/vim/.vim/plugged/vim-pug/ftdetect/pug.vim
new file mode 100644
index 0000000..08d962f
--- /dev/null
+++ b/vim/.vim/plugged/vim-pug/ftdetect/pug.vim
@@ -0,0 +1,5 @@
+" Pug
+autocmd BufNewFile,BufReadPost *.pug set filetype=pug
+
+" Jade
+autocmd BufNewFile,BufReadPost *.jade set filetype=pug
diff --git a/vim/.vim/plugged/vim-pug/ftplugin/pug.vim b/vim/.vim/plugged/vim-pug/ftplugin/pug.vim
new file mode 100644
index 0000000..db071fa
--- /dev/null
+++ b/vim/.vim/plugged/vim-pug/ftplugin/pug.vim
@@ -0,0 +1,57 @@
+" Vim filetype plugin
+" Language: Pug
+" Maintainer: Joshua Borton
+" Credits: Tim Pope
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let s:save_cpo = &cpo
+set cpo-=C
+
+setlocal iskeyword+=-
+
+" Define some defaults in case the included ftplugins don't set them.
+let s:undo_ftplugin = ""
+let s:browsefilter = "All Files (*.*)\t*.*\n"
+let s:match_words = ""
+
+runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
+unlet! b:did_ftplugin
+
+" Override our defaults if these were set by an included ftplugin.
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin
+ unlet b:undo_ftplugin
+endif
+if exists("b:browsefilter")
+ let s:browsefilter = b:browsefilter
+ unlet b:browsefilter
+endif
+if exists("b:match_words")
+ let s:match_words = b:match_words
+ unlet b:match_words
+endif
+
+" Change the browse dialog on Win32 to show mainly Haml-related files
+if has("gui_win32")
+ let b:browsefilter="Pug Files (*.pug)\t*.pug\n" . s:browsefilter
+endif
+
+" Load the combined list of match_words for matchit.vim
+if exists("loaded_matchit")
+ let b:match_words = s:match_words
+endif
+
+setlocal comments=://-,:// commentstring=//\ %s
+
+setlocal suffixesadd+=.pug
+
+let b:undo_ftplugin = "setl cms< com< "
+ \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
+
+let &cpo = s:save_cpo
+
+" vim:set sw=2:
diff --git a/vim/.vim/plugged/vim-pug/indent/pug.vim b/vim/.vim/plugged/vim-pug/indent/pug.vim
new file mode 100644
index 0000000..bc7f2b4
--- /dev/null
+++ b/vim/.vim/plugged/vim-pug/indent/pug.vim
@@ -0,0 +1,70 @@
+" Vim indent file
+" Language: Pug
+" Maintainer: Joshua Borton
+" Credits: Tim Pope (vim-pug)
+" Last Change: 2010 Sep 22
+
+if exists("b:did_indent")
+ finish
+endif
+
+unlet! b:did_indent
+let b:did_indent = 1
+
+setlocal autoindent
+setlocal indentexpr=GetPugIndent()
+setlocal indentkeys=o,O,*<Return>,},],0),!^F
+
+" Only define the function once.
+if exists("*GetPugIndent")
+ finish
+endif
+
+let s:attributes = '\%((.\{-\})\)'
+let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
+
+if !exists('g:pug_self_closing_tags')
+ let g:pug_self_closing_tags = 'meta|link|img|hr|br|input'
+endif
+
+setlocal formatoptions+=r
+setlocal comments+=n:\|
+
+function! GetPugIndent()
+ let lnum = prevnonblank(v:lnum-1)
+ if lnum == 0
+ return 0
+ endif
+ let line = substitute(getline(lnum),'\s\+$','','')
+ let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
+ let lastcol = strlen(line)
+ let line = substitute(line,'^\s\+','','')
+ let indent = indent(lnum)
+ let cindent = indent(v:lnum)
+ let increase = indent + &sw
+ if indent == indent(lnum)
+ let indent = cindent <= indent ? -1 : increase
+ endif
+
+ let group = synIDattr(synID(lnum,lastcol,1),'name')
+
+ if line =~ '^!!!'
+ return indent
+ elseif line =~ '^/\%(\[[^]]*\]\)\=$'
+ return increase
+ elseif line =~ '^\%(if\|else\|unless\|for\|each\|block\|mixin\|append\|case\|when\)'
+ return increase
+ elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
+ return increase
+ elseif line == '-#'
+ return increase
+ elseif line =~? '^\v%('.g:pug_self_closing_tags.')>'
+ return indent
+ elseif group =~? '\v^%(pugAttributesDelimiter|pugClass|pugId|htmlTagName|htmlSpecialTagName|pugFilter|pugTagBlockChar)$'
+ return increase
+ else
+ return indent
+ endif
+endfunction
+
+" vim:set sw=2:
diff --git a/vim/.vim/plugged/vim-pug/syntax/pug.vim b/vim/.vim/plugged/vim-pug/syntax/pug.vim
new file mode 100644
index 0000000..850f815
--- /dev/null
+++ b/vim/.vim/plugged/vim-pug/syntax/pug.vim
@@ -0,0 +1,113 @@
+" Vim syntax file
+" Language: Pug
+" Maintainer: Joshua Borton
+" Credits: Tim Pope
+" Filenames: *.pug
+
+if exists("b:current_syntax")
+ finish
+endif
+
+if !exists("main_syntax")
+ let main_syntax = 'pug'
+endif
+
+silent! syntax include @htmlCoffeescript syntax/coffee.vim
+unlet! b:current_syntax
+silent! syntax include @htmlStylus syntax/stylus.vim
+unlet! b:current_syntax
+silent! syntax include @htmlCss syntax/css.vim
+unlet! b:current_syntax
+silent! syntax include @htmlMarkdown syntax/markdown.vim
+unlet! b:current_syntax
+
+syn case match
+
+syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend
+syn cluster htmlJavascript add=javascriptParenthesisBlock
+
+syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
+syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
+syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
+syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
+syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName,pugJavascript nextgroup=@pugComponent
+syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
+syn keyword pugCommentTodo contained TODO FIXME XXX TBD
+syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
+syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
+syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
+syn region pugAngular2 start="(" end=")" contains=htmlEvent
+syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained
+syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained
+syn region pugJavascriptString start=+`+ skip=+\\\(`\|$\)+ end=+`\|$+ contains=javascriptInterpolation contained
+syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end="\(.\zs)\)\|)" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
+syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
+syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
+syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
+syn match pugClass "\%(\w\|-\)\+" contained nextgroup=@pugComponent
+syn match pugId "\%(\w\|-\)\+" contained nextgroup=@pugComponent
+syn region pugDocType start="^\s*\(!!!\|doctype\)" end="$"
+" Unless I'm mistaken, syntax/html.vim requires
+" that the = sign be present for these matches.
+" This adds the matches back for pug.
+syn keyword pugHtmlArg contained href title
+
+syn match pugPlainChar "\\" contained
+syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
+syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
+syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug,@Spell
+syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugPipedText skipnl
+syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
+syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
+syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
+syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend
+
+syn region pugJavascriptFilter matchgroup=pugFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
+syn region pugMarkdownFilter matchgroup=pugFilter start=/^\z(\s*\):\%(markdown\|marked\)\s*$/ end=/^\%(\z1\s\|\s*$\)\@!/ contains=@htmlMarkdown
+syn region pugStylusFilter matchgroup=pugFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
+syn region pugPlainFilter matchgroup=pugFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
+
+syn match pugScriptConditional "^\s*\<\%(if\|else\|else if\|elif\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
+syn match pugScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
+syn region pugScriptLoopRegion start="^\s*\(for \)" end="$" contains=pugScriptLoopKeywords
+syn keyword pugScriptLoopKeywords for in
+
+syn region pugJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,pugJavascriptTag,pugCoffeescriptFilter keepend
+syn region javascriptInterpolation start=/${/ end=/}/ contained
+
+syn region pugCoffeescriptFilter matchgroup=pugFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
+syn region pugJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=pugBegin,pugTag
+syn region pugCssBlock start="^\z(\s*\)style" nextgroup=@pugComponent,pugError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
+
+syn match pugError "\$" contained
+
+hi def link pugPlainChar Special
+hi def link pugScriptConditional PreProc
+hi def link pugScriptLoopKeywords PreProc
+hi def link pugScriptStatement PreProc
+hi def link pugHtmlArg htmlArg
+hi def link pugAttributeString String
+hi def link pugAttributesDelimiter Identifier
+hi def link pugIdChar Special
+hi def link pugClassChar Special
+hi def link pugBlockExpansionChar Special
+hi def link pugPipeChar Special
+hi def link pugTagBlockChar Special
+hi def link pugId Identifier
+hi def link pugClass Type
+hi def link pugInterpolationDelimiter Delimiter
+hi def link pugInlineDelimiter Delimiter
+hi def link pugFilter PreProc
+hi def link pugDocType PreProc
+hi def link pugCommentTodo Todo
+hi def link pugComment Comment
+hi def link pugCommentBlock Comment
+hi def link pugHtmlConditionalComment pugComment
+hi def link pugJavascriptString String
+hi def link javascriptInterpolation Delimiter
+
+let b:current_syntax = "pug"
+
+if main_syntax == "pug"
+ unlet main_syntax
+endif
diff --git a/vim/.vim/plugged/vimling/LICENSE b/vim/.vim/plugged/vimling/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/vim/.vim/plugged/vimling/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/vim/.vim/plugged/vimling/README.md b/vim/.vim/plugged/vimling/README.md
new file mode 100644
index 0000000..eb8555d
--- /dev/null
+++ b/vim/.vim/plugged/vimling/README.md
@@ -0,0 +1,34 @@
+# Luke's vim helpers
+
+Just some little things I source in my vimrc. Moving these from the
+[voidrice](https://github.com/lukesmithxyz/voidrice) repo for extensibility's
+sake. Mostly language-related.
+
+## Who's who?
+
+### `deadkeys.vim`
+
+A script modeled off one on the vim wiki by Max Baker, but with more deadkeys
+and a toggling command.
+
+This gives you a function `ToggleDeadKeys()` that will, as its name suggest,
+make ', ", ~ and : into keys that can be combined with other letters to give
+you accents, specifically:
+
+* ' gives you acute accents (á)
+* ~ gives you tildes (ã)
+* ` gives you grave accents (à)
+* : gives you macrons (ā)
+* " gives you umlauts (ä)
+
+These will all work with most vowels and some consonants if the combination is
+commonly used.
+
+### `ipa.vim`
+
+Adjustable bindings for International Phonetic Alphabet characters. Can be
+toggled with `ToggleIPA()`.
+
+### `prose.vim`
+
+A prose mode.
diff --git a/vim/.vim/plugged/vimling/plugin/deadkeys.vim b/vim/.vim/plugged/vimling/plugin/deadkeys.vim
new file mode 100644
index 0000000..9885b0f
--- /dev/null
+++ b/vim/.vim/plugged/vimling/plugin/deadkeys.vim
@@ -0,0 +1,253 @@
+let g:DeadKeysOn=0
+
+function! ToggleDeadKeys()
+ if !g:DeadKeysOn
+ call DeadKeys()
+ else
+ call DeadKeysOff()
+ endif
+endfunction
+
+function! DeadKeys()
+ echo "Dead Keys: On"
+ let g:DeadKeysOn=1
+ " grave accents
+ imap `a à
+ imap `e è
+ imap `i ì
+ imap `o ò
+ imap `u ù
+ imap `A À
+ imap `E È
+ imap `I Ì
+ imap `O Ò
+ imap `U Ù
+ imap `<space> `
+
+ " umlaut
+ imap "a ä
+ imap "e ë
+ imap "i ï
+ imap "o ö
+ imap "u ü
+ imap "A Ä
+ imap "E Ë
+ imap "I Ï
+ imap "O Ö
+ imap "U Ü
+ imap "<space> "
+
+ " macrons
+ imap :a ā
+ imap :e ē
+ imap :i ī
+ imap :o ō
+ imap :u ū
+ imap :A Ā
+ imap :E Ē
+ imap :I Ī
+ imap :O Ō
+ imap :U Ū
+
+ " acute accents
+ imap 'a á
+ imap 'A Á
+ imap 'C Ć
+ imap 'c ć
+ imap 'e é
+ imap 'E É
+ imap 'i í
+ imap 'I Í
+ imap 'N Ń
+ imap 'n ń
+ imap 'o ó
+ imap 'R Ŕ
+ imap 'r ŕ
+ imap 'S Ś
+ imap 's ś
+ imap 'O Ó
+ imap 'u ú
+ imap 'U Ú
+ imap '<space> '
+
+ " under dot
+ imap .D Ḍ
+ imap .d ḍ
+ imap .H Ḥ
+ imap .h ḥ
+ imap .L Ḹ
+ imap .l ḹ
+ imap .M Ṃ
+ imap .m ṃ
+ imap .N Ṇ
+ imap .n ṇ
+ imap .R Ṛ
+ imap .r ṛ
+ imap .G Ṝ
+ imap .g ṝ
+ imap .S Ṣ
+ imap .s ṣ
+ imap .T Ṭ
+ imap .t ṭ
+
+ " tilde
+ imap ~a ã
+ imap ~A Ã
+ imap ~e ẽ
+ imap ~E Ẽ
+ imap ~i ĩ
+ imap ~I Ĩ
+ imap ~o õ
+ imap ~O Õ
+ imap ~u ũ
+ imap ~U Ũ
+ imap ~n ñ
+ imap ~N Ñ
+
+ " caron
+ imap >A Ǎ
+ imap >a ǎ
+ imap >C Č
+ imap >c č
+ imap >E Ě
+ imap >e ě
+ imap >G Ǧ
+ imap >g ǧ
+ imap >I Ǐ
+ imap >i ǐ
+ imap >O Ǒ
+ imap >o ǒ
+ imap >R Ř
+ imap >r ř
+ imap >S Ṧ
+ imap >s ṧ
+ imap >U Ǔ
+ imap >u ǔ
+ imap >V Ǚ
+ imap >v ǚ
+ imap >Z Ž
+ imap >z ž
+
+endfunction "deadkeys()
+
+
+function! DeadKeysOff()
+ echo "Dead Keys: Off"
+ let g:DeadKeysOn=0
+
+ " unmapping graves
+ iunmap `a
+ iunmap `e
+ iunmap `i
+ iunmap `o
+ iunmap `u
+ iunmap `A
+ iunmap `E
+ iunmap `I
+ iunmap `O
+ iunmap `U
+ iunmap `<space>
+
+ " unmapping umlauts
+ iunmap "a
+ iunmap "e
+ iunmap "i
+ iunmap "o
+ iunmap "u
+ iunmap "A
+ iunmap "E
+ iunmap "I
+ iunmap "O
+ iunmap "U
+ iunmap "<space>
+
+ " unmapping macrons
+ iunmap :a
+ iunmap :e
+ iunmap :i
+ iunmap :o
+ iunmap :u
+ iunmap :A
+ iunmap :E
+ iunmap :I
+ iunmap :O
+ iunmap :U
+
+ " unmapping acutes
+ iunmap 'a
+ iunmap 'A
+ iunmap 'C
+ iunmap 'c
+ iunmap 'e
+ iunmap 'E
+ iunmap 'i
+ iunmap 'I
+ iunmap 'N
+ iunmap 'n
+ iunmap 'o
+ iunmap 'R
+ iunmap 'r
+ iunmap 'S
+ iunmap 's
+ iunmap 'O
+ iunmap 'u
+ iunmap 'U
+ iunmap '<space>
+ " under dot
+ iunmap .D
+ iunmap .d
+ iunmap .H
+ iunmap .h
+ iunmap .L
+ iunmap .l
+ iunmap .M
+ iunmap .m
+ iunmap .N
+ iunmap .n
+ iunmap .R
+ iunmap .r
+ iunmap .G
+ iunmap .g
+ iunmap .S
+ iunmap .s
+ iunmap .T
+ iunmap .t
+
+ "tilde
+ iunmap ~a
+ iunmap ~A
+ iunmap ~e
+ iunmap ~E
+ iunmap ~i
+ iunmap ~I
+ iunmap ~o
+ iunmap ~O
+ iunmap ~u
+ iunmap ~U
+ iunmap ~n
+
+ " caron
+ iunmap >A
+ iunmap >a
+ iunmap >C
+ iunmap >c
+ iunmap >E
+ iunmap >e
+ iunmap >G
+ iunmap >g
+ iunmap >I
+ iunmap >i
+ iunmap >O
+ iunmap >o
+ iunmap >R
+ iunmap >r
+ iunmap >S
+ iunmap >s
+ iunmap >U
+ iunmap >u
+ iunmap >V
+ iunmap >v
+ iunmap >Z
+ iunmap >z
+
+endfunction
diff --git a/vim/.vim/plugged/vimling/plugin/ipa.vim b/vim/.vim/plugged/vimling/plugin/ipa.vim
new file mode 100644
index 0000000..3fbd23c
--- /dev/null
+++ b/vim/.vim/plugged/vimling/plugin/ipa.vim
@@ -0,0 +1,186 @@
+let g:IPAOn=0
+
+function! ToggleIPA()
+ if !g:IPAOn
+ call IPA()
+ else
+ call IPAOff()
+ endif
+endfunction
+
+function! IPA()
+ echo "IPA macros activated"
+ let g:IPAOn=1
+ imap ,nn ɲ̊
+ imap ,gn ɲ
+ imap ,ng ŋ
+ imap ,' ʔ
+ imap ,sh ʃ
+ imap ,zh ʒ
+ imap ,xi ɕ
+ imap ,zi ʑ
+ imap ,ph ɸ
+ imap ,bh β
+ imap ,th θ
+ imap ,dh ð
+ imap ,cc ç
+ imap ,jj ʝ
+ imap ,gh ɣ
+ imap ,xx χ
+ imap ,fr ʁ
+ imap ,HH ħ
+ imap ,hh ɦ
+ imap ,vv ʋ
+ imap ,er ɹ
+ imap ,fl ɾ
+ imap ,bb ʙ
+ imap ,ih ɨ
+ imap ,ii ɪ
+ imap ,eu ɯ̽
+ imap ,uu ʊ
+ imap ,uh ə
+ imap ,eh ɛ
+ imap ,oe œ
+ imap ,au ɔ
+ imap ,ae æ
+ imap ,aa ɐ
+ imap ,OE ɶ
+ imap ,ah ɑ
+ imap ,ba ɒ
+endfunction
+
+function! IPAOff()
+ echo "IPA macros off."
+ let g:IPAOn=0
+ iunmap ,nn
+ iunmap ,gn
+ iunmap ,ng
+ iunmap ,'
+ iunmap ,sh
+ iunmap ,zh
+ iunmap ,xi
+ iunmap ,zi
+ iunmap ,ph
+ iunmap ,bh
+ iunmap ,th
+ iunmap ,dh
+ iunmap ,cc
+ iunmap ,jj
+ iunmap ,gh
+ iunmap ,xx
+ iunmap ,fr
+ iunmap ,HH
+ iunmap ,hh
+ iunmap ,vv
+ iunmap ,er
+ iunmap ,fl
+ iunmap ,bb
+ iunmap ,ih
+ iunmap ,ii
+ iunmap ,eu
+ iunmap ,uu
+ iunmap ,uh
+ iunmap ,eh
+ iunmap ,oe
+ iunmap ,au
+ iunmap ,ae
+ iunmap ,aa
+ iunmap ,OE
+ iunmap ,ah
+ iunmap ,ba
+endfunction
+
+" As of yet unimplemented:
+"b̪
+"t̼
+"d̼
+"ʈ
+"ɖ
+"ɟ
+"ɡ
+"ɢ
+"ʡ
+"ʂ
+"ʐ
+"θ̼
+"ð̼
+"θ̠
+"ð̠
+"ɹ̠̊
+"ɹ̠
+"ɻ
+"ʕ
+"ʢ
+"ʋ̥
+"ɹ̥
+"ɻ̊
+"ɻ
+"j̊
+"ɰ̊
+"ɰ
+"ʔ̞
+"ⱱ̟
+"ⱱ
+"ɾ̼
+"ɾ̥
+"ɽ̊
+"ɽ
+"ɢ̆
+"ʡ̮
+"ʙ̥
+"r̼
+"r̥
+"ɽ̊
+"ɽ
+"ʀ̥
+"ʀ
+"ʜ
+"ʢ
+"ɬ
+"ɮ
+"ɭ̊
+"ʎ̥
+"ʎ̝
+"ʟ̝̊
+"ʟ̝
+"l̥
+"ɭ̊
+"ɭ
+"ʎ̥
+"ʎ
+"ʟ̥
+"ʟ
+"ʟ̠
+"ɺ
+"ɺ̢
+"ʎ̮
+"ʟ̆
+"ʉ
+"ɯ
+"ʏ
+"ɪ̈
+"ʊ̈
+"ø
+"ɘ
+"ɵ
+"ɤ
+"e̞
+"ø̞
+"ɵ̞
+"ɤ̞
+"o̞
+"ɜ
+"ɞ
+"ʌ
+"ɞ̞
+"ä
+"ɒ̈
+"m̥
+"ɱ
+"n̼
+"n̥
+"ɳ̊
+"ɳ
+"ŋ̊
+"ɴ
+"p̪
diff --git a/vim/.vim/plugged/vimling/plugin/prose.vim b/vim/.vim/plugged/vimling/plugin/prose.vim
new file mode 100644
index 0000000..cf9470e
--- /dev/null
+++ b/vim/.vim/plugged/vimling/plugin/prose.vim
@@ -0,0 +1,38 @@
+let g:ProseOn=0
+
+function! ToggleProse()
+ if !g:ProseOn
+ call Prose()
+ else
+ call ProseOff()
+ endif
+endfunction
+
+function! Prose()
+ echo "Prose: On"
+ let g:ProseOn=1
+
+ noremap j gj
+ noremap k gk
+ noremap 0 g0
+ noremap $ g$
+ noremap A g$a
+ noremap I g0i
+ setlocal linebreak nonumber norelativenumber t_Co=0 foldcolumn=2
+ hi! link FoldColumn Normal
+
+endfunction
+
+function! ProseOff()
+ echo "Prose: Off"
+ let g:ProseOn=0
+
+ noremap j j
+ noremap k k
+ noremap 0 0
+ noremap $ $
+ noremap A A
+ noremap I I
+ setlocal nolinebreak number relativenumber t_Co=256 foldcolumn=0
+
+endfunction
diff --git a/vim/.vim/plugged/vimling/plugin/vimling.vim b/vim/.vim/plugged/vimling/plugin/vimling.vim
new file mode 100644
index 0000000..c30493c
--- /dev/null
+++ b/vim/.vim/plugged/vimling/plugin/vimling.vim
@@ -0,0 +1,8 @@
+nm <leader><leader>d :call ToggleDeadKeys()<CR>
+imap <leader><leader>d <esc>:call ToggleDeadKeys()<CR>a
+
+nm <leader><leader>i :call ToggleIPA()<CR>
+imap <leader><leader>i <esc>:call ToggleIPA()<CR>a
+
+nm <F8> :call ToggleProse()<CR>
+
diff --git a/vim/.vim/plugged/vimwiki/LICENSE b/vim/.vim/plugged/vimwiki/LICENSE
new file mode 100644
index 0000000..cdf8546
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2008-2010 Maxim Kim
+ 2013-2017 Daniel Schemala
+
+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.
diff --git a/vim/.vim/plugged/vimwiki/README-cn.md b/vim/.vim/plugged/vimwiki/README-cn.md
new file mode 100644
index 0000000..60574ae
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/README-cn.md
@@ -0,0 +1,161 @@
+VimWiki —— Vim 个人 Wiki 插件
+==============================================================================
+
+[English](README.md)
+
+![screenshot1](doc/screenshot_1.png)
+![screenshot2](doc/screenshot_2.png) *
+
+介绍
+------------------------------------------------------------------------------
+
+Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法高亮的文本文件。
+
+通过 Vimwiki,你可以:
+
+ * 组织笔记和想法
+ * 管理待办事项
+ * 编写文档
+ * 坚持写日记
+ * 将这一切导出成 HTML 网页
+
+马上开始!按下 `<Leader>ww`(通常是 `\ww`)进入作为目录页的 wiki 文件,这个文件默认存放在 `~/vimwiki/index.wiki`。
+
+在该文件中输入以下示例:
+
+ = 我的个人知识库 =
+ * 任务列表 -- _昨天_ 就该完成的事!!!
+ * Gutenberg 计划 -- 好书给我力量。
+ * 草稿 -- 临时记录一些东西。
+
+把光标移到 `任务` 二字上,按 Enter(回车)创建链接。按下后,`任务`二字会变成 `[[任务]]` —— 这是一个 Vimwiki 链接。再次按 Enter 即可进入这个链接(打开新的 wiki 文件)。编辑这个新文件,保存,然后按 Backspace(退格)就能回到目录页。
+
+如果 Vimwiki 链接长度不止一个单词(指的是英文单词),只需在 Visual 模式选择这段文本后按 Enter 即可。用上面的 `Gutenberg 计划` 试试吧。最终结果是这样:
+
+ = 我的个人知识库 =
+ * [[任务列表]] -- _昨天_ 就该完成的事!!!
+ * [[Gutenberg 计划]] -- 好书给我力量。
+ * 草稿 -- 临时记录一些东西。
+
+
+基本标记
+------------------------------------------------------------------------------
+
+ = 一级标题 =
+ == 二级标题 ==
+ === 三级标题 ===
+
+
+ *bold* -- 粗体文本
+ _italic_ -- 斜体文本
+ (应用于句中的汉字文本时,必须在标记前后加空格,例如:一段 *中文* 文本)
+
+ [[wiki link]] -- wiki 链接
+ [[wiki link|description]] -- 带有描述文本的 wiki 链接
+
+
+列表:
+
+ * bullet list item 1(无编号列表)
+ - bullet list item 2
+ - bullet list item 3
+ * bullet list item 4
+ * bullet list item 5
+ * bullet list item 6
+ * bullet list item 7
+ - bullet list item 8
+ - bullet list item 9
+
+ 1. numbered list item 1(有编号列表)
+ 2. numbered list item 2
+ a) numbered list item 3
+ b) numbered list item 4
+
+
+更多格式说明,请阅 `:h vimwiki-syntax`
+
+
+键位绑定
+------------------------------------------------------------------------------
+
+normal 模式:
+
+ * `<Leader>ww` -- 打开默认的 wiki 目录文件
+ * `<Leader>wt` -- 在新标签(Tab)中打开 wiki 目录文件
+ * `<Leader>ws` -- 在多个 wiki 中选择并打开该 wiki 的目录文件
+ * `<Leader>wd` -- 删除当前 wiki 文件
+ * `<Leader>wr` -- 重命名当前 wiki 文件
+ * `<Enter>` -- 创建或打开 wiki 链接
+ * `<Shift-Enter>` -- 先上下分屏再打开 wiki 链接(若非链接则先创建)
+ * `<Ctrl-Enter>` -- 先左右分屏再打开 wiki 链接(若非链接则先创建)
+ * `<Backspace>` -- 返回之前浏览的 wiki 文件
+ * `<Tab>` -- 跳到本文件中下一个 wiki 链接
+ * `<Shift-Tab>` -- 跳到本文件中上一个 wiki 链接
+
+更多快捷键说明,请阅 `:h vimwiki-mappings`
+
+
+命令
+------------------------------------------------------------------------------
+
+ * `:Vimwiki2HTML` -- 将当前 wiki 文件转换成 HTML 网页
+ * `:VimwikiAll2HTML` -- 把所有 wiki 文件转换成 HTML 网页
+ * `:help vimwiki-commands` -- 显示全部命令
+
+
+安装
+==============================================================================
+
+准备工作
+------------------------------------------------------------------------------
+
+确保在 `vimrc` 中加入了以下设置:
+
+ set nocompatible
+ filetype plugin on
+ syntax on
+
+没有这些设置,Vimwiki 将无法正常工作。
+
+通过 [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) 安装(Vim 7.4.1528 后)
+------------------------------------------------------------------------------
+
+ git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
+
+通过 [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) 安装
+------------------------------------------------------------------------------
+
+ cd ~/.vim
+ mkdir bundle
+ cd bundle
+ git clone https://github.com/vimwiki/vimwiki.git
+
+通过 [Vim-Plug](https://github.com/junegunn/vim-plug) 安装
+------------------------------------------------------------------------------
+
+在 `vimrc` 中加入以下插件设置:
+
+ Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
+
+然后运行 `:PlugInstall`。
+
+通过 [Vundle](https://github.com/VundleVim/Vundle.vim) 安装
+------------------------------------------------------------------------------
+
+在 `vimrc` 中加入 `Plugin 'vimwiki/vimwiki'`,然后执行:
+
+ vim +PluginInstall +qall
+
+或者下载 [zip 压缩包](https://github.com/vimwiki/vimwiki/archive/master.zip)然后解压到 `~/.vim/bundle/` 目录下。
+
+安装后,启动 Vim 并执行 `:Helptags` 以及 `:help vimwiki`,检查安装是否成功。
+
+
+获取帮助
+==============================================================================
+
+遇到问题?在 Freenode 的 IRC 频道 `#vimwiki`([网页聊天](https://webchat.freenode.net/?channels=#vimwiki))提问,或者发送问题到[邮件列表](https://groups.google.com/forum/#!forum/vimwiki)上吧。
+
+
+----
+\* 前面截图中用的是 [solarized 配色方案](https://github.com/altercation/vim-colors-solarized)以及 [lightline](https://github.com/itchyny/lightline.vim) 插件。
diff --git a/vim/.vim/plugged/vimwiki/README.md b/vim/.vim/plugged/vimwiki/README.md
new file mode 100644
index 0000000..a8a203a
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/README.md
@@ -0,0 +1,170 @@
+A Personal Wiki For Vim
+==============================================================================
+
+[中文](README-cn.md)
+
+![screenshot1](doc/screenshot_1.png)
+![screenshot2](doc/screenshot_2.png) *
+
+Intro
+------------------------------------------------------------------------------
+
+Vimwiki is a personal wiki for Vim -- a number of linked text files that have
+their own syntax highlighting.
+
+With Vimwiki you can:
+
+ * organize notes and ideas
+ * manage todo-lists
+ * write documentation
+ * maintain a diary
+ * export everything to HTML
+
+To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your index
+wiki file. By default it is located in `~/vimwiki/index.wiki`.
+
+Feed it with the following example:
+
+ = My knowledge base =
+ * Tasks -- things to be done _yesterday_!!!
+ * Project Gutenberg -- good books are power.
+ * Scratchpad -- various temporary stuff.
+
+Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
+`Tasks` will become `[[Tasks]]` -- a Vimwiki link. Press Enter again to
+open it. Edit the file, save it, and then press Backspace to jump back to your
+index.
+
+A Vimwiki link can be constructed from more than one word. Just visually
+select the words to be linked and press Enter. Try it with `Project Gutenberg`.
+The result should look something like:
+
+ = My knowledge base =
+ * [[Tasks]] -- things to be done _yesterday_!!!
+ * [[Project Gutenberg]] -- good books are power.
+ * Scratchpad -- various temporary stuff.
+
+
+Basic Markup
+------------------------------------------------------------------------------
+
+ = Header1 =
+ == Header2 ==
+ === Header3 ===
+
+
+ *bold* -- bold text
+ _italic_ -- italic text
+
+ [[wiki link]] -- wiki link
+ [[wiki link|description]] -- wiki link with description
+
+
+Lists:
+
+ * bullet list item 1
+ - bullet list item 2
+ - bullet list item 3
+ * bullet list item 4
+ * bullet list item 5
+ * bullet list item 6
+ * bullet list item 7
+ - bullet list item 8
+ - bullet list item 9
+
+ 1. numbered list item 1
+ 2. numbered list item 2
+ a) numbered list item 3
+ b) numbered list item 4
+
+
+For other syntax elements, see `:h vimwiki-syntax`
+
+
+Key bindings
+------------------------------------------------------------------------------
+
+normal mode:
+
+ * `<Leader>ww` -- Open default wiki index file.
+ * `<Leader>wt` -- Open default wiki index file in a new tab.
+ * `<Leader>ws` -- Select and open wiki index file.
+ * `<Leader>wd` -- Delete wiki file you are in.
+ * `<Leader>wr` -- Rename wiki file you are in.
+ * `<Enter>` -- Follow/Create wiki link
+ * `<Shift-Enter>` -- Split and follow/create wiki link
+ * `<Ctrl-Enter>` -- Vertical split and follow/create wiki link
+ * `<Backspace>` -- Go back to parent(previous) wiki link
+ * `<Tab>` -- Find next wiki link
+ * `<Shift-Tab>` -- Find previous wiki link
+
+For more keys, see `:h vimwiki-mappings`
+
+
+Commands
+------------------------------------------------------------------------------
+
+ * `:Vimwiki2HTML` -- Convert current wiki link to HTML
+ * `:VimwikiAll2HTML` -- Convert all your wiki links to HTML
+ * `:help vimwiki-commands` -- list all commands
+
+
+Installation
+==============================================================================
+
+Prerequisites
+------------------------------------------------------------------------------
+
+Make sure you have these settings in your vimrc file:
+
+ set nocompatible
+ filetype plugin on
+ syntax on
+
+Without them Vimwiki will not work properly.
+
+
+Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
+------------------------------------------------------------------------------
+
+ git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
+
+Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)
+------------------------------------------------------------------------------
+
+ cd ~/.vim
+ mkdir bundle
+ cd bundle
+ git clone https://github.com/vimwiki/vimwiki.git
+
+Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
+------------------------------------------------------------------------------
+
+Add the following to the plugin-configuration in your vimrc:
+
+ Plug 'vimwiki/vimwiki'
+
+Then run `:PlugInstall`.
+
+Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
+------------------------------------------------------------------------------
+
+Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run
+
+ vim +PluginInstall +qall
+
+Or download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it in `~/.vim/bundle/`
+
+Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was installed.
+
+
+Getting help
+==============================================================================
+
+Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki))
+or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
+
+
+----
+\* Screenshots made with the [solarized colorscheme](https://github.com/altercation/vim-colors-solarized)
+and [lightline](https://github.com/itchyny/lightline.vim)
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/base.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/base.vim
new file mode 100644
index 0000000..2bb8c4d
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/base.vim
@@ -0,0 +1,2046 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Desc: Basic functionality
+" Home: https://github.com/vimwiki/vimwiki/
+
+if exists("g:loaded_vimwiki_auto") || &cp
+ finish
+endif
+let g:loaded_vimwiki_auto = 1
+
+
+function! s:safesubstitute(text, search, replace, mode)
+ " Substitute regexp but do not interpret replace
+ let escaped = escape(a:replace, '\&')
+ return substitute(a:text, a:search, escaped, a:mode)
+endfunction
+
+
+function! s:vimwiki_get_known_syntaxes()
+ " Getting all syntaxes that different wikis could have
+ let syntaxes = {}
+ let syntaxes['default'] = 1
+ for wiki_nr in range(vimwiki#vars#number_of_wikis())
+ let wiki_syntax = vimwiki#vars#get_wikilocal('syntax', wiki_nr)
+ let syntaxes[wiki_syntax] = 1
+ endfor
+ " also consider the syntaxes from g:vimwiki_ext2syntax
+ for syn in values(vimwiki#vars#get_global('ext2syntax'))
+ let syntaxes[syn] = 1
+ endfor
+ return keys(syntaxes)
+endfunction
+
+
+function! vimwiki#base#file_pattern(files)
+ " Get search regex from glob()
+ " string. Aim to support *all* special characters, forcing the user to choose
+ " names that are compatible with any external restrictions that they
+ " encounter (e.g. filesystem, wiki conventions, other syntaxes, ...).
+ " See: https://github.com/vimwiki-backup/vimwiki/issues/316
+ " Change / to [/\\] to allow "Windows paths"
+ return '\V\%('.join(a:files, '\|').'\)\m'
+endfunction
+
+
+"FIXME TODO slow and faulty
+function! vimwiki#base#subdir(path, filename)
+ let path = a:path
+ " ensure that we are not fooled by a symbolic link
+ "FIXME if we are not "fooled", we end up in a completely different wiki?
+ if a:filename !~# '^scp:'
+ let filename = resolve(a:filename)
+ else
+ let filename = a:filename
+ endif
+ let idx = 0
+ "FIXME this can terminate in the middle of a path component!
+ while path[idx] ==? filename[idx]
+ let idx = idx + 1
+ endwhile
+
+ let p = split(strpart(filename, idx), '[/\\]')
+ let res = join(p[:-2], '/')
+ if len(res) > 0
+ let res = res.'/'
+ endif
+ return res
+endfunction
+
+
+function! vimwiki#base#current_subdir()
+ return vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), expand('%:p'))
+endfunction
+
+
+function! vimwiki#base#invsubdir(subdir)
+ return substitute(a:subdir, '[^/\.]\+/', '../', 'g')
+endfunction
+
+
+" Returns: the number of the wiki a file belongs to or -1 if it doesn't belong
+" to any registered wiki.
+" The path can be the full path or just the directory of the file
+function! vimwiki#base#find_wiki(path)
+ let bestmatch = -1
+ let bestlen = 0
+ let path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(a:path))
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let idx_path = expand(vimwiki#vars#get_wikilocal('path', idx))
+ let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path))
+ let common_pfx = vimwiki#path#path_common_pfx(idx_path, path)
+ if vimwiki#path#is_equal(common_pfx, idx_path)
+ if len(common_pfx) > bestlen
+ let bestlen = len(common_pfx)
+ let bestmatch = idx
+ endif
+ endif
+ endfor
+
+ return bestmatch
+endfunction
+
+
+" THE central function of Vimwiki. Extract infos about the target from a link.
+" If the second parameter is present, which should be an absolute file path, it
+" is assumed that the link appears in that file. Without it, the current file
+" is used.
+function! vimwiki#base#resolve_link(link_text, ...)
+ if a:0
+ let source_wiki = vimwiki#base#find_wiki(a:1)
+ let source_file = a:1
+ else
+ let source_wiki = vimwiki#vars#get_bufferlocal('wiki_nr')
+ let source_file = vimwiki#path#current_wiki_file()
+ endif
+
+ let link_text = a:link_text
+
+
+ let link_infos = {
+ \ 'index': -1,
+ \ 'scheme': '',
+ \ 'filename': '',
+ \ 'anchor': '',
+ \ }
+
+ if link_text == ''
+ return link_infos
+ endif
+
+ let scheme = matchstr(link_text, '^\zs'.vimwiki#vars#get_global('rxSchemes').'\ze:')
+ if scheme == ''
+ let link_infos.scheme = 'wiki'.source_wiki
+ else
+ let link_infos.scheme = scheme
+
+ if link_infos.scheme !~# '\mwiki\d\+\|diary\|local\|file'
+ let link_infos.filename = link_text " unknown scheme, may be a weblink
+ return link_infos
+ endif
+
+ let link_text = matchstr(link_text, '^'.vimwiki#vars#get_global('rxSchemes').':\zs.*\ze')
+ endif
+
+ let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' || link_infos.scheme ==# 'diary'
+
+ " extract anchor
+ if is_wiki_link
+ let split_lnk = split(link_text, '#', 1)
+ let link_text = split_lnk[0]
+ if len(split_lnk) > 1 && split_lnk[-1] != ''
+ let link_infos.anchor = join(split_lnk[1:], '#')
+ endif
+ if link_text == '' " because the link was of the form '#anchor'
+ let link_text = fnamemodify(source_file, ':p:t:r')
+ endif
+ endif
+
+ " check if absolute or relative path
+ if is_wiki_link && link_text[0] == '/'
+ if link_text != '/'
+ let link_text = link_text[1:]
+ endif
+ let is_relative = 0
+ elseif !is_wiki_link && vimwiki#path#is_absolute(link_text)
+ let is_relative = 0
+ else
+ let is_relative = 1
+ let root_dir = fnamemodify(source_file, ':p:h') . '/'
+ endif
+
+
+ " extract the other items depending on the scheme
+ if link_infos.scheme =~# '\mwiki\d\+'
+ let link_infos.index = eval(matchstr(link_infos.scheme, '\D\+\zs\d\+\ze'))
+ if link_infos.index < 0 || link_infos.index >= vimwiki#vars#number_of_wikis()
+ let link_infos.filename = ''
+ return link_infos
+ endif
+
+ if !is_relative || link_infos.index != source_wiki
+ let root_dir = vimwiki#vars#get_wikilocal('path', link_infos.index)
+ endif
+
+ let link_infos.filename = root_dir . link_text
+
+ if vimwiki#path#is_link_to_dir(link_text)
+ if vimwiki#vars#get_global('dir_link') != ''
+ let link_infos.filename .= vimwiki#vars#get_global('dir_link') .
+ \ vimwiki#vars#get_wikilocal('ext', link_infos.index)
+ endif
+ else
+ let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
+ endif
+
+ elseif link_infos.scheme ==# 'diary'
+ let link_infos.index = source_wiki
+
+ let link_infos.filename =
+ \ vimwiki#vars#get_wikilocal('path', link_infos.index) .
+ \ vimwiki#vars#get_wikilocal('diary_rel_path', link_infos.index) .
+ \ link_text .
+ \ vimwiki#vars#get_wikilocal('ext', link_infos.index)
+ elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local') && is_relative
+ let link_infos.filename = simplify(root_dir . link_text)
+ else " absolute file link
+ " collapse repeated leading "/"'s within a link
+ let link_text = substitute(link_text, '\m^/\+', '/', '')
+ " expand ~/
+ let link_text = fnamemodify(link_text, ':p')
+ let link_infos.filename = simplify(link_text)
+ endif
+
+ let link_infos.filename = vimwiki#path#normalize(link_infos.filename)
+ return link_infos
+endfunction
+
+
+function! vimwiki#base#system_open_link(url)
+ " handlers
+ function! s:win32_handler(url)
+ "http://vim.wikia.com/wiki/Opening_current_Vim_file_in_your_Windows_browser
+ "disable 'shellslash', otherwise the url will be enclosed in single quotes,
+ "which is problematic
+ "see https://github.com/vimwiki/vimwiki/issues/54#issuecomment-48011289
+ if exists('+shellslash')
+ let old_ssl = &shellslash
+ set noshellslash
+ let url = shellescape(a:url, 1)
+ let &shellslash = old_ssl
+ else
+ let url = shellescape(a:url, 1)
+ endif
+ if &l:shell ==? "powershell"
+ execute 'silent ! start ' . a:url
+ else
+ execute 'silent ! start "Title" /B ' . a:url
+ endif
+ endfunction
+ function! s:macunix_handler(url)
+ call system('open ' . shellescape(a:url).' &')
+ endfunction
+ function! s:linux_handler(url)
+ call system('xdg-open ' . shellescape(a:url).' &')
+ endfunction
+ try
+ if vimwiki#u#is_windows()
+ call s:win32_handler(a:url)
+ return
+ elseif vimwiki#u#is_macos()
+ call s:macunix_handler(a:url)
+ return
+ else
+ call s:linux_handler(a:url)
+ return
+ endif
+ endtry
+ echomsg 'Vimwiki Error: Default Vimwiki link handler was unable to open the HTML file!'
+endfunction
+
+
+function! vimwiki#base#open_link(cmd, link, ...)
+ let link_infos = {}
+ if a:0
+ let link_infos = vimwiki#base#resolve_link(a:link, a:1)
+ else
+ let link_infos = vimwiki#base#resolve_link(a:link)
+ endif
+
+ if link_infos.filename == ''
+ echomsg 'Vimwiki Error: Unable to resolve link!'
+ return
+ endif
+
+ let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' || link_infos.scheme =~# 'diary'
+
+ let update_prev_link = is_wiki_link &&
+ \ !vimwiki#path#is_equal(link_infos.filename, vimwiki#path#current_wiki_file())
+
+ let vimwiki_prev_link = []
+ " update previous link for wiki pages
+ if update_prev_link
+ if a:0
+ let vimwiki_prev_link = [a:1, []]
+ elseif &ft ==# 'vimwiki'
+ let vimwiki_prev_link = [vimwiki#path#current_wiki_file(), getpos('.')]
+ endif
+ endif
+
+ " open/edit
+ if is_wiki_link
+ call vimwiki#base#edit_file(a:cmd, link_infos.filename, link_infos.anchor,
+ \ vimwiki_prev_link, update_prev_link)
+ else
+ call vimwiki#base#system_open_link(link_infos.filename)
+ endif
+endfunction
+
+
+function! vimwiki#base#get_globlinks_escaped() abort
+ " only get links from the current dir
+ " change to the directory of the current file
+ let orig_pwd = getcwd()
+ lcd! %:h
+ " all path are relative to the current file's location
+ let globlinks = glob('*'.vimwiki#vars#get_wikilocal('ext'), 1)."\n"
+ " remove extensions
+ let globlinks = substitute(globlinks, '\'.vimwiki#vars#get_wikilocal('ext').'\ze\n', '', 'g')
+ " restore the original working directory
+ exe 'lcd! '.orig_pwd
+ " convert to a List
+ let lst = split(globlinks, '\n')
+ " Apply fnameescape() to each item
+ call map(lst, 'fnameescape(v:val)')
+ " Convert back to newline-separated list
+ let globlinks = join(lst, "\n")
+ " return all escaped links as a single newline-separated string
+ return globlinks
+endfunction
+
+
+function! vimwiki#base#generate_links()
+ let lines = []
+
+ let links = vimwiki#base#get_wikilinks(vimwiki#vars#get_bufferlocal('wiki_nr'), 0)
+ call sort(links)
+
+ let bullet = repeat(' ', vimwiki#lst#get_list_margin()) . vimwiki#lst#default_symbol().' '
+ for link in links
+ let abs_filepath = vimwiki#path#abs_path_of_link(link)
+ if !s:is_diary_file(abs_filepath)
+ call add(lines, bullet.
+ \ s:safesubstitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
+ \ '__LinkUrl__', link, ''))
+ endif
+ endfor
+
+ let links_rx = '\m^\s*'.vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
+
+ call vimwiki#base#update_listing_in_buffer(lines, 'Generated Links', links_rx, line('$')+1, 1)
+endfunction
+
+
+function! vimwiki#base#goto(...)
+ let key = a:1
+ let anchor = a:0 > 1 ? a:2 : ''
+
+ call vimwiki#base#edit_file(':e',
+ \ vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext'),
+ \ anchor)
+endfunction
+
+
+function! vimwiki#base#backlinks()
+ let current_filename = expand("%:p")
+ let locations = []
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let syntax = vimwiki#vars#get_wikilocal('syntax', idx)
+ let wikifiles = vimwiki#base#find_files(idx, 0)
+ for source_file in wikifiles
+ let links = s:get_links(source_file, idx)
+ for [target_file, _, lnum, col] in links
+ " don't include links from the current file to itself
+ if vimwiki#path#is_equal(target_file, current_filename) &&
+ \ !vimwiki#path#is_equal(target_file, source_file)
+ call add(locations, {'filename':source_file, 'lnum':lnum, 'col':col})
+ endif
+ endfor
+ endfor
+ endfor
+
+ if empty(locations)
+ echomsg 'Vimwiki: No other file links to this file'
+ else
+ call setloclist(0, locations, 'r')
+ lopen
+ endif
+endfunction
+
+
+" Returns: a list containing all files of the given wiki as absolute file path.
+" If the given wiki number is negative, the diary of the current wiki is used
+" If the second argument is not zero, only directories are found
+function! vimwiki#base#find_files(wiki_nr, directories_only)
+ let wiki_nr = a:wiki_nr
+ if wiki_nr >= 0
+ let root_directory = vimwiki#vars#get_wikilocal('path', wiki_nr)
+ else
+ let root_directory = vimwiki#vars#get_wikilocal('path') .
+ \ vimwiki#vars#get_wikilocal('diary_rel_path')
+ let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
+ endif
+ if a:directories_only
+ let ext = '/'
+ else
+ let ext = vimwiki#vars#get_wikilocal('ext', wiki_nr)
+ endif
+ " if current wiki is temporary -- was added by an arbitrary wiki file then do
+ " not search wiki files in subdirectories. Or it would hang the system if
+ " wiki file was created in $HOME or C:/ dirs.
+ if vimwiki#vars#get_wikilocal('is_temporary_wiki', wiki_nr)
+ let pattern = '*'.ext
+ else
+ let pattern = '**/*'.ext
+ endif
+ return split(globpath(root_directory, pattern), '\n')
+endfunction
+
+
+" Returns: a list containing the links to get from the current file to all wiki
+" files in the given wiki.
+" If the given wiki number is negative, the diary of the current wiki is used.
+" If also_absolute_links is nonzero, also return links of the form /file
+function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links)
+ let files = vimwiki#base#find_files(a:wiki_nr, 0)
+ if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
+ let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
+ elseif a:wiki_nr < 0
+ let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
+ else
+ let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr)
+ endif
+ let result = []
+ for wikifile in files
+ let wikifile = fnamemodify(wikifile, ':r') " strip extension
+ let wikifile = vimwiki#path#relpath(cwd, wikifile)
+ call add(result, wikifile)
+ endfor
+ if a:also_absolute_links
+ for wikifile in files
+ if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
+ let cwd = vimwiki#vars#get_wikilocal('path')
+ elseif a:wiki_nr < 0
+ let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
+ endif
+ let wikifile = fnamemodify(wikifile, ':r') " strip extension
+ let wikifile = '/'.vimwiki#path#relpath(cwd, wikifile)
+ call add(result, wikifile)
+ endfor
+ endif
+ return result
+endfunction
+
+
+" Returns: a list containing the links to all directories from the current file
+function! vimwiki#base#get_wiki_directories(wiki_nr)
+ let dirs = vimwiki#base#find_files(a:wiki_nr, 1)
+ if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
+ let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
+ let root_dir = vimwiki#vars#get_wikilocal('path')
+ else
+ let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr)
+ endif
+ let result = ['./']
+ for wikidir in dirs
+ let wikidir_relative = vimwiki#path#relpath(cwd, wikidir)
+ call add(result, wikidir_relative)
+ if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
+ let wikidir_absolute = '/'.vimwiki#path#relpath(root_dir, wikidir)
+ call add(result, wikidir_absolute)
+ endif
+ endfor
+ return result
+endfunction
+
+
+function! vimwiki#base#get_anchors(filename, syntax)
+ if !filereadable(a:filename)
+ return []
+ endif
+
+ let rxheader = vimwiki#vars#get_syntaxlocal('header_search', a:syntax)
+ let rxbold = vimwiki#vars#get_syntaxlocal('bold_search', a:syntax)
+ let rxtag = vimwiki#vars#get_syntaxlocal('tag_search', a:syntax)
+
+ let anchor_level = ['', '', '', '', '', '', '']
+ let anchors = []
+ let current_complete_anchor = ''
+ for line in readfile(a:filename)
+
+ " collect headers
+ let h_match = matchlist(line, rxheader)
+ if !empty(h_match)
+ let header = vimwiki#u#trim(h_match[2])
+ let level = len(h_match[1])
+ call add(anchors, header)
+ let anchor_level[level-1] = header
+ for l in range(level, 6)
+ let anchor_level[l] = ''
+ endfor
+ if level == 1
+ let current_complete_anchor = header
+ else
+ let current_complete_anchor = ''
+ for l in range(level-1)
+ if anchor_level[l] != ''
+ let current_complete_anchor .= anchor_level[l].'#'
+ endif
+ endfor
+ let current_complete_anchor .= header
+ call add(anchors, current_complete_anchor)
+ endif
+ endif
+
+ " collect bold text (there can be several in one line)
+ let bold_count = 1
+ while 1
+ let bold_text = matchstr(line, rxbold, 0, bold_count)
+ if bold_text == ''
+ break
+ endif
+ call add(anchors, bold_text)
+ if current_complete_anchor != ''
+ call add(anchors, current_complete_anchor.'#'.bold_text)
+ endif
+ let bold_count += 1
+ endwhile
+
+ " collect tags text (there can be several in one line)
+ let tag_count = 1
+ while 1
+ let tag_group_text = matchstr(line, rxtag, 0, tag_count)
+ if tag_group_text == ''
+ break
+ endif
+ for tag_text in split(tag_group_text, ':')
+ call add(anchors, tag_text)
+ if current_complete_anchor != ''
+ call add(anchors, current_complete_anchor.'#'.tag_text)
+ endif
+ endfor
+ let tag_count += 1
+ endwhile
+
+ endfor
+
+ return anchors
+endfunction
+
+
+function! s:jump_to_anchor(anchor)
+ let oldpos = getpos('.')
+ call cursor(1, 1)
+
+ let anchor = vimwiki#u#escape(a:anchor)
+
+ let segments = split(anchor, '#', 0)
+
+ for segment in segments
+
+ let anchor_header = s:safesubstitute(
+ \ vimwiki#vars#get_syntaxlocal('header_match'),
+ \ '__Header__', segment, '')
+ let anchor_bold = s:safesubstitute(
+ \ vimwiki#vars#get_syntaxlocal('bold_match'),
+ \ '__Text__', segment, '')
+ let anchor_tag = s:safesubstitute(
+ \ vimwiki#vars#get_syntaxlocal('tag_match'),
+ \ '__Tag__', segment, '')
+
+ if !search(anchor_tag, 'Wc') && !search(anchor_header, 'Wc') && !search(anchor_bold, 'Wc')
+ call setpos('.', oldpos)
+ break
+ endif
+ let oldpos = getpos('.')
+ endfor
+endfunction
+
+
+" Params: full path to a wiki file and its wiki number
+" Returns: a list of all links inside the wiki file
+" Every list item has the form
+" [target file, anchor, line number of the link in source file, column number]
+function! s:get_links(wikifile, idx)
+ if !filereadable(a:wikifile)
+ return []
+ endif
+
+ let syntax = vimwiki#vars#get_wikilocal('syntax', a:idx)
+ let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
+ let links = []
+ let lnum = 0
+
+ for line in readfile(a:wikifile)
+ let lnum += 1
+
+ let link_count = 1
+ while 1
+ let col = match(line, rx_link, 0, link_count)+1
+ let link_text = matchstr(line, rx_link, 0, link_count)
+ if link_text == ''
+ break
+ endif
+ let link_count += 1
+ let target = vimwiki#base#resolve_link(link_text, a:wikifile)
+ if target.filename != '' && target.scheme =~# '\mwiki\d\+\|diary\|file\|local'
+ call add(links, [target.filename, target.anchor, lnum, col])
+ endif
+ endwhile
+ endfor
+
+ return links
+endfunction
+
+
+function! vimwiki#base#check_links()
+ let anchors_of_files = {}
+ let links_of_files = {}
+ let errors = []
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let syntax = vimwiki#vars#get_wikilocal('syntax', idx)
+ let wikifiles = vimwiki#base#find_files(idx, 0)
+ for wikifile in wikifiles
+ let links_of_files[wikifile] = s:get_links(wikifile, idx)
+ let anchors_of_files[wikifile] = vimwiki#base#get_anchors(wikifile, syntax)
+ endfor
+ endfor
+
+ for wikifile in keys(links_of_files)
+ for [target_file, target_anchor, lnum, col] in links_of_files[wikifile]
+ if target_file == '' && target_anchor == ''
+ call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
+ \ 'text': "numbered scheme refers to a non-existent wiki"})
+ elseif has_key(anchors_of_files, target_file)
+ if target_anchor != '' && index(anchors_of_files[target_file], target_anchor) < 0
+ call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
+ \'text': "there is no such anchor: ".target_anchor})
+ endif
+ else
+ if target_file =~ '\m/$' " maybe it's a link to a directory
+ if !isdirectory(target_file)
+ call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
+ \'text': "there is no such directory: ".target_file})
+ endif
+ else " maybe it's a non-wiki file
+ if filereadable(target_file)
+ let anchors_of_files[target_file] = []
+ else
+ call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
+ \'text': "there is no such file: ".target_file})
+ endif
+ endif
+ endif
+ endfor
+ endfor
+
+
+ " Check which wiki files are reachable from at least one of the index files.
+ " First, all index files are marked as reachable. Then, pick a reachable file
+ " and mark all files to which it links as reachable, too. Repeat until the
+ " links of all reachable files have been checked.
+
+ " Map every wiki file to a number. 0 means not reachable from any index file,
+ " 1 means reachable, but the outgoing links are not checked yet, 2 means
+ " reachable and done.
+ let reachable_wikifiles = {}
+
+ " first, all files are considered not reachable
+ for wikifile in keys(links_of_files)
+ let reachable_wikifiles[wikifile] = 0
+ endfor
+
+ " mark every index file as reachable
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let index_file = vimwiki#vars#get_wikilocal('path', idx) .
+ \ vimwiki#vars#get_wikilocal('index', idx) . vimwiki#vars#get_wikilocal('ext', idx)
+ if filereadable(index_file)
+ let reachable_wikifiles[index_file] = 1
+ endif
+ endfor
+
+ while 1
+ let next_unvisited_wikifile = ''
+ for wf in keys(reachable_wikifiles)
+ if reachable_wikifiles[wf] == 1
+ let next_unvisited_wikifile = wf
+ let reachable_wikifiles[wf] = 2
+ break
+ endif
+ endfor
+ if next_unvisited_wikifile == ''
+ break
+ endif
+ for [target_file, target_anchor, lnum, col] in links_of_files[next_unvisited_wikifile]
+ if has_key(reachable_wikifiles, target_file) && reachable_wikifiles[target_file] == 0
+ let reachable_wikifiles[target_file] = 1
+ endif
+ endfor
+ endwhile
+
+ for wf in keys(reachable_wikifiles)
+ if reachable_wikifiles[wf] == 0
+ call add(errors, {'text':wf." is not reachable from the index file"})
+ endif
+ endfor
+
+ if empty(errors)
+ echomsg 'Vimwiki: All links are OK'
+ else
+ call setqflist(errors, 'r')
+ copen
+ endif
+endfunction
+
+
+function! vimwiki#base#edit_file(command, filename, anchor, ...)
+ let fname = escape(a:filename, '% *|#`')
+ let dir = fnamemodify(a:filename, ":p:h")
+
+ let ok = vimwiki#path#mkdir(dir, 1)
+
+ if !ok
+ echomsg ' '
+ echomsg 'Vimwiki Error: Unable to edit file in non-existent directory: '.dir
+ return
+ endif
+
+ " Check if the file we want to open is already the current file
+ " which happens if we jump to an achor in the current file.
+ " This hack is necessary because apparently Vim messes up the result of
+ " getpos() directly after this command. Strange.
+ if !(a:command ==# ':e ' && vimwiki#path#is_equal(a:filename, expand('%:p')))
+ try
+ if &autowriteall && !&hidden " in this case, the file is saved before switching to the
+ " new buffer. This causes Vim to show two messages in the command line which triggers
+ " the annoying hit-enter prompt. Solution: show no messages at all.
+ silent execute a:command fname
+ else
+ execute a:command fname
+ endif
+ catch /E37:/
+ echomsg 'Vimwiki: The current file is modified. Hint: Take a look at'
+ \ ''':h g:vimwiki_autowriteall'' to see how to save automatically.'
+ return
+ endtry
+
+ " If the opened file was not already loaded by Vim, an autocommand is
+ " triggered at this point
+
+ " Make sure no other plugin takes ownership over the new file. Vimwiki
+ " rules them all! Well, except for directories, which may be opened with
+ " Netrw
+ if &filetype != 'vimwiki' && fname !~ '\m/$'
+ setfiletype vimwiki
+ endif
+ endif
+ if a:anchor != ''
+ call s:jump_to_anchor(a:anchor)
+ endif
+
+ " save previous link
+ " a:1 -- previous vimwiki link to save
+ " a:2 -- should we update previous link
+ if a:0 && a:2 && len(a:1) > 0
+ call vimwiki#vars#set_bufferlocal('prev_link', a:1)
+ endif
+endfunction
+
+
+function! vimwiki#base#search_word(wikiRx, cmd)
+ let match_line = search(a:wikiRx, 's'.a:cmd)
+ if match_line == 0
+ echomsg 'Vimwiki: Wiki link not found'
+ endif
+endfunction
+
+
+" Returns part of the line that matches wikiRX at cursor
+function! vimwiki#base#matchstr_at_cursor(wikiRX)
+ let col = col('.') - 1
+ let line = getline('.')
+ let ebeg = -1
+ let cont = match(line, a:wikiRX, 0)
+ while (ebeg >= 0 || (0 <= cont) && (cont <= col))
+ let contn = matchend(line, a:wikiRX, cont)
+ if (cont <= col) && (col < contn)
+ let ebeg = match(line, a:wikiRX, cont)
+ let elen = contn - ebeg
+ break
+ else
+ let cont = match(line, a:wikiRX, contn)
+ endif
+ endwh
+ if ebeg >= 0
+ return strpart(line, ebeg, elen)
+ else
+ return ""
+ endif
+endfunction
+
+
+function! vimwiki#base#replacestr_at_cursor(wikiRX, sub)
+ let col = col('.') - 1
+ let line = getline('.')
+ let ebeg = -1
+ let cont = match(line, a:wikiRX, 0)
+ while (ebeg >= 0 || (0 <= cont) && (cont <= col))
+ let contn = matchend(line, a:wikiRX, cont)
+ if (cont <= col) && (col < contn)
+ let ebeg = match(line, a:wikiRX, cont)
+ let elen = contn - ebeg
+ break
+ else
+ let cont = match(line, a:wikiRX, contn)
+ endif
+ endwh
+ if ebeg >= 0
+ " TODO: There might be problems with Unicode chars...
+ let newline = strpart(line, 0, ebeg).a:sub.strpart(line, ebeg+elen)
+ call setline(line('.'), newline)
+ endif
+endfunction
+
+
+function! s:print_wiki_list()
+ let idx = 0
+ while idx < vimwiki#vars#number_of_wikis()
+ if idx == vimwiki#vars#get_bufferlocal('wiki_nr')
+ let sep = ' * '
+ echohl PmenuSel
+ else
+ let sep = ' '
+ echohl None
+ endif
+ echo (idx + 1) . sep . vimwiki#vars#get_wikilocal('path', idx)
+ let idx += 1
+ endwhile
+ echohl None
+endfunction
+
+
+function! s:update_wiki_link(fname, old, new)
+ echo "Updating links in ".a:fname
+ let has_updates = 0
+ let dest = []
+ for line in readfile(a:fname)
+ if !has_updates && match(line, a:old) != -1
+ let has_updates = 1
+ endif
+ " XXX: any other characters to escape!?
+ call add(dest, substitute(line, a:old, escape(a:new, "&"), "g"))
+ endfor
+ " add exception handling...
+ if has_updates
+ call rename(a:fname, a:fname.'#vimwiki_upd#')
+ call writefile(dest, a:fname)
+ call delete(a:fname.'#vimwiki_upd#')
+ endif
+endfunction
+
+
+function! s:update_wiki_links_dir(dir, old_fname, new_fname)
+ let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g')
+ let new_fname = a:new_fname
+
+ let old_fname_r = vimwiki#base#apply_template(
+ \ vimwiki#vars#get_syntaxlocal('WikiLinkMatchUrlTemplate'), old_fname, '', '')
+
+ let files = split(glob(vimwiki#vars#get_wikilocal('path').a:dir.'*'.
+ \ vimwiki#vars#get_wikilocal('ext')), '\n')
+ for fname in files
+ call s:update_wiki_link(fname, old_fname_r, new_fname)
+ endfor
+endfunction
+
+
+function! s:tail_name(fname)
+ let result = substitute(a:fname, ":", "__colon__", "g")
+ let result = fnamemodify(result, ":t:r")
+ let result = substitute(result, "__colon__", ":", "g")
+ return result
+endfunction
+
+
+function! s:update_wiki_links(old_fname, new_fname)
+ let old_fname = a:old_fname
+ let new_fname = a:new_fname
+
+ let subdirs = split(a:old_fname, '[/\\]')[: -2]
+
+ " TODO: Use Dictionary here...
+ let dirs_keys = ['']
+ let dirs_vals = ['']
+ if len(subdirs) > 0
+ let dirs_keys = ['']
+ let dirs_vals = [join(subdirs, '/').'/']
+ let idx = 0
+ while idx < len(subdirs) - 1
+ call add(dirs_keys, join(subdirs[: idx], '/').'/')
+ call add(dirs_vals, join(subdirs[idx+1 :], '/').'/')
+ let idx = idx + 1
+ endwhile
+ call add(dirs_keys,join(subdirs, '/').'/')
+ call add(dirs_vals, '')
+ endif
+
+ let idx = 0
+ while idx < len(dirs_keys)
+ let dir = dirs_keys[idx]
+ let new_dir = dirs_vals[idx]
+ call s:update_wiki_links_dir(dir, new_dir.old_fname, new_dir.new_fname)
+ let idx = idx + 1
+ endwhile
+endfunction
+
+
+function! s:get_wiki_buffers()
+ let blist = []
+ let bcount = 1
+ while bcount<=bufnr("$")
+ if bufexists(bcount)
+ let bname = fnamemodify(bufname(bcount), ":p")
+ " this may find buffers that are not part of the current wiki, but that
+ " doesn't hurt
+ if bname =~# vimwiki#vars#get_wikilocal('ext')."$"
+ let bitem = [bname, vimwiki#vars#get_bufferlocal('prev_link', bcount)]
+ call add(blist, bitem)
+ endif
+ endif
+ let bcount = bcount + 1
+ endwhile
+ return blist
+endfunction
+
+
+function! s:open_wiki_buffer(item)
+ call vimwiki#base#edit_file(':e', a:item[0], '')
+ if !empty(a:item[1])
+ call vimwiki#vars#set_bufferlocal('prev_link', a:item[1], a:item[0])
+ endif
+endfunction
+
+
+function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort
+" From http://vim.wikia.com/wiki/VimTip857
+ let ft=toupper(a:filetype)
+ let group='textGroup'.ft
+ if exists('b:current_syntax')
+ let s:current_syntax=b:current_syntax
+ " Remove current syntax definition, as some syntax files (e.g. cpp.vim)
+ " do nothing if b:current_syntax is defined.
+ unlet b:current_syntax
+ endif
+
+ " Some syntax files set up iskeyword which might scratch vimwiki a bit.
+ " Let us save and restore it later.
+ " let b:skip_set_iskeyword = 1
+ let is_keyword = &iskeyword
+
+ try
+ " keep going even if syntax file is not found
+ execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
+ execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim'
+ catch
+ endtry
+
+ let &iskeyword = is_keyword
+
+ if exists('s:current_syntax')
+ let b:current_syntax=s:current_syntax
+ else
+ unlet b:current_syntax
+ endif
+
+ " Fix issue #236: tell Vimwiki to think in maths when encountering maths
+ " blocks like {{$ }}$. Here, we don't want the tex highlight group, but the
+ " group for tex math.
+ if a:textSnipHl ==# 'VimwikiMath'
+ let group='texMathZoneGroup'
+ endif
+
+ execute 'syntax region textSnip'.ft.
+ \ ' matchgroup='.a:textSnipHl.
+ \ ' start="'.a:start.'" end="'.a:end.'"'.
+ \ ' contains=@'.group.' keepend'
+
+ " A workaround to Issue 115: Nested Perl syntax highlighting differs from
+ " regular one.
+ " Perl syntax file has perlFunctionName which is usually has no effect due to
+ " 'contained' flag. Now we have 'syntax include' that makes all the groups
+ " included as 'contained' into specific group.
+ " Here perlFunctionName (with quite an angry regexp "\h\w*[^:]") clashes with
+ " the rest syntax rules as now it has effect being really 'contained'.
+ " Clear it!
+ if ft =~? 'perl'
+ syntax clear perlFunctionName
+ endif
+endfunction
+
+
+" creates or updates auto-generated listings in a wiki file, like TOC, diary
+" links, tags list etc.
+" - the listing consists of a level 1 header and a list of strings as content
+" - a:content_regex is used to determine how long a potentially existing list is
+" - a:default_lnum is the line number where the new listing should be placed if
+" it's not already present
+" - if a:create is true, it will be created if it doesn't exist, otherwise it
+" will only be updated if it already exists
+function! vimwiki#base#update_listing_in_buffer(strings, start_header,
+ \ content_regex, default_lnum, create)
+ " apparently, Vim behaves strange when files change while in diff mode
+ if &diff || &readonly
+ return
+ endif
+
+ " check if the listing is already there
+ let already_there = 0
+
+ let header_rx = '\m^\s*'.substitute(vimwiki#vars#get_syntaxlocal('rxH1_Template'),
+ \ '__Header__', a:start_header, '') .'\s*$'
+
+ let start_lnum = 1
+ while start_lnum <= line('$')
+ if getline(start_lnum) =~# header_rx
+ let already_there = 1
+ break
+ endif
+ let start_lnum += 1
+ endwhile
+
+ if !already_there && !a:create
+ return
+ endif
+
+ let winview_save = winsaveview()
+ let cursor_line = winview_save.lnum
+ let is_cursor_after_listing = 0
+
+ let is_fold_closed = 1
+
+ let lines_diff = 0
+
+ if already_there
+ let is_fold_closed = ( foldclosed(start_lnum) > -1 )
+ " delete the old listing
+ let whitespaces_in_first_line = matchstr(getline(start_lnum), '\m^\s*')
+ let end_lnum = start_lnum + 1
+ while end_lnum <= line('$') && getline(end_lnum) =~# a:content_regex
+ let end_lnum += 1
+ endwhile
+ let is_cursor_after_listing = ( cursor_line >= end_lnum )
+ " We'll be removing a range. But, apparently, if folds are enabled, Vim
+ " won't let you remove a range that overlaps with closed fold -- the entire
+ " fold gets deleted. So we temporarily disable folds, and then reenable
+ " them right back.
+ let foldenable_save = &l:foldenable
+ setlo nofoldenable
+ silent exe start_lnum.','.string(end_lnum - 1).'delete _'
+ let &l:foldenable = foldenable_save
+ let lines_diff = 0 - (end_lnum - start_lnum)
+ else
+ let start_lnum = a:default_lnum
+ let is_cursor_after_listing = ( cursor_line > a:default_lnum )
+ let whitespaces_in_first_line = ''
+ endif
+
+ let start_of_listing = start_lnum
+
+ " write new listing
+ let new_header = whitespaces_in_first_line
+ \ . s:safesubstitute(vimwiki#vars#get_syntaxlocal('rxH1_Template'),
+ \ '__Header__', a:start_header, '')
+ call append(start_lnum - 1, new_header)
+ let start_lnum += 1
+ let lines_diff += 1 + len(a:strings)
+ for string in a:strings
+ call append(start_lnum - 1, string)
+ let start_lnum += 1
+ endfor
+ " append an empty line if there is not one
+ if start_lnum <= line('$') && getline(start_lnum) !~# '\m^\s*$'
+ call append(start_lnum - 1, '')
+ let lines_diff += 1
+ endif
+
+ " Open fold, if needed
+ if !is_fold_closed && ( foldclosed(start_of_listing) > -1 )
+ exe start_of_listing
+ norm! zo
+ endif
+
+ if is_cursor_after_listing
+ let winview_save.lnum += lines_diff
+ endif
+ call winrestview(winview_save)
+endfunction
+
+
+function! vimwiki#base#find_next_link()
+ call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), '')
+endfunction
+
+
+function! vimwiki#base#find_prev_link()
+ "Jump 2 times if the cursor is in the middle of a link
+ if synIDattr(synID(line('.'), col('.'), 0), "name") =~# "VimwikiLink.*" &&
+ \ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~# "VimwikiLink.*"
+ call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), 'b')
+ endif
+ call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), 'b')
+endfunction
+
+
+" This is an API function, that is, remappable by the user. Don't change the signature.
+function! vimwiki#base#follow_link(split, reuse, move_cursor, ...)
+ " Parse link at cursor and pass to VimwikiLinkHandler, or failing that, the
+ " default open_link handler
+
+ " try WikiLink
+ let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink')),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
+ " try WikiIncl
+ if lnk == ""
+ let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')),
+ \ vimwiki#vars#get_global('rxWikiInclMatchUrl'))
+ endif
+ " try Weblink
+ if lnk == ""
+ let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink')),
+ \ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'))
+ endif
+
+ if lnk != "" " cursor is indeed on a link
+ let processed_by_user_defined_handler = VimwikiLinkHandler(lnk)
+ if processed_by_user_defined_handler
+ return
+ endif
+
+ if a:split ==# "hsplit"
+ let cmd = ":split "
+ elseif a:split ==# "vsplit"
+ let cmd = ":vsplit "
+ elseif a:split ==# "tab"
+ let cmd = ":tabnew "
+ else
+ let cmd = ":e "
+ endif
+
+ " if we want to and can reuse a split window, jump to that window and open
+ " the new file there
+ if (a:split ==# 'hsplit' || a:split ==# 'vsplit') && a:reuse
+ let previous_window_nr = winnr('#')
+ if previous_window_nr > 0 && previous_window_nr != winnr()
+ execute previous_window_nr . 'wincmd w'
+ let cmd = ':e'
+ endif
+ endif
+
+
+ if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
+ let processed_by_markdown_reflink = vimwiki#markdown_base#open_reflink(lnk)
+ if processed_by_markdown_reflink
+ return
+ endif
+
+ " remove the extension from the filename if exists, because non-vimwiki
+ " markdown files usually include the extension in links
+ let lnk = substitute(lnk, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '')
+ endif
+
+ let current_tab_page = tabpagenr()
+
+ call vimwiki#base#open_link(cmd, lnk)
+
+ if !a:move_cursor
+ if (a:split ==# 'hsplit' || a:split ==# 'vsplit')
+ execute 'wincmd p'
+ elseif a:split ==# 'tab'
+ execute 'tabnext ' . current_tab_page
+ endif
+ endif
+
+ else
+ if a:0 > 0
+ execute "normal! ".a:1
+ else
+ call vimwiki#base#normalize_link(0)
+ endif
+ endif
+endfunction
+
+
+function! vimwiki#base#go_back_link()
+ let prev_link = vimwiki#vars#get_bufferlocal('prev_link')
+ if !empty(prev_link)
+ " go back to saved wiki link
+ call vimwiki#base#edit_file(':e ', prev_link[0], '')
+ call setpos('.', prev_link[1])
+ else
+ " maybe we came here by jumping to a tag -> pop from the tag stack
+ silent! pop!
+ endif
+endfunction
+
+
+function! vimwiki#base#goto_index(wnum, ...)
+ if a:wnum > vimwiki#vars#number_of_wikis()
+ echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in your Vimwiki settings!'
+ return
+ endif
+
+ " usually a:wnum is greater then 0 but with the following command it is == 0:
+ " vim -n -c ":VimwikiIndex"
+ if a:wnum > 0
+ let idx = a:wnum - 1
+ else
+ let idx = 0
+ endif
+
+ if a:0
+ if a:1 == 1
+ let cmd = 'tabedit'
+ elseif a:1 == 2
+ let cmd = 'split'
+ elseif a:1 == 3
+ let cmd = 'vsplit'
+ endif
+ else
+ let cmd = 'edit'
+ endif
+
+ let index_file = vimwiki#vars#get_wikilocal('path', idx).
+ \ vimwiki#vars#get_wikilocal('index', idx).
+ \ vimwiki#vars#get_wikilocal('ext', idx)
+
+ call vimwiki#base#edit_file(cmd, index_file, '')
+endfunction
+
+
+function! vimwiki#base#delete_link()
+ " Delete wiki file you are in from filesystem
+ let val = input('Delete "'.expand('%').'" [y]es/[N]o? ')
+ if val !~? '^y'
+ return
+ endif
+ let fname = expand('%:p')
+ try
+ call delete(fname)
+ catch /.*/
+ echomsg 'Vimwiki Error: Cannot delete "'.expand('%:t:r').'"!'
+ return
+ endtry
+
+ call vimwiki#base#go_back_link()
+ execute "bdelete! ".escape(fname, " ")
+
+ " reread buffer => deleted wiki link should appear as non-existent
+ if expand('%:p') != ""
+ execute "e"
+ endif
+endfunction
+
+
+" Rename current file, update all links to it
+function! vimwiki#base#rename_link()
+ let subdir = vimwiki#vars#get_bufferlocal('subdir')
+ let old_fname = subdir.expand('%:t')
+
+ " there is no file (new one maybe)
+ if glob(expand('%:p')) == ''
+ echomsg 'Vimwiki Error: Cannot rename "'.expand('%:p').
+ \'". It does not exist! (New file? Save it before renaming.)'
+ return
+ endif
+
+ let val = input('Rename "'.expand('%:t:r').'" [y]es/[N]o? ')
+ if val !~? '^y'
+ return
+ endif
+
+ let new_link = input('Enter new name: ')
+
+ if new_link =~# '[/\\]'
+ " It is actually doable but I do not have free time to do it.
+ echomsg 'Vimwiki Error: Cannot rename to a filename with path!'
+ return
+ endif
+
+ " check new_fname - it should be 'good', not empty
+ if substitute(new_link, '\s', '', 'g') == ''
+ echomsg 'Vimwiki Error: Cannot rename to an empty filename!'
+ return
+ endif
+
+ let url = matchstr(new_link, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
+ if url != ''
+ let new_link = url
+ endif
+
+ let new_link = subdir.new_link
+ let new_fname = vimwiki#vars#get_wikilocal('path') . new_link . vimwiki#vars#get_wikilocal('ext')
+
+ " do not rename if file with such name exists
+ let fname = glob(new_fname)
+ if fname != ''
+ echomsg 'Vimwiki Error: Cannot rename to "'.new_fname.'". File with that name exist!'
+ return
+ endif
+ " rename wiki link file
+ try
+ echomsg 'Vimwiki: Renaming '.vimwiki#vars#get_wikilocal('path').old_fname.' to '.new_fname
+ let res = rename(expand('%:p'), expand(new_fname))
+ if res != 0
+ throw "Cannot rename!"
+ end
+ catch /.*/
+ echomsg 'Vimwiki Error: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
+ return
+ endtry
+
+ let &buftype="nofile"
+
+ let cur_buffer = [expand('%:p'), vimwiki#vars#get_bufferlocal('prev_link')]
+
+ let blist = s:get_wiki_buffers()
+
+ " save wiki buffers
+ for bitem in blist
+ execute ':b '.escape(bitem[0], ' ')
+ execute ':update'
+ endfor
+
+ execute ':b '.escape(cur_buffer[0], ' ')
+
+ " remove wiki buffers
+ for bitem in blist
+ execute 'bwipeout '.escape(bitem[0], ' ')
+ endfor
+
+ let setting_more = &more
+ setlocal nomore
+
+ " update links
+ call s:update_wiki_links(s:tail_name(old_fname), new_link)
+
+ " restore wiki buffers
+ for bitem in blist
+ if !vimwiki#path#is_equal(bitem[0], cur_buffer[0])
+ call s:open_wiki_buffer(bitem)
+ endif
+ endfor
+
+ call s:open_wiki_buffer([new_fname, cur_buffer[1]])
+ " execute 'bwipeout '.escape(cur_buffer[0], ' ')
+
+ echomsg 'Vimwiki: '.old_fname.' is renamed to '.new_fname
+
+ let &more = setting_more
+endfunction
+
+
+function! vimwiki#base#ui_select()
+ call s:print_wiki_list()
+ let idx = input("Select Wiki (specify number): ")
+ if idx == ""
+ return
+ endif
+ call vimwiki#base#goto_index(idx)
+endfunction
+
+
+function! vimwiki#base#TO_header(inner, including_subheaders, count)
+ let headers = s:collect_headers()
+ if empty(headers)
+ return
+ endif
+
+ let current_line = line('.')
+
+ let current_header_index = s:current_header(headers, current_line)
+
+ if current_header_index < 0
+ return
+ endif
+
+ " from which to which header
+ if !a:including_subheaders && a:count <= 1
+ let first_line = headers[current_header_index][0]
+ let last_line = current_header_index == len(headers)-1 ? line('$') :
+ \ headers[current_header_index + 1][0] - 1
+ else
+ let first_header_index = current_header_index
+ for _ in range(a:count - 1)
+ let parent = s:get_another_header(headers, first_header_index, -1, '<')
+ if parent < 0
+ break
+ else
+ let first_header_index = parent
+ endif
+ endfor
+
+ let next_sibling_or_higher = s:get_another_header(headers, first_header_index, +1, '<=')
+
+ let first_line = headers[first_header_index][0]
+ let last_line =
+ \ next_sibling_or_higher >= 0 ? headers[next_sibling_or_higher][0] - 1 : line('$')
+ endif
+
+ if a:inner
+ let first_line += 1
+ let last_line = prevnonblank(last_line)
+ endif
+
+ if first_line > last_line
+ " this can happen e.g. when doing vih on a header with another header in the very next line
+ return
+ endif
+
+ call cursor(first_line, 1)
+ normal! V
+ call cursor(last_line, 1)
+endfunction
+
+
+function! vimwiki#base#TO_table_cell(inner, visual)
+ if col('.') == col('$')-1
+ return
+ endif
+
+ if a:visual
+ normal! `>
+ let sel_end = getpos('.')
+ normal! `<
+ let sel_start = getpos('.')
+
+ let firsttime = sel_start == sel_end
+
+ if firsttime
+ if !search('|\|\(-+-\)', 'cb', line('.'))
+ return
+ endif
+ if getline('.')[virtcol('.')] == '+'
+ normal! l
+ endif
+ if a:inner
+ normal! 2l
+ endif
+ let sel_start = getpos('.')
+ endif
+
+ normal! `>
+ call search('|\|\(-+-\)', '', line('.'))
+ if getline('.')[virtcol('.')] == '+'
+ normal! l
+ endif
+ if a:inner
+ if firsttime || abs(sel_end[2] - getpos('.')[2]) != 2
+ normal! 2h
+ endif
+ endif
+ let sel_end = getpos('.')
+
+ call setpos('.', sel_start)
+ exe "normal! \<C-v>"
+ call setpos('.', sel_end)
+
+ " XXX: WORKAROUND.
+ " if blockwise selection is ended at | character then pressing j to extend
+ " selection further fails. But if we shake the cursor left and right then
+ " it works.
+ normal! hl
+ else
+ if !search('|\|\(-+-\)', 'cb', line('.'))
+ return
+ endif
+ if a:inner
+ normal! 2l
+ endif
+ normal! v
+ call search('|\|\(-+-\)', '', line('.'))
+ if !a:inner && getline('.')[virtcol('.')-1] == '|'
+ normal! h
+ elseif a:inner
+ normal! 2h
+ endif
+ endif
+endfunction
+
+
+function! vimwiki#base#TO_table_col(inner, visual)
+ let t_rows = vimwiki#tbl#get_rows(line('.'))
+ if empty(t_rows)
+ return
+ endif
+
+ " TODO: refactor it!
+ if a:visual
+ normal! `>
+ let sel_end = getpos('.')
+ normal! `<
+ let sel_start = getpos('.')
+
+ let firsttime = sel_start == sel_end
+
+ if firsttime
+ " place cursor to the top row of the table
+ call vimwiki#u#cursor(t_rows[0][0], virtcol('.'))
+ " do not accept the match at cursor position if cursor is next to column
+ " separator of the table separator (^ is a cursor):
+ " |-----^-+-------|
+ " | bla | bla |
+ " |-------+-------|
+ " or it will select wrong column.
+ if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
+ let s_flag = 'b'
+ else
+ let s_flag = 'cb'
+ endif
+ " search the column separator backwards
+ if !search('|\|\(-+-\)', s_flag, line('.'))
+ return
+ endif
+ " -+- column separator is matched --> move cursor to the + sign
+ if getline('.')[virtcol('.')] == '+'
+ normal! l
+ endif
+ " inner selection --> reduce selection
+ if a:inner
+ normal! 2l
+ endif
+ let sel_start = getpos('.')
+ endif
+
+ normal! `>
+ if !firsttime && getline('.')[virtcol('.')] == '|'
+ normal! l
+ elseif a:inner && getline('.')[virtcol('.')+1] =~# '[|+]'
+ normal! 2l
+ endif
+ " search for the next column separator
+ call search('|\|\(-+-\)', '', line('.'))
+ " Outer selection selects a column without border on the right. So we move
+ " our cursor left if the previous search finds | border, not -+-.
+ if getline('.')[virtcol('.')] != '+'
+ normal! h
+ endif
+ if a:inner
+ " reduce selection a bit more if inner.
+ normal! h
+ endif
+ " expand selection to the bottom line of the table
+ call vimwiki#u#cursor(t_rows[-1][0], virtcol('.'))
+ let sel_end = getpos('.')
+
+ call setpos('.', sel_start)
+ exe "normal! \<C-v>"
+ call setpos('.', sel_end)
+
+ else
+ " place cursor to the top row of the table
+ call vimwiki#u#cursor(t_rows[0][0], virtcol('.'))
+ " do not accept the match at cursor position if cursor is next to column
+ " separator of the table separator (^ is a cursor):
+ " |-----^-+-------|
+ " | bla | bla |
+ " |-------+-------|
+ " or it will select wrong column.
+ if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
+ let s_flag = 'b'
+ else
+ let s_flag = 'cb'
+ endif
+ " search the column separator backwards
+ if !search('|\|\(-+-\)', s_flag, line('.'))
+ return
+ endif
+ " -+- column separator is matched --> move cursor to the + sign
+ if getline('.')[virtcol('.')] == '+'
+ normal! l
+ endif
+ " inner selection --> reduce selection
+ if a:inner
+ normal! 2l
+ endif
+
+ exe "normal! \<C-V>"
+
+ " search for the next column separator
+ call search('|\|\(-+-\)', '', line('.'))
+ " Outer selection selects a column without border on the right. So we move
+ " our cursor left if the previous search finds | border, not -+-.
+ if getline('.')[virtcol('.')] != '+'
+ normal! h
+ endif
+ " reduce selection a bit more if inner.
+ if a:inner
+ normal! h
+ endif
+ " expand selection to the bottom line of the table
+ call vimwiki#u#cursor(t_rows[-1][0], virtcol('.'))
+ endif
+endfunction
+
+
+function! vimwiki#base#AddHeaderLevel()
+ let lnum = line('.')
+ let line = getline(lnum)
+ let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
+ if line =~# '^\s*$'
+ return
+ endif
+
+ if line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ let level = vimwiki#u#count_first_sym(line)
+ if level < 6
+ if vimwiki#vars#get_syntaxlocal('symH')
+ let line = substitute(line, '\('.rxHdr.'\+\).\+\1', rxHdr.'&'.rxHdr, '')
+ else
+ let line = substitute(line, '\('.rxHdr.'\+\).\+', rxHdr.'&', '')
+ endif
+ call setline(lnum, line)
+ endif
+ else
+ let line = substitute(line, '^\s*', '&'.rxHdr.' ', '')
+ if vimwiki#vars#get_syntaxlocal('symH')
+ let line = substitute(line, '\s*$', ' '.rxHdr.'&', '')
+ endif
+ call setline(lnum, line)
+ endif
+endfunction
+
+
+function! vimwiki#base#RemoveHeaderLevel()
+ let lnum = line('.')
+ let line = getline(lnum)
+ let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
+ if line =~# '^\s*$'
+ return
+ endif
+
+ if line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ let level = vimwiki#u#count_first_sym(line)
+ let old = repeat(rxHdr, level)
+ let new = repeat(rxHdr, level - 1)
+
+ let chomp = line =~# rxHdr.'\s'
+
+ if vimwiki#vars#get_syntaxlocal('symH')
+ let line = substitute(line, old, new, 'g')
+ else
+ let line = substitute(line, old, new, '')
+ endif
+
+ if level == 1 && chomp
+ let line = substitute(line, '^\s', '', 'g')
+ let line = substitute(line, '\s$', '', 'g')
+ endif
+
+ let line = substitute(line, '\s*$', '', '')
+
+ call setline(lnum, line)
+ endif
+endfunction
+
+
+
+" Returns all the headers in the current buffer as a list of the form
+" [[line_number, header_level, header_text], [...], [...], ...]
+function! s:collect_headers()
+ let is_inside_pre_or_math = 0 " 1: inside pre, 2: inside math, 0: outside
+ let headers = []
+ for lnum in range(1, line('$'))
+ let line_content = getline(lnum)
+ if (is_inside_pre_or_math == 1 && line_content =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')) ||
+ \ (is_inside_pre_or_math == 2 && line_content =~# vimwiki#vars#get_syntaxlocal('rxMathEnd'))
+ let is_inside_pre_or_math = 0
+ continue
+ endif
+ if is_inside_pre_or_math > 0
+ continue
+ endif
+ if line_content =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
+ let is_inside_pre_or_math = 1
+ continue
+ endif
+ if line_content =~# vimwiki#vars#get_syntaxlocal('rxMathStart')
+ let is_inside_pre_or_math = 2
+ continue
+ endif
+ if line_content !~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ continue
+ endif
+ let header_level = vimwiki#u#count_first_sym(line_content)
+ let header_text =
+ \ vimwiki#u#trim(matchstr(line_content, vimwiki#vars#get_syntaxlocal('rxHeader')))
+ call add(headers, [lnum, header_level, header_text])
+ endfor
+
+ return headers
+endfunction
+
+
+function! s:current_header(headers, line_number)
+ if empty(a:headers)
+ return -1
+ endif
+
+ if a:line_number >= a:headers[-1][0]
+ return len(a:headers) - 1
+ endif
+
+ let current_header_index = -1
+ while a:headers[current_header_index+1][0] <= a:line_number
+ let current_header_index += 1
+ endwhile
+ return current_header_index
+endfunction
+
+
+function! s:get_another_header(headers, current_index, direction, operation)
+ if empty(a:headers) || a:current_index < 0
+ return -1
+ endif
+ let current_level = a:headers[a:current_index][1]
+ let index = a:current_index + a:direction
+
+ while 1
+ if index < 0 || index >= len(a:headers)
+ return -1
+ endif
+ if eval('a:headers[index][1] ' . a:operation . ' current_level')
+ return index
+ endif
+ let index += a:direction
+ endwhile
+endfunction
+
+
+function! vimwiki#base#goto_parent_header()
+ let headers = s:collect_headers()
+ let current_header_index = s:current_header(headers, line('.'))
+ let parent_header = s:get_another_header(headers, current_header_index, -1, '<')
+ if parent_header >= 0
+ call cursor(headers[parent_header][0], 1)
+ else
+ echo 'Vimwiki: no parent header found'
+ endif
+endfunction
+
+
+function! vimwiki#base#goto_next_header()
+ let headers = s:collect_headers()
+ let current_header_index = s:current_header(headers, line('.'))
+ if current_header_index >= 0 && current_header_index < len(headers) - 1
+ call cursor(headers[current_header_index + 1][0], 1)
+ elseif current_header_index < 0 && !empty(headers) " we're above the first header
+ call cursor(headers[0][0], 1)
+ else
+ echo 'Vimwiki: no next header found'
+ endif
+endfunction
+
+
+function! vimwiki#base#goto_prev_header()
+ let headers = s:collect_headers()
+ let current_header_index = s:current_header(headers, line('.'))
+ " if the cursor already was on a header, jump to the previous one
+ if current_header_index >= 1 && headers[current_header_index][0] == line('.')
+ let current_header_index -= 1
+ endif
+ if current_header_index >= 0
+ call cursor(headers[current_header_index][0], 1)
+ else
+ echo 'Vimwiki: no previous header found'
+ endif
+endfunction
+
+
+function! vimwiki#base#goto_sibling(direction)
+ let headers = s:collect_headers()
+ let current_header_index = s:current_header(headers, line('.'))
+ let next_potential_sibling =
+ \ s:get_another_header(headers, current_header_index, a:direction, '<=')
+ if next_potential_sibling >= 0 && headers[next_potential_sibling][1] ==
+ \ headers[current_header_index][1]
+ call cursor(headers[next_potential_sibling][0], 1)
+ else
+ echo 'Vimwiki: no sibling header found'
+ endif
+endfunction
+
+
+" a:create == 1: creates or updates TOC in current file
+" a:create == 0: update if TOC exists
+function! vimwiki#base#table_of_contents(create)
+ let headers = s:collect_headers()
+ let numbering = vimwiki#vars#get_global('html_header_numbering')
+ let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
+ let complete_header_infos = []
+ for header in headers
+ let h_text = header[2]
+ let h_level = header[1]
+ if h_text ==# vimwiki#vars#get_global('toc_header') " don't include the TOC's header itself
+ continue
+ endif
+ let headers_levels[h_level-1] = [h_text, headers_levels[h_level-1][1]+1]
+ for idx in range(h_level, 5) | let headers_levels[idx] = ['', 0] | endfor
+
+ let h_complete_id = ''
+ for l in range(h_level-1)
+ if headers_levels[l][0] != ''
+ let h_complete_id .= headers_levels[l][0].'#'
+ endif
+ endfor
+ let h_complete_id .= headers_levels[h_level-1][0]
+
+ if numbering > 0 && numbering <= h_level
+ let h_number = join(map(copy(headers_levels[numbering-1 : h_level-1]), 'v:val[1]'), '.')
+ let h_number .= vimwiki#vars#get_global('html_header_numbering_sym')
+ let h_text = h_number.' '.h_text
+ endif
+
+ call add(complete_header_infos, [h_level, h_complete_id, h_text])
+ endfor
+
+ let lines = []
+ let startindent = repeat(' ', vimwiki#lst#get_list_margin())
+ let indentstring = repeat(' ', vimwiki#u#sw())
+ let bullet = vimwiki#lst#default_symbol().' '
+ for [lvl, link, desc] in complete_header_infos
+ let esc_link = substitute(link, "'", "''", 'g')
+ let esc_desc = substitute(desc, "'", "''", 'g')
+ let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
+ if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
+ let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
+ endif
+ let link = s:safesubstitute(link_tpl, '__LinkUrl__',
+ \ '#'.esc_link, '')
+ let link = s:safesubstitute(link, '__LinkDescription__', esc_desc, '')
+ call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link)
+ endfor
+
+ let links_rx = '\m^\s*'.vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
+
+ call vimwiki#base#update_listing_in_buffer(lines,
+ \ vimwiki#vars#get_global('toc_header'), links_rx, 1, a:create)
+endfunction
+
+
+" Construct a regular expression matching from template (with special
+" characters properly escaped), by substituting rxUrl for __LinkUrl__, rxDesc
+" for __LinkDescription__, and rxStyle for __LinkStyle__. The three
+" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
+" special character escapes or substitutions.
+function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle)
+ let lnk = a:template
+ if a:rxUrl != ""
+ let lnk = s:safesubstitute(lnk, '__LinkUrl__', a:rxUrl, 'g')
+ endif
+ if a:rxDesc != ""
+ let lnk = s:safesubstitute(lnk, '__LinkDescription__', a:rxDesc, 'g')
+ endif
+ if a:rxStyle != ""
+ let lnk = s:safesubstitute(lnk, '__LinkStyle__', a:rxStyle, 'g')
+ endif
+ return lnk
+endfunction
+
+
+function! s:clean_url(url)
+ let url = split(a:url, '/\|=\|-\|&\|?\|\.')
+ let url = filter(url, 'v:val !=# ""')
+ let url = filter(url, 'v:val !=# "www"')
+ let url = filter(url, 'v:val !=# "com"')
+ let url = filter(url, 'v:val !=# "org"')
+ let url = filter(url, 'v:val !=# "net"')
+ let url = filter(url, 'v:val !=# "edu"')
+ let url = filter(url, 'v:val !=# "http\:"')
+ let url = filter(url, 'v:val !=# "https\:"')
+ let url = filter(url, 'v:val !=# "file\:"')
+ let url = filter(url, 'v:val !=# "xml\:"')
+ return join(url, " ")
+endfunction
+
+
+function! s:is_diary_file(filename)
+ let file_path = vimwiki#path#path_norm(a:filename)
+ let rel_path = vimwiki#vars#get_wikilocal('diary_rel_path')
+ let diary_path = vimwiki#path#path_norm(vimwiki#vars#get_wikilocal('path') . rel_path)
+ return rel_path != '' && file_path =~# '^'.vimwiki#u#escape(diary_path)
+endfunction
+
+
+function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template)
+ let url = matchstr(a:str, a:rxUrl)
+ let descr = matchstr(a:str, a:rxDesc)
+ if descr == ""
+ let descr = s:clean_url(url)
+ endif
+ let lnk = s:safesubstitute(a:template, '__LinkDescription__', descr, '')
+ let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '')
+ return lnk
+endfunction
+
+
+function! vimwiki#base#normalize_imagelink_helper(str, rxUrl, rxDesc, rxStyle, template)
+ let lnk = vimwiki#base#normalize_link_helper(a:str, a:rxUrl, a:rxDesc, a:template)
+ let style = matchstr(a:str, a:rxStyle)
+ let lnk = s:safesubstitute(lnk, '__LinkStyle__', style, '')
+ return lnk
+endfunction
+
+
+function! s:normalize_link_in_diary(lnk)
+ let link = a:lnk . vimwiki#vars#get_wikilocal('ext')
+ let link_wiki = vimwiki#vars#get_wikilocal('path') . '/' . link
+ let link_diary = vimwiki#vars#get_wikilocal('path') . '/'
+ \ . vimwiki#vars#get_wikilocal('diary_rel_path') . '/' . link
+ let link_exists_in_diary = filereadable(link_diary)
+ let link_exists_in_wiki = filereadable(link_wiki)
+ let link_is_date = a:lnk =~# '\d\d\d\d-\d\d-\d\d'
+
+ if ! link_exists_in_wiki || link_exists_in_diary || link_is_date
+ let str = a:lnk
+ let rxUrl = vimwiki#vars#get_global('rxWord')
+ let rxDesc = ''
+ let template = vimwiki#vars#get_global('WikiLinkTemplate1')
+ else
+ let depth = len(split(vimwiki#vars#get_wikilocal('diary_rel_path'), '/'))
+ let str = repeat('../', depth) . a:lnk . '|' . a:lnk
+ let rxUrl = '^.*\ze|'
+ let rxDesc = '|\zs.*$'
+ let template = vimwiki#vars#get_global('WikiLinkTemplate2')
+ endif
+
+ return vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template)
+endfunction
+
+
+function! s:normalize_link_syntax_n()
+
+ " try WikiLink
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'),
+ \ vimwiki#vars#get_global('WikiLinkTemplate2'))
+ call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink'), sub)
+ return
+ endif
+
+ " try WikiIncl
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl'))
+ if !empty(lnk)
+ " NO-OP !!
+ return
+ endif
+
+ " try Weblink
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ lnk, '', vimwiki#vars#get_global('WikiLinkTemplate2'))
+ call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'), sub)
+ return
+ endif
+
+ " try Word (any characters except separators)
+ " rxWord is less permissive than rxWikiLinkUrl which is used in
+ " normalize_link_syntax_v
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord'))
+ if !empty(lnk)
+ if s:is_diary_file(expand("%:p"))
+ let sub = s:normalize_link_in_diary(lnk)
+ else
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_global('rxWord'), '',
+ \ vimwiki#vars#get_global('WikiLinkTemplate1'))
+ endif
+ call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
+ return
+ endif
+
+endfunction
+
+
+function! s:normalize_link_syntax_v()
+ let sel_save = &selection
+ let &selection = "old"
+ let default_register_save = @"
+ let registertype_save = getregtype('"')
+
+ try
+ " Save selected text to register "
+ normal! gv""y
+
+ " Set substitution
+ if s:is_diary_file(expand("%:p"))
+ let sub = s:normalize_link_in_diary(@")
+ else
+ let sub = s:safesubstitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
+ \ '__LinkUrl__', @", '')
+ endif
+
+ " Put substitution in register " and change text
+ call setreg('"', substitute(sub, '\n', '', ''), visualmode())
+ normal! `>""pgvd
+ finally
+ call setreg('"', default_register_save, registertype_save)
+ let &selection = sel_save
+ endtry
+endfunction
+
+
+function! vimwiki#base#normalize_link(is_visual_mode)
+ if exists('*vimwiki#'.vimwiki#vars#get_wikilocal('syntax').'_base#normalize_link')
+ " Syntax-specific links
+ call vimwiki#{vimwiki#vars#get_wikilocal('syntax')}_base#normalize_link(a:is_visual_mode)
+ else
+ if !a:is_visual_mode
+ call s:normalize_link_syntax_n()
+ elseif line("'<") == line("'>")
+ " action undefined for multi-line visual mode selections
+ call s:normalize_link_syntax_v()
+ endif
+ endif
+endfunction
+
+
+function! vimwiki#base#detect_nested_syntax()
+ let last_word = '\v.*<(\w+)\s*$'
+ let lines = map(filter(getline(1, "$"), 'v:val =~ "\\%({{{\\|```\\)" && v:val =~ last_word'),
+ \ 'substitute(v:val, last_word, "\\=submatch(1)", "")')
+ let dict = {}
+ for elem in lines
+ let dict[elem] = elem
+ endfor
+ return dict
+endfunction
+
+
+function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort
+ " We can safely ignore args if we use -custom=complete option, Vim engine
+ " will do the job of filtering.
+ return vimwiki#base#get_globlinks_escaped()
+endfunction
+
+
+" -------------------------------------------------------------------------
+" Load syntax-specific Wiki functionality
+for s:syn in s:vimwiki_get_known_syntaxes()
+ execute 'runtime! autoload/vimwiki/'.s:syn.'_base.vim'
+endfor
+" -------------------------------------------------------------------------
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/customwiki2html.sh b/vim/.vim/plugged/vimwiki/autoload/vimwiki/customwiki2html.sh
new file mode 100644
index 0000000..6b0c17a
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/customwiki2html.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# This script converts markdown into html, to be used with vimwiki's
+# "customwiki2html" option. Experiment with the two proposed methods by
+# commenting / uncommenting the relevant lines below.
+#
+# NEW! An alternative converter was developed by Jason6Anderson, and can
+# be located at https://github.com/vimwiki-backup/vimwiki/issues/384
+#
+#
+# To use this script, you must have the Discount converter installed.
+#
+# http://www.pell.portland.or.us/~orc/Code/discount/
+#
+# To verify your installation, check that the commands markdown and mkd2text,
+# are on your path.
+#
+# Also verify that this file is executable.
+#
+# Then, in your .vimrc file, set:
+#
+# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
+#
+# On your next restart, Vimwiki will run this script instead of using the
+# internal wiki2html converter.
+#
+
+MARKDOWN=markdown
+MKD2HTML=mkd2html
+
+
+FORCE="$1"
+SYNTAX="$2"
+EXTENSION="$3"
+OUTPUTDIR="$4"
+INPUT="$5"
+CSSFILE="$6"
+
+FORCEFLAG=
+
+[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; };
+[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; };
+
+OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
+
+# # Method 1:
+# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
+#
+# URLBASE=http://example.com
+# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT
+
+
+# Method 2:
+# mkd2html [-css file] [-header string] [-footer string] [file]
+
+$MKD2HTML -css "$CSSFILE" "$INPUT"
+OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
+mv -f "$OUTPUTTMP" "$OUTPUT"
+
+
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/default.tpl b/vim/.vim/plugged/vimwiki/autoload/vimwiki/default.tpl
new file mode 100644
index 0000000..3a4045f
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/default.tpl
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
+<title>%title%</title>
+<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
+</head>
+<body>
+%content%
+</body>
+</html>
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/diary.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/diary.vim
new file mode 100644
index 0000000..164211d
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/diary.vim
@@ -0,0 +1,322 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Handle diary notes
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+if exists("g:loaded_vimwiki_diary_auto") || &cp
+ finish
+endif
+let g:loaded_vimwiki_diary_auto = 1
+
+
+let s:vimwiki_max_scan_for_caption = 5
+
+
+function! s:prefix_zero(num)
+ if a:num < 10
+ return '0'.a:num
+ endif
+ return a:num
+endfunction
+
+
+function! s:diary_path(...)
+ let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
+ return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)
+endfunction
+
+
+function! s:diary_index(...)
+ let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
+ return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).
+ \ vimwiki#vars#get_wikilocal('ext', idx)
+endfunction
+
+
+function! vimwiki#diary#diary_date_link(...)
+ if a:0
+ return strftime('%Y-%m-%d', a:1)
+ else
+ return strftime('%Y-%m-%d')
+ endif
+endfunction
+
+
+function! s:get_position_links(link)
+ let idx = -1
+ let links = []
+ if a:link =~# '^\d\{4}-\d\d-\d\d'
+ let links = map(s:get_diary_files(), 'fnamemodify(v:val, ":t:r")')
+ " include 'today' into links
+ if index(links, vimwiki#diary#diary_date_link()) == -1
+ call add(links, vimwiki#diary#diary_date_link())
+ endif
+ call sort(links)
+ let idx = index(links, a:link)
+ endif
+ return [idx, links]
+endfunction
+
+
+function! s:get_month_name(month)
+ return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
+endfunction
+
+
+function! s:read_captions(files)
+ let result = {}
+ let rx_header = vimwiki#vars#get_syntaxlocal('rxHeader')
+ for fl in a:files
+ " remove paths and extensions
+ let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
+
+ if filereadable(fl)
+ for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
+ if line =~# rx_header && !has_key(result, fl_key)
+ let result[fl_key] = vimwiki#u#trim(matchstr(line, rx_header))
+ endif
+ endfor
+ endif
+
+ if !has_key(result, fl_key)
+ let result[fl_key] = ''
+ endif
+
+ endfor
+ return result
+endfunction
+
+
+function! s:get_diary_files()
+ let rx = '^\d\{4}-\d\d-\d\d'
+ let s_files = glob(vimwiki#vars#get_wikilocal('path').
+ \ vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
+ let files = split(s_files, '\n')
+ call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
+
+ " remove backup files (.wiki~)
+ call filter(files, 'v:val !~# ''.*\~$''')
+
+ return files
+endfunction
+
+
+function! s:group_links(links)
+ let result = {}
+ let p_year = 0
+ let p_month = 0
+ for fl in sort(keys(a:links))
+ let year = strpart(fl, 0, 4)
+ let month = strpart(fl, 5, 2)
+ if p_year != year
+ let result[year] = {}
+ let p_month = 0
+ endif
+ if p_month != month
+ let result[year][month] = {}
+ endif
+ let result[year][month][fl] = a:links[fl]
+ let p_year = year
+ let p_month = month
+ endfor
+ return result
+endfunction
+
+
+function! s:sort(lst)
+ if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc'
+ return reverse(sort(a:lst))
+ else
+ return sort(a:lst)
+ endif
+endfunction
+
+
+function! s:format_diary()
+ let result = []
+
+ let links_with_captions = s:read_captions(s:get_diary_files())
+ let g_files = s:group_links(links_with_captions)
+
+ for year in s:sort(keys(g_files))
+ call add(result, '')
+ call add(result,
+ \ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
+
+ for month in s:sort(keys(g_files[year]))
+ call add(result, '')
+ call add(result, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
+ \ '__Header__', s:get_month_name(month), ''))
+
+ for [fl, cap] in s:sort(items(g_files[year][month]))
+ let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
+
+ if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
+ let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
+
+ if empty(cap) " When using markdown syntax, we should ensure we always have a link description.
+ let cap = fl
+ endif
+ elseif empty(cap)
+ let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
+ endif
+
+ let entry = substitute(link_tpl, '__LinkUrl__', fl, '')
+ let entry = substitute(entry, '__LinkDescription__', cap, '')
+ call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
+ endfor
+
+ endfor
+ endfor
+
+ return result
+endfunction
+
+
+" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
+" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
+" is used.
+function! vimwiki#diary#make_note(wnum, ...)
+ if a:wnum == 0
+ let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
+ if wiki_nr < 0 " this happens when e.g. VimwikiMakeDiaryNote was called outside a wiki buffer
+ let wiki_nr = 0
+ endif
+ else
+ let wiki_nr = a:wnum - 1
+ endif
+
+ if wiki_nr >= vimwiki#vars#number_of_wikis()
+ echomsg 'Vimwiki Error: Wiki '.wiki_nr.' is not registered in g:vimwiki_list!'
+ return
+ endif
+
+ " TODO: refactor it. base#goto_index uses the same
+
+ call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
+ \ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
+
+ let cmd = 'edit'
+ if a:0
+ if a:1 == 1
+ let cmd = 'tabedit'
+ elseif a:1 == 2
+ let cmd = 'split'
+ elseif a:1 == 3
+ let cmd = 'vsplit'
+ endif
+ endif
+ if a:0>1
+ let link = 'diary:'.a:2
+ else
+ let link = 'diary:'.vimwiki#diary#diary_date_link()
+ endif
+
+ call vimwiki#base#open_link(cmd, link, s:diary_index(wiki_nr))
+endfunction
+
+
+function! vimwiki#diary#goto_diary_index(wnum)
+ if a:wnum > vimwiki#vars#number_of_wikis()
+ echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
+ return
+ endif
+
+ " TODO: refactor it. base#goto_index uses the same
+ if a:wnum > 0
+ let idx = a:wnum - 1
+ else
+ let idx = 0
+ endif
+
+ call vimwiki#base#edit_file('e', s:diary_index(idx), '')
+endfunction
+
+
+function! vimwiki#diary#goto_next_day()
+ let link = ''
+ let [idx, links] = s:get_position_links(expand('%:t:r'))
+
+ if idx == (len(links) - 1)
+ return
+ endif
+
+ if idx != -1 && idx < len(links) - 1
+ let link = 'diary:'.links[idx+1]
+ else
+ " goto today
+ let link = 'diary:'.vimwiki#diary#diary_date_link()
+ endif
+
+ if len(link)
+ call vimwiki#base#open_link(':e ', link)
+ endif
+endfunction
+
+
+function! vimwiki#diary#goto_prev_day()
+ let link = ''
+ let [idx, links] = s:get_position_links(expand('%:t:r'))
+
+ if idx == 0
+ return
+ endif
+
+ if idx > 0
+ let link = 'diary:'.links[idx-1]
+ else
+ " goto today
+ let link = 'diary:'.vimwiki#diary#diary_date_link()
+ endif
+
+ if len(link)
+ call vimwiki#base#open_link(':e ', link)
+ endif
+endfunction
+
+
+function! vimwiki#diary#generate_diary_section()
+ let current_file = vimwiki#path#path_norm(expand("%:p"))
+ let diary_file = vimwiki#path#path_norm(s:diary_index())
+ if vimwiki#path#is_equal(current_file, diary_file)
+ let content_rx = '^\%(\s*\* \)\|\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)'
+ call vimwiki#base#update_listing_in_buffer(s:format_diary(),
+ \ vimwiki#vars#get_wikilocal('diary_header'), content_rx, line('$')+1, 1)
+ else
+ echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
+ endif
+endfunction
+
+
+" Callback function for Calendar.vim
+function! vimwiki#diary#calendar_action(day, month, year, week, dir)
+ let day = s:prefix_zero(a:day)
+ let month = s:prefix_zero(a:month)
+
+ let link = a:year.'-'.month.'-'.day
+ if winnr('#') == 0
+ if a:dir ==? 'V'
+ vsplit
+ else
+ split
+ endif
+ else
+ wincmd p
+ if !&hidden && &modified
+ new
+ endif
+ endif
+
+ call vimwiki#diary#make_note(0, 0, link)
+endfunction
+
+
+function vimwiki#diary#calendar_sign(day, month, year)
+ let day = s:prefix_zero(a:day)
+ let month = s:prefix_zero(a:month)
+ let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').
+ \ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
+ return filereadable(expand(sfile))
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/html.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/html.vim
new file mode 100644
index 0000000..bce5465
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/html.vim
@@ -0,0 +1,1666 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: HTML export
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+if exists("g:loaded_vimwiki_html_auto") || &cp
+ finish
+endif
+let g:loaded_vimwiki_html_auto = 1
+
+
+function! s:root_path(subdir)
+ return repeat('../', len(split(a:subdir, '[/\\]')))
+endfunction
+
+
+function! s:syntax_supported()
+ return vimwiki#vars#get_wikilocal('syntax') ==? "default"
+endfunction
+
+
+function! s:remove_blank_lines(lines)
+ while !empty(a:lines) && a:lines[-1] =~# '^\s*$'
+ call remove(a:lines, -1)
+ endwhile
+endfunction
+
+
+function! s:is_web_link(lnk)
+ if a:lnk =~# '^\%(https://\|http://\|www.\|ftp://\|file://\|mailto:\)'
+ return 1
+ endif
+ return 0
+endfunction
+
+
+function! s:is_img_link(lnk)
+ if tolower(a:lnk) =~# '\.\%(png\|jpg\|gif\|jpeg\)$'
+ return 1
+ endif
+ return 0
+endfunction
+
+
+function! s:has_abs_path(fname)
+ if a:fname =~# '\(^.:\)\|\(^/\)'
+ return 1
+ endif
+ return 0
+endfunction
+
+
+function! s:find_autoload_file(name)
+ for path in split(&runtimepath, ',')
+ let fname = path.'/autoload/vimwiki/'.a:name
+ if glob(fname) != ''
+ return fname
+ endif
+ endfor
+ return ''
+endfunction
+
+
+function! s:default_CSS_full_name(path)
+ let path = expand(a:path)
+ let css_full_name = path . vimwiki#vars#get_wikilocal('css_name')
+ return css_full_name
+endfunction
+
+
+function! s:create_default_CSS(path)
+ let css_full_name = s:default_CSS_full_name(a:path)
+ if glob(css_full_name) == ""
+ call vimwiki#path#mkdir(fnamemodify(css_full_name, ':p:h'))
+ let default_css = s:find_autoload_file('style.css')
+ if default_css != ''
+ let lines = readfile(default_css)
+ call writefile(lines, css_full_name)
+ return 1
+ endif
+ endif
+ return 0
+endfunction
+
+
+function! s:template_full_name(name)
+ if a:name == ''
+ let name = vimwiki#vars#get_wikilocal('template_default')
+ else
+ let name = a:name
+ endif
+
+ let fname = expand(vimwiki#vars#get_wikilocal('template_path').
+ \ name . vimwiki#vars#get_wikilocal('template_ext'))
+
+ if filereadable(fname)
+ return fname
+ else
+ return ''
+ endif
+endfunction
+
+
+function! s:get_html_template(template)
+ " TODO: refactor it!!!
+ let lines=[]
+
+ if a:template != ''
+ let template_name = s:template_full_name(a:template)
+ try
+ let lines = readfile(template_name)
+ return lines
+ catch /E484/
+ echomsg 'Vimwiki: HTML template '.template_name. ' does not exist!'
+ endtry
+ endif
+
+ let default_tpl = s:template_full_name('')
+
+ if default_tpl == ''
+ let default_tpl = s:find_autoload_file('default.tpl')
+ endif
+
+ let lines = readfile(default_tpl)
+ return lines
+endfunction
+
+
+function! s:safe_html_preformatted(line)
+ let line = substitute(a:line,'<','\&lt;', 'g')
+ let line = substitute(line,'>','\&gt;', 'g')
+ return line
+endfunction
+
+
+function! s:escape_html_attribute(string)
+ return substitute(a:string, '"', '\&quot;', 'g')
+endfunction
+
+
+function! s:safe_html_line(line)
+ " escape & < > when producing HTML text
+ " s:lt_pattern, s:gt_pattern depend on g:vimwiki_valid_html_tags
+ " and are set in vimwiki#html#Wiki2HTML()
+ let line = substitute(a:line, '&', '\&amp;', 'g')
+ let line = substitute(line,s:lt_pattern,'\&lt;', 'g')
+ let line = substitute(line,s:gt_pattern,'\&gt;', 'g')
+
+ return line
+endfunction
+
+
+function! s:delete_html_files(path)
+ let htmlfiles = split(glob(a:path.'**/*.html'), '\n')
+ for fname in htmlfiles
+ " ignore user html files, e.g. search.html,404.html
+ if stridx(vimwiki#vars#get_global('user_htmls'), fnamemodify(fname, ":t")) >= 0
+ continue
+ endif
+
+ " delete if there is no corresponding wiki file
+ let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path_html'), fname)
+ let wikifile = vimwiki#vars#get_wikilocal('path').subdir.
+ \fnamemodify(fname, ":t:r").vimwiki#vars#get_wikilocal('ext')
+ if filereadable(wikifile)
+ continue
+ endif
+
+ try
+ call delete(fname)
+ catch
+ echomsg 'Vimwiki Error: Cannot delete '.fname
+ endtry
+ endfor
+endfunction
+
+
+function! s:mid(value, cnt)
+ return strpart(a:value, a:cnt, len(a:value) - 2 * a:cnt)
+endfunction
+
+
+function! s:subst_func(line, regexp, func, ...)
+ " Substitute text found by regexp with result of
+ " func(matched) function.
+
+ let pos = 0
+ let lines = split(a:line, a:regexp, 1)
+ let res_line = ""
+ for line in lines
+ let res_line = res_line.line
+ let matched = matchstr(a:line, a:regexp, pos)
+ if matched != ""
+ if a:0
+ let res_line = res_line.{a:func}(matched, a:1)
+ else
+ let res_line = res_line.{a:func}(matched)
+ endif
+ endif
+ let pos = matchend(a:line, a:regexp, pos)
+ endfor
+ return res_line
+endfunction
+
+
+function! s:save_vimwiki_buffer()
+ if &filetype ==? 'vimwiki' && filewritable(expand('%'))
+ silent update
+ endif
+endfunction
+
+
+function! s:process_date(placeholders, default_date)
+ if !empty(a:placeholders)
+ for [placeholder, row, idx] in a:placeholders
+ let [type, param] = placeholder
+ if type ==# 'date' && !empty(param)
+ return param
+ endif
+ endfor
+ endif
+ return a:default_date
+endfunction
+
+
+function! s:process_title(placeholders, default_title)
+ if !empty(a:placeholders)
+ for [placeholder, row, idx] in a:placeholders
+ let [type, param] = placeholder
+ if type ==# 'title' && !empty(param)
+ return param
+ endif
+ endfor
+ endif
+ return a:default_title
+endfunction
+
+
+function! s:is_html_uptodate(wikifile)
+ let tpl_time = -1
+
+ let tpl_file = s:template_full_name('')
+ if tpl_file != ''
+ let tpl_time = getftime(tpl_file)
+ endif
+
+ let wikifile = fnamemodify(a:wikifile, ":p")
+ let htmlfile = expand(vimwiki#vars#get_wikilocal('path_html') .
+ \ vimwiki#vars#get_bufferlocal('subdir') . fnamemodify(wikifile, ":t:r").".html")
+
+ if getftime(wikifile) <= getftime(htmlfile) && tpl_time <= getftime(htmlfile)
+ return 1
+ endif
+ return 0
+endfunction
+
+
+function! s:html_insert_contents(html_lines, content)
+ let lines = []
+ for line in a:html_lines
+ if line =~# '%content%'
+ let parts = split(line, '%content%', 1)
+ if empty(parts)
+ call extend(lines, a:content)
+ else
+ for idx in range(len(parts))
+ call add(lines, parts[idx])
+ if idx < len(parts) - 1
+ call extend(lines, a:content)
+ endif
+ endfor
+ endif
+ else
+ call add(lines, line)
+ endif
+ endfor
+ return lines
+endfunction
+
+
+function! s:tag_eqin(value)
+ " mathJAX wants \( \) for inline maths
+ return '\('.s:mid(a:value, 1).'\)'
+endfunction
+
+
+function! s:tag_em(value)
+ return '<em>'.s:mid(a:value, 1).'</em>'
+endfunction
+
+
+function! s:tag_strong(value, header_ids)
+ let text = s:mid(a:value, 1)
+ let id = s:escape_html_attribute(text)
+ let complete_id = ''
+ for l in range(6)
+ if a:header_ids[l][0] != ''
+ let complete_id .= a:header_ids[l][0].'-'
+ endif
+ endfor
+ if a:header_ids[5][0] == ''
+ let complete_id = complete_id[:-2]
+ endif
+ let complete_id .= '-'.id
+ return '<span id="'.s:escape_html_attribute(complete_id).'"></span><strong id="'
+ \ .id.'">'.text.'</strong>'
+endfunction
+
+
+function! s:tag_tags(value, header_ids)
+ let complete_id = ''
+ for level in range(6)
+ if a:header_ids[level][0] != ''
+ let complete_id .= a:header_ids[level][0].'-'
+ endif
+ endfor
+ if a:header_ids[5][0] == ''
+ let complete_id = complete_id[:-2]
+ endif
+ let complete_id = s:escape_html_attribute(complete_id)
+
+ let result = []
+ for tag in split(a:value, ':')
+ let id = s:escape_html_attribute(tag)
+ call add(result, '<span id="'.complete_id.'-'.id.'"></span><span class="tag" id="'
+ \ .id.'">'.tag.'</span>')
+ endfor
+ return join(result)
+endfunction
+
+
+function! s:tag_todo(value)
+ return '<span class="todo">'.a:value.'</span>'
+endfunction
+
+
+function! s:tag_strike(value)
+ return '<del>'.s:mid(a:value, 2).'</del>'
+endfunction
+
+
+function! s:tag_super(value)
+ return '<sup><small>'.s:mid(a:value, 1).'</small></sup>'
+endfunction
+
+
+function! s:tag_sub(value)
+ return '<sub><small>'.s:mid(a:value, 2).'</small></sub>'
+endfunction
+
+
+function! s:tag_code(value)
+ return '<code>'.s:safe_html_preformatted(s:mid(a:value, 1)).'</code>'
+endfunction
+
+
+" match n-th ARG within {{URL[|ARG1|ARG2|...]}}
+" *c,d,e),...
+function! s:incl_match_arg(nn_index)
+ let rx = vimwiki#vars#get_global('rxWikiInclPrefix'). vimwiki#vars#get_global('rxWikiInclUrl')
+ let rx = rx . repeat(vimwiki#vars#get_global('rxWikiInclSeparator') .
+ \ vimwiki#vars#get_global('rxWikiInclArg'), a:nn_index-1)
+ if a:nn_index > 0
+ let rx = rx. vimwiki#vars#get_global('rxWikiInclSeparator'). '\zs' .
+ \ vimwiki#vars#get_global('rxWikiInclArg') . '\ze'
+ endif
+ let rx = rx . vimwiki#vars#get_global('rxWikiInclArgs') .
+ \ vimwiki#vars#get_global('rxWikiInclSuffix')
+ return rx
+endfunction
+
+
+function! s:linkify_link(src, descr)
+ let src_str = ' href="'.s:escape_html_attribute(a:src).'"'
+ let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','')
+ let descr = (descr == "" ? a:src : descr)
+ let descr_str = (descr =~# vimwiki#vars#get_global('rxWikiIncl')
+ \ ? s:tag_wikiincl(descr)
+ \ : descr)
+ return '<a'.src_str.'>'.descr_str.'</a>'
+endfunction
+
+
+function! s:linkify_image(src, descr, verbatim_str)
+ let src_str = ' src="'.a:src.'"'
+ let descr_str = (a:descr != '' ? ' alt="'.a:descr.'"' : '')
+ let verbatim_str = (a:verbatim_str != '' ? ' '.a:verbatim_str : '')
+ return '<img'.src_str.descr_str.verbatim_str.' />'
+endfunction
+
+
+function! s:tag_weblink(value)
+ " Weblink Template -> <a href="url">descr</a>
+ let str = a:value
+ let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'))
+ let descr = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWeblinkMatchDescr'))
+ let line = s:linkify_link(url, descr)
+ return line
+endfunction
+
+
+function! s:tag_wikiincl(value)
+ " {{imgurl|arg1|arg2}} -> ???
+ " {{imgurl}} -> <img src="imgurl"/>
+ " {{imgurl|descr|style="A"}} -> <img src="imgurl" alt="descr" style="A" />
+ " {{imgurl|descr|class="B"}} -> <img src="imgurl" alt="descr" class="B" />
+ let str = a:value
+ " custom transclusions
+ let line = VimwikiWikiIncludeHandler(str)
+ " otherwise, assume image transclusion
+ if line == ''
+ let url_0 = matchstr(str, vimwiki#vars#get_global('rxWikiInclMatchUrl'))
+ let descr = matchstr(str, s:incl_match_arg(1))
+ let verbatim_str = matchstr(str, s:incl_match_arg(2))
+
+ let link_infos = vimwiki#base#resolve_link(url_0)
+
+ if link_infos.scheme =~# '\mlocal\|wiki\d\+\|diary'
+ let url = vimwiki#path#relpath(fnamemodify(s:current_html_file, ':h'), link_infos.filename)
+ " strip the .html extension when we have wiki links, so that the user can
+ " simply write {{image.png}} to include an image from the wiki directory
+ if link_infos.scheme =~# '\mwiki\d\+\|diary'
+ let url = fnamemodify(url, ':r')
+ endif
+ else
+ let url = link_infos.filename
+ endif
+
+ let url = escape(url, '#')
+ let line = s:linkify_image(url, descr, verbatim_str)
+ endif
+ return line
+endfunction
+
+
+function! s:tag_wikilink(value)
+ " [[url]] -> <a href="url.html">url</a>
+ " [[url|descr]] -> <a href="url.html">descr</a>
+ " [[url|{{...}}]] -> <a href="url.html"> ... </a>
+ " [[fileurl.ext|descr]] -> <a href="fileurl.ext">descr</a>
+ " [[dirurl/|descr]] -> <a href="dirurl/index.html">descr</a>
+ " [[url#a1#a2]] -> <a href="url.html#a1-a2">url#a1#a2</a>
+ " [[#a1#a2]] -> <a href="#a1-a2">#a1#a2</a>
+ let str = a:value
+ let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
+ let descr = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'))
+ let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url)
+
+ let line = VimwikiLinkConverter(url, s:current_wiki_file, s:current_html_file)
+ if line == ''
+ let link_infos = vimwiki#base#resolve_link(url, s:current_wiki_file)
+
+ if link_infos.scheme ==# 'file'
+ " external file links are always absolute
+ let html_link = link_infos.filename
+ elseif link_infos.scheme ==# 'local'
+ let html_link = vimwiki#path#relpath(fnamemodify(s:current_html_file, ':h'),
+ \ link_infos.filename)
+ elseif link_infos.scheme =~# '\mwiki\d\+\|diary'
+ " wiki links are always relative to the current file
+ let html_link = vimwiki#path#relpath(
+ \ fnamemodify(s:current_wiki_file, ':h'),
+ \ fnamemodify(link_infos.filename, ':r'))
+ if html_link !~ '\m/$'
+ let html_link .= '.html'
+ endif
+ else " other schemes, like http, are left untouched
+ let html_link = link_infos.filename
+ endif
+
+ if link_infos.anchor != ''
+ let anchor = substitute(link_infos.anchor, '#', '-', 'g')
+ let html_link .= '#'.anchor
+ endif
+ let line = html_link
+ endif
+
+ let line = s:linkify_link(line, descr)
+ return line
+endfunction
+
+
+function! s:tag_remove_internal_link(value)
+ let value = s:mid(a:value, 2)
+
+ let line = ''
+ if value =~# '|'
+ let link_parts = split(value, "|", 1)
+ else
+ let link_parts = split(value, "][", 1)
+ endif
+
+ if len(link_parts) > 1
+ if len(link_parts) < 3
+ let style = ""
+ else
+ let style = link_parts[2]
+ endif
+ let line = link_parts[1]
+ else
+ let line = value
+ endif
+ return line
+endfunction
+
+
+function! s:tag_remove_external_link(value)
+ let value = s:mid(a:value, 1)
+
+ let line = ''
+ if s:is_web_link(value)
+ let lnkElements = split(value)
+ let head = lnkElements[0]
+ let rest = join(lnkElements[1:])
+ if rest == ""
+ let rest = head
+ endif
+ let line = rest
+ elseif s:is_img_link(value)
+ let line = '<img src="'.value.'" />'
+ else
+ " [alskfj sfsf] shouldn't be a link. So return it as it was --
+ " enclosed in [...]
+ let line = '['.value.']'
+ endif
+ return line
+endfunction
+
+
+function! s:make_tag(line, regexp, func, ...)
+ " Make tags for a given matched regexp.
+ " Exclude preformatted text and href links.
+ " FIXME
+ let patt_splitter = '\(`[^`]\+`\)\|'.
+ \ '\('.vimwiki#vars#get_syntaxlocal('rxPreStart').'.\+'.
+ \ vimwiki#vars#get_syntaxlocal('rxPreEnd').'\)\|'.
+ \ '\(<a href.\{-}</a>\)\|'.
+ \ '\(<img src.\{-}/>\)\|'.
+ \ '\(<pre.\{-}</pre>\)\|'.
+ \ '\('.vimwiki#vars#get_syntaxlocal('rxEqIn').'\)'
+
+ "FIXME FIXME !!! these can easily occur on the same line!
+ "XXX {{{ }}} ??? obsolete
+ if '`[^`]\+`' ==# a:regexp || '{{{.\+}}}' ==# a:regexp ||
+ \ vimwiki#vars#get_syntaxlocal('rxEqIn') ==# a:regexp
+ let res_line = s:subst_func(a:line, a:regexp, a:func)
+ else
+ let pos = 0
+ " split line with patt_splitter to have parts of line before and after
+ " href links, preformatted text
+ " ie:
+ " hello world `is just a` simple <a href="link.html">type of</a> prg.
+ " result:
+ " ['hello world ', ' simple ', 'type of', ' prg']
+ let lines = split(a:line, patt_splitter, 1)
+ let res_line = ""
+ for line in lines
+ if a:0
+ let res_line = res_line.s:subst_func(line, a:regexp, a:func, a:1)
+ else
+ let res_line = res_line.s:subst_func(line, a:regexp, a:func)
+ endif
+ let res_line = res_line.matchstr(a:line, patt_splitter, pos)
+ let pos = matchend(a:line, patt_splitter, pos)
+ endfor
+ endif
+ return res_line
+endfunction
+
+
+function! s:process_tags_remove_links(line)
+ let line = a:line
+ let line = s:make_tag(line, '\[\[.\{-}\]\]', 's:tag_remove_internal_link')
+ let line = s:make_tag(line, '\[.\{-}\]', 's:tag_remove_external_link')
+ return line
+endfunction
+
+
+function! s:process_tags_typefaces(line, header_ids)
+ let line = a:line
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxItalic'), 's:tag_em')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxBold'), 's:tag_strong', a:header_ids)
+ let line = s:make_tag(line, vimwiki#vars#get_global('rxTodo'), 's:tag_todo')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxDelText'), 's:tag_strike')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSuperScript'), 's:tag_super')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSubScript'), 's:tag_sub')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxCode'), 's:tag_code')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxEqIn'), 's:tag_eqin')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxTags'), 's:tag_tags', a:header_ids)
+ return line
+endfunction
+
+
+function! s:process_tags_links(line)
+ let line = a:line
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxWikiLink'), 's:tag_wikilink')
+ let line = s:make_tag(line, vimwiki#vars#get_global('rxWikiIncl'), 's:tag_wikiincl')
+ let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxWeblink'), 's:tag_weblink')
+ return line
+endfunction
+
+
+function! s:process_inline_tags(line, header_ids)
+ let line = s:process_tags_links(a:line)
+ let line = s:process_tags_typefaces(line, a:header_ids)
+ return line
+endfunction
+
+
+function! s:close_tag_pre(pre, ldest)
+ if a:pre[0]
+ call insert(a:ldest, "</pre>")
+ return 0
+ endif
+ return a:pre
+endfunction
+
+
+function! s:close_tag_math(math, ldest)
+ if a:math[0]
+ call insert(a:ldest, "\\\]")
+ return 0
+ endif
+ return a:math
+endfunction
+
+
+function! s:close_tag_quote(quote, ldest)
+ if a:quote
+ call insert(a:ldest, "</blockquote>")
+ return 0
+ endif
+ return a:quote
+endfunction
+
+
+function! s:close_tag_para(para, ldest)
+ if a:para
+ call insert(a:ldest, "</p>")
+ return 0
+ endif
+ return a:para
+endfunction
+
+
+function! s:close_tag_table(table, ldest, header_ids)
+ " The first element of table list is a string which tells us if table should be centered.
+ " The rest elements are rows which are lists of columns:
+ " ['center',
+ " [ CELL1, CELL2, CELL3 ],
+ " [ CELL1, CELL2, CELL3 ],
+ " [ CELL1, CELL2, CELL3 ],
+ " ]
+ " And CELLx is: { 'body': 'col_x', 'rowspan': r, 'colspan': c }
+
+ function! s:sum_rowspan(table)
+ let table = a:table
+
+ " Get max cells
+ let max_cells = 0
+ for row in table[1:]
+ let n_cells = len(row)
+ if n_cells > max_cells
+ let max_cells = n_cells
+ end
+ endfor
+
+ " Sum rowspan
+ for cell_idx in range(max_cells)
+ let rows = 1
+
+ for row_idx in range(len(table)-1, 1, -1)
+ if cell_idx >= len(table[row_idx])
+ let rows = 1
+ continue
+ endif
+
+ if table[row_idx][cell_idx].rowspan == 0
+ let rows += 1
+ else " table[row_idx][cell_idx].rowspan == 1
+ let table[row_idx][cell_idx].rowspan = rows
+ let rows = 1
+ endif
+ endfor
+ endfor
+ endfunction
+
+ function! s:sum_colspan(table)
+ for row in a:table[1:]
+ let cols = 1
+
+ for cell_idx in range(len(row)-1, 0, -1)
+ if row[cell_idx].colspan == 0
+ let cols += 1
+ else "row[cell_idx].colspan == 1
+ let row[cell_idx].colspan = cols
+ let cols = 1
+ endif
+ endfor
+ endfor
+ endfunction
+
+ function! s:close_tag_row(row, header, ldest, header_ids)
+ call add(a:ldest, '<tr>')
+
+ " Set tag element of columns
+ if a:header
+ let tag_name = 'th'
+ else
+ let tag_name = 'td'
+ end
+
+ " Close tag of columns
+ for cell in a:row
+ if cell.rowspan == 0 || cell.colspan == 0
+ continue
+ endif
+
+ if cell.rowspan > 1
+ let rowspan_attr = ' rowspan="' . cell.rowspan . '"'
+ else "cell.rowspan == 1
+ let rowspan_attr = ''
+ endif
+ if cell.colspan > 1
+ let colspan_attr = ' colspan="' . cell.colspan . '"'
+ else "cell.colspan == 1
+ let colspan_attr = ''
+ endif
+
+ call add(a:ldest, '<' . tag_name . rowspan_attr . colspan_attr .'>')
+ call add(a:ldest, s:process_inline_tags(cell.body, a:header_ids))
+ call add(a:ldest, '</'. tag_name . '>')
+ endfor
+
+ call add(a:ldest, '</tr>')
+ endfunction
+
+ let table = a:table
+ let ldest = a:ldest
+ if len(table)
+ call s:sum_rowspan(table)
+ call s:sum_colspan(table)
+
+ if table[0] ==# 'center'
+ call add(ldest, "<table class='center'>")
+ else
+ call add(ldest, "<table>")
+ endif
+
+ " Empty lists are table separators.
+ " Search for the last empty list. All the above rows would be a table header.
+ " We should exclude the first element of the table list as it is a text tag
+ " that shows if table should be centered or not.
+ let head = 0
+ for idx in range(len(table)-1, 1, -1)
+ if empty(table[idx])
+ let head = idx
+ break
+ endif
+ endfor
+ if head > 0
+ for row in table[1 : head-1]
+ if !empty(filter(row, '!empty(v:val)'))
+ call s:close_tag_row(row, 1, ldest, a:header_ids)
+ endif
+ endfor
+ for row in table[head+1 :]
+ call s:close_tag_row(row, 0, ldest, a:header_ids)
+ endfor
+ else
+ for row in table[1 :]
+ call s:close_tag_row(row, 0, ldest, a:header_ids)
+ endfor
+ endif
+ call add(ldest, "</table>")
+ let table = []
+ endif
+ return table
+endfunction
+
+
+function! s:close_tag_list(lists, ldest)
+ while len(a:lists)
+ let item = remove(a:lists, 0)
+ call insert(a:ldest, item[0])
+ endwhile
+endfunction
+
+
+function! s:close_tag_def_list(deflist, ldest)
+ if a:deflist
+ call insert(a:ldest, "</dl>")
+ return 0
+ endif
+ return a:deflist
+endfunction
+
+
+function! s:process_tag_pre(line, pre)
+ " pre is the list of [is_in_pre, indent_of_pre]
+ "XXX always outputs a single line or empty list!
+ let lines = []
+ let pre = a:pre
+ let processed = 0
+ "XXX huh?
+ "if !pre[0] && a:line =~# '^\s*{{{[^\(}}}\)]*\s*$'
+ if !pre[0] && a:line =~# '^\s*{{{'
+ let class = matchstr(a:line, '{{{\zs.*$')
+ "FIXME class cannot contain arbitrary strings
+ let class = substitute(class, '\s\+$', '', 'g')
+ if class != ""
+ call add(lines, "<pre ".class.">")
+ else
+ call add(lines, "<pre>")
+ endif
+ let pre = [1, len(matchstr(a:line, '^\s*\ze{{{'))]
+ let processed = 1
+ elseif pre[0] && a:line =~# '^\s*}}}\s*$'
+ let pre = [0, 0]
+ call add(lines, "</pre>")
+ let processed = 1
+ elseif pre[0]
+ let processed = 1
+ "XXX destroys indent in general!
+ "call add(lines, substitute(a:line, '^\s\{'.pre[1].'}', '', ''))
+ call add(lines, s:safe_html_preformatted(a:line))
+ endif
+ return [processed, lines, pre]
+endfunction
+
+
+function! s:process_tag_math(line, math)
+ " math is the list of [is_in_math, indent_of_math]
+ let lines = []
+ let math = a:math
+ let processed = 0
+ if !math[0] && a:line =~# '^\s*{{\$[^\(}}$\)]*\s*$'
+ let class = matchstr(a:line, '{{$\zs.*$')
+ "FIXME class cannot be any string!
+ let class = substitute(class, '\s\+$', '', 'g')
+ " store the environment name in a global variable in order to close the
+ " environment properly
+ let s:current_math_env = matchstr(class, '^%\zs\S\+\ze%')
+ if s:current_math_env != ""
+ call add(lines, substitute(class, '^%\(\S\+\)%','\\begin{\1}', ''))
+ elseif class != ""
+ call add(lines, "\\\[".class)
+ else
+ call add(lines, "\\\[")
+ endif
+ let math = [1, len(matchstr(a:line, '^\s*\ze{{\$'))]
+ let processed = 1
+ elseif math[0] && a:line =~# '^\s*}}\$\s*$'
+ let math = [0, 0]
+ if s:current_math_env != ""
+ call add(lines, "\\end{".s:current_math_env."}")
+ else
+ call add(lines, "\\\]")
+ endif
+ let processed = 1
+ elseif math[0]
+ let processed = 1
+ call add(lines, substitute(a:line, '^\s\{'.math[1].'}', '', ''))
+ endif
+ return [processed, lines, math]
+endfunction
+
+
+function! s:process_tag_quote(line, quote)
+ let lines = []
+ let quote = a:quote
+ let processed = 0
+ if a:line =~# '^\s\{4,}\S'
+ if !quote
+ call add(lines, "<blockquote>")
+ let quote = 1
+ endif
+ let processed = 1
+ call add(lines, substitute(a:line, '^\s*', '', ''))
+ elseif quote
+ call add(lines, "</blockquote>")
+ let quote = 0
+ endif
+ return [processed, lines, quote]
+endfunction
+
+
+function! s:process_tag_list(line, lists)
+
+ function! s:add_checkbox(line, rx_list)
+ let st_tag = '<li>'
+ let chk = matchlist(a:line, a:rx_list)
+ if !empty(chk) && len(chk[1]) > 0
+ let completion = index(vimwiki#vars#get_syntaxlocal('listsyms_list'), chk[1])
+ let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
+ if completion == 0
+ let st_tag = '<li class="done0">'
+ elseif completion == -1 && chk[1] == vimwiki#vars#get_global('listsym_rejected')
+ let st_tag = '<li class="rejected">'
+ elseif completion > 0 && completion < n
+ let completion = float2nr(round(completion / (n-1.0) * 3.0 + 0.5 ))
+ let st_tag = '<li class="done'.completion.'">'
+ endif
+ endif
+ return [st_tag, '']
+ endfunction
+
+
+ let in_list = (len(a:lists) > 0)
+
+ " If it is not list yet then do not process line that starts from *bold*
+ " text.
+ " XXX necessary? in *bold* text, no space must follow the first *
+ if !in_list
+ let pos = match(a:line, '^\s*'.vimwiki#vars#get_syntaxlocal('rxBold'))
+ if pos != -1
+ return [0, []]
+ endif
+ endif
+
+ let lines = []
+ let processed = 0
+
+ if a:line =~# '^\s*'.s:bullets.'\s'
+ let lstSym = matchstr(a:line, s:bullets)
+ let lstTagOpen = '<ul>'
+ let lstTagClose = '</ul>'
+ let lstRegExp = '^\s*'.s:bullets.'\s'
+ elseif a:line =~# '^\s*'.s:numbers.'\s'
+ let lstSym = matchstr(a:line, s:numbers)
+ let lstTagOpen = '<ol>'
+ let lstTagClose = '</ol>'
+ let lstRegExp = '^\s*'.s:numbers.'\s'
+ else
+ let lstSym = ''
+ let lstTagOpen = ''
+ let lstTagClose = ''
+ let lstRegExp = ''
+ endif
+
+ if lstSym != ''
+ " To get proper indent level 'retab' the line -- change all tabs
+ " to spaces*tabstop
+ let line = substitute(a:line, '\t', repeat(' ', &tabstop), 'g')
+ let indent = stridx(line, lstSym)
+
+ let checkbox = '\s*\[\(.\)\]\s*'
+ let [st_tag, en_tag] = s:add_checkbox(line, lstRegExp.checkbox)
+
+ if !in_list
+ call add(a:lists, [lstTagClose, indent])
+ call add(lines, lstTagOpen)
+ elseif (in_list && indent > a:lists[-1][1])
+ let item = remove(a:lists, -1)
+ call add(lines, item[0])
+
+ call add(a:lists, [lstTagClose, indent])
+ call add(lines, lstTagOpen)
+ elseif (in_list && indent < a:lists[-1][1])
+ while len(a:lists) && indent < a:lists[-1][1]
+ let item = remove(a:lists, -1)
+ call add(lines, item[0])
+ endwhile
+ elseif in_list
+ let item = remove(a:lists, -1)
+ call add(lines, item[0])
+ endif
+
+ call add(a:lists, [en_tag, indent])
+ call add(lines, st_tag)
+ call add(lines, substitute(a:line, lstRegExp.'\%('.checkbox.'\)\?', '', ''))
+ let processed = 1
+ elseif in_list && a:line =~# '^\s\+\S\+'
+ if vimwiki#vars#get_global('list_ignore_newline')
+ call add(lines, a:line)
+ else
+ call add(lines, '<br />'.a:line)
+ endif
+ let processed = 1
+ else
+ call s:close_tag_list(a:lists, lines)
+ endif
+ return [processed, lines]
+endfunction
+
+
+function! s:process_tag_def_list(line, deflist)
+ let lines = []
+ let deflist = a:deflist
+ let processed = 0
+ let matches = matchlist(a:line, '\(^.*\)::\%(\s\|$\)\(.*\)')
+ if !deflist && len(matches) > 0
+ call add(lines, "<dl>")
+ let deflist = 1
+ endif
+ if deflist && len(matches) > 0
+ if matches[1] != ''
+ call add(lines, "<dt>".matches[1]."</dt>")
+ endif
+ if matches[2] != ''
+ call add(lines, "<dd>".matches[2]."</dd>")
+ endif
+ let processed = 1
+ elseif deflist
+ let deflist = 0
+ call add(lines, "</dl>")
+ endif
+ return [processed, lines, deflist]
+endfunction
+
+
+function! s:process_tag_para(line, para)
+ let lines = []
+ let para = a:para
+ let processed = 0
+ if a:line =~# '^\s\{,3}\S'
+ if !para
+ call add(lines, "<p>")
+ let para = 1
+ endif
+ let processed = 1
+ if vimwiki#vars#get_global('text_ignore_newline')
+ call add(lines, a:line)
+ else
+ call add(lines, a:line."<br />")
+ endif
+ elseif para && a:line =~# '^\s*$'
+ call add(lines, "</p>")
+ let para = 0
+ endif
+ return [processed, lines, para]
+endfunction
+
+
+function! s:process_tag_h(line, id)
+ let line = a:line
+ let processed = 0
+ let h_level = 0
+ let h_text = ''
+ let h_id = ''
+
+ if a:line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ let h_level = vimwiki#u#count_first_sym(a:line)
+ endif
+ if h_level > 0
+
+ let h_text = vimwiki#u#trim(matchstr(line, vimwiki#vars#get_syntaxlocal('rxHeader')))
+ let h_number = ''
+ let h_complete_id = ''
+ let h_id = s:escape_html_attribute(h_text)
+ let centered = (a:line =~# '^\s')
+
+ if h_text !=# vimwiki#vars#get_global('toc_header')
+
+ let a:id[h_level-1] = [h_text, a:id[h_level-1][1]+1]
+
+ " reset higher level ids
+ for level in range(h_level, 5)
+ let a:id[level] = ['', 0]
+ endfor
+
+ for l in range(h_level-1)
+ let h_number .= a:id[l][1].'.'
+ if a:id[l][0] != ''
+ let h_complete_id .= a:id[l][0].'-'
+ endif
+ endfor
+ let h_number .= a:id[h_level-1][1]
+ let h_complete_id .= a:id[h_level-1][0]
+
+ if vimwiki#vars#get_global('html_header_numbering')
+ let num = matchstr(h_number,
+ \ '^\(\d.\)\{'.(vimwiki#vars#get_global('html_header_numbering')-1).'}\zs.*')
+ if !empty(num)
+ let num .= vimwiki#vars#get_global('html_header_numbering_sym')
+ endif
+ let h_text = num.' '.h_text
+ endif
+ let h_complete_id = s:escape_html_attribute(h_complete_id)
+ let h_part = '<div id="'.h_complete_id.'"><h'.h_level.' id="'.h_id.'"'
+
+ else
+
+ let h_part = '<div id="'.h_id.'" class="toc"><h1 id="'.h_id.'"'
+
+ endif
+
+ if centered
+ let h_part .= ' class="justcenter">'
+ else
+ let h_part .= '>'
+ endif
+
+ let h_text = s:process_inline_tags(h_text, a:id)
+
+ let line = h_part.h_text.'</h'.h_level.'></div>'
+
+ let processed = 1
+ endif
+ return [processed, line]
+endfunction
+
+
+function! s:process_tag_hr(line)
+ let line = a:line
+ let processed = 0
+ if a:line =~# '^-----*$'
+ let line = '<hr />'
+ let processed = 1
+ endif
+ return [processed, line]
+endfunction
+
+
+function! s:process_tag_table(line, table, header_ids)
+ function! s:table_empty_cell(value)
+ let cell = {}
+
+ if a:value =~# '^\s*\\/\s*$'
+ let cell.body = ''
+ let cell.rowspan = 0
+ let cell.colspan = 1
+ elseif a:value =~# '^\s*&gt;\s*$'
+ let cell.body = ''
+ let cell.rowspan = 1
+ let cell.colspan = 0
+ elseif a:value =~# '^\s*$'
+ let cell.body = '&nbsp;'
+ let cell.rowspan = 1
+ let cell.colspan = 1
+ else
+ let cell.body = a:value
+ let cell.rowspan = 1
+ let cell.colspan = 1
+ endif
+
+ return cell
+ endfunction
+
+ function! s:table_add_row(table, line)
+ if empty(a:table)
+ if a:line =~# '^\s\+'
+ let row = ['center', []]
+ else
+ let row = ['normal', []]
+ endif
+ else
+ let row = [[]]
+ endif
+ return row
+ endfunction
+
+ let table = a:table
+ let lines = []
+ let processed = 0
+
+ if vimwiki#tbl#is_separator(a:line)
+ call extend(table, s:table_add_row(a:table, a:line))
+ let processed = 1
+ elseif vimwiki#tbl#is_table(a:line)
+ call extend(table, s:table_add_row(a:table, a:line))
+
+ let processed = 1
+ " let cells = split(a:line, vimwiki#tbl#cell_splitter(), 1)[1: -2]
+ let cells = vimwiki#tbl#get_cells(a:line)
+ call map(cells, 's:table_empty_cell(v:val)')
+ call extend(table[-1], cells)
+ else
+ let table = s:close_tag_table(table, lines, a:header_ids)
+ endif
+ return [processed, lines, table]
+endfunction
+
+
+function! s:parse_line(line, state)
+ let state = {}
+ let state.para = a:state.para
+ let state.quote = a:state.quote
+ let state.pre = a:state.pre[:]
+ let state.math = a:state.math[:]
+ let state.table = a:state.table[:]
+ let state.lists = a:state.lists[:]
+ let state.deflist = a:state.deflist
+ let state.placeholder = a:state.placeholder
+ let state.header_ids = a:state.header_ids
+
+ let res_lines = []
+
+ let line = s:safe_html_line(a:line)
+
+ let processed = 0
+
+ " pres
+ if !processed
+ let [processed, lines, state.pre] = s:process_tag_pre(line, state.pre)
+ " pre is just fine to be in the list -- do not close list item here.
+ " if processed && len(state.lists)
+ " call s:close_tag_list(state.lists, lines)
+ " endif
+ if !processed
+ let [processed, lines, state.math] = s:process_tag_math(line, state.math)
+ endif
+ if processed && len(state.table)
+ let state.table = s:close_tag_table(state.table, lines, state.header_ids)
+ endif
+ if processed && state.deflist
+ let state.deflist = s:close_tag_def_list(state.deflist, lines)
+ endif
+ if processed && state.quote
+ let state.quote = s:close_tag_quote(state.quote, lines)
+ endif
+ if processed && state.para
+ let state.para = s:close_tag_para(state.para, lines)
+ endif
+ call extend(res_lines, lines)
+ endif
+
+
+ if !processed
+ if line =~# vimwiki#vars#get_syntaxlocal('rxComment')
+ let processed = 1
+ endif
+ endif
+
+ " nohtml -- placeholder
+ if !processed
+ if line =~# '\m^\s*%nohtml\s*$'
+ let processed = 1
+ let state.placeholder = ['nohtml']
+ endif
+ endif
+
+ " title -- placeholder
+ if !processed
+ if line =~# '\m^\s*%title\%(\s.*\)\?$'
+ let processed = 1
+ let param = matchstr(line, '\m^\s*%title\s\+\zs.*')
+ let state.placeholder = ['title', param]
+ endif
+ endif
+
+ " date -- placeholder
+ if !processed
+ if line =~# '\m^\s*%date\%(\s.*\)\?$'
+ let processed = 1
+ let param = matchstr(line, '\m^\s*%date\s\+\zs.*')
+ let state.placeholder = ['date', param]
+ endif
+ endif
+
+ " html template -- placeholder
+ if !processed
+ if line =~# '\m^\s*%template\%(\s.*\)\?$'
+ let processed = 1
+ let param = matchstr(line, '\m^\s*%template\s\+\zs.*')
+ let state.placeholder = ['template', param]
+ endif
+ endif
+
+
+ " tables
+ if !processed
+ let [processed, lines, state.table] = s:process_tag_table(line, state.table, state.header_ids)
+ call extend(res_lines, lines)
+ endif
+
+
+ " lists
+ if !processed
+ let [processed, lines] = s:process_tag_list(line, state.lists)
+ if processed && state.quote
+ let state.quote = s:close_tag_quote(state.quote, lines)
+ endif
+ if processed && state.pre[0]
+ let state.pre = s:close_tag_pre(state.pre, lines)
+ endif
+ if processed && state.math[0]
+ let state.math = s:close_tag_math(state.math, lines)
+ endif
+ if processed && len(state.table)
+ let state.table = s:close_tag_table(state.table, lines, state.header_ids)
+ endif
+ if processed && state.deflist
+ let state.deflist = s:close_tag_def_list(state.deflist, lines)
+ endif
+ if processed && state.para
+ let state.para = s:close_tag_para(state.para, lines)
+ endif
+
+ call map(lines, 's:process_inline_tags(v:val, state.header_ids)')
+
+ call extend(res_lines, lines)
+ endif
+
+
+ " headers
+ if !processed
+ let [processed, line] = s:process_tag_h(line, state.header_ids)
+ if processed
+ call s:close_tag_list(state.lists, res_lines)
+ let state.table = s:close_tag_table(state.table, res_lines, state.header_ids)
+ let state.pre = s:close_tag_pre(state.pre, res_lines)
+ let state.math = s:close_tag_math(state.math, res_lines)
+ let state.quote = s:close_tag_quote(state.quote, res_lines)
+ let state.para = s:close_tag_para(state.para, res_lines)
+
+ call add(res_lines, line)
+ endif
+ endif
+
+
+ " quotes
+ if !processed
+ let [processed, lines, state.quote] = s:process_tag_quote(line, state.quote)
+ if processed && len(state.lists)
+ call s:close_tag_list(state.lists, lines)
+ endif
+ if processed && state.deflist
+ let state.deflist = s:close_tag_def_list(state.deflist, lines)
+ endif
+ if processed && len(state.table)
+ let state.table = s:close_tag_table(state.table, lines, state.header_ids)
+ endif
+ if processed && state.pre[0]
+ let state.pre = s:close_tag_pre(state.pre, lines)
+ endif
+ if processed && state.math[0]
+ let state.math = s:close_tag_math(state.math, lines)
+ endif
+ if processed && state.para
+ let state.para = s:close_tag_para(state.para, lines)
+ endif
+
+ call map(lines, 's:process_inline_tags(v:val, state.header_ids)')
+
+ call extend(res_lines, lines)
+ endif
+
+
+ " horizontal rules
+ if !processed
+ let [processed, line] = s:process_tag_hr(line)
+ if processed
+ call s:close_tag_list(state.lists, res_lines)
+ let state.table = s:close_tag_table(state.table, res_lines, state.header_ids)
+ let state.pre = s:close_tag_pre(state.pre, res_lines)
+ let state.math = s:close_tag_math(state.math, res_lines)
+ call add(res_lines, line)
+ endif
+ endif
+
+
+ " definition lists
+ if !processed
+ let [processed, lines, state.deflist] = s:process_tag_def_list(line, state.deflist)
+
+ call map(lines, 's:process_inline_tags(v:val, state.header_ids)')
+
+ call extend(res_lines, lines)
+ endif
+
+
+ "" P
+ if !processed
+ let [processed, lines, state.para] = s:process_tag_para(line, state.para)
+ if processed && len(state.lists)
+ call s:close_tag_list(state.lists, lines)
+ endif
+ if processed && state.quote
+ let state.quote = s:close_tag_quote(state.quote, res_lines)
+ endif
+ if processed && state.pre[0]
+ let state.pre = s:close_tag_pre(state.pre, res_lines)
+ endif
+ if processed && state.math[0]
+ let state.math = s:close_tag_math(state.math, res_lines)
+ endif
+ if processed && len(state.table)
+ let state.table = s:close_tag_table(state.table, res_lines, state.header_ids)
+ endif
+
+ call map(lines, 's:process_inline_tags(v:val, state.header_ids)')
+
+ call extend(res_lines, lines)
+ endif
+
+
+ "" add the rest
+ if !processed
+ call add(res_lines, line)
+ endif
+
+ return [res_lines, state]
+
+endfunction
+
+
+function! s:use_custom_wiki2html()
+ let custom_wiki2html = vimwiki#vars#get_wikilocal('custom_wiki2html')
+ return !empty(custom_wiki2html) &&
+ \ (s:file_exists(custom_wiki2html) || s:binary_exists(custom_wiki2html))
+endfunction
+
+
+function! vimwiki#html#CustomWiki2HTML(path, wikifile, force)
+ call vimwiki#path#mkdir(a:path)
+ echomsg system(vimwiki#vars#get_wikilocal('custom_wiki2html'). ' '.
+ \ a:force. ' '.
+ \ vimwiki#vars#get_wikilocal('syntax'). ' '.
+ \ strpart(vimwiki#vars#get_wikilocal('ext'), 1). ' '.
+ \ shellescape(a:path). ' '.
+ \ shellescape(a:wikifile). ' '.
+ \ shellescape(s:default_CSS_full_name(a:path)). ' '.
+ \ (len(vimwiki#vars#get_wikilocal('template_path')) > 1 ?
+ \ shellescape(expand(vimwiki#vars#get_wikilocal('template_path'))) : '-'). ' '.
+ \ (len(vimwiki#vars#get_wikilocal('template_default')) > 0 ?
+ \ vimwiki#vars#get_wikilocal('template_default') : '-'). ' '.
+ \ (len(vimwiki#vars#get_wikilocal('template_ext')) > 0 ?
+ \ vimwiki#vars#get_wikilocal('template_ext') : '-'). ' '.
+ \ (len(vimwiki#vars#get_bufferlocal('subdir')) > 0 ?
+ \ shellescape(s:root_path(vimwiki#vars#get_bufferlocal('subdir'))) : '-'). ' '.
+ \ (len(vimwiki#vars#get_wikilocal('custom_wiki2html_args')) > 0 ?
+ \ vimwiki#vars#get_wikilocal('custom_wiki2html_args') : '-'))
+endfunction
+
+
+function! s:convert_file(path_html, wikifile)
+ let done = 0
+
+ let wikifile = fnamemodify(a:wikifile, ":p")
+
+ let path_html = expand(a:path_html).vimwiki#vars#get_bufferlocal('subdir')
+ let htmlfile = fnamemodify(wikifile, ":t:r").'.html'
+
+ " the currently processed file name is needed when processing links
+ " yeah yeah, shame on me for using (quasi-) global variables
+ let s:current_wiki_file = wikifile
+ let s:current_html_file = path_html . htmlfile
+
+ if s:use_custom_wiki2html()
+ let force = 1
+ call vimwiki#html#CustomWiki2HTML(path_html, wikifile, force)
+ let done = 1
+ endif
+
+ if s:syntax_supported() && done == 0
+ let lsource = readfile(wikifile)
+ let ldest = []
+
+ call vimwiki#path#mkdir(path_html)
+
+ " nohtml placeholder -- to skip html generation.
+ let nohtml = 0
+
+ " template placeholder
+ let template_name = ''
+
+ " for table of contents placeholders.
+ let placeholders = []
+
+ " current state of converter
+ let state = {}
+ let state.para = 0
+ let state.quote = 0
+ let state.pre = [0, 0] " [in_pre, indent_pre]
+ let state.math = [0, 0] " [in_math, indent_math]
+ let state.table = []
+ let state.deflist = 0
+ let state.lists = []
+ let state.placeholder = []
+ let state.header_ids = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
+ " [last seen header text in this level, number]
+
+ " prepare constants for s:safe_html_line()
+ let s:lt_pattern = '<'
+ let s:gt_pattern = '>'
+ if vimwiki#vars#get_global('valid_html_tags') != ''
+ let tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
+ let s:lt_pattern = '\c<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
+ let s:gt_pattern = '\c\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
+ endif
+
+ " prepare regexps for lists
+ let s:bullets = '[*-]'
+ let s:numbers = '\C\%(#\|\d\+)\|\d\+\.\|[ivxlcdm]\+)\|[IVXLCDM]\+)\|\l\{1,2})\|\u\{1,2})\)'
+
+ for line in lsource
+ let oldquote = state.quote
+ let [lines, state] = s:parse_line(line, state)
+
+ " Hack: There could be a lot of empty strings before s:process_tag_quote
+ " find out `quote` is over. So we should delete them all. Think of the way
+ " to refactor it out.
+ if oldquote != state.quote
+ call s:remove_blank_lines(ldest)
+ endif
+
+ if !empty(state.placeholder)
+ if state.placeholder[0] ==# 'nohtml'
+ let nohtml = 1
+ break
+ elseif state.placeholder[0] ==# 'template'
+ let template_name = state.placeholder[1]
+ else
+ call add(placeholders, [state.placeholder, len(ldest), len(placeholders)])
+ endif
+ let state.placeholder = []
+ endif
+
+ call extend(ldest, lines)
+ endfor
+
+
+ if nohtml
+ echon "\r"."%nohtml placeholder found"
+ return ''
+ endif
+
+ call s:remove_blank_lines(ldest)
+
+ " process end of file
+ " close opened tags if any
+ let lines = []
+ call s:close_tag_quote(state.quote, lines)
+ call s:close_tag_para(state.para, lines)
+ call s:close_tag_pre(state.pre, lines)
+ call s:close_tag_math(state.math, lines)
+ call s:close_tag_list(state.lists, lines)
+ call s:close_tag_def_list(state.deflist, lines)
+ call s:close_tag_table(state.table, lines, state.header_ids)
+ call extend(ldest, lines)
+
+ let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r"))
+ let date = s:process_date(placeholders, strftime('%Y-%m-%d'))
+
+ let html_lines = s:get_html_template(template_name)
+
+ " processing template variables (refactor to a function)
+ call map(html_lines, 'substitute(v:val, "%title%", "'. title .'", "g")')
+ call map(html_lines, 'substitute(v:val, "%date%", "'. date .'", "g")')
+ call map(html_lines, 'substitute(v:val, "%root_path%", "'.
+ \ s:root_path(vimwiki#vars#get_bufferlocal('subdir')) .'", "g")')
+
+ let css_name = expand(vimwiki#vars#get_wikilocal('css_name'))
+ let css_name = substitute(css_name, '\', '/', 'g')
+ call map(html_lines, 'substitute(v:val, "%css%", "'. css_name .'", "g")')
+
+ let enc = &fileencoding
+ if enc == ''
+ let enc = &encoding
+ endif
+ call map(html_lines, 'substitute(v:val, "%encoding%", "'. enc .'", "g")')
+
+ let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
+
+ call writefile(html_lines, path_html.htmlfile)
+ let done = 1
+
+ endif
+
+ if done == 0
+ echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
+ return ''
+ endif
+
+ return path_html.htmlfile
+endfunction
+
+
+function! vimwiki#html#Wiki2HTML(path_html, wikifile)
+ let result = s:convert_file(a:path_html, a:wikifile)
+ if result != ''
+ call s:create_default_CSS(a:path_html)
+ endif
+ return result
+endfunction
+
+
+function! vimwiki#html#WikiAll2HTML(path_html)
+ if !s:syntax_supported() && !s:use_custom_wiki2html()
+ echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
+ return
+ endif
+
+ echomsg 'Vimwiki: Saving Vimwiki files ...'
+ let save_eventignore = &eventignore
+ let &eventignore = "all"
+ let cur_buf = bufname('%')
+ bufdo call s:save_vimwiki_buffer()
+ exe 'buffer '.cur_buf
+ let &eventignore = save_eventignore
+
+ let path_html = expand(a:path_html)
+ call vimwiki#path#mkdir(path_html)
+
+ echomsg 'Vimwiki: Deleting non-wiki html files ...'
+ call s:delete_html_files(path_html)
+
+ echomsg 'Vimwiki: Converting wiki to html files ...'
+ let setting_more = &more
+ setlocal nomore
+
+ " temporarily adjust current_subdir global state variable
+ let current_subdir = vimwiki#vars#get_bufferlocal('subdir')
+ let current_invsubdir = vimwiki#vars#get_bufferlocal('invsubdir')
+
+ let wikifiles = split(glob(vimwiki#vars#get_wikilocal('path').'**/*'.
+ \ vimwiki#vars#get_wikilocal('ext')), '\n')
+ for wikifile in wikifiles
+ let wikifile = fnamemodify(wikifile, ":p")
+
+ " temporarily adjust 'subdir' and 'invsubdir' state variables
+ let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), wikifile)
+ call vimwiki#vars#set_bufferlocal('subdir', subdir)
+ call vimwiki#vars#set_bufferlocal('invsubdir', vimwiki#base#invsubdir(subdir))
+
+ if !s:is_html_uptodate(wikifile)
+ echomsg 'Vimwiki: Processing '.wikifile
+
+ call s:convert_file(path_html, wikifile)
+ else
+ echomsg 'Vimwiki: Skipping '.wikifile
+ endif
+ endfor
+ " reset 'subdir' state variable
+ call vimwiki#vars#set_bufferlocal('subdir', current_subdir)
+ call vimwiki#vars#set_bufferlocal('invsubdir', current_invsubdir)
+
+ let created = s:create_default_CSS(path_html)
+ if created
+ echomsg 'Vimwiki: Default style.css has been created'
+ endif
+ echomsg 'Vimwiki: HTML exported to '.path_html
+ echomsg 'Vimwiki: Done!'
+
+ let &more = setting_more
+endfunction
+
+
+function! s:file_exists(fname)
+ return !empty(getftype(expand(a:fname)))
+endfunction
+
+
+function! s:binary_exists(fname)
+ return executable(expand(a:fname))
+endfunction
+
+
+function! s:get_wikifile_url(wikifile)
+ return vimwiki#vars#get_wikilocal('path_html') .
+ \ vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), a:wikifile).
+ \ fnamemodify(a:wikifile, ":t:r").'.html'
+endfunction
+
+
+function! vimwiki#html#PasteUrl(wikifile)
+ execute 'r !echo file://'.s:get_wikifile_url(a:wikifile)
+endfunction
+
+
+function! vimwiki#html#CatUrl(wikifile)
+ execute '!echo file://'.s:get_wikifile_url(a:wikifile)
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/lst.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/lst.vim
new file mode 100644
index 0000000..d4ccbbd
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/lst.vim
@@ -0,0 +1,1677 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Everything concerning lists and checkboxes
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+if exists("g:loaded_vimwiki_list_auto") || &cp
+ finish
+endif
+let g:loaded_vimwiki_list_auto = 1
+
+
+" ---------------------------------------------------------
+" incrementation functions for the various kinds of numbers
+" ---------------------------------------------------------
+
+function! s:increment_1(value)
+ return eval(a:value) + 1
+endfunction
+
+
+function! s:increment_A(value)
+ let list_of_chars = split(a:value, '.\zs')
+ let done = 0
+ for idx in reverse(range(len(list_of_chars)))
+ let cur_num = char2nr(list_of_chars[idx])
+ if cur_num < 90
+ let list_of_chars[idx] = nr2char(cur_num + 1)
+ let done = 1
+ break
+ else
+ let list_of_chars[idx] = 'A'
+ endif
+ endfor
+ if !done
+ call insert(list_of_chars, 'A')
+ endif
+ return join(list_of_chars, '')
+endfunction
+
+
+function! s:increment_a(value)
+ let list_of_chars = split(a:value, '.\zs')
+ let done = 0
+ for idx in reverse(range(len(list_of_chars)))
+ let cur_num = char2nr(list_of_chars[idx])
+ if cur_num < 122
+ let list_of_chars[idx] = nr2char(cur_num + 1)
+ let done = 1
+ break
+ else
+ let list_of_chars[idx] = 'a'
+ endif
+ endfor
+ if !done
+ call insert(list_of_chars, 'a')
+ endif
+ return join(list_of_chars, '')
+endfunction
+
+
+function! s:increment_I(value)
+ let subst_list = [ ['XLVIII$', 'IL'], ['VIII$', 'IX'], ['III$', 'IV'],
+ \ ['DCCCXCIX$', 'CM'], ['CCCXCIX$', 'CD'], ['LXXXIX$', 'XC'],
+ \ ['XXXIX$', 'XL'], ['\(I\{1,2\}\)$', '\1I'], ['CDXCIX$', 'D'],
+ \ ['CMXCIX$', 'M'], ['XCIX$', 'C'], ['I\([VXLCDM]\)$', '\1'],
+ \ ['\([VXLCDM]\)$', '\1I'] ]
+ for [regex, subst] in subst_list
+ if a:value =~# regex
+ return substitute(a:value, regex, subst, '')
+ endif
+ endfor
+ return ''
+endfunction
+
+
+function! s:increment_i(value)
+ let subst_list = [ ['xlviii$', 'il'], ['viii$', 'ix'], ['iii$', 'iv'],
+ \ ['dcccxcix$', 'cm'], ['cccxcix$', 'cd'], ['lxxxix$', 'xc'],
+ \ ['xxxix$', 'xl'], ['\(i\{1,2\}\)$', '\1i'], ['cdxcix$', 'd'],
+ \ ['cmxcix$', 'm'], ['xcix$', 'c'], ['i\([vxlcdm]\)$', '\1'],
+ \ ['\([vxlcdm]\)$', '\1i'] ]
+ for [regex, subst] in subst_list
+ if a:value =~# regex
+ return substitute(a:value, regex, subst, '')
+ endif
+ endfor
+ return ''
+endfunction
+
+
+" ---------------------------------------------------------
+" utility functions
+" ---------------------------------------------------------
+
+function! s:substitute_rx_in_line(lnum, pattern, new_string)
+ call setline(a:lnum, substitute(getline(a:lnum), a:pattern, a:new_string, ''))
+endfunction
+
+
+function! s:substitute_string_in_line(lnum, old_string, new_string)
+ call s:substitute_rx_in_line(a:lnum, vimwiki#u#escape(a:old_string), a:new_string)
+endfunction
+
+
+function! s:first_char(string)
+ return matchstr(a:string, '^.')
+endfunction
+
+
+if exists("*strdisplaywidth")
+ function! s:string_length(str)
+ return strdisplaywidth(a:str)
+ endfunction
+else
+ function! s:string_length(str)
+ return strlen(substitute(a:str, '.', 'x', 'g'))
+ endfunction
+endif
+
+
+function! vimwiki#lst#default_symbol()
+ return vimwiki#vars#get_syntaxlocal('list_markers')[0]
+endfunction
+
+
+function! vimwiki#lst#get_list_margin()
+ let list_margin = vimwiki#vars#get_wikilocal('list_margin')
+ if list_margin < 0
+ return &sw
+ else
+ return list_margin
+ endif
+endfunction
+
+
+"Returns: the column where the text of a line starts (possible list item
+"markers and checkboxes are skipped)
+function! s:text_begin(lnum)
+ return s:string_length(matchstr(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem')))
+endfunction
+
+
+"Returns: 2 if there is a marker and text
+" 1 for a marker and no text
+" 0 for no marker at all (empty line or only text)
+function! s:line_has_marker(lnum)
+ if getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*$'
+ return 1
+ elseif getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*\S'
+ return 2
+ else
+ return 0
+ endif
+endfunction
+
+
+" ---------------------------------------------------------
+" get properties of a list item
+" ---------------------------------------------------------
+
+"Returns: the mainly used data structure in this file
+"An item represents a single list item and is a dictionary with the keys
+"lnum - the line number of the list item
+"type - 1 for bulleted item, 2 for numbered item, 0 for a regular line
+"mrkr - the concrete marker, e.g. '**' or 'b)'
+"cb - the char in the checkbox or '' if there is no checkbox
+function! s:get_item(lnum)
+ let item = {'lnum': a:lnum}
+ if a:lnum == 0 || a:lnum > line('$')
+ let item.type = 0
+ return item
+ endif
+
+ let matches = matchlist(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem'))
+ if matches == [] ||
+ \ (matches[1] == '' && matches[2] == '') ||
+ \ (matches[1] != '' && matches[2] != '')
+ let item.type = 0
+ return item
+ endif
+
+ let item.cb = matches[3]
+
+ if matches[1] != ''
+ let item.type = 1
+ let item.mrkr = matches[1]
+ else
+ let item.type = 2
+ let item.mrkr = matches[2]
+ endif
+
+ return item
+endfunction
+
+
+function! s:empty_item()
+ return {'type': 0}
+endfunction
+
+
+"Returns: level of the line
+"0 is the 'highest' level
+function! s:get_level(lnum)
+ if getline(a:lnum) =~# '^\s*$'
+ return 0
+ endif
+ if !vimwiki#vars#get_syntaxlocal('recurring_bullets')
+ let level = indent(a:lnum)
+ else
+ let level = s:string_length(matchstr(getline(a:lnum),
+ \ vimwiki#vars#get_syntaxlocal(rx_bullet_chars)))-1
+ if level < 0
+ let level = (indent(a:lnum) == 0) ? 0 : 9999
+ endif
+ endif
+ return level
+endfunction
+
+
+"Returns: 1, a, i, A, I or ''
+"If in doubt if alphanumeric character or romanian
+"numeral, peek in the previous line
+function! s:guess_kind_of_numbered_item(item)
+ if a:item.type != 2 | return '' | endif
+ let number_chars = a:item.mrkr[:-2]
+ let divisor = a:item.mrkr[-1:]
+
+ let number_kinds = vimwiki#vars#get_syntaxlocal('number_kinds')
+
+ if number_chars =~# '\d\+'
+ return '1'
+ endif
+ if number_chars =~# '\l\+'
+ if number_chars !~# '^[ivxlcdm]\+' || index(number_kinds, 'i') == -1
+ return 'a'
+ else
+
+ let item_above = s:get_prev_list_item(a:item, 0)
+ if item_above.type != 0
+ if index(number_kinds, 'a') == -1 ||
+ \ (item_above.mrkr[-1:] !=# divisor && number_chars =~# 'i\+') ||
+ \ s:increment_i(item_above.mrkr[:-2]) ==# number_chars
+ return 'i'
+ else
+ return 'a'
+ endif
+ else
+ if number_chars =~# 'i\+' || index(number_kinds, 'a') == -1
+ return 'i'
+ else
+ return 'a'
+ endif
+ endif
+
+ endif
+ endif
+ if number_chars =~# '\u\+'
+ if number_chars !~# '^[IVXLCDM]\+' || index(number_kinds, 'I') == -1
+ return 'A'
+ else
+
+ let item_above = s:get_prev_list_item(a:item, 0)
+ if item_above.type != 0
+ if index(number_kinds, 'A') == -1 ||
+ \ (item_above.mrkr[-1:] !=# divisor && number_chars =~# 'I\+') ||
+ \ s:increment_I(item_above.mrkr[:-2]) ==# number_chars
+ return 'I'
+ else
+ return 'A'
+ endif
+ else
+ if number_chars =~# 'I\+' || index(number_kinds, 'A') == -1
+ return 'I'
+ else
+ return 'A'
+ endif
+ endif
+
+ endif
+ endif
+endfunction
+
+
+function! s:regexp_of_marker(item)
+ if a:item.type == 1
+ return vimwiki#u#escape(a:item.mrkr)
+ elseif a:item.type == 2
+ let number_divisors = vimwiki#vars#get_syntaxlocal('number_divisors')
+ for ki in ['d', 'u', 'l']
+ let match = matchstr(a:item.mrkr, '\'.ki.'\+['.number_divisors.']')
+ if match != ''
+ return '\'.ki.'\+'.vimwiki#u#escape(match[-1:])
+ endif
+ endfor
+ else
+ return ''
+ endif
+endfunction
+
+
+" ---------------------------------------------------------
+" functions for navigating between items
+" ---------------------------------------------------------
+
+"Returns: the list item after a:item or an empty item
+"If a:ignore_kind is 1, the markers can differ
+function! s:get_next_list_item(item, ignore_kind)
+ let org_lvl = s:get_level(a:item.lnum)
+ if !a:ignore_kind
+ let org_regex = s:regexp_of_marker(a:item)
+ endif
+
+ let cur_ln = s:get_next_line(a:item.lnum)
+ while cur_ln <= line('$')
+ let cur_lvl = s:get_level(cur_ln)
+ if cur_lvl <= org_lvl
+ if a:ignore_kind
+ return s:get_any_item_of_level(cur_ln, cur_lvl, org_lvl)
+ else
+ return s:get_item_of_level(cur_ln, cur_lvl, org_lvl, org_regex)
+ endif
+ endif
+ let cur_ln = s:get_next_line(cur_ln)
+ endwhile
+ return s:empty_item()
+endfunction
+
+
+"Returns: the list item before a:item or an empty item
+"If a:ignore_kind is 1, the markers can differ
+function! s:get_prev_list_item(item, ignore_kind)
+ let org_lvl = s:get_level(a:item.lnum)
+ if !a:ignore_kind
+ let org_regex = s:regexp_of_marker(a:item)
+ endif
+
+ let cur_ln = s:get_prev_line(a:item.lnum)
+ while cur_ln >= 1
+ let cur_lvl = s:get_level(cur_ln)
+ if cur_lvl <= org_lvl
+ if a:ignore_kind
+ return s:get_any_item_of_level(cur_ln, cur_lvl, org_lvl)
+ else
+ return s:get_item_of_level(cur_ln, cur_lvl, org_lvl, org_regex)
+ endif
+ endif
+ let cur_ln = s:get_prev_line(cur_ln)
+ endwhile
+ return s:empty_item()
+endfunction
+
+
+function! s:get_item_of_level(cur_ln, cur_lvl, org_lvl, org_regex)
+ let cur_linecontent = getline(a:cur_ln)
+ if a:cur_lvl == a:org_lvl
+ if cur_linecontent =~# '^\s*'.a:org_regex.'\s'
+ return s:get_item(a:cur_ln)
+ else
+ return s:empty_item()
+ endif
+ elseif a:cur_lvl < a:org_lvl
+ return s:empty_item()
+ endif
+endfunction
+
+
+function! s:get_any_item_of_level(cur_ln, cur_lvl, org_lvl)
+ if a:cur_lvl == a:org_lvl
+ return s:get_item(a:cur_ln)
+ elseif a:cur_lvl < a:org_lvl
+ return s:empty_item()
+ endif
+endfunction
+
+
+function! s:get_first_item_in_list(item, ignore_kind)
+ let cur_item = a:item
+ while 1
+ let prev_item = s:get_prev_list_item(cur_item, a:ignore_kind)
+ if prev_item.type == 0
+ break
+ else
+ let cur_item = prev_item
+ endif
+ endwhile
+ return cur_item
+endfunction
+
+
+function! s:get_last_item_in_list(item, ignore_kind)
+ let cur_item = a:item
+ while 1
+ let next_item = s:get_next_list_item(cur_item, a:ignore_kind)
+ if next_item.type == 0
+ break
+ else
+ let cur_item = next_item
+ endif
+ endwhile
+ return cur_item
+endfunction
+
+
+"Returns: lnum+1 in most cases, but skips blank lines and preformatted text,
+"0 in case of nonvalid line.
+"If there is no second argument, 0 is returned at a header, otherwise the
+"header is skipped
+function! s:get_next_line(lnum, ...)
+ if getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
+ let cur_ln = a:lnum + 1
+ while cur_ln <= line('$') && getline(cur_ln) !~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
+ let cur_ln += 1
+ endwhile
+ let next_line = cur_ln
+ else
+ let next_line = nextnonblank(a:lnum+1)
+ endif
+
+ if a:0 > 0 && getline(next_line) =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ let next_line = s:get_next_line(next_line, 1)
+ endif
+
+ if next_line < 0 || next_line > line('$') ||
+ \ (getline(next_line) =~# vimwiki#vars#get_syntaxlocal('rxHeader') && a:0 == 0)
+ return 0
+ endif
+
+ return next_line
+endfunction
+
+
+"Returns: lnum-1 in most cases, but skips blank lines and preformatted text
+"0 in case of nonvalid line and a header, because a header ends every list
+function! s:get_prev_line(lnum)
+ let prev_line = prevnonblank(a:lnum-1)
+
+ if getline(prev_line) =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
+ let cur_ln = a:lnum - 1
+ while 1
+ if cur_ln == 0 || getline(cur_ln) =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
+ break
+ endif
+ let cur_ln -= 1
+ endwhile
+ let prev_line = cur_ln
+ endif
+
+ if prev_line < 0 || prev_line > line('$') ||
+ \ getline(prev_line) =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ return 0
+ endif
+
+ return prev_line
+endfunction
+
+
+function! s:get_first_child(item)
+ if a:item.lnum >= line('$')
+ return s:empty_item()
+ endif
+ let org_lvl = s:get_level(a:item.lnum)
+ let cur_item = s:get_item(s:get_next_line(a:item.lnum))
+ while 1
+ if cur_item.type != 0 && s:get_level(cur_item.lnum) > org_lvl
+ return cur_item
+ endif
+ if cur_item.lnum > line('$') || cur_item.lnum <= 0 || s:get_level(cur_item.lnum) <= org_lvl
+ return s:empty_item()
+ endif
+ let cur_item = s:get_item(s:get_next_line(cur_item.lnum))
+ endwhile
+endfunction
+
+
+"Returns: the next sibling of a:child, given the parent item
+"Used for iterating over children
+"Note: child items do not necessarily have the same indent, i.e. level
+function! s:get_next_child_item(parent, child)
+ if a:parent.type == 0 | return s:empty_item() | endif
+ let parent_lvl = s:get_level(a:parent.lnum)
+ let cur_ln = s:get_last_line_of_item_incl_children(a:child)
+ while 1
+ let next_line = s:get_next_line(cur_ln)
+ if next_line == 0 || s:get_level(next_line) <= parent_lvl
+ break
+ endif
+ let cur_ln = next_line
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type > 0
+ return cur_item
+ endif
+ endwhile
+ return s:empty_item()
+endfunction
+
+
+function! s:get_parent(item)
+ let parent_line = 0
+
+ let cur_ln = prevnonblank(a:item.lnum)
+ let child_lvl = s:get_level(cur_ln)
+ if child_lvl == 0
+ return s:empty_item()
+ endif
+
+ while 1
+ let cur_ln = s:get_prev_line(cur_ln)
+ if cur_ln == 0 | break | endif
+ let cur_lvl = s:get_level(cur_ln)
+ if cur_lvl < child_lvl
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type == 0
+ let child_lvl = cur_lvl
+ continue
+ endif
+ let parent_line = cur_ln
+ break
+ endif
+ endwhile
+ return s:get_item(parent_line)
+endfunction
+
+
+"Returns: the item above or the item below or an empty item
+function! s:get_a_neighbor_item(item)
+ let prev_item = s:get_prev_list_item(a:item, 1)
+ if prev_item.type != 0
+ return prev_item
+ else
+ let next_item = s:get_next_list_item(a:item, 1)
+ if next_item.type != 0
+ return next_item
+ endif
+ endif
+ return s:empty_item()
+endfunction
+
+
+function! s:get_a_neighbor_item_in_column(lnum, column)
+ let cur_ln = s:get_prev_line(a:lnum)
+ while cur_ln >= 1
+ if s:get_level(cur_ln) <= a:column
+ return s:get_corresponding_item(cur_ln)
+ endif
+ let cur_ln = s:get_prev_line(cur_ln)
+ endwhile
+ return s:empty_item()
+endfunction
+
+
+"Returns: the item if there is one in a:lnum
+"else the multiline item a:lnum belongs to
+function! s:get_corresponding_item(lnum)
+ let item = s:get_item(a:lnum)
+ if item.type != 0
+ return item
+ endif
+ let org_lvl = s:get_level(a:lnum)
+ let cur_ln = a:lnum
+ while cur_ln > 0
+ let cur_lvl = s:get_level(cur_ln)
+ let cur_item = s:get_item(cur_ln)
+ if cur_lvl < org_lvl && cur_item.type != 0
+ return cur_item
+ endif
+ if cur_lvl < org_lvl
+ let org_lvl = cur_lvl
+ endif
+ let cur_ln = s:get_prev_line(cur_ln)
+ endwhile
+ return s:empty_item()
+endfunction
+
+
+"Returns: the last line of a (possibly multiline) item, including all children
+function! s:get_last_line_of_item_incl_children(item)
+ let cur_ln = a:item.lnum
+ let org_lvl = s:get_level(a:item.lnum)
+ while 1
+ let next_line = s:get_next_line(cur_ln)
+ if next_line == 0 || s:get_level(next_line) <= org_lvl
+ return cur_ln
+ endif
+ let cur_ln = next_line
+ endwhile
+endfunction
+
+
+"Returns: the last line of a (possibly multiline) item
+"Note: there can be other list items between the first and last line
+function! s:get_last_line_of_item(item)
+ if a:item.type == 0 | return 0 | endif
+ let org_lvl = s:get_level(a:item.lnum)
+ let last_corresponding_line = a:item.lnum
+
+ let cur_ln = s:get_next_line(a:item.lnum)
+ while 1
+ if cur_ln == 0 || s:get_level(cur_ln) <= org_lvl
+ break
+ endif
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type == 0
+ let last_corresponding_line = cur_ln
+ let cur_ln = s:get_next_line(cur_ln)
+ else
+ let cur_ln = s:get_next_line(s:get_last_line_of_item_incl_children(cur_item))
+ endif
+ endwhile
+
+ return last_corresponding_line
+endfunction
+
+
+" ---------------------------------------------------------
+" renumber list items
+" ---------------------------------------------------------
+
+"Renumbers the current list from a:item on downwards
+"Returns: the last item that was adjusted
+function! s:adjust_numbered_list_below(item, recursive)
+ if !(a:item.type == 2 || (a:item.type == 1 && a:recursive))
+ return a:item
+ endif
+
+ let kind = s:guess_kind_of_numbered_item(a:item)
+
+ let cur_item = a:item
+ while 1
+ if a:recursive
+ call s:adjust_items_recursively(cur_item)
+ endif
+
+ let next_item = s:get_next_list_item(cur_item, 0)
+ if next_item.type == 0
+ break
+ endif
+
+ if cur_item.type == 2
+ let new_val = s:increment_{kind}(cur_item.mrkr[:-2]) . cur_item.mrkr[-1:]
+ call s:substitute_string_in_line(next_item.lnum, next_item.mrkr, new_val)
+ let next_item.mrkr = new_val
+ endif
+
+ let cur_item = next_item
+ endwhile
+ return cur_item
+endfunction
+
+
+function! s:adjust_items_recursively(parent)
+ if a:parent.type == 0
+ return s:empty_item()
+ end
+
+ let child_item = s:get_first_child(a:parent)
+ if child_item.type == 0
+ return child_item
+ endif
+ while 1
+ let last_item = s:adjust_numbered_list(child_item, 1, 1)
+
+ let child_item = s:get_next_child_item(a:parent, last_item)
+ if child_item.type == 0
+ return last_item
+ endif
+ endwhile
+endfunction
+
+
+"Renumbers the list a:item is in.
+"If a:ignore_kind == 0, only the items which have the same kind of marker as
+"a:item are considered, otherwise all items.
+"Returns: the last item that was adjusted
+function! s:adjust_numbered_list(item, ignore_kind, recursive)
+ if !(a:item.type == 2 || (a:item.type == 1 && (a:ignore_kind || a:recursive)))
+ return s:empty_item()
+ end
+
+ let first_item = s:get_first_item_in_list(a:item, a:ignore_kind)
+
+ while 1
+ if first_item.type == 2
+ let new_mrkr = s:guess_kind_of_numbered_item(first_item) . first_item.mrkr[-1:]
+ call s:substitute_string_in_line(first_item.lnum, first_item.mrkr, new_mrkr)
+ let first_item.mrkr = new_mrkr
+ endif
+
+ let last_item = s:adjust_numbered_list_below(first_item, a:recursive)
+
+ let next_first_item = s:get_next_list_item(last_item, 1)
+ if a:ignore_kind == 0 || next_first_item.type == 0
+ return last_item
+ endif
+ let first_item = next_first_item
+ endwhile
+endfunction
+
+
+"Renumbers the list the cursor is in
+"also update its parents checkbox state
+function! vimwiki#lst#adjust_numbered_list()
+ let cur_item = s:get_corresponding_item(line('.'))
+ if cur_item.type == 0 | return | endif
+ call s:adjust_numbered_list(cur_item, 1, 0)
+ call s:update_state(s:get_parent(cur_item))
+endfunction
+
+
+"Renumbers all lists of the buffer
+"of course, this might take some seconds
+function! vimwiki#lst#adjust_whole_buffer()
+ let cur_ln = 1
+ while 1
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type != 0
+ let cur_item = s:adjust_numbered_list(cur_item, 0, 1)
+ endif
+ let cur_ln = s:get_next_line(cur_item.lnum, 1)
+ if cur_ln <= 0 || cur_ln > line('$')
+ return
+ endif
+ endwhile
+endfunction
+
+
+" ---------------------------------------------------------
+" checkbox stuff
+" ---------------------------------------------------------
+
+"Returns: the rate of checkboxed list item in percent
+function! s:get_rate(item)
+ if a:item.type == 0 || a:item.cb == ''
+ return -1
+ endif
+ let state = a:item.cb
+ if state == vimwiki#vars#get_global('listsym_rejected')
+ return -1
+ endif
+ let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
+ return index(vimwiki#vars#get_syntaxlocal('listsyms_list'), state) * 100/(n-1)
+endfunction
+
+
+"Set state of the list item to [ ] or [o] or whatever
+"Returns: 1 if the state changed, 0 otherwise
+function! s:set_state(item, new_rate)
+ let new_state = s:rate_to_state(a:new_rate)
+ let old_state = s:rate_to_state(s:get_rate(a:item))
+ if new_state !=# old_state
+ call s:substitute_rx_in_line(a:item.lnum, '\[.]', '['.new_state.']')
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+
+"Set state of the list item to [ ] or [o] or whatever
+"Updates the states of its child items
+function! s:set_state_plus_children(item, new_rate)
+ call s:set_state(a:item, a:new_rate)
+
+ let child_item = s:get_first_child(a:item)
+ while 1
+ if child_item.type == 0
+ break
+ endif
+ if child_item.cb != ''
+ call s:set_state_plus_children(child_item, a:new_rate)
+ endif
+ let child_item = s:get_next_child_item(a:item, child_item)
+ endwhile
+endfunction
+
+
+"Returns: the appropriate symbol for a given percent rate
+function! s:rate_to_state(rate)
+ let listsyms_list = vimwiki#vars#get_syntaxlocal('listsyms_list')
+ let state = ''
+ let n = len(listsyms_list)
+ if a:rate == 100
+ let state = listsyms_list[n-1]
+ elseif a:rate == 0
+ let state = listsyms_list[0]
+ elseif a:rate == -1
+ let state = vimwiki#vars#get_global('listsym_rejected')
+ else
+ let index = float2nr(ceil(a:rate/100.0*(n-2)))
+ let state = listsyms_list[index]
+ endif
+ return state
+endfunction
+
+
+"updates the symbol of a checkboxed item according to the symbols of its
+"children
+function! s:update_state(item)
+ if a:item.type == 0 || a:item.cb == ''
+ return
+ endif
+
+ let sum_children_rate = 0
+ let count_children_with_cb = 0
+
+ let child_item = s:get_first_child(a:item)
+
+ while 1
+ if child_item.type == 0
+ break
+ endif
+ if child_item.cb != ''
+ let rate = s:get_rate(child_item)
+ if rate != -1
+ let count_children_with_cb += 1
+ let sum_children_rate += rate
+ endif
+ endif
+ let child_item = s:get_next_child_item(a:item, child_item)
+ endwhile
+
+ if count_children_with_cb > 0
+ let new_rate = sum_children_rate / count_children_with_cb
+ call s:set_state_recursively(a:item, new_rate)
+ else
+ let rate = s:get_rate(a:item)
+ if rate > 0 && rate < 100
+ call s:set_state_recursively(a:item, 0)
+ endif
+ endif
+endfunction
+
+
+function! s:set_state_recursively(item, new_rate)
+ let state_changed = s:set_state(a:item, a:new_rate)
+ if state_changed
+ call s:update_state(s:get_parent(a:item))
+ endif
+endfunction
+
+
+"Creates checkbox in a list item.
+"Returns: 1 if successful
+function! s:create_cb(item)
+ if a:item.type == 0 || a:item.cb != ''
+ return 0
+ endif
+
+ let new_item = a:item
+ let new_item.cb = vimwiki#vars#get_syntaxlocal('listsyms_list')[0]
+ call s:substitute_rx_in_line(new_item.lnum,
+ \ vimwiki#u#escape(new_item.mrkr) . '\zs\ze', ' [' . new_item.cb . ']')
+
+ call s:update_state(new_item)
+ return 1
+endfunction
+
+
+function! s:remove_cb(item)
+ let item = a:item
+ if item.type != 0 && item.cb != ''
+ let item.cb = ''
+ call s:substitute_rx_in_line(item.lnum, '\s\+\[.\]', '')
+ endif
+ return item
+endfunction
+
+
+"Change state of checkbox
+"in the lines of the given range
+function! s:change_cb(from_line, to_line, new_rate)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ return
+ endif
+
+ let parent_items_of_lines = []
+
+ for cur_ln in range(from_item.lnum, a:to_line)
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type != 0 && cur_item.cb != ''
+ call s:set_state_plus_children(cur_item, a:new_rate)
+ let cur_parent_item = s:get_parent(cur_item)
+ if index(parent_items_of_lines, cur_parent_item) == -1
+ call insert(parent_items_of_lines, cur_parent_item)
+ endif
+ endif
+ endfor
+
+ for parent_item in parent_items_of_lines
+ call s:update_state(parent_item)
+ endfor
+
+endfunction
+
+
+"Toggles checkbox between two states in the lines of the given range,
+"creates chceckboxes if there aren't any.
+function! s:toggle_create_cb(from_line, to_line, state1, state2)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ return
+ endif
+
+ if from_item.cb == ''
+
+ "if from_line has no CB, make a CB in every selected line
+ let parent_items_of_lines = []
+ for cur_ln in range(from_item.lnum, a:to_line)
+ let cur_item = s:get_item(cur_ln)
+ let success = s:create_cb(cur_item)
+
+ if success
+ let cur_parent_item = s:get_parent(cur_item)
+ if index(parent_items_of_lines, cur_parent_item) == -1
+ call insert(parent_items_of_lines, cur_parent_item)
+ endif
+ endif
+ endfor
+
+ for parent_item in parent_items_of_lines
+ call s:update_state(parent_item)
+ endfor
+
+ else
+
+ "if from_line has CB, toggle it and set all siblings to the same new state
+ let rate_first_line = s:get_rate(from_item)
+ let new_rate = rate_first_line == a:state1 ? a:state2 : a:state1
+
+ call s:change_cb(a:from_line, a:to_line, new_rate)
+
+ endif
+
+endfunction
+
+
+"Decrement checkbox between [ ] and [X]
+"in the lines of the given range
+function! vimwiki#lst#decrement_cb(from_line, to_line)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ return
+ endif
+
+ "if from_line has CB, decrement it and set all siblings to the same new state
+ let rate_first_line = s:get_rate(from_item)
+ let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
+ let new_rate = max([rate_first_line - 100/(n-1)-1, 0])
+
+ call s:change_cb(a:from_line, a:to_line, new_rate)
+
+endfunction
+
+
+"Increment checkbox between [ ] and [X]
+"in the lines of the given range
+function! vimwiki#lst#increment_cb(from_line, to_line)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ return
+ endif
+
+ "if from_line has CB, increment it and set all siblings to the same new state
+ let rate_first_line = s:get_rate(from_item)
+ let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
+ let new_rate = min([rate_first_line + 100/(n-1)+1, 100])
+
+ call s:change_cb(a:from_line, a:to_line, new_rate)
+
+endfunction
+
+
+"Toggles checkbox between [ ] and [X] or creates one
+"in the lines of the given range
+function! vimwiki#lst#toggle_cb(from_line, to_line)
+ return s:toggle_create_cb(a:from_line, a:to_line, 100, 0)
+endfunction
+
+
+"Toggles checkbox between [ ] and [-] or creates one
+"in the lines of the given range
+function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
+ return s:toggle_create_cb(a:from_line, a:to_line, -1, 0)
+endfunction
+
+
+"Increment checkbox between [ ] and [X]
+"in the lines of the given range
+function! vimwiki#lst#increment_cb(from_line, to_line)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ return
+ endif
+
+ "if from_line has CB, increment it and set all siblings to the same new state
+ let rate_first_line = s:get_rate(from_item)
+ let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
+ let new_rate = min([rate_first_line + 100/(n-1)+1, 100])
+
+ call s:change_cb(a:from_line, a:to_line, new_rate)
+
+endfunction
+
+
+"Toggles checkbox between [ ] and [X] or creates one
+"in the lines of the given range
+function! vimwiki#lst#toggle_cb(from_line, to_line)
+ return s:toggle_create_cb(a:from_line, a:to_line, 100, 0)
+endfunction
+
+
+"Toggles checkbox between [ ] and [-] or creates one
+"in the lines of the given range
+function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
+ return s:toggle_create_cb(a:from_line, a:to_line, -1, 0)
+endfunction
+
+
+function! vimwiki#lst#remove_cb(first_line, last_line)
+ let first_item = s:get_corresponding_item(a:first_line)
+ let last_item = s:get_corresponding_item(a:last_line)
+
+ if first_item.type == 0 || last_item.type == 0
+ return
+ endif
+
+ let parent_items_of_lines = []
+ let cur_ln = first_item.lnum
+ while 1
+ if cur_ln <= 0 || cur_ln > last_item.lnum | break | endif
+ let cur_item = s:get_item(cur_ln)
+ if cur_item.type != 0
+ let cur_item = s:remove_cb(cur_item)
+ let cur_parent_item = s:get_parent(cur_item)
+ if index(parent_items_of_lines, cur_parent_item) == -1
+ call insert(parent_items_of_lines, cur_parent_item)
+ endif
+ endif
+ let cur_ln = s:get_next_line(cur_ln)
+ endwhile
+ for parent_item in parent_items_of_lines
+ call s:update_state(parent_item)
+ endfor
+endfunction
+
+
+function! vimwiki#lst#remove_cb_in_list()
+ let first_item = s:get_first_item_in_list(s:get_corresponding_item(line('.')), 0)
+
+ let cur_item = first_item
+ while 1
+ let next_item = s:get_next_list_item(cur_item, 0)
+ let cur_item = s:remove_cb(cur_item)
+ if next_item.type == 0
+ break
+ else
+ let cur_item = next_item
+ endif
+ endwhile
+
+ call s:update_state(s:get_parent(first_item))
+endfunction
+
+
+
+" ---------------------------------------------------------
+" change the level of list items
+" ---------------------------------------------------------
+
+function! s:set_indent(lnum, new_indent)
+ if &expandtab
+ let indentstring = repeat(' ', a:new_indent)
+ else
+ let indentstring = repeat('\t', a:new_indent / &tabstop) . repeat(' ', a:new_indent % &tabstop)
+ endif
+ call s:substitute_rx_in_line(a:lnum, '^\s*', indentstring)
+endfunction
+
+
+function! s:decrease_level(item)
+ let removed_indent = 0
+ if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
+ \ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
+ \ s:first_char(a:item.mrkr)) > -1
+ if s:string_length(a:item.mrkr) >= 2
+ call s:substitute_string_in_line(a:item.lnum, s:first_char(a:item.mrkr), '')
+ let removed_indent = -1
+ endif
+ else
+ let old_indent = indent(a:item.lnum)
+ if &shiftround
+ let new_indent = (old_indent - 1) / vimwiki#u#sw() * vimwiki#u#sw()
+ else
+ let new_indent = old_indent - vimwiki#u#sw()
+ endif
+ call s:set_indent(a:item.lnum, new_indent)
+ let removed_indent = new_indent - old_indent
+ endif
+ return removed_indent
+endfunction
+
+
+function! s:increase_level(item)
+ let additional_indent = 0
+ if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
+ \ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
+ \ s:first_char(a:item.mrkr)) > -1
+ call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
+ \ s:first_char(a:item.mrkr))
+ let additional_indent = 1
+ else
+ let old_indent = indent(a:item.lnum)
+ if &shiftround
+ let new_indent = (old_indent / vimwiki#u#sw() + 1) * vimwiki#u#sw()
+ else
+ let new_indent = old_indent + vimwiki#u#sw()
+ endif
+ call s:set_indent(a:item.lnum, new_indent)
+ let additional_indent = new_indent - old_indent
+ endif
+ return additional_indent
+endfunction
+
+
+"adds a:indent_by to the current indent
+"a:indent_by can be negative
+function! s:indent_line_by(lnum, indent_by)
+ let item = s:get_item(a:lnum)
+ if vimwiki#vars#get_syntaxlocal('recurring_bullets') && item.type == 1 &&
+ \ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
+ \ s:first_char(item.mrkr)) > -1
+ if a:indent_by > 0
+ call s:substitute_string_in_line(a:lnum, item.mrkr, item.mrkr . s:first_char(item.mrkr))
+ elseif a:indent_by < 0
+ call s:substitute_string_in_line(a:lnum, s:first_char(item.mrkr), '')
+ endif
+ else
+ call s:set_indent(a:lnum, indent(a:lnum) + a:indent_by)
+ endif
+endfunction
+
+
+"changes lvl of lines in selection
+function! s:change_level(from_line, to_line, direction, plus_children)
+ let from_item = s:get_corresponding_item(a:from_line)
+ if from_item.type == 0
+ if a:direction ==# 'increase' && a:from_line == a:to_line && empty(getline(a:from_line))
+ "that's because :> doesn't work on an empty line
+ normal! gi
+ else
+ execute a:from_line.','.a:to_line.(a:direction ==# 'increase' ? '>' : '<')
+ endif
+ return
+ endif
+
+ if a:direction ==# 'decrease' && s:get_level(from_item.lnum) == 0
+ return
+ endif
+
+ if a:from_line == a:to_line
+ if a:plus_children
+ let to_line = s:get_last_line_of_item_incl_children(from_item)
+ else
+ let to_line = s:get_last_line_of_item(from_item)
+ endif
+ else
+ let to_item = s:get_corresponding_item(a:to_line)
+ if to_item.type == 0
+ let to_line = a:to_line
+ else
+ if a:plus_children
+ let to_line = s:get_last_line_of_item_incl_children(to_item)
+ else
+ let to_line = s:get_last_line_of_item(to_item)
+ endif
+ endif
+ endif
+
+ if to_line == 0
+ return
+ endif
+
+ let to_be_adjusted = s:get_a_neighbor_item(from_item)
+ let old_parent = s:get_parent(from_item)
+ let first_line_level = s:get_level(from_item.lnum)
+ let more_than_one_level_concerned = 0
+
+ let first_line_indented_by = (a:direction ==# 'increase') ?
+ \ s:increase_level(from_item) : s:decrease_level(from_item)
+
+ let cur_ln = s:get_next_line(from_item.lnum)
+ while cur_ln > 0 && cur_ln <= to_line
+ if !more_than_one_level_concerned &&
+ \ s:get_level(cur_ln) != first_line_level &&
+ \ s:get_item(cur_ln).type != 0
+ let more_than_one_level_concerned = 1
+ endif
+ call s:indent_line_by(cur_ln, first_line_indented_by)
+ let cur_ln = s:get_next_line(cur_ln, 1)
+ endwhile
+
+ if a:from_line == a:to_line
+ call s:adjust_mrkr(from_item)
+ endif
+ call s:update_state(old_parent)
+ let from_item = s:get_item(from_item.lnum)
+ if from_item.cb != ''
+ call s:update_state(from_item)
+ call s:update_state(s:get_parent(from_item))
+ endif
+
+ if more_than_one_level_concerned
+ call vimwiki#lst#adjust_whole_buffer()
+ else
+ call s:adjust_numbered_list(from_item, 0, 0)
+ call s:adjust_numbered_list(to_be_adjusted, 0, 0)
+ endif
+endfunction
+
+
+function! vimwiki#lst#change_level(from_line, to_line, direction, plus_children)
+ let cur_col = col('$') - col('.')
+ call s:change_level(a:from_line, a:to_line, a:direction, a:plus_children)
+ call cursor('.', col('$') - cur_col)
+endfunction
+
+
+"indent line a:lnum to be the continuation of a:prev_item
+function! s:indent_multiline(prev_item, lnum)
+ if a:prev_item.type != 0
+ call s:set_indent(a:lnum, s:text_begin(a:prev_item.lnum))
+ endif
+endfunction
+
+
+" ---------------------------------------------------------
+" change markers of list items
+" ---------------------------------------------------------
+
+"Returns: the position of a marker in g:vimwiki_list_markers
+function! s:get_idx_list_markers(item)
+ if a:item.type == 1
+ let m = s:first_char(a:item.mrkr)
+ else
+ let m = s:guess_kind_of_numbered_item(a:item) . a:item.mrkr[-1:]
+ endif
+ return index(vimwiki#vars#get_syntaxlocal('list_markers'), m)
+endfunction
+
+
+"changes the marker of the given item to the next in g:vimwiki_list_markers
+function! s:get_next_mrkr(item)
+ let markers = vimwiki#vars#get_syntaxlocal('list_markers')
+ if a:item.type == 0
+ let new_mrkr = markers[0]
+ else
+ let idx = s:get_idx_list_markers(a:item)
+ let new_mrkr = markers[(idx+1) % len(markers)]
+ endif
+ return new_mrkr
+endfunction
+
+
+"changes the marker of the given item to the previous in g:vimwiki_list_markers
+function! s:get_prev_mrkr(item)
+ let markers = vimwiki#vars#get_syntaxlocal('list_markers')
+ if a:item.type == 0
+ return markers[-1]
+ endif
+ let idx = s:get_idx_list_markers(a:item)
+ if idx == -1
+ return markers[-1]
+ else
+ return markers[(idx - 1 + len(markers)) % len(markers)]
+ endif
+endfunction
+
+
+function! s:set_new_mrkr(item, new_mrkr)
+ if a:item.type == 0
+ call s:substitute_rx_in_line(a:item.lnum, '^\s*\zs\ze', a:new_mrkr.' ')
+ if indent(a:item.lnum) == 0 && !vimwiki#vars#get_syntaxlocal('recurring_bullets')
+ call s:set_indent(a:item.lnum, vimwiki#lst#get_list_margin())
+ endif
+ else
+ call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:new_mrkr)
+ endif
+endfunction
+
+
+function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode)
+ let cur_col_from_eol = col("$") - (a:mode ==# "i" ? col("'^") : col('.'))
+ let new_mrkr = a:new_mrkr
+ let cur_ln = a:from_line
+ while 1
+ let cur_item = s:get_item(cur_ln)
+
+ if new_mrkr ==# "next"
+ let new_mrkr = s:get_next_mrkr(cur_item)
+ elseif new_mrkr ==# "prev"
+ let new_mrkr = s:get_prev_mrkr(cur_item)
+ endif
+
+ "handle markers like ***
+ if index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
+ "use *** if the item above has *** too
+ let item_above = s:get_prev_list_item(cur_item, 1)
+ if item_above.type == 1 && s:first_char(item_above.mrkr) ==# s:first_char(new_mrkr)
+ let new_mrkr = item_above.mrkr
+ else
+ "use *** if the item below has *** too
+ let item_below = s:get_next_list_item(cur_item, 1)
+ if item_below.type == 1 && s:first_char(item_below.mrkr) ==# s:first_char(new_mrkr)
+ let new_mrkr = item_below.mrkr
+ else
+ "if the old is ### and the new is * use ***
+ if cur_item.type == 1 &&
+ \ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
+ \ s:first_char(cur_item.mrkr))>-1
+ let new_mrkr = repeat(new_mrkr, s:string_length(cur_item.mrkr))
+ else
+ "use *** if the parent item has **
+ let parent_item = s:get_parent(cur_item)
+ if parent_item.type == 1 && s:first_char(parent_item.mrkr) ==# s:first_char(new_mrkr)
+ let new_mrkr = repeat(s:first_char(parent_item.mrkr),
+ \ s:string_length(parent_item.mrkr)+1)
+ endif
+ endif
+ endif
+ endif
+
+ endif
+
+ call s:set_new_mrkr(cur_item, new_mrkr)
+ call s:adjust_numbered_list(s:get_item(cur_ln), 1, 0)
+
+ if cur_ln >= a:to_line | break | endif
+ let cur_ln = s:get_next_line(cur_ln, 1)
+ endwhile
+
+ call cursor('.', col('$') - cur_col_from_eol)
+endfunction
+
+
+function! vimwiki#lst#change_marker_in_list(new_mrkr)
+ let cur_item = s:get_corresponding_item(line('.'))
+ let first_item = s:get_first_item_in_list(cur_item, 0)
+ let last_item = s:get_last_item_in_list(cur_item, 0)
+ if first_item.type == 0 || last_item.type == 0 | return | endif
+ let first_item_line = first_item.lnum
+
+ let cur_item = first_item
+ while cur_item.type != 0 && cur_item.lnum <= last_item.lnum
+ call s:set_new_mrkr(cur_item, a:new_mrkr)
+ let cur_item = s:get_next_list_item(cur_item, 1)
+ endwhile
+
+ call s:adjust_numbered_list(s:get_item(first_item_line), 0, 0)
+endfunction
+
+
+"sets kind of the item depending on neighbor items and the parent item
+function! s:adjust_mrkr(item)
+ if a:item.type == 0 || vimwiki#vars#get_syntaxlocal('recurring_bullets')
+ return
+ endif
+
+ let new_mrkr = a:item.mrkr
+ let neighbor_item = s:get_a_neighbor_item(a:item)
+ if neighbor_item.type != 0
+ let new_mrkr = neighbor_item.mrkr
+ endif
+
+ "if possible, set e.g. *** if parent has ** as marker
+ if neighbor_item.type == 0 && a:item.type == 1 &&
+ \ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
+ \ s:first_char(a:item.mrkr)) > -1
+ let parent_item = s:get_parent(a:item)
+ if parent_item.type == 1 && s:first_char(parent_item.mrkr) ==# s:first_char(a:item.mrkr)
+ let new_mrkr = repeat(s:first_char(parent_item.mrkr), s:string_length(parent_item.mrkr)+1)
+ endif
+ endif
+
+ call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, new_mrkr)
+ call s:adjust_numbered_list(a:item, 0, 1)
+endfunction
+
+
+function! s:clone_marker_from_to(from, to)
+ let item_from = s:get_item(a:from)
+ if item_from.type == 0 | return | endif
+ let new_mrkr = item_from.mrkr . ' '
+ call s:substitute_rx_in_line(a:to, '^\s*', new_mrkr)
+ let new_indent = ( vimwiki#vars#get_syntaxlocal('recurring_bullets') ? 0 : indent(a:from) )
+ call s:set_indent(a:to, new_indent)
+ if item_from.cb != ''
+ call s:create_cb(s:get_item(a:to))
+ call s:update_state(s:get_parent(s:get_item(a:to)))
+ endif
+ if item_from.type == 2
+ let adjust_from = ( a:from < a:to ? a:from : a:to )
+ call s:adjust_numbered_list_below(s:get_item(adjust_from), 0)
+ endif
+endfunction
+
+
+function! s:remove_mrkr(item)
+ let item = a:item
+ if item.cb != ''
+ let item = s:remove_cb(item)
+ let parent_item = s:get_parent(item)
+ else
+ let parent_item = s:empty_item()
+ endif
+ call s:substitute_rx_in_line(item.lnum, vimwiki#u#escape(item.mrkr).'\s*', '')
+ call remove(item, 'mrkr')
+ call remove(item, 'cb')
+ let item.type = 0
+ call s:update_state(parent_item)
+ return item
+endfunction
+
+
+function! s:create_marker(lnum)
+ let new_sibling = s:get_corresponding_item(a:lnum)
+ if new_sibling.type == 0
+ let new_sibling = s:get_a_neighbor_item_in_column(a:lnum, virtcol('.'))
+ endif
+ if new_sibling.type != 0
+ call s:clone_marker_from_to(new_sibling.lnum, a:lnum)
+ else
+ let cur_item = s:get_item(a:lnum)
+ call s:set_new_mrkr(cur_item, vimwiki#vars#get_syntaxlocal('list_markers')[0])
+ call s:adjust_numbered_list(cur_item, 0, 0)
+ endif
+endfunction
+
+
+" ---------------------------------------------------------
+" handle keys
+" ---------------------------------------------------------
+
+function! vimwiki#lst#kbd_o()
+ let fold_end = foldclosedend('.')
+ let lnum = (fold_end == -1) ? line('.') : fold_end
+ let cur_item = s:get_item(lnum)
+ "inserting and deleting the x is necessary
+ "because otherwise the indent is lost
+ normal! ox
+ if cur_item.lnum < s:get_last_line_of_item(cur_item)
+ call s:indent_multiline(cur_item, cur_item.lnum+1)
+ else
+ call s:clone_marker_from_to(cur_item.lnum, cur_item.lnum+1)
+ endif
+ startinsert!
+endfunction
+
+
+function! vimwiki#lst#kbd_O()
+ normal! Ox
+ let cur_ln = line('.')
+ if getline(cur_ln+1) !~# '^\s*$'
+ call s:clone_marker_from_to(cur_ln+1, cur_ln)
+ else
+ call s:clone_marker_from_to(cur_ln-1, cur_ln)
+ endif
+ startinsert!
+endfunction
+
+
+function! s:cr_on_empty_list_item(lnum, behavior)
+ if a:behavior == 1
+ "just make a new list item
+ normal! gi 
+ call s:clone_marker_from_to(a:lnum, a:lnum+1)
+ startinsert!
+ return
+ elseif a:behavior == 2
+ "insert new marker but remove marker in old line
+ call append(a:lnum-1, '')
+ startinsert!
+ return
+ elseif a:behavior == 3
+ "list is finished, but cursor stays in current line
+ let item = s:get_item(a:lnum)
+ let neighbor_item = s:get_a_neighbor_item(item)
+ let child_item = s:get_first_child(item)
+ let parent_item = (item.cb != '') ? s:get_parent(item) : s:empty_item()
+ normal! "_cc
+ call s:adjust_numbered_list(neighbor_item, 0, 0)
+ call s:adjust_numbered_list(child_item, 0, 0)
+ call s:update_state(parent_item)
+ startinsert
+ return
+ elseif a:behavior == 4
+ "list is finished, but cursor goes to next line
+ let item = s:get_item(a:lnum)
+ let neighbor_item = s:get_a_neighbor_item(item)
+ let child_item = s:get_first_child(item)
+ let parent_item = (item.cb != '') ? s:get_parent(item) : s:empty_item()
+ normal! "_cc
+ call s:adjust_numbered_list(neighbor_item, 0, 0)
+ call s:adjust_numbered_list(child_item, 0, 0)
+ call s:update_state(parent_item)
+ startinsert
+ return
+ elseif a:behavior == 5
+ "successively decrease level
+ if s:get_level(a:lnum) > 0
+ call s:change_level(a:lnum, a:lnum, 'decrease', 0)
+ startinsert!
+ else
+ let item = s:get_item(a:lnum)
+ let neighbor_item = s:get_a_neighbor_item(item)
+ let child_item = s:get_first_child(item)
+ let parent_item = (item.cb != '') ? s:get_parent(item) : s:empty_item()
+ normal! "_cc
+ call s:adjust_numbered_list(neighbor_item, 0, 0)
+ call s:adjust_numbered_list(child_item, 0, 0)
+ call s:update_state(parent_item)
+ startinsert
+ endif
+ return
+ endif
+endfunction
+
+
+function! s:cr_on_empty_line(lnum, behavior)
+ "inserting and deleting the x is necessary
+ "because otherwise the indent is lost
+ normal! gi x
+ if a:behavior == 2 || a:behavior == 3
+ call s:create_marker(a:lnum+1)
+ endif
+endfunction
+
+
+function! s:cr_on_list_item(lnum, insert_new_marker, not_at_eol)
+ if a:insert_new_marker
+ "the ultimate feature of this script: make new marker on <CR>
+ normal! gi 
+ call s:clone_marker_from_to(a:lnum, a:lnum+1)
+ "tiny sweet extra feature: indent next line if current line ends with :
+ if !a:not_at_eol && getline(a:lnum) =~# ':$'
+ call s:change_level(a:lnum+1, a:lnum+1, 'increase', 0)
+ endif
+ else
+ " || (cur_item.lnum < s:get_last_line_of_item(cur_item))
+ "indent this line so that it becomes the continuation of the line above
+ normal! gi 
+ let prev_line = s:get_corresponding_item(s:get_prev_line(a:lnum+1))
+ call s:indent_multiline(prev_line, a:lnum+1)
+ endif
+endfunction
+
+
+function! vimwiki#lst#kbd_cr(normal, just_mrkr)
+ let lnum = line('.')
+ let has_bp = s:line_has_marker(lnum)
+
+ if has_bp != 0 && virtcol('.') < s:text_begin(lnum)
+ call append(lnum-1, '')
+ startinsert!
+ return
+ endif
+
+ if has_bp == 1
+ call s:cr_on_empty_list_item(lnum, a:just_mrkr)
+ return
+ endif
+
+ let insert_new_marker = (a:normal == 1 || a:normal == 3)
+ if getline('.')[col("'^")-1:] =~# '^\s\+$'
+ let cur_col = 0
+ else
+ let cur_col = col("$") - col("'^")
+ if getline('.')[col("'^")-1] =~# '\s' && exists("*strdisplaywidth")
+ let ws_behind_cursor =
+ \ strdisplaywidth(matchstr(getline('.')[col("'^")-1:], '\s\+'),
+ \ virtcol("'^")-1)
+ let cur_col -= ws_behind_cursor
+ endif
+ if insert_new_marker && cur_col == 0 && getline(lnum) =~# '\s$'
+ let insert_new_marker = 0
+ endif
+ endif
+
+ if has_bp == 0
+ call s:cr_on_empty_line(lnum, a:normal)
+ endif
+
+ if has_bp == 2
+ call s:cr_on_list_item(lnum, insert_new_marker, cur_col)
+ endif
+
+ call cursor(lnum+1, col("$") - cur_col)
+ if cur_col == 0
+ startinsert!
+ else
+ startinsert
+ endif
+
+endfunction
+
+
+"creates a list item in the current line or removes it
+function! vimwiki#lst#toggle_list_item()
+ let cur_col_from_eol = col("$") - col("'^")
+ let cur_item = s:get_item(line('.'))
+
+ if cur_item.type == 0
+ call s:create_marker(cur_item.lnum)
+ else
+ let prev_item = s:get_prev_list_item(cur_item, 1)
+ if prev_item.type == 0
+ let prev_item = s:get_corresponding_item(s:get_prev_line(cur_item.lnum))
+ endif
+ let cur_item = s:remove_mrkr(cur_item)
+ let adjust_prev_item = (prev_item.type == 2 &&
+ \ s:get_level(cur_item.lnum) <= s:get_level(prev_item.lnum)) ? 1 : 0
+ call s:indent_multiline(prev_item, cur_item.lnum)
+ if adjust_prev_item
+ call s:adjust_numbered_list_below(prev_item, 0)
+ endif
+ endif
+
+ "set cursor position s.t. it's on the same char as before
+ let new_cur_col = col("$") - cur_col_from_eol
+ call cursor(cur_item.lnum, new_cur_col >= 1 ? new_cur_col : 1)
+
+ if cur_col_from_eol == 0 || getline(cur_item.lnum) =~# '^\s*$'
+ startinsert!
+ else
+ startinsert
+ endif
+endfunction
+
+
+" ---------------------------------------------------------
+" misc stuff
+" ---------------------------------------------------------
+
+function! vimwiki#lst#TO_list_item(inner, visual)
+ let lnum = prevnonblank('.')
+ let item = s:get_corresponding_item(lnum)
+ if item.type == 0
+ return
+ endif
+ let from_line = item.lnum
+ if a:inner
+ let to_line = s:get_last_line_of_item(item)
+ else
+ let to_line = s:get_last_line_of_item_incl_children(item)
+ endif
+ normal! V
+ call cursor(to_line, 0)
+ normal! o
+ call cursor(from_line, 0)
+endfunction
+
+
+function! vimwiki#lst#fold_level(lnum)
+ let cur_item = s:get_item(a:lnum)
+ if cur_item.type != 0
+ let parent_item = s:get_parent(cur_item)
+ let child_item = s:get_first_child(cur_item)
+ let next_item = s:get_next_child_item(parent_item, cur_item)
+ if child_item.type != 0
+ return 'a1'
+ elseif next_item.type == 0
+ return 's1'
+ endif
+ endif
+ return '='
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/markdown_base.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/markdown_base.vim
new file mode 100644
index 0000000..f1ce091
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/markdown_base.vim
@@ -0,0 +1,150 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Link functions for markdown syntax
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+function! s:safesubstitute(text, search, replace, mode)
+ " Substitute regexp but do not interpret replace
+ let escaped = escape(a:replace, '\&')
+ return substitute(a:text, a:search, escaped, a:mode)
+endfunction
+
+
+function! vimwiki#markdown_base#scan_reflinks()
+ let mkd_refs = {}
+ " construct list of references using vimgrep
+ try
+ " Why noautocmd? Because https://github.com/vimwiki/vimwiki/issues/121
+ noautocmd execute 'vimgrep #'.vimwiki#vars#get_syntaxlocal('rxMkdRef').'#j %'
+ catch /^Vim\%((\a\+)\)\=:E480/ " No Match
+ "Ignore it, and move on to the next file
+ endtry
+
+ for d in getqflist()
+ let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ')
+ let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr'))
+ let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl'))
+ if descr != '' && url != ''
+ let mkd_refs[descr] = url
+ endif
+ endfor
+ call vimwiki#vars#set_bufferlocal('markdown_refs', mkd_refs)
+ return mkd_refs
+endfunction
+
+
+" try markdown reference links
+function! vimwiki#markdown_base#open_reflink(link)
+ " echom "vimwiki#markdown_base#open_reflink"
+ let link = a:link
+ let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
+ if has_key(mkd_refs, link)
+ let url = mkd_refs[link]
+ call vimwiki#base#system_open_link(url)
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+
+function! s:normalize_link_syntax_n()
+ let lnum = line('.')
+
+ " try WikiIncl
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl'))
+ if !empty(lnk)
+ " NO-OP !!
+ return
+ endif
+
+ " try WikiLink0: replace with WikiLink1
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'),
+ \ vimwiki#vars#get_syntaxlocal('WikiLink1Template2'))
+ call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'), sub)
+ return
+ endif
+
+ " try WikiLink1: replace with WikiLink0
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'),
+ \ vimwiki#vars#get_global('WikiLinkTemplate2'))
+ call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), sub)
+ return
+ endif
+
+ " try Weblink
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'),
+ \ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchDescr'),
+ \ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
+ call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'), sub)
+ return
+ endif
+
+ " try Word (any characters except separators)
+ " rxWord is less permissive than rxWikiLinkUrl which is used in
+ " normalize_link_syntax_v
+ let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord'))
+ if !empty(lnk)
+ let sub = vimwiki#base#normalize_link_helper(lnk,
+ \ vimwiki#vars#get_global('rxWord'), '',
+ \ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
+ call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
+ return
+ endif
+
+endfunction
+
+
+function! s:normalize_link_syntax_v()
+ let lnum = line('.')
+ let sel_save = &selection
+ let &selection = "old"
+ let rv = @"
+ let rt = getregtype('"')
+ let done = 0
+
+ try
+ norm! gvy
+ let visual_selection = @"
+ let link = s:safesubstitute(vimwiki#vars#get_syntaxlocal('Weblink1Template'),
+ \ '__LinkUrl__', visual_selection, '')
+ let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '')
+
+ call setreg('"', substitute(link, '\n', '', ''), visualmode())
+
+ " paste result
+ norm! `>""pgvd
+
+ finally
+ call setreg('"', rv, rt)
+ let &selection = sel_save
+ endtry
+
+endfunction
+
+
+function! vimwiki#markdown_base#normalize_link(is_visual_mode)
+ if 0
+ " Syntax-specific links
+ else
+ if !a:is_visual_mode
+ call s:normalize_link_syntax_n()
+ elseif line("'<") == line("'>")
+ " action undefined for multi-line visual mode selections
+ call s:normalize_link_syntax_v()
+ endif
+ endif
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/path.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/path.vim
new file mode 100644
index 0000000..367b1d7
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/path.vim
@@ -0,0 +1,183 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Path manipulation functions
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+function! vimwiki#path#chomp_slash(str)
+ return substitute(a:str, '[/\\]\+$', '', '')
+endfunction
+
+
+" Define path-compare function, either case-sensitive or not, depending on OS.
+if vimwiki#u#is_windows()
+ function! vimwiki#path#is_equal(p1, p2)
+ return a:p1 ==? a:p2
+ endfunction
+else
+ function! vimwiki#path#is_equal(p1, p2)
+ return a:p1 ==# a:p2
+ endfunction
+endif
+
+
+" collapse sections like /a/b/../c to /a/c
+function! vimwiki#path#normalize(path)
+ let path = a:path
+ while 1
+ let result = substitute(path, '/[^/]\+/\.\.', '', '')
+ if result ==# path
+ break
+ endif
+ let path = result
+ endwhile
+ return result
+endfunction
+
+
+function! vimwiki#path#path_norm(path)
+ " /-slashes
+ if a:path !~# '^scp:'
+ let path = substitute(a:path, '\', '/', 'g')
+ " treat multiple consecutive slashes as one path separator
+ let path = substitute(path, '/\+', '/', 'g')
+ " ensure that we are not fooled by a symbolic link
+ return resolve(path)
+ else
+ return a:path
+ endif
+endfunction
+
+
+function! vimwiki#path#is_link_to_dir(link)
+ " Check if link is to a directory.
+ " It should be ended with \ or /.
+ return a:link =~# '\m[/\\]$'
+endfunction
+
+
+function! vimwiki#path#abs_path_of_link(link)
+ return vimwiki#path#normalize(expand("%:p:h").'/'.a:link)
+endfunction
+
+
+" return longest common path prefix of 2 given paths.
+" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
+function! vimwiki#path#path_common_pfx(path1, path2)
+ let p1 = split(a:path1, '[/\\]', 1)
+ let p2 = split(a:path2, '[/\\]', 1)
+
+ let idx = 0
+ let minlen = min([len(p1), len(p2)])
+ while (idx < minlen) && vimwiki#path#is_equal(p1[idx], p2[idx])
+ let idx = idx + 1
+ endwhile
+ if idx == 0
+ return ''
+ else
+ return join(p1[: idx-1], '/')
+ endif
+endfunction
+
+
+function! vimwiki#path#wikify_path(path)
+ let result = resolve(fnamemodify(a:path, ':p'))
+ if vimwiki#u#is_windows()
+ let result = substitute(result, '\\', '/', 'g')
+ endif
+ let result = vimwiki#path#chomp_slash(result)
+ return result
+endfunction
+
+
+function! vimwiki#path#current_wiki_file()
+ return vimwiki#path#wikify_path(expand('%:p'))
+endfunction
+
+
+" Returns: the relative path from a:dir to a:file
+function! vimwiki#path#relpath(dir, file)
+ let result = []
+ let dir = split(a:dir, '/')
+ let file = split(a:file, '/')
+ while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir[0], file[0])
+ call remove(dir, 0)
+ call remove(file, 0)
+ endwhile
+ if empty(dir) && empty(file)
+ return './'
+ endif
+ for segment in dir
+ let result += ['..']
+ endfor
+ for segment in file
+ let result += [segment]
+ endfor
+ let result_path = join(result, '/')
+ if a:file =~ '\m/$'
+ let result_path .= '/'
+ endif
+ return result_path
+endfunction
+
+
+" If the optional argument provided and nonzero,
+" it will ask before creating a directory
+" Returns: 1 iff directory exists or successfully created
+function! vimwiki#path#mkdir(path, ...)
+ let path = expand(a:path)
+
+ if path =~# '^scp:'
+ " we can not do much, so let's pretend everything is ok
+ return 1
+ endif
+
+ if isdirectory(path)
+ return 1
+ else
+ if !exists("*mkdir")
+ return 0
+ endif
+
+ let path = vimwiki#path#chomp_slash(path)
+ if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc'))
+ let path = iconv(path, &enc, vimwiki#vars#get_global('w32_dir_enc'))
+ endif
+
+ if a:0 && a:1 && input("Vimwiki: Make new directory: ".path."\n [y]es/[N]o? ") !~? '^y'
+ return 0
+ endif
+
+ call mkdir(path, "p")
+ return 1
+ endif
+endfunction
+
+
+function! vimwiki#path#is_absolute(path)
+ if vimwiki#u#is_windows()
+ return a:path =~? '\m^\a:'
+ else
+ return a:path =~# '\m^/\|\~/'
+ endif
+endfunction
+
+
+" Combine a directory and a file into one path, doesn't generate duplicate
+" path separator in case the directory is also having an ending / or \. This
+" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
+" valid path.
+if vimwiki#u#is_windows()
+ function! vimwiki#path#join_path(directory, file)
+ let directory = vimwiki#path#chomp_slash(a:directory)
+ let file = substitute(a:file, '\m^[\\/]\+', '', '')
+ return directory . '/' . file
+ endfunction
+else
+ function! vimwiki#path#join_path(directory, file)
+ let directory = substitute(a:directory, '\m/\+$', '', '')
+ let file = substitute(a:file, '\m^/\+', '', '')
+ return directory . '/' . file
+ endfunction
+endif
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/style.css b/vim/.vim/plugged/vimwiki/autoload/vimwiki/style.css
new file mode 100644
index 0000000..431d15b
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/style.css
@@ -0,0 +1,82 @@
+body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
+h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
+h1 {font-size: 2.6em; color: #000000;}
+h2 {font-size: 2.2em; color: #404040;}
+h3 {font-size: 1.8em; color: #707070;}
+h4 {font-size: 1.4em; color: #909090;}
+h5 {font-size: 1.3em; color: #989898;}
+h6 {font-size: 1.2em; color: #9c9c9c;}
+p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
+ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
+li {margin: 0.3em auto;}
+ul {margin-left: 2em; padding-left: 0.5em;}
+dt {font-weight: bold;}
+img {border: none;}
+pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
+blockquote {padding: 0.4em; background-color: #f6f5eb;}
+th, td {border: 1px solid #ccc; padding: 0.3em;}
+th {background-color: #f0f0f0;}
+hr {border: none; border-top: 1px solid #ccc; width: 100%;}
+del {text-decoration: line-through; color: #777777;}
+.toc li {list-style-type: none;}
+.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
+.justleft {text-align: left;}
+.justright {text-align: right;}
+.justcenter {text-align: center;}
+.center {margin-left: auto; margin-right: auto;}
+.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
+
+/* classes for items of todo lists */
+.rejected {
+ /* list-style: none; */
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAACXBIWXMAAADFAAAAxQEdzbqoAAAAB3RJTUUH4QgEFhAtuWgv9wAAAPZQTFRFmpqam5iYnJaWnJeXnpSUn5OTopCQpoqKpouLp4iIqIiIrYCAt3V1vW1tv2xsmZmZmpeXnpKS/x4e/x8f/yAg/yIi/yQk/yUl/yYm/ygo/ykp/yws/zAw/zIy/zMz/zQ0/zU1/zY2/zw8/0BA/0ZG/0pK/1FR/1JS/1NT/1RU/1VV/1ZW/1dX/1pa/15e/19f/2Zm/2lp/21t/25u/3R0/3p6/4CA/4GB/4SE/4iI/46O/4+P/52d/6am/6ur/66u/7Oz/7S0/7e3/87O/9fX/9zc/93d/+Dg/+vr/+3t/+/v//Dw//Ly//X1//f3//n5//z8////gzaKowAAAA90Uk5T/Pz8/Pz8/Pz8/Pz8/f39ppQKWQAAAAFiS0dEEnu8bAAAAACuSURBVAhbPY9ZF4FQFEZPSKbIMmWep4gMGTKLkIv6/3/GPbfF97b3w17rA0kQOPgvAeHW6uJ6+5h7HqLdwowgOzejXRXBdx6UdSru216xuOMBHHNU0clTzeSUA6EhF8V8kqroluMiU6HKcuf4phGPr1o2q9kYZWwNq1qfRRmTaXpqsyjj17KkWCxKBUBgXWueHIyiAIg18gsse4KHkLF5IKIY10WQgv7fOy4ST34BRiopZ8WLNrgAAAAASUVORK5CYII=);
+ background-repeat: no-repeat;
+ background-position: 0 .2em;
+ padding-left: 1.5em;
+}
+.done0 {
+ /* list-style: none; */
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
+ background-repeat: no-repeat;
+ background-position: 0 .2em;
+ padding-left: 1.5em;
+}
+.done1 {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
+ background-repeat: no-repeat;
+ background-position: 0 .15em;
+ padding-left: 1.5em;
+}
+.done2 {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
+ background-repeat: no-repeat;
+ background-position: 0 .15em;
+ padding-left: 1.5em;
+}
+.done3 {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
+ background-repeat: no-repeat;
+ background-position: 0 .15em;
+ padding-left: 1.5em;
+}
+.done4 {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
+ background-repeat: no-repeat;
+ background-position: 0 .15em;
+ padding-left: 1.5em;
+}
+
+code {
+ font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
+ -webkit-border-radius: 1px;
+ -moz-border-radius: 1px;
+ border-radius: 1px;
+ -moz-background-clip: padding;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+ padding: 0px 3px;
+ display: inline-block;
+ color: #52595d;
+ border: 1px solid #ccc;
+ background-color: #f9f9f9;
+}
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/tags.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/tags.vim
new file mode 100644
index 0000000..e802bce
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/tags.vim
@@ -0,0 +1,342 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+
+
+let s:TAGS_METADATA_FILE_NAME = '.tags'
+
+
+
+" Tags metadata in-memory format:
+" metadata := { 'pagename': [entries, ...] }
+" entry := { 'tagname':..., 'lineno':..., 'link':... }
+
+" Tags metadata in-file format:
+"
+" Is based on CTags format (see |tags-file-format|).
+"
+" {tagaddress} is set to lineno. We'll let vim search by exact line number; we
+" can afford that, we assume metadata file is always updated before use.
+"
+" Pagename and link are not saved in standard ctags fields, so we'll add
+" an optional field, "vimwiki:". In this field, we encode tab-separated values
+" of missing parameters -- "pagename" and "link".
+
+
+
+" Update tags metadata.
+" a:full_rebuild == 1: re-scan entire wiki
+" a:full_rebuild == 0: only re-scan current page
+" a:all_files == '': only if the file is newer than .tags
+function! vimwiki#tags#update_tags(full_rebuild, all_files)
+ let all_files = a:all_files != ''
+ if !a:full_rebuild
+ " Updating for one page (current)
+ let page_name = vimwiki#vars#get_bufferlocal('subdir') . expand('%:t:r')
+ " Collect tags in current file
+ let tags = s:scan_tags(getline(1, '$'), page_name)
+ " Load metadata file
+ let metadata = s:load_tags_metadata()
+ " Drop old tags
+ let metadata = s:remove_page_from_tags(metadata, page_name)
+ " Merge in the new ones
+ let metadata = s:merge_tags(metadata, page_name, tags)
+ " Save
+ call s:write_tags_metadata(metadata)
+ else " full rebuild
+ let files = vimwiki#base#find_files(vimwiki#vars#get_bufferlocal('wiki_nr'), 0)
+ let wiki_base_dir = vimwiki#vars#get_wikilocal('path')
+ let tags_file_last_modification = getftime(vimwiki#tags#metadata_file_path())
+ let metadata = s:load_tags_metadata()
+ for file in files
+ if all_files || getftime(file) >= tags_file_last_modification
+ let subdir = vimwiki#base#subdir(wiki_base_dir, file)
+ let page_name = subdir . fnamemodify(file, ':t:r')
+ let tags = s:scan_tags(readfile(file), page_name)
+ let metadata = s:remove_page_from_tags(metadata, page_name)
+ let metadata = s:merge_tags(metadata, page_name, tags)
+ endif
+ endfor
+ call s:write_tags_metadata(metadata)
+ endif
+endfunction
+
+
+" Scans the list of text lines (argument) and produces tags metadata as a list of tag entries.
+function! s:scan_tags(lines, page_name)
+
+ let entries = []
+
+ " Code wireframe to scan for headers -- borrowed from
+ " vimwiki#base#get_anchors(), with minor modifications.
+
+ let rxheader = vimwiki#vars#get_syntaxlocal('header_search')
+ let rxtag = vimwiki#vars#get_syntaxlocal('tag_search')
+
+ let anchor_level = ['', '', '', '', '', '', '']
+ let current_complete_anchor = ''
+
+ let PROXIMITY_LINES_NR = 2
+ let header_line_nr = - (2 * PROXIMITY_LINES_NR)
+
+ for line_nr in range(1, len(a:lines))
+ let line = a:lines[line_nr - 1]
+
+ " process headers
+ let h_match = matchlist(line, rxheader)
+ if !empty(h_match) " got a header
+ let header_line_nr = line_nr
+ let header = vimwiki#u#trim(h_match[2])
+ let level = len(h_match[1])
+ let anchor_level[level-1] = header
+ for l in range(level, 6)
+ let anchor_level[l] = ''
+ endfor
+ if level == 1
+ let current_complete_anchor = header
+ else
+ let current_complete_anchor = ''
+ for l in range(level-1)
+ if anchor_level[l] != ''
+ let current_complete_anchor .= anchor_level[l].'#'
+ endif
+ endfor
+ let current_complete_anchor .= header
+ endif
+ continue " tags are not allowed in headers
+ endif
+
+ " TODO ignore verbatim blocks
+
+ " Scan line for tags. There can be many of them.
+ let str = line
+ while 1
+ let tag_group = matchstr(str, rxtag)
+ if tag_group == ''
+ break
+ endif
+ let tagend = matchend(str, rxtag)
+ let str = str[(tagend):]
+ for tag in split(tag_group, ':')
+ " Create metadata entry
+ let entry = {}
+ let entry.tagname = tag
+ let entry.lineno = line_nr
+ if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
+ " Tag appeared at the top of the file
+ let entry.link = a:page_name
+ elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
+ " Tag appeared right below a header
+ let entry.link = a:page_name . '#' . current_complete_anchor
+ else
+ " Tag stands on its own
+ let entry.link = a:page_name . '#' . tag
+ endif
+ call add(entries, entry)
+ endfor
+ endwhile
+
+ endfor " loop over lines
+ return entries
+endfunction
+
+
+" Returns tags metadata file path
+function! vimwiki#tags#metadata_file_path() abort
+ return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'),
+ \ s:TAGS_METADATA_FILE_NAME), ':p')
+endfunction
+
+
+" Loads tags metadata from file, returns a dictionary
+function! s:load_tags_metadata() abort
+ let metadata_path = vimwiki#tags#metadata_file_path()
+ if !filereadable(metadata_path)
+ return {}
+ endif
+ let metadata = {}
+ for line in readfile(metadata_path)
+ if line =~ '^!_TAG_FILE_'
+ continue
+ endif
+ let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$')
+ if parts[0] == '' || parts[1] == '' || parts[2] == ''
+ throw 'VimwikiTags1: Metadata file corrupted'
+ endif
+ let std_fields = split(parts[1], '\t')
+ if len(std_fields) != 3
+ throw 'VimwikiTags2: Metadata file corrupted'
+ endif
+ let vw_part = parts[2]
+ if vw_part[0] != "\t"
+ throw 'VimwikiTags3: Metadata file corrupted'
+ endif
+ let vw_fields = split(vw_part[1:], "\t")
+ if len(vw_fields) != 1 || vw_fields[0] !~ '^vimwiki:'
+ throw 'VimwikiTags4: Metadata file corrupted'
+ endif
+ let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '')
+ let vw_data = substitute(vw_data, '\\n', "\n", 'g')
+ let vw_data = substitute(vw_data, '\\r', "\r", 'g')
+ let vw_data = substitute(vw_data, '\\t', "\t", 'g')
+ let vw_data = substitute(vw_data, '\\\\', "\\", 'g')
+ let vw_fields = split(vw_data, "\t")
+ if len(vw_fields) != 2
+ throw 'VimwikiTags5: Metadata file corrupted'
+ endif
+ let pagename = vw_fields[0]
+ let entry = {}
+ let entry.tagname = std_fields[0]
+ let entry.lineno = std_fields[2]
+ let entry.link = vw_fields[1]
+ if has_key(metadata, pagename)
+ call add(metadata[pagename], entry)
+ else
+ let metadata[pagename] = [entry]
+ endif
+ endfor
+ return metadata
+endfunction
+
+
+" Removes all entries for given page from metadata in-place. Returns updated
+" metadata (just in case).
+function! s:remove_page_from_tags(metadata, page_name)
+ if has_key(a:metadata, a:page_name)
+ call remove(a:metadata, a:page_name)
+ return a:metadata
+ else
+ return a:metadata
+ endif
+endfunction
+
+
+" Merges metadata of one file into a:metadata
+function! s:merge_tags(metadata, pagename, file_metadata)
+ let metadata = a:metadata
+ let metadata[a:pagename] = a:file_metadata
+ return metadata
+endfunction
+
+
+" Compares two actual lines from tags file. Return value is in strcmp style.
+" See help on sort() -- that's what this function is going to be used for.
+" See also s:write_tags_metadata below -- that's where we compose these tags
+" file lines.
+"
+" This function is needed for tags sorting, since plain sort() compares line
+" numbers as strings, not integers, and so, for example, tag at line 14
+" preceeds the same tag on the same page at line 9. (Because string "14" is
+" alphabetically 'less than' string "9".)
+function! s:tags_entry_cmp(i1, i2)
+ let items = []
+ for orig_item in [a:i1, a:i2]
+ let fields = split(orig_item, "\t")
+ let item = {}
+ let item.text = fields[0]."\t".fields[1]
+ let item.lineno = 0 + matchstr(fields[2], '\m\d\+')
+ call add(items, item)
+ endfor
+ if items[0].text ># items[1].text
+ return 1
+ elseif items[0].text <# items[1].text
+ return -1
+ elseif items[0].lineno > items[1].lineno
+ return 1
+ elseif items[0].lineno < items[1].lineno
+ return -1
+ else
+ return 0
+ endif
+endfunction
+
+
+" Saves metadata object into a file. Throws exceptions in case of problems.
+function! s:write_tags_metadata(metadata)
+ let metadata_path = vimwiki#tags#metadata_file_path()
+ let tags = []
+ for pagename in keys(a:metadata)
+ for entry in a:metadata[pagename]
+ let entry_data = pagename . "\t" . entry.link
+ let entry_data = substitute(entry_data, "\\", '\\\\', 'g')
+ let entry_data = substitute(entry_data, "\t", '\\t', 'g')
+ let entry_data = substitute(entry_data, "\r", '\\r', 'g')
+ let entry_data = substitute(entry_data, "\n", '\\n', 'g')
+ call add(tags,
+ \ entry.tagname . "\t"
+ \ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t"
+ \ . entry.lineno
+ \ . ';"'
+ \ . "\t" . "vimwiki:" . entry_data
+ \)
+ endfor
+ endfor
+ call sort(tags, "s:tags_entry_cmp")
+ call insert(tags, "!_TAG_FILE_SORTED\t1\t")
+ call writefile(tags, metadata_path)
+endfunction
+
+
+" Returns list of unique tags found in the .tags file
+function! vimwiki#tags#get_tags()
+ let metadata = s:load_tags_metadata()
+ let tags = {}
+ for entries in values(metadata)
+ for entry in entries
+ let tags[entry.tagname] = 1
+ endfor
+ endfor
+ return keys(tags)
+endfunction
+
+
+" Similar to vimwiki#base#generate_links. In the current buffer, appends
+" tags and references to all their instances. If no arguments (tags) are
+" specified, outputs all tags.
+function! vimwiki#tags#generate_tags(...) abort
+ let need_all_tags = (a:0 == 0)
+ let specific_tags = a:000
+
+ let metadata = s:load_tags_metadata()
+
+ " make a dictionary { tag_name: [tag_links, ...] }
+ let tags_entries = {}
+ for entries in values(metadata)
+ for entry in entries
+ if has_key(tags_entries, entry.tagname)
+ call add(tags_entries[entry.tagname], entry.link)
+ else
+ let tags_entries[entry.tagname] = [entry.link]
+ endif
+ endfor
+ endfor
+
+ let lines = []
+ let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
+ for tagname in sort(keys(tags_entries))
+ if need_all_tags || index(specific_tags, tagname) != -1
+ call extend(lines, [
+ \ '',
+ \ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', tagname, ''),
+ \ '' ])
+ for taglink in sort(tags_entries[tagname])
+ call add(lines, bullet . substitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
+ \ '__LinkUrl__', taglink, ''))
+ endfor
+ endif
+ endfor
+
+ let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
+ \ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
+ \ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)'
+
+ call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx, line('$')+1, 1)
+endfunction
+
+
+function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
+ " We can safely ignore args if we use -custom=complete option, Vim engine
+ " will do the job of filtering.
+ let taglist = vimwiki#tags#get_tags()
+ return join(taglist, "\n")
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/tbl.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/tbl.vim
new file mode 100644
index 0000000..1c049ce
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/tbl.vim
@@ -0,0 +1,703 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Tables
+" | Easily | manageable | text | tables | ! |
+" |--------|------------|-------|--------|---------|
+" | Have | fun! | Drink | tea | Period. |
+"
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+
+if exists("g:loaded_vimwiki_tbl_auto") || &cp
+ finish
+endif
+let g:loaded_vimwiki_tbl_auto = 1
+
+
+let s:textwidth = &tw
+
+
+function! s:rxSep()
+ return vimwiki#vars#get_syntaxlocal('rxTableSep')
+endfunction
+
+
+function! s:wide_len(str)
+ " vim73 has new function that gives correct string width.
+ if exists("*strdisplaywidth")
+ return strdisplaywidth(a:str)
+ endif
+
+ " get str display width in vim ver < 7.2
+ if !vimwiki#vars#get_global('CJK_length')
+ let ret = strlen(substitute(a:str, '.', 'x', 'g'))
+ else
+ let savemodified = &modified
+ let save_cursor = getpos('.')
+ exe "norm! o\<esc>"
+ call setline(line("."), a:str)
+ let ret = virtcol("$") - 1
+ d
+ call setpos('.', save_cursor)
+ let &modified = savemodified
+ endif
+ return ret
+endfunction
+
+
+function! s:cell_splitter()
+ return '\s*'.s:rxSep().'\s*'
+endfunction
+
+
+function! s:sep_splitter()
+ return '-'.s:rxSep().'-'
+endfunction
+
+
+function! s:is_table(line)
+ return s:is_separator(a:line) ||
+ \ (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
+endfunction
+
+
+function! s:is_separator(line)
+ return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
+endfunction
+
+
+function! s:is_separator_tail(line)
+ return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
+endfunction
+
+
+function! s:is_last_column(lnum, cnum)
+ let line = strpart(getline(a:lnum), a:cnum - 1)
+ return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
+endfunction
+
+
+function! s:is_first_column(lnum, cnum)
+ let line = strpart(getline(a:lnum), 0, a:cnum - 1)
+ return line =~# '^\s*$' ||
+ \ (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
+endfunction
+
+
+function! s:count_separators_up(lnum)
+ let lnum = a:lnum - 1
+ while lnum > 1
+ if !s:is_separator(getline(lnum))
+ break
+ endif
+ let lnum -= 1
+ endwhile
+
+ return (a:lnum-lnum)
+endfunction
+
+
+function! s:count_separators_down(lnum)
+ let lnum = a:lnum + 1
+ while lnum < line('$')
+ if !s:is_separator(getline(lnum))
+ break
+ endif
+ let lnum += 1
+ endwhile
+
+ return (lnum-a:lnum)
+endfunction
+
+
+function! s:create_empty_row(cols)
+ let row = s:rxSep()
+ let cell = " ".s:rxSep()
+
+ for c in range(a:cols)
+ let row .= cell
+ endfor
+
+ return row
+endfunction
+
+
+function! s:create_row_sep(cols)
+ let row = s:rxSep()
+ let cell = "---".s:rxSep()
+
+ for c in range(a:cols)
+ let row .= cell
+ endfor
+
+ return row
+endfunction
+
+
+function! vimwiki#tbl#get_cells(line)
+ let result = []
+ let cell = ''
+ let quote = ''
+ let state = 'NONE'
+
+ " 'Simple' FSM
+ for idx in range(strlen(a:line))
+ " The only way I know Vim can do Unicode...
+ let ch = a:line[idx]
+ if state ==# 'NONE'
+ if ch == '|'
+ let state = 'CELL'
+ endif
+ elseif state ==# 'CELL'
+ if ch == '[' || ch == '{'
+ let state = 'BEFORE_QUOTE_START'
+ let quote = ch
+ elseif ch == '|'
+ call add(result, vimwiki#u#trim(cell))
+ let cell = ""
+ else
+ let cell .= ch
+ endif
+ elseif state ==# 'BEFORE_QUOTE_START'
+ if ch == '[' || ch == '{'
+ let state = 'QUOTE'
+ let quote .= ch
+ else
+ let state = 'CELL'
+ let cell .= quote.ch
+ let quote = ''
+ endif
+ elseif state ==# 'QUOTE'
+ if ch == ']' || ch == '}'
+ let state = 'BEFORE_QUOTE_END'
+ endif
+ let quote .= ch
+ elseif state ==# 'BEFORE_QUOTE_END'
+ if ch == ']' || ch == '}'
+ let state = 'CELL'
+ endif
+ let cell .= quote.ch
+ let quote = ''
+ endif
+ endfor
+
+ if cell.quote != ''
+ call add(result, vimwiki#u#trim(cell.quote, '|'))
+ endif
+ return result
+endfunction
+
+
+function! s:col_count(lnum)
+ return len(vimwiki#tbl#get_cells(getline(a:lnum)))
+endfunction
+
+
+function! s:get_indent(lnum)
+ if !s:is_table(getline(a:lnum))
+ return
+ endif
+
+ let indent = 0
+
+ let lnum = a:lnum - 1
+ while lnum > 1
+ let line = getline(lnum)
+ if !s:is_table(line)
+ let indent = indent(lnum+1)
+ break
+ endif
+ let lnum -= 1
+ endwhile
+
+ return indent
+endfunction
+
+
+function! s:get_rows(lnum)
+ if !s:is_table(getline(a:lnum))
+ return
+ endif
+
+ let upper_rows = []
+ let lower_rows = []
+
+ let lnum = a:lnum - 1
+ while lnum >= 1
+ let line = getline(lnum)
+ if s:is_table(line)
+ call add(upper_rows, [lnum, line])
+ else
+ break
+ endif
+ let lnum -= 1
+ endwhile
+ call reverse(upper_rows)
+
+ let lnum = a:lnum
+ while lnum <= line('$')
+ let line = getline(lnum)
+ if s:is_table(line)
+ call add(lower_rows, [lnum, line])
+ else
+ break
+ endif
+ let lnum += 1
+ endwhile
+
+ return upper_rows + lower_rows
+endfunction
+
+
+function! s:get_cell_max_lens(lnum, ...)
+ let max_lens = {}
+ for [lnum, row] in s:get_rows(a:lnum)
+ if s:is_separator(row)
+ continue
+ endif
+ let cells = a:0 > 1 ? a:1[lnum - a:2] : vimwiki#tbl#get_cells(row)
+ for idx in range(len(cells))
+ let value = cells[idx]
+ if has_key(max_lens, idx)
+ let max_lens[idx] = max([s:wide_len(value), max_lens[idx]])
+ else
+ let max_lens[idx] = s:wide_len(value)
+ endif
+ endfor
+ endfor
+ return max_lens
+endfunction
+
+
+function! s:get_aligned_rows(lnum, col1, col2)
+ let rows = s:get_rows(a:lnum)
+ let startlnum = rows[0][0]
+ let cells = []
+ for [lnum, row] in rows
+ call add(cells, vimwiki#tbl#get_cells(row))
+ endfor
+ let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum)
+ let result = []
+ for [lnum, row] in rows
+ if s:is_separator(row)
+ let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
+ else
+ let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, a:col1, a:col2)
+ endif
+ call add(result, [lnum, new_row])
+ endfor
+ return result
+endfunction
+
+
+" Number of the current column. Starts from 0.
+function! s:cur_column()
+ let line = getline('.')
+ if !s:is_table(line)
+ return -1
+ endif
+ " TODO: do we need conditional: if s:is_separator(line)
+
+ let curs_pos = col('.')
+ let mpos = match(line, s:rxSep(), 0)
+ let col = -1
+ while mpos < curs_pos && mpos != -1
+ let mpos = match(line, s:rxSep(), mpos+1)
+ if mpos != -1
+ let col += 1
+ endif
+ endwhile
+ return col
+endfunction
+
+
+function! s:fmt_cell(cell, max_len)
+ let cell = ' '.a:cell.' '
+
+ let diff = a:max_len - s:wide_len(a:cell)
+ if diff == 0 && empty(a:cell)
+ let diff = 1
+ endif
+
+ let cell .= repeat(' ', diff)
+ return cell
+endfunction
+
+
+function! s:fmt_row(cells, max_lens, col1, col2)
+ let new_line = s:rxSep()
+ for idx in range(len(a:cells))
+ if idx == a:col1
+ let idx = a:col2
+ elseif idx == a:col2
+ let idx = a:col1
+ endif
+ let value = a:cells[idx]
+ let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep()
+ endfor
+
+ let idx = len(a:cells)
+ while idx < len(a:max_lens)
+ let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep()
+ let idx += 1
+ endwhile
+ return new_line
+endfunction
+
+
+function! s:fmt_cell_sep(max_len)
+ if a:max_len == 0
+ return repeat('-', 3)
+ else
+ return repeat('-', a:max_len+2)
+ endif
+endfunction
+
+
+function! s:fmt_sep(max_lens, col1, col2)
+ let new_line = s:rxSep()
+ for idx in range(len(a:max_lens))
+ if idx == a:col1
+ let idx = a:col2
+ elseif idx == a:col2
+ let idx = a:col1
+ endif
+ let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep()
+ endfor
+ return new_line
+endfunction
+
+
+function! s:kbd_create_new_row(cols, goto_first)
+ let cmd = "\<ESC>o".s:create_empty_row(a:cols)
+ let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
+ let cmd .= "\<ESC>0"
+ if a:goto_first
+ let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
+ else
+ let cmd .= (col('.')-1)."l"
+ let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
+ endif
+ let cmd .= "a"
+
+ return cmd
+endfunction
+
+
+function! s:kbd_goto_next_row()
+ let cmd = "\<ESC>j"
+ let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
+ let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
+ let cmd .= "a"
+ return cmd
+endfunction
+
+
+function! s:kbd_goto_prev_row()
+ let cmd = "\<ESC>k"
+ let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
+ let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
+ let cmd .= "a"
+ return cmd
+endfunction
+
+
+" Used in s:kbd_goto_next_col
+function! vimwiki#tbl#goto_next_col()
+ let curcol = virtcol('.')
+ let lnum = line('.')
+ let newcol = s:get_indent(lnum)
+ let max_lens = s:get_cell_max_lens(lnum)
+ for cell_len in values(max_lens)
+ if newcol >= curcol-1
+ break
+ endif
+ let newcol += cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
+ endfor
+ let newcol += 2 " +2 == 1 separator + 1 space |<space
+ call vimwiki#u#cursor(lnum, newcol)
+endfunction
+
+
+function! s:kbd_goto_next_col(jumpdown)
+ let cmd = "\<ESC>"
+ if a:jumpdown
+ let seps = s:count_separators_down(line('.'))
+ let cmd .= seps."j0"
+ endif
+ let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
+ return cmd
+endfunction
+
+
+" Used in s:kbd_goto_prev_col
+function! vimwiki#tbl#goto_prev_col()
+ let curcol = virtcol('.')
+ let lnum = line('.')
+ let newcol = s:get_indent(lnum)
+ let max_lens = s:get_cell_max_lens(lnum)
+ let prev_cell_len = 0
+ for cell_len in values(max_lens)
+ let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
+ if newcol + delta > curcol-1
+ let newcol -= (prev_cell_len + 3) " +3 == 2 spaces + 1 separator |<space>...<space>
+ break
+ elseif newcol + delta == curcol-1
+ break
+ endif
+ let prev_cell_len = cell_len
+ let newcol += delta
+ endfor
+ let newcol += 2 " +2 == 1 separator + 1 space |<space
+ call vimwiki#u#cursor(lnum, newcol)
+endfunction
+
+
+function! s:kbd_goto_prev_col(jumpup)
+ let cmd = "\<ESC>"
+ if a:jumpup
+ let seps = s:count_separators_up(line('.'))
+ let cmd .= seps."k"
+ let cmd .= "$"
+ endif
+ let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
+ " let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
+ " let cmd .= "a"
+ "echomsg "DEBUG kbd_goto_prev_col> ".cmd
+ return cmd
+endfunction
+
+
+function! vimwiki#tbl#kbd_cr()
+ let lnum = line('.')
+ if !s:is_table(getline(lnum))
+ return ""
+ endif
+
+ if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
+ let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
+ return s:kbd_create_new_row(cols, 0)
+ else
+ return s:kbd_goto_next_row()
+ endif
+endfunction
+
+
+function! vimwiki#tbl#kbd_tab()
+ let lnum = line('.')
+ if !s:is_table(getline(lnum))
+ return "\<Tab>"
+ endif
+
+ let last = s:is_last_column(lnum, col('.'))
+ let is_sep = s:is_separator_tail(getline(lnum))
+ "echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
+ if (is_sep || last) && !s:is_table(getline(lnum+1))
+ let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
+ return s:kbd_create_new_row(cols, 1)
+ endif
+ return s:kbd_goto_next_col(is_sep || last)
+endfunction
+
+
+function! vimwiki#tbl#kbd_shift_tab()
+ let lnum = line('.')
+ if !s:is_table(getline(lnum))
+ return "\<S-Tab>"
+ endif
+
+ let first = s:is_first_column(lnum, col('.'))
+ let is_sep = s:is_separator_tail(getline(lnum))
+ "echomsg "DEBUG kbd_tab> ".first
+ if (is_sep || first) && !s:is_table(getline(lnum-1))
+ return ""
+ endif
+ return s:kbd_goto_prev_col(is_sep || first)
+endfunction
+
+
+function! vimwiki#tbl#format(lnum, ...)
+ if !(&filetype ==? 'vimwiki')
+ return
+ endif
+ let line = getline(a:lnum)
+ if !s:is_table(line)
+ return
+ endif
+
+ if a:0 == 2
+ let col1 = a:1
+ let col2 = a:2
+ else
+ let col1 = 0
+ let col2 = 0
+ endif
+
+ let indent = s:get_indent(a:lnum)
+ if &expandtab
+ let indentstring = repeat(' ', indent)
+ else
+ let indentstring = repeat(' ', indent / &tabstop) . repeat(' ', indent % &tabstop)
+ endif
+
+ for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
+ let row = indentstring.row
+ call setline(lnum, row)
+ endfor
+
+ let &tw = s:textwidth
+endfunction
+
+
+function! vimwiki#tbl#create(...)
+ if a:0 > 1
+ let cols = a:1
+ let rows = a:2
+ elseif a:0 == 1
+ let cols = a:1
+ let rows = 2
+ elseif a:0 == 0
+ let cols = 5
+ let rows = 2
+ endif
+
+ if cols < 1
+ let cols = 5
+ endif
+
+ if rows < 1
+ let rows = 2
+ endif
+
+ let lines = []
+ let row = s:create_empty_row(cols)
+
+ call add(lines, row)
+ if rows > 1
+ call add(lines, s:create_row_sep(cols))
+ endif
+
+ for r in range(rows - 1)
+ call add(lines, row)
+ endfor
+
+ call append(line('.'), lines)
+endfunction
+
+
+function! vimwiki#tbl#align_or_cmd(cmd)
+ if s:is_table(getline('.'))
+ call vimwiki#tbl#format(line('.'))
+ else
+ exe 'normal! '.a:cmd
+ endif
+endfunction
+
+
+function! vimwiki#tbl#reset_tw(lnum)
+ if !(&filetype ==? 'vimwiki')
+ return
+ endif
+ let line = getline(a:lnum)
+ if !s:is_table(line)
+ return
+ endif
+
+ let s:textwidth = &tw
+ let &tw = 0
+endfunction
+
+
+" TODO: move_column_left and move_column_right are good candidates to be refactored.
+function! vimwiki#tbl#move_column_left()
+
+ "echomsg "DEBUG move_column_left: "
+
+ let line = getline('.')
+
+ if !s:is_table(line)
+ return
+ endif
+
+ let cur_col = s:cur_column()
+ if cur_col == -1
+ return
+ endif
+
+ if cur_col > 0
+ call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
+ call cursor(line('.'), 1)
+
+ let sep = '\('.s:rxSep().'\).\zs'
+ let mpos = -1
+ let col = -1
+ while col < cur_col-1
+ let mpos = match(line, sep, mpos+1)
+ if mpos != -1
+ let col += 1
+ else
+ break
+ endif
+ endwhile
+
+ endif
+endfunction
+
+
+function! vimwiki#tbl#move_column_right()
+
+ let line = getline('.')
+
+ if !s:is_table(line)
+ return
+ endif
+
+ let cur_col = s:cur_column()
+ if cur_col == -1
+ return
+ endif
+
+ if cur_col < s:col_count(line('.'))-1
+ call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
+ call cursor(line('.'), 1)
+
+ let sep = '\('.s:rxSep().'\).\zs'
+ let mpos = -1
+ let col = -1
+ while col < cur_col+1
+ let mpos = match(line, sep, mpos+1)
+ if mpos != -1
+ let col += 1
+ else
+ break
+ endif
+ endwhile
+ endif
+endfunction
+
+
+function! vimwiki#tbl#get_rows(lnum)
+ return s:get_rows(a:lnum)
+endfunction
+
+
+function! vimwiki#tbl#is_table(line)
+ return s:is_table(a:line)
+endfunction
+
+
+function! vimwiki#tbl#is_separator(line)
+ return s:is_separator(a:line)
+endfunction
+
+
+function! vimwiki#tbl#cell_splitter()
+ return s:cell_splitter()
+endfunction
+
+
+function! vimwiki#tbl#sep_splitter()
+ return s:sep_splitter()
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/u.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/u.vim
new file mode 100644
index 0000000..c8f62ee
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/u.vim
@@ -0,0 +1,72 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Description: Utility functions
+" Home: https://github.com/vimwiki/vimwiki/
+
+function! vimwiki#u#trim(string, ...)
+ let chars = ''
+ if a:0 > 0
+ let chars = a:1
+ endif
+ let res = substitute(a:string, '^[[:space:]'.chars.']\+', '', '')
+ let res = substitute(res, '[[:space:]'.chars.']\+$', '', '')
+ return res
+endfunction
+
+
+" Builtin cursor doesn't work right with unicode characters.
+function! vimwiki#u#cursor(lnum, cnum)
+ exe a:lnum
+ exe 'normal! 0'.a:cnum.'|'
+endfunction
+
+
+function! vimwiki#u#is_windows()
+ return has("win32") || has("win64") || has("win95") || has("win16")
+endfunction
+
+
+function! vimwiki#u#is_macos()
+ if has("mac") || has("macunix") || has("gui_mac")
+ return 1
+ endif
+ " that still doesn't mean we are not on Mac OS
+ let os = substitute(system('uname'), '\n', '', '')
+ return os == 'Darwin' || os == 'Mac'
+endfunction
+
+
+function! vimwiki#u#count_first_sym(line)
+ let first_sym = matchstr(a:line, '\S')
+ return len(matchstr(a:line, first_sym.'\+'))
+endfunction
+
+
+function! vimwiki#u#escape(string)
+ return escape(a:string, '~.*[]\^$')
+endfunction
+
+
+" Load concrete Wiki syntax: sets regexes and templates for headers and links
+function vimwiki#u#reload_regexes()
+ execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
+endfunction
+
+
+" Load syntax-specific functionality
+function vimwiki#u#reload_regexes_custom()
+ execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
+endfunction
+
+
+" Backward compatible version of the built-in function shiftwidth()
+if exists('*shiftwidth')
+ func vimwiki#u#sw()
+ return shiftwidth()
+ endfunc
+else
+ func vimwiki#u#sw()
+ return &sw
+ endfunc
+endif
+
diff --git a/vim/.vim/plugged/vimwiki/autoload/vimwiki/vars.vim b/vim/.vim/plugged/vimwiki/autoload/vimwiki/vars.vim
new file mode 100644
index 0000000..2f1ab50
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/autoload/vimwiki/vars.vim
@@ -0,0 +1,711 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki autoload plugin file
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+
+" ------------------------------------------------------------------------------------------------
+" This file provides functions to manage the various state variables which are needed during a
+" Vimwiki session.
+" They consist of:
+"
+" - global variables. These are stored in the dict g:vimwiki_global_vars. They consist mainly of
+" global user variables and syntax stuff which is the same for every syntax.
+"
+" - wiki-local variables. They are stored in g:vimwiki_wikilocal_vars which is a list of
+" dictionaries. One dict for every registered wiki. The last dictionary contains default values
+" (used for temporary wikis).
+"
+" - syntax variables. Stored in the dict g:vimwiki_syntax_variables which holds all the regexes and
+" other stuff which is needed for highlighting.
+"
+" - buffer-local variables. They are stored as buffer variables directly (b:foo)
+
+" As a developer, you should, if possible, only use the get_ and set_ functions for these types of
+" variables, not the underlying dicts!
+" ------------------------------------------------------------------------------------------------
+
+
+function! s:populate_global_variables()
+
+ let g:vimwiki_global_vars = {
+ \ 'CJK_length': 0,
+ \ 'auto_chdir': 0,
+ \ 'autowriteall': 1,
+ \ 'conceallevel': 2,
+ \ 'diary_months':
+ \ {
+ \ 1: 'January', 2: 'February', 3: 'March',
+ \ 4: 'April', 5: 'May', 6: 'June',
+ \ 7: 'July', 8: 'August', 9: 'September',
+ \ 10: 'October', 11: 'November', 12: 'December'
+ \ },
+ \ 'dir_link': '',
+ \ 'ext2syntax': {},
+ \ 'folding': '',
+ \ 'global_ext': 1,
+ \ 'hl_cb_checked': 0,
+ \ 'hl_headers': 0,
+ \ 'html_header_numbering': 0,
+ \ 'html_header_numbering_sym': '',
+ \ 'list_ignore_newline': 1,
+ \ 'text_ignore_newline': 1,
+ \ 'listsyms': ' .oOX',
+ \ 'listsym_rejected': '-',
+ \ 'map_prefix': '<Leader>w',
+ \ 'menu': 'Vimwiki',
+ \ 'table_auto_fmt': 1,
+ \ 'table_mappings': 1,
+ \ 'toc_header': 'Contents',
+ \ 'url_maxsave': 15,
+ \ 'use_calendar': 1,
+ \ 'use_mouse': 0,
+ \ 'user_htmls': '',
+ \ 'valid_html_tags': 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em',
+ \ 'w32_dir_enc': '',
+ \ }
+
+ " copy the user's settings from variables of the form g:vimwiki_<option> into the dict
+ " g:vimwiki_global_vars (or set a default value)
+ for key in keys(g:vimwiki_global_vars)
+ if exists('g:vimwiki_'.key)
+ let g:vimwiki_global_vars[key] = g:vimwiki_{key}
+ endif
+ endfor
+
+ " non-configurable global variables:
+
+ " Scheme regexes must be defined even if syntax file is not loaded yet cause users should be
+ " able to <leader>w<leader>w without opening any vimwiki file first
+ let g:vimwiki_global_vars.schemes = join(['wiki\d\+', 'diary', 'local'], '\|')
+ let g:vimwiki_global_vars.web_schemes1 = join(['http', 'https', 'file', 'ftp', 'gopher',
+ \ 'telnet', 'nntp', 'ldap', 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
+ \ 'git', 'ssh', 'fish', 'sftp'], '\|')
+ let web_schemes2 =
+ \ join(['mailto', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data'], '\|')
+
+ let g:vimwiki_global_vars.rxSchemes = '\%('.
+ \ g:vimwiki_global_vars.schemes . '\|'.
+ \ g:vimwiki_global_vars.web_schemes1 . '\|'.
+ \ web_schemes2 .
+ \ '\)'
+
+ " match URL for common protocols; see http://en.wikipedia.org/wiki/URI_scheme
+ " http://tools.ietf.org/html/rfc3986
+ let rxWebProtocols =
+ \ '\%('.
+ \ '\%('.
+ \ '\%('.g:vimwiki_global_vars.web_schemes1 . '\):'.
+ \ '\%(//\)'.
+ \ '\)'.
+ \ '\|'.
+ \ '\%('.web_schemes2.'\):'.
+ \ '\)'
+
+ let g:vimwiki_global_vars.rxWeblinkUrl = rxWebProtocols . '\S\{-1,}'. '\%(([^ \t()]*)\)\='
+
+ let wikilink_prefix = '[['
+ let wikilink_suffix = ']]'
+ let wikilink_separator = '|'
+ let g:vimwiki_global_vars.rx_wikilink_prefix = vimwiki#u#escape(wikilink_prefix)
+ let g:vimwiki_global_vars.rx_wikilink_suffix = vimwiki#u#escape(wikilink_suffix)
+ let g:vimwiki_global_vars.rx_wikilink_separator = vimwiki#u#escape(wikilink_separator)
+
+ " templates for the creation of wiki links
+ " [[URL]]
+ let g:vimwiki_global_vars.WikiLinkTemplate1 = wikilink_prefix . '__LinkUrl__'. wikilink_suffix
+ " [[URL|DESCRIPTION]]
+ let g:vimwiki_global_vars.WikiLinkTemplate2 = wikilink_prefix . '__LinkUrl__'. wikilink_separator
+ \ . '__LinkDescription__' . wikilink_suffix
+
+ let valid_chars = '[^\\\]]'
+ let g:vimwiki_global_vars.rxWikiLinkUrl = valid_chars.'\{-}'
+ let g:vimwiki_global_vars.rxWikiLinkDescr = valid_chars.'\{-}'
+
+ " this regexp defines what can form a link when the user presses <CR> in the
+ " buffer (and not on a link) to create a link
+ " basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all
+ " non-Ascii characters, except that . is not accepted as the last character
+ let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]*[^[:blank:]!"$%&''()*+.,:;<=>?\[\]\\^`{}]'
+
+ let g:vimwiki_global_vars.rx_wikilink_prefix1 = g:vimwiki_global_vars.rx_wikilink_prefix .
+ \ g:vimwiki_global_vars.rxWikiLinkUrl . g:vimwiki_global_vars.rx_wikilink_separator
+ let g:vimwiki_global_vars.rx_wikilink_suffix1 = g:vimwiki_global_vars.rx_wikilink_suffix
+
+ let g:vimwiki_global_vars.rxWikiInclPrefix = '{{'
+ let g:vimwiki_global_vars.rxWikiInclSuffix = '}}'
+ let g:vimwiki_global_vars.rxWikiInclSeparator = '|'
+ " '{{__LinkUrl__}}'
+ let g:vimwiki_global_vars.WikiInclTemplate1 = g:vimwiki_global_vars.rxWikiInclPrefix
+ \ .'__LinkUrl__'. g:vimwiki_global_vars.rxWikiInclSuffix
+ " '{{__LinkUrl____LinkDescription__}}'
+ let g:vimwiki_global_vars.WikiInclTemplate2 = g:vimwiki_global_vars.rxWikiInclPrefix
+ \ . '__LinkUrl__' . g:vimwiki_global_vars.rxWikiInclSeparator . '__LinkDescription__'
+ \ . g:vimwiki_global_vars.rxWikiInclSuffix
+
+ let valid_chars = '[^\\\}]'
+ let g:vimwiki_global_vars.rxWikiInclUrl = valid_chars.'\{-}'
+ let g:vimwiki_global_vars.rxWikiInclArg = valid_chars.'\{-}'
+ let g:vimwiki_global_vars.rxWikiInclArgs = '\%('. g:vimwiki_global_vars.rxWikiInclSeparator.
+ \ g:vimwiki_global_vars.rxWikiInclArg. '\)'.'\{-}'
+
+ " *. {{URL}[{...}]} - i.e. {{URL}}, {{URL|ARG1}}, {{URL|ARG1|ARG2}}, etc.
+ " *a) match {{URL}[{...}]}
+ let g:vimwiki_global_vars.rxWikiIncl = g:vimwiki_global_vars.rxWikiInclPrefix.
+ \ g:vimwiki_global_vars.rxWikiInclUrl.
+ \ g:vimwiki_global_vars.rxWikiInclArgs. g:vimwiki_global_vars.rxWikiInclSuffix
+ " *b) match URL within {{URL}[{...}]}
+ let g:vimwiki_global_vars.rxWikiInclMatchUrl = g:vimwiki_global_vars.rxWikiInclPrefix.
+ \ '\zs'. g:vimwiki_global_vars.rxWikiInclUrl . '\ze'.
+ \ g:vimwiki_global_vars.rxWikiInclArgs . g:vimwiki_global_vars.rxWikiInclSuffix
+
+ let g:vimwiki_global_vars.rxWikiInclPrefix1 = g:vimwiki_global_vars.rxWikiInclPrefix.
+ \ g:vimwiki_global_vars.rxWikiInclUrl . g:vimwiki_global_vars.rxWikiInclSeparator
+ let g:vimwiki_global_vars.rxWikiInclSuffix1 = g:vimwiki_global_vars.rxWikiInclArgs.
+ \ g:vimwiki_global_vars.rxWikiInclSuffix
+
+ let g:vimwiki_global_vars.rxTodo = '\C\<\%(TODO\|DONE\|STARTED\|FIXME\|FIXED\|XXX\)\>'
+
+ " default colors when headers of different levels are highlighted differently
+ " not making it yet another option; needed by ColorScheme autocommand
+ let g:vimwiki_global_vars.hcolor_guifg_light = ['#aa5858', '#507030', '#1030a0', '#103040'
+ \ , '#505050', '#636363']
+ let g:vimwiki_global_vars.hcolor_ctermfg_light = ['DarkRed', 'DarkGreen', 'DarkBlue', 'Black'
+ \ , 'Black', 'Black']
+ let g:vimwiki_global_vars.hcolor_guifg_dark = ['#e08090', '#80e090', '#6090e0', '#c0c0f0'
+ \ , '#e0e0f0', '#f0f0f0']
+ let g:vimwiki_global_vars.hcolor_ctermfg_dark = ['Red', 'Green', 'Blue', 'White', 'White'
+ \ , 'White']
+endfunction
+
+
+function! s:populate_wikilocal_options()
+ let default_values = {
+ \ 'auto_export': 0,
+ \ 'auto_tags': 0,
+ \ 'auto_toc': 0,
+ \ 'automatic_nested_syntaxes': 1,
+ \ 'css_name': 'style.css',
+ \ 'custom_wiki2html': '',
+ \ 'custom_wiki2html_args': '',
+ \ 'diary_header': 'Diary',
+ \ 'diary_index': 'diary',
+ \ 'diary_rel_path': 'diary/',
+ \ 'diary_sort': 'desc',
+ \ 'ext': '.wiki',
+ \ 'index': 'index',
+ \ 'list_margin': -1,
+ \ 'maxhi': 0,
+ \ 'nested_syntaxes': {},
+ \ 'path': '~/vimwiki/',
+ \ 'path_html': '',
+ \ 'syntax': 'default',
+ \ 'template_default': 'default',
+ \ 'template_ext': '.tpl',
+ \ 'template_path': '~/vimwiki/templates/',
+ \ }
+
+ let g:vimwiki_wikilocal_vars = []
+
+ let default_wiki_settings = {}
+ for key in keys(default_values)
+ if exists('g:vimwiki_'.key)
+ let default_wiki_settings[key] = g:vimwiki_{key}
+ else
+ let default_wiki_settings[key] = default_values[key]
+ endif
+ endfor
+
+ " set the wiki-local variables according to g:vimwiki_list (or the default settings)
+ if exists('g:vimwiki_list')
+ for users_wiki_settings in g:vimwiki_list
+ let new_wiki_settings = {}
+ for key in keys(default_values)
+ if has_key(users_wiki_settings, key)
+ let new_wiki_settings[key] = users_wiki_settings[key]
+ elseif exists('g:vimwiki_'.key)
+ let new_wiki_settings[key] = g:vimwiki_{key}
+ else
+ let new_wiki_settings[key] = default_values[key]
+ endif
+ endfor
+
+ let new_wiki_settings.is_temporary_wiki = 0
+
+ call add(g:vimwiki_wikilocal_vars, new_wiki_settings)
+ endfor
+ else
+ " if the user hasn't registered any wiki, we register one wiki using the default values
+ let new_wiki_settings = deepcopy(default_wiki_settings)
+ let new_wiki_settings.is_temporary_wiki = 0
+ call add(g:vimwiki_wikilocal_vars, new_wiki_settings)
+ endif
+
+ " default values for temporary wikis
+ let temporary_wiki_settings = deepcopy(default_wiki_settings)
+ let temporary_wiki_settings.is_temporary_wiki = 1
+ call add(g:vimwiki_wikilocal_vars, temporary_wiki_settings)
+
+ call s:validate_settings()
+endfunction
+
+
+function! s:validate_settings()
+ for wiki_settings in g:vimwiki_wikilocal_vars
+ let wiki_settings['path'] = s:normalize_path(wiki_settings['path'])
+
+ let path_html = wiki_settings['path_html']
+ if !empty(path_html)
+ let wiki_settings['path_html'] = s:normalize_path(path_html)
+ else
+ let wiki_settings['path_html'] = s:normalize_path(
+ \ substitute(wiki_settings['path'], '[/\\]\+$', '', '').'_html/')
+ endif
+
+ let wiki_settings['template_path'] = s:normalize_path(wiki_settings['template_path'])
+ let wiki_settings['diary_rel_path'] = s:normalize_path(wiki_settings['diary_rel_path'])
+ endfor
+endfunction
+
+
+function! s:normalize_path(path)
+ " trim trailing / and \ because otherwise resolve() doesn't work quite right
+ let path = substitute(a:path, '[/\\]\+$', '', '')
+ if path !~# '^scp:'
+ return resolve(expand(path)).'/'
+ else
+ return path.'/'
+ endif
+endfunction
+
+
+function! vimwiki#vars#populate_syntax_vars(syntax)
+ if !exists('g:vimwiki_syntax_variables')
+ let g:vimwiki_syntax_variables = {}
+ endif
+
+ if has_key(g:vimwiki_syntax_variables, a:syntax)
+ return
+ endif
+
+ let g:vimwiki_syntax_variables[a:syntax] = {}
+
+ execute 'runtime! syntax/vimwiki_'.a:syntax.'.vim'
+
+ " generic stuff
+ let header_symbol = g:vimwiki_syntax_variables[a:syntax].rxH
+ if g:vimwiki_syntax_variables[a:syntax].symH
+ " symmetric headers
+ for i in range(1,6)
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Template'] =
+ \ repeat(header_symbol, i).' __Header__ '.repeat(header_symbol, i)
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] =
+ \ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']'
+ \ .header_symbol.'\{'.i.'}\s*$'
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] =
+ \ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']'
+ \ .header_symbol.'\{'.i.'}\s*$'
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_End'] =
+ \ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']'
+ \ .header_symbol.'\{1,'.i.'}\s*$'
+ endfor
+ let g:vimwiki_syntax_variables[a:syntax].rxHeader =
+ \ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*[^'.header_symbol.']\ze\1\s*$'
+ else
+ " asymmetric
+ for i in range(1,6)
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Template'] =
+ \ repeat(header_symbol, i).' __Header__'
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] =
+ \ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$'
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] =
+ \ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$'
+ let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_End'] =
+ \ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*$'
+ endfor
+ let g:vimwiki_syntax_variables[a:syntax].rxHeader =
+ \ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*\ze$'
+ endif
+
+ let g:vimwiki_syntax_variables[a:syntax].rxPreStart =
+ \ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreStart
+ let g:vimwiki_syntax_variables[a:syntax].rxPreEnd =
+ \ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreEnd.'\s*$'
+
+ let g:vimwiki_syntax_variables[a:syntax].rxMathStart =
+ \ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathStart
+ let g:vimwiki_syntax_variables[a:syntax].rxMathEnd =
+ \ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathEnd.'\s*$'
+
+ " list stuff
+ let g:vimwiki_syntax_variables[a:syntax].rx_bullet_chars =
+ \ '['.join(g:vimwiki_syntax_variables[a:syntax].bullet_types, '').']\+'
+
+ let g:vimwiki_syntax_variables[a:syntax].multiple_bullet_chars =
+ \ g:vimwiki_syntax_variables[a:syntax].recurring_bullets
+ \ ? g:vimwiki_syntax_variables[a:syntax].bullet_types : []
+
+ let g:vimwiki_syntax_variables[a:syntax].number_kinds = []
+ let g:vimwiki_syntax_variables[a:syntax].number_divisors = ''
+ for i in g:vimwiki_syntax_variables[a:syntax].number_types
+ call add(g:vimwiki_syntax_variables[a:syntax].number_kinds, i[0])
+ let g:vimwiki_syntax_variables[a:syntax].number_divisors .= vimwiki#u#escape(i[1])
+ endfor
+
+ let char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+',
+ \ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
+
+ "create regexp for bulleted list items
+ if !empty(g:vimwiki_syntax_variables[a:syntax].bullet_types)
+ let g:vimwiki_syntax_variables[a:syntax].rxListBullet =
+ \ join( map(g:vimwiki_syntax_variables[a:syntax].bullet_types,
+ \'vimwiki#u#escape(v:val).'
+ \ .'repeat("\\+", g:vimwiki_syntax_variables[a:syntax].recurring_bullets)'
+ \ ) , '\|')
+ else
+ "regex that matches nothing
+ let g:vimwiki_syntax_variables[a:syntax].rxListBullet = '$^'
+ endif
+
+ "create regex for numbered list items
+ if !empty(g:vimwiki_syntax_variables[a:syntax].number_types)
+ let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '\C\%('
+ for type in g:vimwiki_syntax_variables[a:syntax].number_types[:-2]
+ let g:vimwiki_syntax_variables[a:syntax].rxListNumber .= char_to_rx[type[0]] .
+ \ vimwiki#u#escape(type[1]) . '\|'
+ endfor
+ let g:vimwiki_syntax_variables[a:syntax].rxListNumber .=
+ \ char_to_rx[g:vimwiki_syntax_variables[a:syntax].number_types[-1][0]].
+ \ vimwiki#u#escape(g:vimwiki_syntax_variables[a:syntax].number_types[-1][1]) . '\)'
+ else
+ "regex that matches nothing
+ let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '$^'
+ endif
+
+ "the user can set the listsyms as string, but vimwiki needs a list
+ let g:vimwiki_syntax_variables[a:syntax].listsyms_list =
+ \ split(vimwiki#vars#get_global('listsyms'), '\zs')
+ if match(vimwiki#vars#get_global('listsyms'), vimwiki#vars#get_global('listsym_rejected')) != -1
+ echomsg 'Vimwiki Warning: the value of g:vimwiki_listsym_rejected ('''
+ \ . vimwiki#vars#get_global('listsym_rejected')
+ \ . ''') must not be a part of g:vimwiki_listsyms (''' .
+ \ . vimwiki#vars#get_global('listsyms') . ''')'
+ endif
+ let g:vimwiki_syntax_variables[a:syntax].rxListItemWithoutCB =
+ \ '^\s*\%(\('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\)\|\('
+ \ .g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\)\s'
+ let g:vimwiki_syntax_variables[a:syntax].rxListItem =
+ \ g:vimwiki_syntax_variables[a:syntax].rxListItemWithoutCB
+ \ . '\+\%(\[\(['.vimwiki#vars#get_global('listsyms')
+ \ . vimwiki#vars#get_global('listsym_rejected').']\)\]\s\)\?'
+ if g:vimwiki_syntax_variables[a:syntax].recurring_bullets
+ let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren =
+ \ '^\('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\)\s\+\[['
+ \ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1]
+ \ . vimwiki#vars#get_global('listsym_rejected') . ']\]\s.*\%(\n\%(\1\%('
+ \ .g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\).*\|^$\|\s.*\)\)*'
+ else
+ let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren =
+ \ '^\(\s*\)\%('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\|'
+ \ . g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\s\+\[['
+ \ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1]
+ \ . vimwiki#vars#get_global('listsym_rejected') . ']\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
+ endif
+
+ " 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
+ " let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
+ " \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
+ let g:vimwiki_syntax_variables[a:syntax].rxWeblink =
+ \ '\<'. g:vimwiki_global_vars.rxWeblinkUrl . '\S*'
+ " 0a) match URL within URL
+ let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchUrl =
+ \ g:vimwiki_syntax_variables[a:syntax].rxWeblink
+ " 0b) match DESCRIPTION within URL
+ let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchDescr = ''
+
+ " template for matching all wiki links with a given target file
+ let g:vimwiki_syntax_variables[a:syntax].WikiLinkMatchUrlTemplate =
+ \ g:vimwiki_global_vars.rx_wikilink_prefix .
+ \ '\zs__LinkUrl__\ze\%(#.*\)\?' .
+ \ g:vimwiki_global_vars.rx_wikilink_suffix .
+ \ '\|' .
+ \ g:vimwiki_global_vars.rx_wikilink_prefix .
+ \ '\zs__LinkUrl__\ze\%(#.*\)\?' .
+ \ g:vimwiki_global_vars.rx_wikilink_separator .
+ \ '.*' .
+ \ g:vimwiki_global_vars.rx_wikilink_suffix
+
+ " a) match [[URL|DESCRIPTION]]
+ let g:vimwiki_syntax_variables[a:syntax].rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix.
+ \ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator.
+ \ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
+ let g:vimwiki_syntax_variables[a:syntax].rxAnyLink =
+ \ g:vimwiki_syntax_variables[a:syntax].rxWikiLink.'\|'.
+ \ g:vimwiki_global_vars.rxWikiIncl.'\|'.g:vimwiki_syntax_variables[a:syntax].rxWeblink
+ " b) match URL within [[URL|DESCRIPTION]]
+ let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchUrl =
+ \ g:vimwiki_global_vars.rx_wikilink_prefix . '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl
+ \ .'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator
+ \ . g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
+ " c) match DESCRIPTION within [[URL|DESCRIPTION]]
+ let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchDescr =
+ \ g:vimwiki_global_vars.rx_wikilink_prefix . g:vimwiki_global_vars.rxWikiLinkUrl
+ \ . g:vimwiki_global_vars.rx_wikilink_separator.'\%(\zs'
+ \ . g:vimwiki_global_vars.rxWikiLinkDescr. '\ze\)\?'
+ \ . g:vimwiki_global_vars.rx_wikilink_suffix
+
+ if a:syntax ==# 'markdown'
+ call s:populate_extra_markdown_vars()
+ endif
+endfunction
+
+
+function! s:populate_extra_markdown_vars()
+ let mkd_syntax = g:vimwiki_syntax_variables['markdown']
+
+ " 0a) match [[URL|DESCRIPTION]]
+ let mkd_syntax.rxWikiLink0 = mkd_syntax.rxWikiLink
+ " 0b) match URL within [[URL|DESCRIPTION]]
+ let mkd_syntax.rxWikiLink0MatchUrl = mkd_syntax.rxWikiLinkMatchUrl
+ " 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
+ let mkd_syntax.rxWikiLink0MatchDescr = mkd_syntax.rxWikiLinkMatchDescr
+
+ let wikilink_md_prefix = '['
+ let wikilink_md_suffix = ']'
+ let wikilink_md_separator = ']['
+ let rx_wikilink_md_separator = vimwiki#u#escape(wikilink_md_separator)
+ let mkd_syntax.rx_wikilink_md_prefix = vimwiki#u#escape(wikilink_md_prefix)
+ let mkd_syntax.rx_wikilink_md_suffix = vimwiki#u#escape(wikilink_md_suffix)
+
+ " [URL][]
+ let mkd_syntax.WikiLink1Template1 = wikilink_md_prefix . '__LinkUrl__'.
+ \ wikilink_md_separator. wikilink_md_suffix
+ " [DESCRIPTION][URL]
+ let mkd_syntax.WikiLink1Template2 = wikilink_md_prefix. '__LinkDescription__'.
+ \ wikilink_md_separator. '__LinkUrl__'. wikilink_md_suffix
+ let mkd_syntax.WikiLinkMatchUrlTemplate .=
+ \ '\|' .
+ \ mkd_syntax.rx_wikilink_md_prefix .
+ \ '.*' .
+ \ rx_wikilink_md_separator .
+ \ '\zs__LinkUrl__\ze\%(#.*\)\?' .
+ \ mkd_syntax.rx_wikilink_md_suffix .
+ \ '\|' .
+ \ mkd_syntax.rx_wikilink_md_prefix .
+ \ '\zs__LinkUrl__\ze\%(#.*\)\?' .
+ \ rx_wikilink_md_separator .
+ \ mkd_syntax.rx_wikilink_md_suffix
+
+ let valid_chars = '[^\\\[\]]'
+ let mkd_syntax.rxWikiLink1Url = valid_chars.'\{-}'
+ let mkd_syntax.rxWikiLink1Descr = valid_chars.'\{-}'
+ let mkd_syntax.rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
+ let mkd_syntax.rxWikiLink1InvalidSuffix = '[\]\[]\@!'
+ let mkd_syntax.rx_wikilink_md_prefix = mkd_syntax.rxWikiLink1InvalidPrefix.
+ \ mkd_syntax.rx_wikilink_md_prefix
+ let mkd_syntax.rx_wikilink_md_suffix = mkd_syntax.rx_wikilink_md_suffix.
+ \ mkd_syntax.rxWikiLink1InvalidSuffix
+
+ " 1. match [URL][], [DESCRIPTION][URL]
+ let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix.
+ \ mkd_syntax.rxWikiLink1Url. rx_wikilink_md_separator.
+ \ mkd_syntax.rx_wikilink_md_suffix.
+ \ '\|'. mkd_syntax.rx_wikilink_md_prefix.
+ \ mkd_syntax.rxWikiLink1Descr . rx_wikilink_md_separator.
+ \ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
+ " 2. match URL within [URL][], [DESCRIPTION][URL]
+ let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix.
+ \ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. rx_wikilink_md_separator.
+ \ mkd_syntax.rx_wikilink_md_suffix.
+ \ '\|'. mkd_syntax.rx_wikilink_md_prefix.
+ \ mkd_syntax.rxWikiLink1Descr. rx_wikilink_md_separator.
+ \ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix
+ " 3. match DESCRIPTION within [DESCRIPTION][URL]
+ let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix.
+ \ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. rx_wikilink_md_separator.
+ \ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
+
+ let mkd_syntax.rxWikiLink1Prefix1 = mkd_syntax.rx_wikilink_md_prefix
+ let mkd_syntax.rxWikiLink1Suffix1 = rx_wikilink_md_separator.
+ \ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
+
+ " 1. match ANY wikilink
+ let mkd_syntax.rxWikiLink = mkd_syntax.rxWikiLink0 . '\|' . mkd_syntax.rxWikiLink1
+ " 2. match URL within ANY wikilink
+ let mkd_syntax.rxWikiLinkMatchUrl = mkd_syntax.rxWikiLink0MatchUrl . '\|' .
+ \ mkd_syntax.rxWikiLink1MatchUrl
+ " 3. match DESCRIPTION within ANY wikilink
+ let mkd_syntax.rxWikiLinkMatchDescr = mkd_syntax.rxWikiLink0MatchDescr . '\|' .
+ \ mkd_syntax.rxWikiLink1MatchDescr
+
+ " 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
+ let mkd_syntax.rxWeblink0 = mkd_syntax.rxWeblink
+ " 0a) match URL within URL
+ let mkd_syntax.rxWeblinkMatchUrl0 = mkd_syntax.rxWeblinkMatchUrl
+ " 0b) match DESCRIPTION within URL
+ let mkd_syntax.rxWeblinkMatchDescr0 = mkd_syntax.rxWeblinkMatchDescr
+
+ let mkd_syntax.rxWeblink1Prefix = '['
+ let mkd_syntax.rxWeblink1Suffix = ')'
+ let mkd_syntax.rxWeblink1Separator = ']('
+ " [DESCRIPTION](URL)
+ let mkd_syntax.Weblink1Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
+ \ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'.
+ \ mkd_syntax.rxWeblink1Suffix
+
+ let valid_chars = '[^\\]'
+
+ let mkd_syntax.rxWeblink1Prefix = vimwiki#u#escape(mkd_syntax.rxWeblink1Prefix)
+ let mkd_syntax.rxWeblink1Suffix = vimwiki#u#escape(mkd_syntax.rxWeblink1Suffix)
+ let mkd_syntax.rxWeblink1Separator = vimwiki#u#escape(mkd_syntax.rxWeblink1Separator)
+ let mkd_syntax.rxWeblink1Url = valid_chars.'\{-}'
+ let mkd_syntax.rxWeblink1Descr = valid_chars.'\{-}'
+
+ " 1. [DESCRIPTION](URL)
+ " 1a) match [DESCRIPTION](URL)
+ let mkd_syntax.rxWeblink1 = mkd_syntax.rxWeblink1Prefix.
+ \ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Separator.
+ \ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Suffix
+ " 1b) match URL within [DESCRIPTION](URL)
+ let mkd_syntax.rxWeblink1MatchUrl = mkd_syntax.rxWeblink1Prefix.
+ \ mkd_syntax.rxWeblink1Descr. mkd_syntax.rxWeblink1Separator.
+ \ '\zs' . mkd_syntax.rxWeblink1Url . '\ze' . mkd_syntax.rxWeblink1Suffix
+ " 1c) match DESCRIPTION within [DESCRIPTION](URL)
+ let mkd_syntax.rxWeblink1MatchDescr = mkd_syntax.rxWeblink1Prefix.
+ \ '\zs'.mkd_syntax.rxWeblink1Descr.'\ze'. mkd_syntax.rxWeblink1Separator.
+ \ mkd_syntax.rxWeblink1Url. mkd_syntax.rxWeblink1Suffix
+
+ " TODO: image links too !!
+ let mkd_syntax.rxWeblink1Prefix1 = mkd_syntax.rxWeblink1Prefix
+ let mkd_syntax.rxWeblink1Suffix1 = mkd_syntax.rxWeblink1Separator.
+ \ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Suffix
+
+ " *a) match ANY weblink
+ let mkd_syntax.rxWeblink = ''.
+ \ mkd_syntax.rxWeblink1.'\|'.
+ \ mkd_syntax.rxWeblink0
+ " *b) match URL within ANY weblink
+ let mkd_syntax.rxWeblinkMatchUrl = ''.
+ \ mkd_syntax.rxWeblink1MatchUrl.'\|'.
+ \ mkd_syntax.rxWeblinkMatchUrl0
+ " *c) match DESCRIPTION within ANY weblink
+ let mkd_syntax.rxWeblinkMatchDescr = ''.
+ \ mkd_syntax.rxWeblink1MatchDescr.'\|'.
+ \ mkd_syntax.rxWeblinkMatchDescr0
+
+ let mkd_syntax.rxAnyLink = mkd_syntax.rxWikiLink.'\|'.
+ \ g:vimwiki_global_vars.rxWikiIncl.'\|'.mkd_syntax.rxWeblink
+
+ let mkd_syntax.rxMkdRef = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)'.
+ \ mkd_syntax.rxWeblink0
+ let mkd_syntax.rxMkdRefMatchDescr =
+ \ '\[\zs'.g:vimwiki_global_vars.rxWikiLinkDescr.'\ze]:\%(\s\+\|\n\)'. mkd_syntax.rxWeblink0
+ let mkd_syntax.rxMkdRefMatchUrl =
+ \ '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)\zs'.
+ \ mkd_syntax.rxWeblink0.'\ze'
+endfunction
+
+
+function! vimwiki#vars#init()
+ call s:populate_global_variables()
+ call s:populate_wikilocal_options()
+endfunction
+
+
+function! vimwiki#vars#get_syntaxlocal(key, ...)
+ if a:0
+ let syntax = a:1
+ else
+ let syntax = vimwiki#vars#get_wikilocal('syntax')
+ endif
+ if !exists('g:vimwiki_syntax_variables') || !has_key(g:vimwiki_syntax_variables, syntax)
+ call vimwiki#vars#populate_syntax_vars(syntax)
+ endif
+
+ return g:vimwiki_syntax_variables[syntax][a:key]
+endfunction
+
+
+" Get a variable for the buffer we are currently in or for the given buffer (number or name).
+" Populate the variable, if it doesn't exist.
+function! vimwiki#vars#get_bufferlocal(key, ...)
+ let buffer = a:0 ? a:1 : '%'
+
+ let value = getbufvar(buffer, 'vimwiki_'.a:key, '/\/\')
+ if type(value) != 1 || value !=# '/\/\'
+ return value
+ elseif a:key ==# 'wiki_nr'
+ call setbufvar(buffer, 'vimwiki_wiki_nr', vimwiki#base#find_wiki(expand('%:p')))
+ elseif a:key ==# 'subdir'
+ call setbufvar(buffer, 'vimwiki_subdir', vimwiki#base#current_subdir())
+ elseif a:key ==# 'invsubdir'
+ let subdir = vimwiki#vars#get_bufferlocal('subdir')
+ call setbufvar(buffer, 'vimwiki_invsubdir', vimwiki#base#invsubdir(subdir))
+ elseif a:key ==# 'existing_wikifiles'
+ call setbufvar(buffer, 'vimwiki_existing_wikifiles',
+ \ vimwiki#base#get_wikilinks(vimwiki#vars#get_bufferlocal('wiki_nr'), 1))
+ elseif a:key ==# 'existing_wikidirs'
+ call setbufvar(buffer, 'vimwiki_existing_wikidirs',
+ \ vimwiki#base#get_wiki_directories(vimwiki#vars#get_bufferlocal('wiki_nr')))
+ elseif a:key ==# 'prev_link'
+ call setbufvar(buffer, 'vimwiki_prev_link', [])
+ elseif a:key ==# 'markdown_refs'
+ call setbufvar(buffer, 'vimwiki_markdown_refs', vimwiki#markdown_base#scan_reflinks())
+ else
+ echoerr 'Vimwiki Error: unknown buffer variable ' . string(a:key)
+ endif
+
+ return getbufvar(buffer, 'vimwiki_'.a:key)
+endfunction
+
+
+function! vimwiki#vars#set_bufferlocal(key, value, ...)
+ let buffer = a:0 ? a:1 : '%'
+ call setbufvar(buffer, 'vimwiki_' . a:key, a:value)
+endfunction
+
+
+function! vimwiki#vars#get_global(key)
+ return g:vimwiki_global_vars[a:key]
+endfunction
+
+
+" the second argument can be a wiki number. When absent, the wiki of the currently active buffer is
+" used
+function! vimwiki#vars#get_wikilocal(key, ...)
+ if a:0
+ return g:vimwiki_wikilocal_vars[a:1][a:key]
+ else
+ return g:vimwiki_wikilocal_vars[vimwiki#vars#get_bufferlocal('wiki_nr')][a:key]
+ endif
+endfunction
+
+
+function! vimwiki#vars#get_wikilocal_default(key)
+ return g:vimwiki_wikilocal_vars[-1][a:key]
+endfunction
+
+
+function! vimwiki#vars#set_wikilocal(key, value, wiki_nr)
+ if a:wiki_nr == len(g:vimwiki_wikilocal_vars) - 1
+ call insert(g:vimwiki_wikilocal_vars, {}, -1)
+ endif
+ let g:vimwiki_wikilocal_vars[a:wiki_nr][a:key] = a:value
+endfunction
+
+
+function! vimwiki#vars#add_temporary_wiki(settings)
+ let new_temp_wiki_settings = copy(g:vimwiki_wikilocal_vars[-1])
+ for [key, value] in items(a:settings)
+ let new_temp_wiki_settings[key] = value
+ endfor
+ call insert(g:vimwiki_wikilocal_vars, new_temp_wiki_settings, -1)
+ call s:validate_settings()
+endfunction
+
+
+" number of registered wikis + temporary
+function! vimwiki#vars#number_of_wikis()
+ return len(g:vimwiki_wikilocal_vars) - 1
+endfunction
+
diff --git a/vim/.vim/plugged/vimwiki/doc/screenshot_1.png b/vim/.vim/plugged/vimwiki/doc/screenshot_1.png
new file mode 100644
index 0000000..8c875c2
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/doc/screenshot_1.png
Binary files differ
diff --git a/vim/.vim/plugged/vimwiki/doc/screenshot_2.png b/vim/.vim/plugged/vimwiki/doc/screenshot_2.png
new file mode 100644
index 0000000..a4a1fc2
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/doc/screenshot_2.png
Binary files differ
diff --git a/vim/.vim/plugged/vimwiki/doc/tags b/vim/.vim/plugged/vimwiki/doc/tags
new file mode 100644
index 0000000..612b3a1
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/doc/tags
@@ -0,0 +1,214 @@
+:VWB vimwiki.txt /*:VWB*
+:VWS vimwiki.txt /*:VWS*
+:Vimwiki2HTML vimwiki.txt /*:Vimwiki2HTML*
+:Vimwiki2HTMLBrowse vimwiki.txt /*:Vimwiki2HTMLBrowse*
+:VimwikiAll2HTML vimwiki.txt /*:VimwikiAll2HTML*
+:VimwikiBacklinks vimwiki.txt /*:VimwikiBacklinks*
+:VimwikiCheckLinks vimwiki.txt /*:VimwikiCheckLinks*
+:VimwikiDeleteLink vimwiki.txt /*:VimwikiDeleteLink*
+:VimwikiDiaryGenerateLinks vimwiki.txt /*:VimwikiDiaryGenerateLinks*
+:VimwikiDiaryIndex vimwiki.txt /*:VimwikiDiaryIndex*
+:VimwikiDiaryNextDay vimwiki.txt /*:VimwikiDiaryNextDay*
+:VimwikiDiaryPrevDay vimwiki.txt /*:VimwikiDiaryPrevDay*
+:VimwikiFollowLink vimwiki.txt /*:VimwikiFollowLink*
+:VimwikiGenerateLinks vimwiki.txt /*:VimwikiGenerateLinks*
+:VimwikiGenerateTags vimwiki.txt /*:VimwikiGenerateTags*
+:VimwikiGoBackLink vimwiki.txt /*:VimwikiGoBackLink*
+:VimwikiGoto vimwiki.txt /*:VimwikiGoto*
+:VimwikiIndex vimwiki.txt /*:VimwikiIndex*
+:VimwikiListChangeLevel vimwiki.txt /*:VimwikiListChangeLevel*
+:VimwikiMakeDiaryNote vimwiki.txt /*:VimwikiMakeDiaryNote*
+:VimwikiMakeTomorrowDiaryNote vimwiki.txt /*:VimwikiMakeTomorrowDiaryNote*
+:VimwikiMakeYesterdayDiaryNote vimwiki.txt /*:VimwikiMakeYesterdayDiaryNote*
+:VimwikiNextLink vimwiki.txt /*:VimwikiNextLink*
+:VimwikiPrevLink vimwiki.txt /*:VimwikiPrevLink*
+:VimwikiRebuildTags vimwiki.txt /*:VimwikiRebuildTags*
+:VimwikiRenameLink vimwiki.txt /*:VimwikiRenameLink*
+:VimwikiSearch vimwiki.txt /*:VimwikiSearch*
+:VimwikiSearchTags vimwiki.txt /*:VimwikiSearchTags*
+:VimwikiSplitLink vimwiki.txt /*:VimwikiSplitLink*
+:VimwikiTOC vimwiki.txt /*:VimwikiTOC*
+:VimwikiTabIndex vimwiki.txt /*:VimwikiTabIndex*
+:VimwikiTabMakeDiaryNote vimwiki.txt /*:VimwikiTabMakeDiaryNote*
+:VimwikiTable vimwiki.txt /*:VimwikiTable*
+:VimwikiTableMoveColumnLeft vimwiki.txt /*:VimwikiTableMoveColumnLeft*
+:VimwikiTableMoveColumnRight vimwiki.txt /*:VimwikiTableMoveColumnRight*
+:VimwikiTabnewLink vimwiki.txt /*:VimwikiTabnewLink*
+:VimwikiToggleListItem vimwiki.txt /*:VimwikiToggleListItem*
+:VimwikiToggleRejectedListItem vimwiki.txt /*:VimwikiToggleRejectedListItem*
+:VimwikiUISelect vimwiki.txt /*:VimwikiUISelect*
+:VimwikiVSplitLink vimwiki.txt /*:VimwikiVSplitLink*
+VimwikiLinkConverter vimwiki.txt /*VimwikiLinkConverter*
+VimwikiLinkHandler vimwiki.txt /*VimwikiLinkHandler*
+VimwikiWikiIncludeHandler vimwiki.txt /*VimwikiWikiIncludeHandler*
+g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length*
+g:vimwiki_auto_chdir vimwiki.txt /*g:vimwiki_auto_chdir*
+g:vimwiki_autowriteall vimwiki.txt /*g:vimwiki_autowriteall*
+g:vimwiki_conceallevel vimwiki.txt /*g:vimwiki_conceallevel*
+g:vimwiki_diary_months vimwiki.txt /*g:vimwiki_diary_months*
+g:vimwiki_dir_link vimwiki.txt /*g:vimwiki_dir_link*
+g:vimwiki_ext2syntax vimwiki.txt /*g:vimwiki_ext2syntax*
+g:vimwiki_folding vimwiki.txt /*g:vimwiki_folding*
+g:vimwiki_global_ext vimwiki.txt /*g:vimwiki_global_ext*
+g:vimwiki_hl_cb_checked vimwiki.txt /*g:vimwiki_hl_cb_checked*
+g:vimwiki_hl_headers vimwiki.txt /*g:vimwiki_hl_headers*
+g:vimwiki_html_header_numbering vimwiki.txt /*g:vimwiki_html_header_numbering*
+g:vimwiki_html_header_numbering_sym vimwiki.txt /*g:vimwiki_html_header_numbering_sym*
+g:vimwiki_list vimwiki.txt /*g:vimwiki_list*
+g:vimwiki_list_ignore_newline vimwiki.txt /*g:vimwiki_list_ignore_newline*
+g:vimwiki_listsym_rejected vimwiki.txt /*g:vimwiki_listsym_rejected*
+g:vimwiki_listsyms vimwiki.txt /*g:vimwiki_listsyms*
+g:vimwiki_map_prefix vimwiki.txt /*g:vimwiki_map_prefix*
+g:vimwiki_menu vimwiki.txt /*g:vimwiki_menu*
+g:vimwiki_table_auto_fmt vimwiki.txt /*g:vimwiki_table_auto_fmt*
+g:vimwiki_table_mappings vimwiki.txt /*g:vimwiki_table_mappings*
+g:vimwiki_text_ignore_newline vimwiki.txt /*g:vimwiki_text_ignore_newline*
+g:vimwiki_toc_header vimwiki.txt /*g:vimwiki_toc_header*
+g:vimwiki_url_maxsave vimwiki.txt /*g:vimwiki_url_maxsave*
+g:vimwiki_use_calendar vimwiki.txt /*g:vimwiki_use_calendar*
+g:vimwiki_use_mouse vimwiki.txt /*g:vimwiki_use_mouse*
+g:vimwiki_user_htmls vimwiki.txt /*g:vimwiki_user_htmls*
+g:vimwiki_valid_html_tags vimwiki.txt /*g:vimwiki_valid_html_tags*
+g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
+vimwiki vimwiki.txt /*vimwiki*
+vimwiki-anchors vimwiki.txt /*vimwiki-anchors*
+vimwiki-build-tags vimwiki.txt /*vimwiki-build-tags*
+vimwiki-calendar vimwiki.txt /*vimwiki-calendar*
+vimwiki-changelog vimwiki.txt /*vimwiki-changelog*
+vimwiki-commands vimwiki.txt /*vimwiki-commands*
+vimwiki-contributing vimwiki.txt /*vimwiki-contributing*
+vimwiki-date vimwiki.txt /*vimwiki-date*
+vimwiki-development vimwiki.txt /*vimwiki-development*
+vimwiki-diary vimwiki.txt /*vimwiki-diary*
+vimwiki-folding vimwiki.txt /*vimwiki-folding*
+vimwiki-follow_link vimwiki.txt /*vimwiki-follow_link*
+vimwiki-functions vimwiki.txt /*vimwiki-functions*
+vimwiki-global-commands vimwiki.txt /*vimwiki-global-commands*
+vimwiki-global-mappings vimwiki.txt /*vimwiki-global-mappings*
+vimwiki-global-options vimwiki.txt /*vimwiki-global-options*
+vimwiki-help vimwiki.txt /*vimwiki-help*
+vimwiki-intro vimwiki.txt /*vimwiki-intro*
+vimwiki-license vimwiki.txt /*vimwiki-license*
+vimwiki-list-manipulation vimwiki.txt /*vimwiki-list-manipulation*
+vimwiki-list-mappings vimwiki.txt /*vimwiki-list-mappings*
+vimwiki-lists vimwiki.txt /*vimwiki-lists*
+vimwiki-local-commands vimwiki.txt /*vimwiki-local-commands*
+vimwiki-local-mappings vimwiki.txt /*vimwiki-local-mappings*
+vimwiki-local-options vimwiki.txt /*vimwiki-local-options*
+vimwiki-mappings vimwiki.txt /*vimwiki-mappings*
+vimwiki-nohtml vimwiki.txt /*vimwiki-nohtml*
+vimwiki-option-auto_export vimwiki.txt /*vimwiki-option-auto_export*
+vimwiki-option-auto_tags vimwiki.txt /*vimwiki-option-auto_tags*
+vimwiki-option-auto_toc vimwiki.txt /*vimwiki-option-auto_toc*
+vimwiki-option-automatic_nested_syntaxes vimwiki.txt /*vimwiki-option-automatic_nested_syntaxes*
+vimwiki-option-css_name vimwiki.txt /*vimwiki-option-css_name*
+vimwiki-option-custom_wiki2html vimwiki.txt /*vimwiki-option-custom_wiki2html*
+vimwiki-option-diary_header vimwiki.txt /*vimwiki-option-diary_header*
+vimwiki-option-diary_index vimwiki.txt /*vimwiki-option-diary_index*
+vimwiki-option-diary_rel_path vimwiki.txt /*vimwiki-option-diary_rel_path*
+vimwiki-option-diary_sort vimwiki.txt /*vimwiki-option-diary_sort*
+vimwiki-option-ext vimwiki.txt /*vimwiki-option-ext*
+vimwiki-option-index vimwiki.txt /*vimwiki-option-index*
+vimwiki-option-list_margin vimwiki.txt /*vimwiki-option-list_margin*
+vimwiki-option-maxhi vimwiki.txt /*vimwiki-option-maxhi*
+vimwiki-option-nested_syntaxes vimwiki.txt /*vimwiki-option-nested_syntaxes*
+vimwiki-option-path vimwiki.txt /*vimwiki-option-path*
+vimwiki-option-path_html vimwiki.txt /*vimwiki-option-path_html*
+vimwiki-option-syntax vimwiki.txt /*vimwiki-option-syntax*
+vimwiki-option-template_default vimwiki.txt /*vimwiki-option-template_default*
+vimwiki-option-template_ext vimwiki.txt /*vimwiki-option-template_ext*
+vimwiki-option-template_path vimwiki.txt /*vimwiki-option-template_path*
+vimwiki-options vimwiki.txt /*vimwiki-options*
+vimwiki-placeholders vimwiki.txt /*vimwiki-placeholders*
+vimwiki-prerequisites vimwiki.txt /*vimwiki-prerequisites*
+vimwiki-register-extension vimwiki.txt /*vimwiki-register-extension*
+vimwiki-register-wiki vimwiki.txt /*vimwiki-register-wiki*
+vimwiki-syntax vimwiki.txt /*vimwiki-syntax*
+vimwiki-syntax-blockquotes vimwiki.txt /*vimwiki-syntax-blockquotes*
+vimwiki-syntax-comments vimwiki.txt /*vimwiki-syntax-comments*
+vimwiki-syntax-headers vimwiki.txt /*vimwiki-syntax-headers*
+vimwiki-syntax-hr vimwiki.txt /*vimwiki-syntax-hr*
+vimwiki-syntax-links vimwiki.txt /*vimwiki-syntax-links*
+vimwiki-syntax-lists vimwiki.txt /*vimwiki-syntax-lists*
+vimwiki-syntax-math vimwiki.txt /*vimwiki-syntax-math*
+vimwiki-syntax-paragraphs vimwiki.txt /*vimwiki-syntax-paragraphs*
+vimwiki-syntax-preformatted vimwiki.txt /*vimwiki-syntax-preformatted*
+vimwiki-syntax-tables vimwiki.txt /*vimwiki-syntax-tables*
+vimwiki-syntax-tags vimwiki.txt /*vimwiki-syntax-tags*
+vimwiki-syntax-typefaces vimwiki.txt /*vimwiki-syntax-typefaces*
+vimwiki-table-mappings vimwiki.txt /*vimwiki-table-mappings*
+vimwiki-table-of-contents vimwiki.txt /*vimwiki-table-of-contents*
+vimwiki-tables vimwiki.txt /*vimwiki-tables*
+vimwiki-tagbar vimwiki.txt /*vimwiki-tagbar*
+vimwiki-template vimwiki.txt /*vimwiki-template*
+vimwiki-temporary-wiki vimwiki.txt /*vimwiki-temporary-wiki*
+vimwiki-text-objects vimwiki.txt /*vimwiki-text-objects*
+vimwiki-title vimwiki.txt /*vimwiki-title*
+vimwiki-toc vimwiki.txt /*vimwiki-toc*
+vimwiki-todo-lists vimwiki.txt /*vimwiki-todo-lists*
+vimwiki.txt vimwiki.txt /*vimwiki.txt*
+vimwiki_+ vimwiki.txt /*vimwiki_+*
+vimwiki_- vimwiki.txt /*vimwiki_-*
+vimwiki_<A-Left> vimwiki.txt /*vimwiki_<A-Left>*
+vimwiki_<A-Right> vimwiki.txt /*vimwiki_<A-Right>*
+vimwiki_<Backspace> vimwiki.txt /*vimwiki_<Backspace>*
+vimwiki_<C-CR> vimwiki.txt /*vimwiki_<C-CR>*
+vimwiki_<C-Down> vimwiki.txt /*vimwiki_<C-Down>*
+vimwiki_<C-S-CR> vimwiki.txt /*vimwiki_<C-S-CR>*
+vimwiki_<C-Space> vimwiki.txt /*vimwiki_<C-Space>*
+vimwiki_<C-Up> vimwiki.txt /*vimwiki_<C-Up>*
+vimwiki_<CR> vimwiki.txt /*vimwiki_<CR>*
+vimwiki_<D-CR> vimwiki.txt /*vimwiki_<D-CR>*
+vimwiki_<Leader>w<Leader>i vimwiki.txt /*vimwiki_<Leader>w<Leader>i*
+vimwiki_<Leader>wd vimwiki.txt /*vimwiki_<Leader>wd*
+vimwiki_<Leader>wh vimwiki.txt /*vimwiki_<Leader>wh*
+vimwiki_<Leader>whh vimwiki.txt /*vimwiki_<Leader>whh*
+vimwiki_<Leader>wr vimwiki.txt /*vimwiki_<Leader>wr*
+vimwiki_<S-CR> vimwiki.txt /*vimwiki_<S-CR>*
+vimwiki_<S-Tab> vimwiki.txt /*vimwiki_<S-Tab>*
+vimwiki_<Tab> vimwiki.txt /*vimwiki_<Tab>*
+vimwiki_= vimwiki.txt /*vimwiki_=*
+vimwiki_[= vimwiki.txt /*vimwiki_[=*
+vimwiki_[[ vimwiki.txt /*vimwiki_[[*
+vimwiki_[u vimwiki.txt /*vimwiki_[u*
+vimwiki_]= vimwiki.txt /*vimwiki_]=*
+vimwiki_]] vimwiki.txt /*vimwiki_]]*
+vimwiki_]u vimwiki.txt /*vimwiki_]u*
+vimwiki_gL# vimwiki.txt /*vimwiki_gL#*
+vimwiki_gL- vimwiki.txt /*vimwiki_gL-*
+vimwiki_gL1 vimwiki.txt /*vimwiki_gL1*
+vimwiki_gL<Space> vimwiki.txt /*vimwiki_gL<Space>*
+vimwiki_gLA vimwiki.txt /*vimwiki_gLA*
+vimwiki_gLI vimwiki.txt /*vimwiki_gLI*
+vimwiki_gLa vimwiki.txt /*vimwiki_gLa*
+vimwiki_gLh vimwiki.txt /*vimwiki_gLh*
+vimwiki_gLi vimwiki.txt /*vimwiki_gLi*
+vimwiki_gLl vimwiki.txt /*vimwiki_gLl*
+vimwiki_gLr vimwiki.txt /*vimwiki_gLr*
+vimwiki_gLstar vimwiki.txt /*vimwiki_gLstar*
+vimwiki_gl# vimwiki.txt /*vimwiki_gl#*
+vimwiki_gl- vimwiki.txt /*vimwiki_gl-*
+vimwiki_gl1 vimwiki.txt /*vimwiki_gl1*
+vimwiki_gl<Space> vimwiki.txt /*vimwiki_gl<Space>*
+vimwiki_glA vimwiki.txt /*vimwiki_glA*
+vimwiki_glI vimwiki.txt /*vimwiki_glI*
+vimwiki_gla vimwiki.txt /*vimwiki_gla*
+vimwiki_glh vimwiki.txt /*vimwiki_glh*
+vimwiki_gli vimwiki.txt /*vimwiki_gli*
+vimwiki_gll vimwiki.txt /*vimwiki_gll*
+vimwiki_gln vimwiki.txt /*vimwiki_gln*
+vimwiki_glp vimwiki.txt /*vimwiki_glp*
+vimwiki_glr vimwiki.txt /*vimwiki_glr*
+vimwiki_glstar vimwiki.txt /*vimwiki_glstar*
+vimwiki_glx vimwiki.txt /*vimwiki_glx*
+vimwiki_gqq vimwiki.txt /*vimwiki_gqq*
+vimwiki_gww vimwiki.txt /*vimwiki_gww*
+vimwiki_i_<C-D> vimwiki.txt /*vimwiki_i_<C-D>*
+vimwiki_i_<C-L>_<C-J> vimwiki.txt /*vimwiki_i_<C-L>_<C-J>*
+vimwiki_i_<C-L>_<C-K> vimwiki.txt /*vimwiki_i_<C-L>_<C-K>*
+vimwiki_i_<C-L>_<C-M> vimwiki.txt /*vimwiki_i_<C-L>_<C-M>*
+vimwiki_i_<C-T> vimwiki.txt /*vimwiki_i_<C-T>*
+vimwiki_i_<CR> vimwiki.txt /*vimwiki_i_<CR>*
+vimwiki_i_<CR>_table vimwiki.txt /*vimwiki_i_<CR>_table*
+vimwiki_i_<S-CR> vimwiki.txt /*vimwiki_i_<S-CR>*
+vimwiki_i_<Tab>_table vimwiki.txt /*vimwiki_i_<Tab>_table*
diff --git a/vim/.vim/plugged/vimwiki/doc/vimwiki.txt b/vim/.vim/plugged/vimwiki/doc/vimwiki.txt
new file mode 100644
index 0000000..835036e
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/doc/vimwiki.txt
@@ -0,0 +1,3238 @@
+*vimwiki.txt* A Personal Wiki for Vim
+
+ __ __ ___ __ __ _ _ ___ ___ _ ___ ~
+ | | | || | | |_| || | _ | || | | | | || | ~
+ | |_| || | | || || || || | | |_| || | ~
+ | || | | || || | | _|| | ~
+ | || | | || || | | |_ | | ~
+ | | | | | ||_|| || _ || | | _ || | ~
+ |___| |___| |_| |_||__| |__||___| |___| |_||___| ~
+
+
+ Version: 2.3
+
+==============================================================================
+CONTENTS *vimwiki*
+
+ 1. Intro |vimwiki-intro|
+ 2. Prerequisites |vimwiki-prerequisites|
+ 3. Mappings |vimwiki-mappings|
+ 3.1. Global mappings |vimwiki-global-mappings|
+ 3.2. Local mappings |vimwiki-local-mappings|
+ 3.3. Text objects |vimwiki-text-objects|
+ 4. Commands |vimwiki-commands|
+ 4.1. Global commands |vimwiki-global-commands|
+ 4.2. Local commands |vimwiki-local-commands|
+ 5. Wiki syntax |vimwiki-syntax|
+ 5.1. Typefaces |vimwiki-syntax-typefaces|
+ 5.2. Links |vimwiki-syntax-links|
+ 5.3. Headers |vimwiki-syntax-headers|
+ 5.4. Paragraphs |vimwiki-syntax-paragraphs|
+ 5.5. Lists |vimwiki-syntax-lists|
+ 5.6. Tables |vimwiki-syntax-tables|
+ 5.7. Preformatted text |vimwiki-syntax-preformatted|
+ 5.8. Mathematical formulae |vimwiki-syntax-math|
+ 5.9. Blockquotes |vimwiki-syntax-blockquotes|
+ 5.10. Comments |vimwiki-syntax-comments|
+ 5.11. Horizontal line |vimwiki-syntax-hr|
+ 5.12. Tags |vimwiki-syntax-tags|
+ 6. Folding/Outline |vimwiki-folding|
+ 7. Placeholders |vimwiki-placeholders|
+ 8. Lists |vimwiki-lists|
+ 9. Tables |vimwiki-tables|
+ 10. Diary |vimwiki-diary|
+ 11. Anchors |vimwiki-anchors|
+ 12. Options |vimwiki-options|
+ 12.1. Registered Wiki |vimwiki-register-wiki|
+ 12.2. Temporary Wiki |vimwiki-temporary-wiki|
+ 12.3. Per-Wiki Options |vimwiki-local-options|
+ 12.4. Global Options |vimwiki-global-options|
+ 13. Getting help |vimwiki-help|
+ 14. Contributing & Bug reports |vimwiki-contributing|
+ 15. Development |vimwiki-development|
+ 16. Changelog |vimwiki-changelog|
+ 17. License |vimwiki-license|
+
+
+==============================================================================
+1. Intro *vimwiki-intro*
+
+Vimwiki is a personal wiki for Vim -- a number of linked text files that have
+their own syntax highlighting.
+
+With Vimwiki you can:
+ - organize notes and ideas
+ - manage todo-lists
+ - write documentation
+ - maintain a diary
+ - export everything to HTML
+
+To do a quick start press <Leader>ww (this is usually \ww) to go to your index
+wiki file. By default it is located in ~/vimwiki/index.wiki
+
+Feed it with the following example:
+
+= My knowledge base =
+ * Tasks -- things to be done _yesterday_!!!
+ * Project Gutenberg -- good books are power.
+ * Scratchpad -- various temporary stuff.
+
+Place your cursor on 'Tasks' and press Enter to create a link. Once pressed,
+'Tasks' will become '[[Tasks]]' -- a Vimwiki link. Press Enter again to
+open it. Edit the file, save it, and then press Backspace to jump back to
+your index.
+
+A Vimwiki link can be constructed from more than one word. Just visually
+select the words to be linked and press Enter. Try it with 'Project
+Gutenberg'. The result should look something like:
+
+= My knowledge base =
+ * [[Tasks]] -- things to be done _yesterday_!!!
+ * [[Project Gutenberg]] -- good books are power.
+ * Scratchpad -- various temporary stuff.
+
+==============================================================================
+2. Prerequisites *vimwiki-prerequisites*
+
+Make sure you have these settings in your vimrc file: >
+ set nocompatible
+ filetype plugin on
+ syntax on
+
+Without them Vimwiki will not work properly.
+
+
+==============================================================================
+3. Mappings *vimwiki-mappings*
+
+There are global and local mappings in Vimwiki.
+
+------------------------------------------------------------------------------
+3.1. Global mappings *vimwiki-global-mappings*
+
+[count]<Leader>ww or <Plug>VimwikiIndex
+ Open index file of the [count]'s wiki.
+
+ <Leader>ww opens the first wiki from |g:vimwiki_list|.
+ 1<Leader>ww as above, opens the first wiki from |g:vimwiki_list|.
+ 2<Leader>ww opens the second wiki from |g:vimwiki_list|.
+ 3<Leader>ww opens the third wiki from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>w <Plug>VimwikiIndex
+<
+See also |:VimwikiIndex|
+
+
+[count]<Leader>wt or <Plug>VimwikiTabIndex
+ Open index file of the [count]'s wiki in a new tab.
+
+ <Leader>wt tabopens the first wiki from |g:vimwiki_list|.
+ 1<Leader>wt as above tabopens the first wiki from |g:vimwiki_list|.
+ 2<Leader>wt tabopens the second wiki from |g:vimwiki_list|.
+ 3<Leader>wt tabopens the third wiki from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>t <Plug>VimwikiTabIndex
+<
+See also |:VimwikiTabIndex|
+
+
+<Leader>ws or <Plug>VimwikiUISelect
+ List and select available wikis.
+ To remap: >
+ :nmap <Leader>wq <Plug>VimwikiUISelect
+<
+See also |:VimwikiUISelect|
+
+
+[count]<Leader>wi or <Plug>VimwikiDiaryIndex
+ Open diary index file of the [count]'s wiki.
+
+ <Leader>wi opens diary index file of the first wiki from
+ |g:vimwiki_list|.
+ 1<Leader>wi the same as above.
+ 2<Leader>wi opens diary index file of the second wiki from
+ |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>i <Plug>VimwikiDiaryIndex
+
+See also |:VimwikiDiaryIndex|
+
+
+[count]<Leader>w<Leader>w or <Plug>VimwikiMakeDiaryNote
+ Open diary wiki-file for today of the [count]'s wiki.
+
+ <Leader>w<Leader>w opens diary wiki-file for today in the first wiki
+ from |g:vimwiki_list|.
+ 1<Leader>w<Leader>w as above opens diary wiki-file for today in the
+ first wiki from |g:vimwiki_list|.
+ 2<Leader>w<Leader>w opens diary wiki-file for today in the second wiki
+ from |g:vimwiki_list|.
+ 3<Leader>w<Leader>w opens diary wiki-file for today in the third wiki
+ from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>d <Plug>VimwikiMakeDiaryNote
+<
+See also |:VimwikiMakeDiaryNote|
+
+
+[count]<Leader>w<Leader>t or <Plug>VimwikiTabMakeDiaryNote
+ Open diary wiki-file for today of the [count]'s wiki in a new tab.
+
+ <Leader>w<Leader>t tabopens diary wiki-file for today in the first
+ wiki from |g:vimwiki_list|.
+ 1<Leader>w<Leader>t as above tabopens diary wiki-file for today in the
+ first wiki from |g:vimwiki_list|.
+ 2<Leader>w<Leader>t tabopens diary wiki-file for today in the second
+ wiki from |g:vimwiki_list|.
+ 3<Leader>w<Leader>t tabopens diary wiki-file for today in the third
+ wiki from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>dt <Plug>VimwikiTabMakeDiaryNote
+<
+See also |:VimwikiTabMakeDiaryNote|
+
+
+[count]<Leader>w<Leader>y or <Plug>VimwikiMakeYesterdayDiaryNote
+ Open diary wiki-file for yesterday of the [count]'s wiki.
+
+ <Leader>w<Leader>y opens diary wiki-file for yesterday in the first
+ wiki from |g:vimwiki_list|.
+ 1<Leader>w<Leader>y as above opens diary wiki-file for yesterday in
+ the first wiki from |g:vimwiki_list|.
+ 2<Leader>w<Leader>y opens diary wiki-file for yesterday in the second
+ wiki from |g:vimwiki_list|.
+ 3<Leader>w<Leader>y opens diary wiki-file for yesterday in the third
+ wiki from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>dy <Plug>VimwikiMakeYesterdayDiaryNote
+<
+See also |:VimwikiMakeYesterdayDiaryNote|
+
+[count]<Leader>w<Leader>m or <Plug>VimwikiMakeTomorrowDiaryNote
+ Open diary wiki-file for tomorrow of the [count]'s wiki.
+
+ <Leader>w<Leader>m opens diary wiki-file for tomorrow in the first
+ wiki from |g:vimwiki_list|.
+ 1<Leader>w<Leader>m as above opens diary wiki-file for tomorrow in
+ the first wiki from |g:vimwiki_list|.
+ 2<Leader>w<Leader>m opens diary wiki-file for tomorrow in the second
+ wiki from |g:vimwiki_list|.
+ 3<Leader>w<Leader>m opens diary wiki-file for tomorrow in the third
+ wiki from |g:vimwiki_list|.
+ etc.
+ To remap: >
+ :nmap <Leader>dm <Plug>VimwikiMakeTomorrowDiaryNote
+<
+See also |:VimwikiMakeTomorrowDiaryNote|
+
+------------------------------------------------------------------------------
+3.2. Local mappings
+
+To remap one of these keys, either put it in your .vimrc like this >
+ :nmap <Leader>wc <Plug>Vimwiki2HTML
+or, the better way, put it in a file .vim/ftplugin/vimwiki.vim like this >
+ :nmap <silent><buffer> <Leader>wc <Plug>Vimwiki2HTML
+
+The latter has the advantage that the mapping is local to Vimwiki buffers in
+every case.
+
+Also note that some keys work in normal mode as well as in visual mode. If you
+remap them using :map, they will also run in operator-pending mode. If you
+don't want that, use >
+ :nmap <Leader>tt <Plug>VimwikiToggleListItem
+ :vmap <Leader>tt <Plug>VimwikiToggleListItem
+
+
+NORMAL MODE *vimwiki-local-mappings*
+ *vimwiki_<Leader>wh*
+<Leader>wh Convert current wiki page to HTML.
+ Maps to |:Vimwiki2HTML|
+ To remap: >
+ :nmap <Leader>wc <Plug>Vimwiki2HTML
+<
+ *vimwiki_<Leader>whh*
+<Leader>whh Convert current wiki page to HTML and open it in the
+ webbrowser.
+ Maps to |:Vimwiki2HTMLBrowse|
+ To remap: >
+ :nmap <Leader>wcc <Plug>Vimwiki2HTMLBrowse
+<
+ *vimwiki_<Leader>w<Leader>i*
+<Leader>w<Leader>i Update diary section (delete old, insert new)
+ Only works from the diary index.
+ Maps to |:VimwikiDiaryGenerateLinks|
+ To remap: >
+ :nmap <Leader>wcr <Plug>VimwikiDiaryGenerateLinks
+<
+ *vimwiki_<CR>*
+<CR> Follow/create wiki link (create target wiki page if
+ needed).
+ Maps to |:VimwikiFollowLink|.
+ To remap: >
+ :nmap <Leader>wf <Plug>VimwikiFollowLink
+<
+ *vimwiki_<S-CR>*
+<S-CR> Split and follow (create target wiki page if needed).
+ May not work in some terminals. Remapping could help.
+ Maps to |:VimwikiSplitLink|.
+ To remap: >
+ :nmap <Leader>we <Plug>VimwikiSplitLink
+<
+ *vimwiki_<C-CR>*
+<C-CR> Vertical split and follow (create target wiki page if
+ needed).
+ May not work in some terminals. Remapping could help.
+ Maps to |:VimwikiVSplitLink|.
+ To remap: >
+ :nmap <Leader>wq <Plug>VimwikiVSplitLink
+<
+ *vimwiki_<C-S-CR>* *vimwiki_<D-CR>*
+<C-S-CR>, <D-CR> Follow wiki link (create target wiki page if needed),
+ opening in a new tab.
+ May not work in some terminals. Remapping could help.
+ Maps to |:VimwikiTabnewLink|.
+ To remap: >
+ :nmap <Leader>wt <Plug>VimwikiTabnewLink
+<
+ *vimwiki_<Backspace>*
+<Backspace> Go back to previously visited wiki page.
+ Maps to |:VimwikiGoBackLink|.
+ To remap: >
+ :nmap <Leader>wb <Plug>VimwikiGoBackLink
+<
+ *vimwiki_<Tab>*
+<Tab> Find next link in the current page.
+ Maps to |:VimwikiNextLink|.
+ To remap: >
+ :nmap <Leader>wn <Plug>VimwikiNextLink
+<
+ *vimwiki_<S-Tab>*
+<S-Tab> Find previous link in the current page.
+ Maps to |:VimwikiPrevLink|.
+ To remap: >
+ :nmap <Leader>wp <Plug>VimwikiPrevLink
+<
+ *vimwiki_<Leader>wd*
+<Leader>wd Delete wiki page you are in.
+ Maps to |:VimwikiDeleteLink|.
+ To remap: >
+ :nmap <Leader>dd <Plug>VimwikiDeleteLink
+<
+ *vimwiki_<Leader>wr*
+<Leader>wr Rename wiki page you are in.
+ Maps to |:VimwikiRenameLink|.
+ To remap: >
+ :nmap <Leader>rr <Plug>VimwikiRenameLink
+<
+ *vimwiki_=*
+= Add header level. Create if needed.
+ There is nothing to indent with '==' command in
+ Vimwiki, so it should be ok to use '=' here.
+ To remap: >
+ :nmap == <Plug>VimwikiAddHeaderLevel
+<
+ *vimwiki_-*
+- Remove header level.
+ To remap: >
+ :nmap -- <Plug>VimwikiRemoveHeaderLevel
+<
+ *vimwiki_[[*
+[[ Go to the previous header in the buffer.
+ To remap: >
+ :nmap <- <Plug>VimwikiGoToPrevHeader
+<
+ *vimwiki_]]*
+]] Go to the next header in the buffer.
+ To remap: >
+ :nmap -> <Plug>VimwikiGoToNextHeader
+<
+ *vimwiki_[=*
+[= Go to the previous header which has the same level as
+ the header the cursor is currently under.
+ To remap: >
+ :nmap <= <Plug>VimwikiGoToPrevSiblingHeader
+<
+ *vimwiki_]=*
+]= Go to the next header which has the same level as the
+ header the cursor is currently under.
+ To remap: >
+ :nmap => <Plug>VimwikiGoToNextSiblingHeader
+<
+ *vimwiki_]u* *vimwiki_[u*
+]u [u Go one level up -- that is, to the parent header of
+ the header the cursor is currently under.
+ To remap: >
+ :nmap -^ <Plug>VimwikiGoToParentHeader
+<
+ *vimwiki_+*
++ Create and/or decorate links. Depending on the
+ context, this command will: convert words into
+ wikilinks; convert raw URLs into wikilinks; and add
+ placeholder description text to wiki- or weblinks that
+ are missing descriptions. Can be activated in normal
+ mode with the cursor over a word or link, or in visual
+ mode with the selected text.
+ To remap: >
+ :nmap ++ <Plug>VimwikiNormalizeLink
+ :vmap ++ <Plug>VimwikiNormalizeLinkVisual
+<
+ *vimwiki_<C-Space>*
+<C-Space> Toggle checkbox of a list item on/off.
+ Maps to |:VimwikiToggleListItem|.
+ See |vimwiki-todo-lists|.
+ To remap: >
+ :map <Leader>tt <Plug>VimwikiToggleListItem
+<
+ *vimwiki_gl<Space>* *vimwiki_gL<Space>*
+gl<Space> Remove checkbox from list item.
+gL<Space> Remove checkboxes from all sibling list items.
+ To remap: >
+ :map <Leader><Space> <Plug>VimwikiRemoveSingleCB
+ :map <Leader><Space> <Plug>VimwikiRemoveCBInList
+<
+ *vimwiki_gln* *vimwiki_glp*
+gln Increase the "done" status of a list checkbox, i.e.
+ from [ ] to [.] to [o] etc. See |vimwiki-todo-lists|.
+glp Decrease the "done" status.
+ To remap: >
+ :nmap <M-+> <Plug>VimwikiIncrementListItem
+ :vmap <M-+> <Plug>VimwikiIncrementListItem
+ :nmap <M--> <Plug>VimwikiDecrementListItem
+ :vmap <M--> <Plug>VimwikiDecrementListItem
+
+ *vimwiki_gll* *vimwiki_gLl*
+gll Increase the level of a list item.
+gLl Increase the level of a list item and all child items.
+ To remap: >
+ :map >> <Plug>VimwikiIncreaseLvlSingleItem
+ :map >>> <Plug>VimwikiIncreaseLvlWholeItem
+<
+ *vimwiki_glh* *vimwiki_gLh*
+glh Decrease the level of a list item.
+gLh Decrease the level of a list item and all child items.
+ To remap: >
+ :map << <Plug>VimwikiDecreaseLvlSingleItem
+ :map <<< <Plug>VimwikiDecreaseLvlWholeItem
+<
+ *vimwiki_glr* *vimwiki_gLr*
+glr Renumber list items if the cursor is on a numbered
+ list item.
+gLr Renumber list items in all numbered lists in the whole
+ file.
+ Also readjust checkboxes.
+ To remap: >
+ :nmap <c-r> <Plug>VimwikiRenumberList
+ :nmap <c-r> <Plug>VimwikiRenumberAllLists
+<
+ *vimwiki_glstar* *vimwiki_gLstar*
+gl* Make a list item out of a normal line or change the
+ symbol of the current item to *.
+gL* Change the symbol of the current list to *.
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo *<CR>
+ noremap glO :VimwikiChangeSymbolInListTo *<CR>
+<
+ *vimwiki_gl#* *vimwiki_gL#*
+gl# Make a list item out of a normal line or change the
+ symbol of the current item to #.
+gL# Change the symbol of the current list to #.
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo #<CR>
+ noremap glO :VimwikiChangeSymbolInListTo #<CR>
+<
+ *vimwiki_gl-* *vimwiki_gL-*
+gl- Make a list item out of a normal line or change the
+ symbol of the current item to -.
+gL- Change the symbol of the current list to -.
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo -<CR>
+ noremap glO :VimwikiChangeSymbolInListTo -<CR>
+<
+ *vimwiki_gl1* *vimwiki_gL1*
+gl1 Make a list item out of a normal line or change the
+ symbol of the current item to 1., the numbering is
+ adjusted according to the surrounding list items.
+gL1 Change the symbol of the current list to 1. 2. 3. ...
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo 1.<CR>
+ noremap glO :VimwikiChangeSymbolInListTo 1.<CR>
+<
+ *vimwiki_gla* *vimwiki_gLa*
+gla Make a list item out of a normal line or change the
+ symbol of the current item to a), the numbering is
+ adjusted according to the surrounding list items.
+gLa Change the symbol of the current list to a) b) c) ...
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo a)<CR>
+ noremap glO :VimwikiChangeSymbolInListTo a)<CR>
+<
+ *vimwiki_glA* *vimwiki_gLA*
+glA Make a list item out of a normal line or change the
+ symbol of the current item to A), the numbering is
+ adjusted according to the surrounding list items.
+gLA Change the symbol of the current list to A) B) C) ...
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo A)<CR>
+ noremap glO :VimwikiChangeSymbolInListTo A)<CR>
+<
+ *vimwiki_gli* *vimwiki_gLi*
+gli Make a list item out of a normal line or change the
+ symbol of the current item to i), the numbering is
+ adjusted according to the surrounding list items.
+gLi Change the symbol of the current list to
+ i) ii) iii) ...
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo i)<CR>
+ noremap glO :VimwikiChangeSymbolInListTo i)<CR>
+<
+ *vimwiki_glI* *vimwiki_gLI*
+glI Make a list item out of a normal line or change the
+ symbol of the current item to I), the numbering is
+ adjusted according to the surrounding list items.
+gLI Change the symbol of the current list to
+ I) II) III) ...
+ To remap: >
+ noremap glo :VimwikiChangeSymbolTo I)<CR>
+ noremap glO :VimwikiChangeSymbolInListTo I)<CR>
+<
+ *vimwiki_glx*
+glx Toggle checkbox of a list item disabled/off.
+ Maps to |:VimwikiToggleRejectedListItem|.
+ See |vimwiki-todo-lists|.
+ To remap: >
+ :map <Leader>tx <Plug>VimwikiToggleRejectedListItem
+<
+ *vimwiki_gqq* *vimwiki_gww*
+gqq Format table. If you made some changes to a table
+ or without swapping insert/normal modes this command
+gww will reformat it.
+
+ *vimwiki_<A-Left>*
+<A-Left> Move current table column to the left.
+ See |:VimwikiTableMoveColumnLeft|
+ To remap: >
+ :nmap <Leader>wtl <Plug>VimwikiTableMoveColumnLeft
+<
+ *vimwiki_<A-Right>*
+<A-Right> Move current table column to the right.
+ See |:VimwikiTableMoveColumnRight|
+ To remap: >
+ :nmap <Leader>wtr <Plug>VimwikiTableMoveColumnRight
+<
+ *vimwiki_<C-Up>*
+<C-Up> Open the previous day's diary link if available.
+ See |:VimwikiDiaryPrevDay|
+ To remap: >
+ :nmap <Leader>k <Plug>VimwikiDiaryPrevDay
+<
+ *vimwiki_<C-Down>*
+<C-Down> Open the next day's diary link if available.
+ See |:VimwikiDiaryNextDay|
+ To remap: >
+ :nmap <Leader>j <Plug>VimwikiDiaryNextDay
+<
+
+Works only if |g:vimwiki_use_mouse| is set to 1.
+<2-LeftMouse> Follow wiki link (create target wiki page if needed).
+
+<S-2-LeftMouse> Split and follow wiki link (create target wiki page if
+ needed).
+
+<C-2-LeftMouse> Vertical split and follow wiki link (create target
+ wiki page if needed).
+
+<RightMouse><LeftMouse> Go back to previous wiki page.
+
+Note: <2-LeftMouse> is just left double click.
+
+
+
+INSERT MODE *vimwiki-table-mappings*
+ *vimwiki_i_<CR>_table*
+<CR> Go to the table cell beneath the current one, create
+ a new row if on the last one.
+
+ *vimwiki_i_<Tab>_table*
+<Tab> Go to the next table cell, create a new row if on the
+ last cell.
+See |g:vimwiki_table_mappings| to turn them off.
+
+INSERT MODE *vimwiki-list-mappings*
+ *vimwiki_i_<CR>*
+<CR> In a list item, insert a new bullet or number in the
+ next line, numbers are incremented.
+ In an empty list item, delete the item symbol. This is
+ useful to end a list, simply press <CR> twice.
+ See |vimwiki-lists| for details and for how to
+ configure the behavior.
+
+ *vimwiki_i_<S-CR>*
+<S-CR> Does not insert a new list item, useful to create
+ multilined list items.
+ See |vimwiki-lists| for details and for how to
+ configure the behavior.
+
+ *vimwiki_i_<C-T>*
+<C-T> Increase the level of a list item.
+ To remap: >
+ :imap <C-E> <Plug>VimwikiIncreaseLvlSingleItem
+<
+ *vimwiki_i_<C-D>*
+<C-D> Decrease the level of a list item.
+ To remap: >
+ :imap <C-E> <Plug>VimwikiDecreaseLvlSingleItem
+<
+ *vimwiki_i_<C-L>_<C-J>*
+<C-L><C-J> Change the symbol of the current list item to the next
+ available. From - to 1. to * to I) to a).
+ To remap: >
+ :imap <C-A> <Plug>VimwikiListNextSymbol
+<
+ *vimwiki_i_<C-L>_<C-K>*
+<C-L><C-K> Change the symbol of the current list item to the prev
+ available. From - to a) to I) to * to 1.
+ To remap: >
+ :imap <C-S> <Plug>VimwikiListPrevSymbol
+<
+ *vimwiki_i_<C-L>_<C-M>*
+<C-L><C-M> Create/remove a symbol from a list item.
+ To remap: >
+ :imap <C-K> <Plug>VimwikiListToggle
+<
+
+------------------------------------------------------------------------------
+3.3. Text objects *vimwiki-text-objects*
+
+ah A header including its content up to the next header.
+ih The content under a header (like 'ah', but excluding
+ the header itself and trailing empty lines).
+
+aH A header including all of its subheaders. When [count]
+ is 2, include the parent header, when [count] is 3,
+ the grandparent and so on.
+iH Like 'aH', but excluding the header itself and
+ trailing empty lines.
+
+Examples:
+- type 'cih' to change the content under the current header
+- 'daH' deletes an entire header plus its content including the content of all
+ of its subheaders
+- 'v2aH' selects the parent header of the header the cursor is under plus all
+ of the content of all of its subheaders
+
+a\ A cell in a table.
+i\ An inner cell in a table.
+ac A column in a table.
+ic An inner column in a table.
+
+al A list item plus its children.
+il A single list item.
+
+
+==============================================================================
+4. Commands *vimwiki-commands*
+
+------------------------------------------------------------------------------
+4.1. Global Commands *vimwiki-global-commands*
+
+*:VimwikiIndex*
+ Open index file of the current wiki.
+
+*:VimwikiTabIndex*
+ Open index file of the current wiki in a new tab.
+
+*:VimwikiUISelect*
+ Open index file of the selected wiki.
+
+*:VimwikiDiaryIndex*
+ Open diary index file of the current wiki.
+
+*:VimwikiMakeDiaryNote*
+ Open diary wiki-file for today of the current wiki.
+
+*:VimwikiTabMakeDiaryNote*
+ Open diary wiki-file for today of the current wiki in a new tab.
+
+*:VimwikiMakeYesterdayDiaryNote*
+ Open diary wiki-file for yesterday of the current wiki.
+
+*:VimwikiMakeTomorrowDiaryNote*
+ Open diary wiki-file for tomorrow of the current wiki.
+
+------------------------------------------------------------------------------
+4.2. Local commands *vimwiki-local-commands*
+
+These commands are only available (and meaningful) when you are currently in a
+Vimwiki file.
+
+*:VimwikiFollowLink*
+ Follow wiki link (or create target wiki page if needed).
+
+*:VimwikiGoBackLink*
+ Go back to the wiki page you came from.
+
+*:VimwikiSplitLink*
+ Split and follow wiki link (create target wiki page if needed).
+
+*:VimwikiVSplitLink*
+ Vertical split and follow wiki link (create target wiki page if needed).
+
+*:VimwikiTabnewLink*
+ Follow wiki link in a new tab (create target wiki page if needed).
+
+*:VimwikiNextLink*
+ Find next link on the current page.
+
+*:VimwikiPrevLink*
+ Find previous link on the current page.
+
+*:VimwikiGoto*
+ Goto link provided by an argument. For example: >
+ :VimwikiGoto HelloWorld
+< opens/creates HelloWorld wiki page.
+
+ Supports |cmdline-completion| for link name.
+
+*:VimwikiDeleteLink*
+ Delete the wiki page you are in.
+
+*:VimwikiRenameLink*
+ Rename the wiki page you are in.
+
+*:Vimwiki2HTML*
+ Convert current wiki page to HTML using Vimwiki's own converter or a
+ user-supplied script (see |vimwiki-option-custom_wiki2html|).
+
+*:Vimwiki2HTMLBrowse*
+ Convert current wiki page to HTML and open it in the webbrowser.
+
+*:VimwikiAll2HTML*
+ Convert all wiki pages to HTML.
+ Default CSS file (style.css) is created if there is no one.
+
+*:VimwikiToggleListItem*
+ Toggle checkbox of a list item on/off.
+ See |vimwiki-todo-lists|.
+
+*:VimwikiToggleRejectedListItem*
+ Toggle checkbox of a list item disabled/off.
+ See |vimwiki-todo-lists|.
+
+*:VimwikiListChangeLevel* CMD
+ Change the nesting level, or symbol, for a single-line list item.
+ CMD may be ">>" or "<<" to change the indentation of the item, or
+ one of the syntax-specific bullets: "*", "#", "1.", "-".
+ See |vimwiki-todo-lists|.
+
+*:VimwikiSearch* /pattern/
+*:VWS* /pattern/
+ Search for /pattern/ in all files of current wiki.
+ To display all matches use |:lopen| command.
+ To display next match use |:lnext| command.
+ To display previous match use |:lprevious| command.
+
+ Hint: this feature is simply a wrapper around |:lvimgrep|. For a
+ description of how the pattern can look like, see |:vimgrep|. For example,
+ to do a case insensitive search, use >
+ :VWS /\cpattern/
+
+*:VimwikiBacklinks*
+*:VWB*
+ Search for wikilinks to the current wiki page in all files of current
+ wiki.
+ To display all matches use |:lopen| command.
+ To display next match use |:lnext| command.
+ To display previous match use |:lprevious| command.
+
+
+*:VimwikiTable*
+ Create a table with 5 cols and 2 rows.
+
+ :VimwikiTable cols rows
+ Create a table with the given cols and rows
+
+ :VimwikiTable cols
+ Create a table with the given cols and 2 rows
+
+
+*:VimwikiTableMoveColumnLeft* , *:VimwikiTableMoveColumnRight*
+ Move current column to the left or to the right:
+ Example: >
+
+ | head1 | head2 | head3 | head4 | head5 |
+ |--------|--------|--------|--------|--------|
+ | value1 | value2 | value3 | value4 | value5 |
+
+
+ Cursor is on 'head1'.
+ :VimwikiTableMoveColumnRight
+
+ | head2 | head1 | head3 | head4 | head5 |
+ |--------|--------|--------|--------|--------|
+ | value2 | value1 | value3 | value4 | value5 |
+
+ Cursor is on 'head3'.
+ :VimwikiTableMoveColumnLeft
+
+ | head2 | head3 | head1 | head4 | head5 |
+ |--------|--------|--------|--------|--------|
+ | value2 | value3 | value1 | value4 | value5 |
+<
+
+ Commands are mapped to <A-Left> and <A-Right> respectively.
+
+
+*:VimwikiGenerateLinks*
+ Insert the links of all available wiki files into the current buffer.
+
+*:VimwikiDiaryGenerateLinks*
+ Delete old, insert new diary section into diary index file.
+
+*:VimwikiDiaryNextDay*
+ Open next day diary link if available.
+ Mapped to <C-Down>.
+
+*:VimwikiDiaryPrevDay*
+ Open previous day diary link if available.
+ Mapped to <C-Up>.
+
+*:VimwikiTOC*
+ Create or update the Table of Contents for the current wiki file.
+ See |vimwiki-toc|.
+
+*:VimwikiCheckLinks*
+ Search through all wiki files and check if the targets of all wiki links
+ and links to external files actually exist. Check also if all wiki files
+ are reachable from the index file. The results are shown in the quickfix
+ window.
+
+*:VimwikiRebuildTags*
+ Rebuilds the tags metadata file for all wiki files newer than the metadata
+ file.
+ Necessary for all tags related commands: |vimwiki-syntax-tags|.
+
+ :VimwikiRebuildTags! does the same for all files.
+
+*:VimwikiSearchTags*
+ Searches over the pages in current wiki and finds all locations of a given
+ tag. Supports |cmdline-completion|.
+
+*:VimwikiGenerateTags* tagname1 tagname2 ...
+ Creates or updates an overview on all tags of the wiki with links to all
+ their instances. Supports |cmdline-completion|. If no arguments (tags)
+ are specified, outputs all tags. To make this command work properly, make
+ sure the tags have been built (see |vimwiki-build-tags|).
+
+------------------------------------------------------------------------------
+4.3. Functions *vimwiki-functions*
+
+Functions to interact with Vimwiki. (It's intended that most commands will be
+replaced with corresponding function calls in the future.)
+Warning: this is currently unstable and likely to change.
+
+
+To map them to a key, use >
+ nnoremap <C-K> :call vimwiki#base#function_name(arg1, arg2)<CR>
+<
+
+ *vimwiki-follow_link*
+vimwiki#base#follow_link({split}, {reuse}, {move_cursor})
+ Open the link under the cursor. {split} can have the following values:
+ 'nosplit' open the link in the current window
+ 'vsplit' open in a vertically split window
+ 'hsplit' open in a horizontally split window
+ 'tab' open in a new tab
+
+ If {reuse} is 1 and {split} one of 'vsplit' or 'hsplit', open the link in
+ a possibly existing split window instead of making a new split.
+
+ If {move_cursor} is 1 the cursor moves to the window or tab with the
+ opened link, otherwise, it stays in the window or tab with the link.
+
+ For example, <CR> is per default mapped to
+ vimwiki#base#follow_link('nosplit', 0, 1)
+
+
+==============================================================================
+5. Wiki syntax *vimwiki-syntax*
+
+
+There are a lot of different wikis out there. Most of them have their own
+syntax and Vimwiki is not an exception here.
+
+Vimwiki has evolved its own syntax that closely resembles Google's wiki
+markup. This syntax is described in detail below.
+
+Vimwiki also supports alternative syntaxes, like Markdown and MediaWiki, to
+varying degrees; see |vimwiki-option-syntax|. Static elements like headers,
+quotations, and lists are customized in syntax/vimwiki_xxx.vim, where xxx
+stands for the chosen syntax.
+
+Interactive elements such as links and Vimwiki commands are supported by
+definitions and routines in syntax/vimwiki_xxx_custom.vim and
+autoload/vimwiki/xxx_base.vim. Currently, only Markdown includes this level
+of support.
+
+Vimwiki2HTML is currently functional only for the default syntax.
+
+------------------------------------------------------------------------------
+5.1. Typefaces *vimwiki-syntax-typefaces*
+
+There are a few typefaces that give you a bit of control over how your text
+is decorated: >
+
+ *bold text*
+ _italic text_
+ ~~strikeout text~~
+ `code (no syntax) text`
+ super^script^
+ sub,,script,,
+
+
+------------------------------------------------------------------------------
+5.2. Links *vimwiki-syntax-links*
+
+Wikilinks~
+
+Plain link: >
+ [[This is a link]]
+With description: >
+ [[This is a link source|Description of the link]]
+
+Wiki files don't need to be in the root directory of your wiki, you can put
+them in subdirectories as well: >
+ [[projects/Important Project 1]]
+To jump from that file back to the index file, use this link: >
+ [[../index]]
+or: >
+ [[/index]]
+The latter works because wiki links starting with "/" are considered to be
+absolute to the wiki root directory, that is, the link [[/index]] always opens
+the file /path/to/your/wiki/index.wiki, no matter in which subdirectory you
+are currently in.
+
+Links to subdirectories inside the wiki directory are also supported. They
+end with a "/": >
+ [[a subdirectory/|Other files]]
+Use |g:vimwiki_dir_link| to control the behavior when opening directories.
+
+Typing wikilinks can be simplified by using Vim's omni completion (see
+|compl-omni|) like so: >
+ [[ind<C-X><C-O>
+which opens up a popup menu with all the wiki files starting with "ind".
+
+When |vimwiki-option-maxhi| equals 1, a distinct highlighting style is used to
+identify wikilinks whose targets are not found.
+
+Interwiki~
+
+If you maintain more than one wiki, you can create interwiki links between
+them by adding a numbered prefix "wikiX:" in front of a link: >
+ [[wiki1:This is a link]]
+or: >
+ [[wiki1:This is a link source|Description of the link]]
+
+The number behind "wiki" is in the range 0..N-1 and identifies the destination
+wiki in |g:vimwiki_list|.
+
+Diary~
+
+The "diary:" scheme is used to link to diary entries: >
+ [[diary:2012-03-05]]
+
+Anchors~
+
+A wikilink, interwiki link or diary link can be followed by a '#' and the name
+of an anchor. When opening a link, the cursor jumps to the anchor. >
+ [[Todo List#Tomorrow|Tasks for tomorrow]]
+
+To jump inside the current wiki file you can omit the file: >
+ [[#Tomorrow]]
+
+See |vimwiki-anchors| for how to set an anchor.
+
+Raw URLs~
+
+Raw URLs are also supported: >
+ https://github.com/vimwiki/vimwiki.git
+ mailto:habamax@gmail.com
+ ftp://vim.org
+
+External files~
+
+The "file:" and "local:" schemes allow you to directly link to arbitrary
+resources using absolute or relative paths: >
+ [[file:/home/somebody/a/b/c/music.mp3]]
+ [[file:C:/Users/somebody/d/e/f/music.mp3]]
+ [[file:~/a/b/c/music.mp3]]
+ [[file:../assets/data.csv|Important Data]]
+ [[local:C:/Users/somebody/d/e/f/music.mp3]]
+ [[file:/home/user/documents/|Link to a directory]]
+
+These links are opened with the system command, i.e. !xdg-open (Linux), !open
+(Mac), or !start (Windows). To customize this behavior, see
+|VimwikiLinkHandler|.
+
+In Vim, "file:" and "local:" behave the same, i.e. you can use them with both
+relative and absolute links. When converted to HTML, however, "file:" links
+will become absolute links, while "local:" links become relative to the HTML
+output directory. The latter can be useful if you copy your HTML files to
+another computer.
+To customize the HTML conversion of links, see |VimwikiLinkConverter|.
+
+Transclusion (Wiki-Include) Links~
+
+Links that use "{{" and "}}" delimiters signify content that is to be
+included into the HTML output, rather than referenced via hyperlink.
+
+Wiki-include URLs may use any of the supported schemes, may be absolute or
+relative, and need not end with an extension.
+
+The primary purpose for wiki-include links is to include images.
+
+Transclude from a local URL: >
+ {{file:../../images/vimwiki_logo.png}}
+or from a universal URL: >
+ {{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png}}
+
+Transclude image with alternate text: >
+ {{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png|Vimwiki}}
+in HTML: >
+ <img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
+ alt="Vimwiki"/>
+
+Transclude image with alternate text and some style: >
+ {{http://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
+in HTML: >
+ <img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
+ alt="cool stuff" style="width:150px; height:120px"/>
+
+Transclude image _without_ alternate text and with a CSS class: >
+ {{http://.../vimwiki_logo.png||class="center flow blabla"}}
+in HTML: >
+ <img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
+ alt="" class="center flow blabla"/>
+
+A trial feature allows you to supply your own handler for wiki-include links.
+See |VimwikiWikiIncludeHandler|.
+
+Thumbnail links~
+>
+Thumbnail links are constructed like this: >
+ [[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
+
+in HTML: >
+ <a href="http://someaddr.com/ ... /.jpg">
+ <img src="http://../thumbnail.jpg /></a>
+
+Markdown Links~
+
+These links are only available for Markdown syntax. See
+http://daringfireball.net/projects/markdown/syntax#link.
+
+Inline link: >
+ [Looks like this](URL)
+
+Image link: >
+ ![Looks like this](URL)
+
+The URL can be anything recognized by Vimwiki as a raw URL.
+
+
+Reference-style links: >
+ a) [Link Name][Id]
+ b) [Id][], using the "implicit link name" shortcut
+
+Reference style links must always include two consecutive pairs of
+[-brackets, and field entries can not use "[" or "]".
+
+
+NOTE: (in Vimwiki's current implementation) Reference-style links are a hybrid
+of Vimwiki's default "Wikilink" and the tradition reference-style link.
+
+If the Id is defined elsewhere in the source, as per the Markdown standard: >
+ [Id]: URL
+
+then the URL is opened with the system default handler. Otherwise, Vimwiki
+treats the reference-style link as a Wikilink, interpreting the Id field as a
+wiki page name.
+
+Highlighting of existing links when |vimwiki-option-maxhi| is activated
+identifies links whose Id field is not defined, either as a reference-link or
+as a wiki page.
+
+To scan the page for new or changed definitions for reference-links, simply
+re-open the page ":e<CR>".
+
+------------------------------------------------------------------------------
+5.3. Headers *vimwiki-syntax-headers*
+
+= Header level 1 =~
+By default all headers are highlighted using |hl-Title| highlight group.
+
+== Header level 2 ==~
+You can set up different colors for each header level: >
+ :hi VimwikiHeader1 guifg=#FF0000
+ :hi VimwikiHeader2 guifg=#00FF00
+ :hi VimwikiHeader3 guifg=#0000FF
+ :hi VimwikiHeader4 guifg=#FF00FF
+ :hi VimwikiHeader5 guifg=#00FFFF
+ :hi VimwikiHeader6 guifg=#FFFF00
+Set up colors for all 6 header levels or none at all.
+
+=== Header level 3 ===~
+==== Header level 4 ====~
+===== Header level 5 =====~
+====== Header level 6 ======~
+
+
+You can center your headers in HTML by placing spaces before the first '=':
+ = Centered Header L1 =~
+
+
+------------------------------------------------------------------------------
+5.4. Paragraphs *vimwiki-syntax-paragraphs*
+
+A paragraph is a group of lines starting in column 1 (no indentation).
+Paragraphs are separated by a blank line:
+
+This is first paragraph
+with two lines.
+
+This is a second paragraph with
+two lines.
+
+
+------------------------------------------------------------------------------
+5.5. Lists *vimwiki-syntax-lists*
+
+Unordered lists: >
+ - Bulleted list item 1
+ - Bulleted list item 2
+or: >
+ * Bulleted list item 1
+ * Bulleted list item 2
+
+
+Ordered lists: >
+ 1. Numbered list item 1
+ 2. Numbered list item 2
+ 3. Numbered list item 3
+or: >
+ 1) Numbered list item 1
+ 2) Numbered list item 2
+ 3) Numbered list item 3
+or: >
+ a) Numbered list item 1
+ b) Numbered list item 2
+ c) Numbered list item 3
+or: >
+ A) Numbered list item 1
+ B) Numbered list item 2
+ C) Numbered list item 3
+or: >
+ i) Numbered list item 1
+ ii) Numbered list item 2
+ iii) Numbered list item 3
+or: >
+ I) Numbered list item 1
+ II) Numbered list item 2
+ III) Numbered list item 3
+or: >
+ # Bulleted list item 1
+ # the # become numbers when converted to HTML
+
+Note that a space after the list item symbols (-, *, 1. etc.) is essential.
+
+You can nest and mix the various types: >
+ - Bulleted list item 1
+ - Bulleted list item 2
+ a) Numbered list sub item 1
+ b) more ...
+ * and more ...
+ * ...
+ c) Numbered list sub item 3
+ 1. Numbered list sub sub item 1
+ 2. Numbered list sub sub item 2
+ d) etc.
+ - Bulleted list item 3
+
+List items can span multiple lines: >
+ * Item 1
+ Item 1 continued line.
+ Item 1 next continued line.
+ * Item 2
+ - Sub item 1
+ Sub item 1 continued line.
+ Sub item 1 next continued line.
+ - Sub item 2
+ - etc.
+ Continuation of Item 2
+ Next continuation of Item 2
+
+
+Definition lists: >
+ Term 1:: Definition 1
+ Term 2::
+ :: Definition 2
+ :: Definition 3
+
+
+------------------------------------------------------------------------------
+5.6. Tables *vimwiki-syntax-tables*
+
+Tables are created by entering the content of each cell separated by |
+delimiters. You can insert other inline wiki syntax in table cells, including
+typeface formatting and links.
+For example: >
+
+ | Year | Temperature (low) | Temperature (high) |
+ |------|-------------------|--------------------|
+ | 1900 | -10 | 25 |
+ | 1910 | -15 | 30 |
+ | 1920 | -10 | 32 |
+ | 1930 | _N/A_ | _N/A_ |
+ | 1940 | -2 | 40 |
+>
+
+In HTML the following part >
+ | Year | Temperature (low) | Temperature (high) |
+ |------|-------------------|--------------------|
+>
+is highlighted as a table header.
+
+If you indent a table then it will be centered in HTML.
+
+If you put > in a cell, the cell spans the left column.
+If you put \/ in a cell, the cell spans the above row.
+For example: >
+
+ | a | b | c | d |
+ | \/ | e | > | f |
+ | \/ | \/ | > | g |
+ | h | > | > | > |
+>
+
+See |vimwiki-tables| for more details on how to manage tables.
+
+
+------------------------------------------------------------------------------
+5.7. Preformatted text *vimwiki-syntax-preformatted*
+
+Use {{{ and }}} to define a block of preformatted text:
+{{{ >
+ Tyger! Tyger! burning bright
+ In the forests of the night,
+ What immortal hand or eye
+ Could frame thy fearful symmetry?
+ In what distant deeps or skies
+ Burnt the fire of thine eyes?
+ On what wings dare he aspire?
+ What the hand dare sieze the fire?
+}}}
+
+
+You can add optional information after the {{{: >
+{{{class="brush: python" >
+ def hello(world):
+ for x in range(10):
+ print("Hello {0} number {1}".format(world, x))
+}}}
+
+Result of HTML export: >
+ <pre class="brush: python">
+ def hello(world):
+ for x in range(10):
+ print("Hello {0} number {1}".format(world, x))
+ </pre>
+
+This might be useful for coloring program code with external JS tools
+such as Google's syntax highlighter.
+
+You can setup Vimwiki to highlight code snippets in preformatted text.
+See |vimwiki-option-nested_syntaxes| and
+|vimwiki-option-automatic_nested_syntaxes|.
+
+
+------------------------------------------------------------------------------
+5.8. Mathematical formulae *vimwiki-syntax-math*
+
+Mathematical formulae are highlighted, and can be rendered in HTML using the
+powerful open source display engine MathJax (http://www.mathjax.org/).
+
+There are three supported syntaxes, which are inline, block display and
+block environment.
+
+Inline math is for short formulae within text. It is enclosed by single
+dollar signs, e.g.:
+ $ \sum_i a_i^2 = 1 $
+
+Block display creates a centered formula with some spacing before and after
+it. It must start with a line including only {{$, then an arbitrary number
+of mathematical text are allowed, and it must end with a line including only
+}}$.
+E.g.:
+ {{$
+ \sum_i a_i^2
+ =
+ 1
+ }}$
+
+Note: no matter how many lines are used in the text file, the HTML will
+compress it to one line only.
+
+Block environment is similar to block display, but is able to use specific
+LaTeX environments, such as 'align'. The syntax is the same as for block
+display, except for the first line which is {{$%environment%.
+E.g.:
+ {{$%align%
+ \sum_i a_i^2 &= 1 + 1 \\
+ &= 2.
+ }}$
+
+Similar compression rules for the HTML page hold (as MathJax interprets the
+LaTeX code).
+
+Note: the highlighting in Vim is automatic. For the rendering in HTML, you
+have two alternative options:
+
+1. installing MathJax locally (Recommended: faster, no internet required).
+Choose a folder on your hard drive and save MathJax in it. Then add to your
+HTML template the following line:
+
+<script type="text/javascript" src="<mathjax_folder>/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+
+where <mathjax_folder> is the folder on your HD, as a relative path to the
+template folder. For instance, a sensible folder structure could be:
+
+- wiki
+ - text
+ - html
+ - templates
+ - mathjax
+
+In this case, <mathjax_folder> would be "../mathjax" (without quotes).
+
+2. Loading MathJax from a CDN-server (needs internet connection).
+Add to your HTML template the following line:
+
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/config/TeX-AMS-MML_HTMLorMML.js"></script>
+
+
+------------------------------------------------------------------------------
+5.9. Blockquotes *vimwiki-syntax-blockquotes*
+
+Text which starts with 4 or more spaces is a blockquote.
+
+ This would be a blockquote in Vimwiki. It is not highlighted in Vim but
+ could be styled by CSS in HTML. Blockquotes are usually used to quote a
+ long piece of text from another source.
+
+
+------------------------------------------------------------------------------
+5.10. Comments *vimwiki-syntax-comments*
+
+A line that starts with %% is a comment.
+E.g.: >
+ %% this text would not be in HTML
+<
+
+------------------------------------------------------------------------------
+5.11. Horizontal line *vimwiki-syntax-hr*
+
+4 or more dashes at the start of the line is a horizontal line (<hr />): >
+ ----
+<
+
+------------------------------------------------------------------------------
+5.12. Tags *vimwiki-syntax-tags*
+
+You can tag a wiki file, a header or an arbitrary place in a wiki file. Then,
+you can use Vim's built-in tag search functionality (see |tagsrch.txt|) or
+Vimwiki's tag related commands to quickly jump to all occurrences of the tag.
+
+A tag is a sequence of non-space characters between two colons: >
+ :tag-example:
+<
+It is allowed to concatenate multiple tags in one line: >
+ :tag-one:tag-two:
+<
+If placed in the first two lines of a file, the whole file is tagged. If
+placed under a header, within the 2 lines below it, the header is then tagged
+with this tag, and the tag search commands will jump to this specific header.
+Otherwise, the tag stands of its own and the search command jumps directly to
+it.
+
+Typing tags can be simplified by using Vim's omni completion (see
+|compl-omni|) like so: >
+ :ind<C-X><C-O>
+which opens up a popup menu with all tags defined in the wiki starting with
+"ind".
+
+Tags are also treated as |vimwiki-anchors| (similar to bold text).
+
+ *vimwiki-build-tags*
+Note that the tag search/jump/completion commands need certain metadata saved
+in the wiki folder. This metadata file can be manually updated by running
+|:VimwikiRebuildTags|. When the option |vimwiki-option-auto_tags| is enabled,
+the tags metadata will be auto-updated on each page save.
+
+
+Tags-related commands and options:
+ * |:VimwikiRebuildTags|
+ * |:VimwikiGenerateTags|
+ * |:VimwikiSearchTags|
+ * |vimwiki-option-auto_tags|
+
+
+==============================================================================
+6. Folding/Outline *vimwiki-folding*
+
+Vimwiki can fold or outline sections using headers and preformatted blocks.
+Alternatively, one can fold list subitems instead. Folding is not enabled
+by default, and requires the |g:vimwiki_folding| variable to be set.
+
+Example for list folding with |g:vimwiki_folding| set to 'list':
+
+= My current task =
+* [ ] Do stuff 1
+ * [ ] Do substuff 1.1
+ * [ ] Do substuff 1.2
+ * [ ] Do substuff 1.2.1
+ * [ ] Do substuff 1.2.2
+ * [ ] Do substuff 1.3
+* [ ] Do stuff 2
+* [ ] Do stuff 3
+
+Hit |zM| :
+= My current task =
+* [ ] Do stuff 1 [6] --------------------------------------~
+* [ ] Do stuff 2
+* [ ] Do stuff 3
+
+Hit |zr| :
+= My current task =
+* [ ] Do stuff 1
+ * [ ] Do substuff 1.1
+ * [ ] Do substuff 1.2 [3] -------------------------------~
+ * [ ] Do substuff 1.3
+* [ ] Do stuff 2
+* [ ] Do stuff 3
+
+Hit |zr| one more time :
+= My current task =
+* [ ] Do stuff 1
+ * [ ] Do substuff 1.1
+ * [ ] Do substuff 1.2
+ * [ ] Do substuff 1.2.1
+ * [ ] Do substuff 1.2.2
+ * [ ] Do substuff 1.3
+* [ ] Do stuff 2
+* [ ] Do stuff 3
+
+Note: If you use the default Vimwiki syntax, folding on list items will work
+properly only if all of them are indented using the current 'shiftwidth'.
+For Markdown and MediaWiki syntax, * or # should be in the first column.
+
+To turn folding on/off check |g:vimwiki_folding|.
+
+
+==============================================================================
+7. Placeholders *vimwiki-placeholders*
+
+------------------------------------------------------------------------------
+%title Title of the page *vimwiki-title*
+
+When you htmlize your wiki page, the default title is the filename of the
+page. Place >
+
+%title My books
+
+into your wiki page if you want another title.
+
+
+------------------------------------------------------------------------------
+%nohtml *vimwiki-nohtml*
+
+If you do not want a wiki page to be converted to HTML, place:
+
+%nohtml
+
+into it.
+
+
+------------------------------------------------------------------------------
+%template *vimwiki-template*
+
+To apply a concrete HTML template to a wiki page, place:
+
+%template name
+
+into it.
+
+See |vimwiki-option-template_path| for details.
+
+------------------------------------------------------------------------------
+%date *vimwiki-date*
+
+The date of the wiki page. The value can be used in the HTML template, see
+|vimwiki-option-template_path| for details.
+
+%date 2017-07-08
+%date
+
+If you omit the date after the placeholder, the date of the HTML conversion is
+used.
+
+
+==============================================================================
+8. Lists *vimwiki-lists*
+
+While writing lists, the keys <CR>, o and O insert new bullets or numbers as
+you would expect it. A new bullet/number is inserted if and only if the cursor
+is in a list item. To make a list item with more than one line, press <S-CR>
+or press <CR> and <C-L><C-M>.
+Note that the mapping <S-CR> is not available in all terminals.
+
+Furthermore, <CR> and <S-CR> behave differently when the cursor is behind an
+empty list item. See the table below.
+
+You can configure the behavior of <CR> and of <S-CR> like this: >
+ inoremap <CR> <Esc>:VimwikiReturn 1 5<CR>
+ inoremap <S-CR> <Esc>:VimwikiReturn 2 2<CR>
+
+The first argument of the command :VimwikiReturn is a number that specifies
+when to insert a new bullet/number and when not, depending on whether the
+cursor is in a list item or in a normal line: >
+
+ Number │ Before │ After
+ ======================================
+ 1 │ 1. item| │ 1. item
+ │ │ 2. |
+ │–––––––––––––––––––––––––––––– ← default for <CR>
+ │ 1. item │ 1. item
+ │ continue| │ continue
+ │ │ |
+ ======================================
+ 2 │ 1. item| │ 1. item
+ │ │ |
+ │–––––––––––––––––––––––––––––– ← default for <S-CR>
+ │ 1. item │ 1. item
+ │ continue| │ continue
+ │ │ 2. |
+ ======================================
+ 3 │ 1. item| │ 1. item
+ │ │ 2. |
+ │––––––––––––––––––––––––––––––
+ │ 1. item │ 1. item
+ │ continue| │ continue
+ │ │ 2. |
+ ======================================
+ 4 │ 1. item| │ 1. item
+ │ │ |
+ │––––––––––––––––––––––––––––––
+ │ 1. item │ 1. item
+ │ continue| │ continue
+ │ │ |
+<
+
+The second argument is a number that specifies what should happen when you
+press <CR> or <S-CR> behind an empty list item. There are no less than five
+possibilities:
+>
+ Number │ Before │ After
+ ======================================
+ 1 │ 1. | │ 1.
+ │ │ 2. |
+ ======================================
+ 2 │ 1. | │ ← default for <S-CR>
+ │ │ 1. |
+ ======================================
+ 3 │ 1. | │ |
+ │ │
+ ======================================
+ 4 │ 1. | │
+ │ │ |
+ ======================================
+ 5 │ 1. | │ 1. |
+ │ │
+ │–––––––––––––––––––––––––––––– ← default for <CR>
+ │ 1. | │ |
+ │ │
+<
+
+
+ *vimwiki-list-manipulation*
+The level of a list item is determined by its indentation (default and
+Markdown syntax) or by the number of list symbols (MediaWiki syntax).
+
+Use gll and glh in normal mode to increase or decrease the level of a list
+item. The symbols are adjusted automatically to the list items around it.
+Use gLl and gLh to increase or decrease the level of a list item plus all
+list items of lower level below it, that is, all child items.
+
+Use <C-T> and <C-D> to change the level of a list item in insert mode.
+
+See |vimwiki_gll|, |vimwiki_gLl|, |vimwiki_glh|, |vimwiki_gLh|,
+|vimwiki_i_<C-T>|, |vimwiki_i_<C-D>|
+
+
+Use gl followed by the desired symbol to change the symbol of a list item or
+create one. Type gL and the symbol to change all items of the current list.
+For default syntax, the following types are available: >
+ - hyphen
+ * asterisk
+ # hash
+ 1. number with period
+ 1) number with parenthesis
+ a) lower-case letter with parenthesis
+ A) upper-case letter with parenthesis
+ i) lower-case Roman numerals with parenthesis
+ I) upper-case Roman numerals with parenthesis
+
+Markdown syntax has the following types: >
+ - hyphen
+ * asterisk
+ + plus
+ 1. number with period
+
+MediaWiki syntax only has: >
+ * asterisk
+ # hash
+
+In insert mode, use the keys <C-L><C-J> and <C-L><C-K> to switch between
+symbols. For convenience, only the commonly used symbols can be reached
+through these keys for default syntax.
+
+Note that such a list: a) b) c) … only goes up to zz), to avoid confusion with
+normal text followed by a parenthesis.
+Roman numerals go up to MMMM) and numbers up to 2147483647. or
+9223372036854775807. depending if your Vim is 32 or 64 bit.
+
+Also note that you can, of course, mix different list symbols in one list, but
+if you have the strange idea of putting a list with Romanian numerals right
+after a list using letters or vice versa, Vimwiki will get confused because
+it cannot distinguish which is which (at least if the types are both upper
+case or both lower case).
+
+See |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|,
+|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI|
+
+
+Use glr and gLr if the numbers of a numbered list are mixed up. See
+|vimwiki_glr| and |vimwiki_gLr|.
+
+
+------------------------------------------------------------------------------
+Todo lists *vimwiki-todo-lists*
+
+You can have todo lists -- lists of items you can check/uncheck.
+
+Consider the following example: >
+ = Toggleable list of todo items =
+ * [X] Toggle list item on/off.
+ * [X] Simple toggling between [ ] and [X].
+ * [X] All list's subitems should be toggled on/off appropriately.
+ * [X] Toggle child subitems only if current line is list item
+ * [X] Parent list item should be toggled depending on it's child items.
+ * [X] Make numbered list items toggleable too
+ * [X] Add highlighting to list item boxes
+ * [X] Add [ ] to the next list item created with o, O and <CR>.
+
+Pressing <C-Space> on the first list item will toggle it and all of its child
+items: >
+ = Toggleable list of todo items =
+ * [ ] Toggle list item on/off.
+ * [ ] Simple toggling between [ ] and [X].
+ * [ ] All of a list's subitems should be toggled on/off appropriately.
+ * [ ] Toggle child subitems only if the current line is a list item.
+ * [ ] Parent list item should be toggled depending on their child items.
+ * [X] Make numbered list items toggleable too.
+ * [X] Add highlighting to list item boxes.
+ * [X] Add [ ] to the next list item created using o, O or <CR>.
+
+Pressing <C-Space> on the third list item will toggle it and adjust all of its
+parent items: >
+ = Toggleable list of todo items =
+ * [.] Toggle list item on/off.
+ * [ ] Simple toggling between [ ] and [X].
+ * [X] All of a list's subitems should be toggled on/off appropriately.
+ * [ ] Toggle child subitems only if current line is list item.
+ * [ ] Parent list item should be toggled depending on it's child items.
+ * [ ] Make numbered list items toggleable too.
+ * [ ] Add highlighting to list item boxes.
+ * [ ] Add [ ] to the next list item created using o, O or <CR>.
+
+Parent items should change when their child items change. If not, use
+|vimwiki_glr|. The symbol between [ ] depends on the percentage of toggled
+child items (see also |g:vimwiki_listsyms|): >
+ [ ] -- 0%
+ [.] -- 1-33%
+ [o] -- 34-66%
+ [O] -- 67-99%
+ [X] -- 100%
+
+You can use |vimwiki_gln| and |vimwiki_glp| to change the "done" status of a
+checkbox without a childitem.
+
+It is possible to toggle several list items using visual mode. But note that
+instead of toggling every item individually, all items get checked if the
+first item is unchecked and all items get unchecked if the first item is
+checked.
+
+Use gl<Space> (see |vimwiki_gl<Space>|) to remove a single checkbox and
+gL<Space> (see |vimwiki_gL<Space>|) to remove all checkboxes of the list the
+cursor is in.
+
+You can mark an item as rejected ("won't do") with
+|vimwiki_glx|. A rejected item will not influence the status of its parents.
+
+
+==============================================================================
+9. Tables *vimwiki-tables*
+
+Use the :VimwikiTable command to create a default table with 5 columns and 2
+rows: >
+
+ | | | | | |
+ |---|---|---|---|---|
+ | | | | | |
+<
+
+Tables are auto-formattable. Let's add some text into first cell: >
+
+ | First Name | | | | |
+ |---|---|---|---|---|
+ | | | | | |
+<
+
+Whenever you press <TAB>, <CR> or leave Insert mode, the table is formatted: >
+
+ | First Name | | | | |
+ |------------|---|---|---|---|
+ | | | | | |
+<
+
+You can easily create nice-looking text tables, just press <TAB> and enter new
+values: >
+
+ | First Name | Last Name | Age | City | e-mail |
+ |------------|------------|-----|----------|----------------------|
+ | Vladislav | Pokrishkin | 31 | Moscow | vlad_pok@smail.com |
+ | James | Esfandiary | 27 | Istanbul | esfandiary@tmail.com |
+<
+
+To indent table indent the first row. Then format it with 'gqq'.
+
+
+==============================================================================
+10. Diary *vimwiki-diary*
+
+The diary helps you make daily notes. You can easily add information into
+Vimwiki that should be sorted out later. Just hit <Leader>w<Leader>w to create
+a new note for today with a name based on the current date.
+
+To generate the diary section with all available links one can use
+|:VimwikiDiaryGenerateLinks| or <Leader>w<Leader>i .
+
+Note: it works only for diary index file.
+
+Example of diary section: >
+ = Diary =
+
+ == 2011 ==
+
+ === December ===
+ * [[2011-12-09]]
+ * [[2011-12-08]]
+
+
+See |g:vimwiki_diary_months| if you would like to rename months.
+
+
+------------------------------------------------------------------------------
+Calendar integration *vimwiki-calendar*
+
+If you have Calendar.vim installed you can use it to create diary notes.
+Just open calendar with :Calendar and tap <Enter> on the date. A wiki file
+will be created in the default wiki's diary.
+
+Get it from http://www.vim.org/scripts/script.php?script_id=52
+
+See |g:vimwiki_use_calendar| option to turn it off/on.
+
+
+==============================================================================
+12. Anchors *vimwiki-anchors*
+
+Every header, tag, and bold text can be used as an anchor. To jump to it, use
+a wikilink of the form >
+ [[file#anchor]]
+
+For example, consider the following file "Todo.wiki": >
+ = My tasks =
+ :todo-lists:
+ == Home ==
+ - [ ] bathe my dog
+ == Work ==
+ - [ ] beg for *pay rise*
+ == Knitting club ==
+ === Knitting projects ===
+ - [ ] a *funny pig*
+ - [ ] a *scary dog*
+
+Then, to jump from your index.wiki directly to your knitting projects, use: >
+ [[Todo#Knitting projects]]
+
+Or, to jump to an individual project, use this link: >
+ [[Todo#funny pig]]
+
+Or, to jump to a tag, use this link: >
+ [[Todo#todo-lists]]
+
+If there are multiple instances of an anchor, you can use the long form which
+consists of the complete header hierarchy, separated by '#': >
+ [[Todo#My tasks#Knitting club#Knitting projects#scary dog]]
+
+If you don't feel like typing the whole stuff, type just [[Todo# and then
+|i_CTRL-X_CTRL-O| to start the omni completion of anchors.
+
+For jumping inside a single file, you can omit the file in the link: >
+ [[#pay rise]]
+
+
+------------------------------------------------------------------------------
+Table of Contents *vimwiki-toc* *vimwiki-table-of-contents*
+
+You can create a "table of contents" at the top of your wiki file.
+The commando |:VimwikiTOC| creates the magic header >
+ = Contents =
+in the current file and below it a list of all the headers in this file as
+links, so you can directly jump to specific parts of the file.
+
+For the indentation of the list, the value of |vimwiki-option-list_margin| is
+used.
+
+If you don't want the TOC to sit in the very first line, e.g. because you have
+a modeline there, put the magic header in the second or third line and run
+:VimwikiTOC to update the TOC.
+
+If English is not your preferred language, set the option
+|g:vimwiki_toc_header| to your favorite translation.
+
+If you want to keep the TOC up to date automatically, use the option
+|vimwiki-option-auto_toc|.
+
+
+------------------------------------------------------------------------------
+Tagbar integration *vimwiki-tagbar*
+
+As an alternative to the Table of Contents, you can use the Tagbar plugin
+(http://majutsushi.github.io/tagbar/) to show the headers of your wiki files
+in a side pane.
+Download the Python script from
+https://raw.githubusercontent.com/vimwiki/utils/master/vwtags.py and follow
+the instructions in it.
+
+
+==============================================================================
+12. Options *vimwiki-options*
+
+There are global options and local (per-wiki) options available to tune
+Vimwiki.
+
+Global options are configured via global variables. For a complete list of
+them, see |vimwiki-global-options|.
+
+Local options for multiple independent wikis are stored in a single global
+variable |g:vimwiki_list|. The per-wiki options can be registered in advance,
+as described in |vimwiki-register-wiki|, or may be registered on the fly as
+described in |vimwiki-temporary-wiki|. For a list of per-wiki options, see
+|vimwiki-local-options|.
+
+
+------------------------------------------------------------------------------
+12.1 Registered Wiki *g:vimwiki_list* *vimwiki-register-wiki*
+
+One or more wikis can be registered using the |g:vimwiki_list| variable.
+
+Each item in |g:vimwiki_list| is a |Dictionary| that holds all customizations
+available for a distinct wiki. The options dictionary has the form: >
+ {'option1': 'value1', 'option2': 'value2', ...}
+
+Consider the following: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'path_html': '~/public_html/'}]
+
+This defines one wiki located at ~/my_site/. When converted to HTML, the
+produced HTML files go to ~/public_html/ .
+
+Another example: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'path_html': '~/public_html/'},
+ \ {'path': '~/my_docs/', 'ext': '.mdox'}]
+
+defines two wikis: the first as before, and the second one located in
+~/my_docs/, with files that have the .mdox extension.
+
+An empty |Dictionary| in g:vimwiki_list is the wiki with default options: >
+ let g:vimwiki_list = [{},
+ \ {'path': '~/my_docs/', 'ext': '.mdox'}]
+
+For clarity, in your .vimrc file you can define wiki options using separate
+|Dictionary| variables and subsequently compose them into |g:vimwiki_list|. >
+ let wiki_1 = {}
+ let wiki_1.path = '~/my_docs/'
+ let wiki_1.html_template = '~/public_html/template.tpl'
+ let wiki_1.nested_syntaxes = {'python': 'python', 'c++': 'cpp'}
+
+ let wiki_2 = {}
+ let wiki_2.path = '~/project_docs/'
+ let wiki_2.index = 'main'
+
+ let g:vimwiki_list = [wiki_1, wiki_2]
+<
+
+
+------------------------------------------------------------------------------
+12.2 Temporary Wiki *vimwiki-temporary-wiki*
+
+
+The creation of temporary wikis allows you to create a wiki on the fly.
+
+If a file with a registered wiki extension (see |vimwiki-register-extension|)
+is opened in a directory that: 1) is not listed in |g:vimwiki_list|, and 2) is
+not a subdirectory of any such directory, then a temporary wiki is created and
+appended to the list of configured wikis in |g:vimwiki_list|.
+
+In addition to Vimwiki's editing functionality, the temporary wiki enables: 1)
+wiki-linking to other files in the same subtree, 2) highlighting of existing
+wiki pages when |vimwiki-option-maxhi| is activated, and 3) HTML generation to
+|vimwiki-option-path_html|.
+
+Temporary wikis are configured using default |vimwiki-local-options|, except
+for the path, extension, and syntax options. The path and extension are set
+using the file's location and extension. The syntax is set to Vimwiki's
+default unless another syntax is registered via |vimwiki-register-extension|.
+
+Use |g:vimwiki_global_ext| to turn off creation of temporary wikis.
+
+NOTE: Vimwiki assumes that the locations of distinct wikis do not overlap.
+
+
+------------------------------------------------------------------------------
+12.3 Per-Wiki Options *vimwiki-local-options*
+
+
+*vimwiki-option-path*
+------------------------------------------------------------------------------
+Key Default value~
+path ~/vimwiki/
+
+Description~
+Wiki files location: >
+ let g:vimwiki_list = [{'path': '~/my_site/'}]
+<
+
+*vimwiki-option-path_html*
+------------------------------------------------------------------------------
+Key Default value~
+path_html ''
+
+Description~
+Location of HTML files converted from wiki files: >
+ let g:vimwiki_list = [{'path': '~/my_site/',
+ \ 'path_html': '~/html_site/'}]
+
+If path_html is an empty string, the location is derived from
+|vimwiki-option-path| by adding '_html'; i.e. for: >
+ let g:vimwiki_list = [{'path': '~/okidoki/'}]
+
+path_html will be set to '~/okidoki_html/'.
+
+
+*vimwiki-option-auto_export*
+------------------------------------------------------------------------------
+Key Default value Values~
+auto_export 0 0, 1
+
+Description~
+Set this option to 1 to automatically generate the HTML file when the
+corresponding wiki page is saved: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'auto_export': 1}]
+
+This will keep your HTML files up to date.
+
+
+*vimwiki-option-auto_toc*
+------------------------------------------------------------------------------
+Key Default value Values~
+auto_toc 0 0, 1
+
+Description~
+Set this option to 1 to automatically update the table of contents when the
+current wiki page is saved: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'auto_toc': 1}]
+
+
+*vimwiki-option-index*
+------------------------------------------------------------------------------
+Key Default value~
+index index
+
+Description~
+Name of wiki index file: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'index': 'main'}]
+
+NOTE: Do not include the extension.
+
+
+*vimwiki-option-ext*
+------------------------------------------------------------------------------
+Key Default value~
+ext .wiki
+
+Description~
+Extension of wiki files: >
+ let g:vimwiki_list = [{'path': '~/my_site/',
+ \ 'index': 'main', 'ext': '.document'}]
+
+<
+*vimwiki-option-syntax*
+------------------------------------------------------------------------------
+Key Default value Values~
+syntax default default, markdown, or media
+
+Description~
+Wiki syntax. You can use different markup languages (currently: Vimwiki's
+default, Markdown, and MediaWiki), but only Vimwiki's default markup will be
+converted to HTML at the moment.
+
+To use Markdown's wiki markup: >
+ let g:vimwiki_list = [{'path': '~/my_site/',
+ \ 'syntax': 'markdown', 'ext': '.md'}]
+<
+
+*vimwiki-option-template_path*
+------------------------------------------------------------------------------
+Key Default value~
+template_path ~/vimwiki/templates/
+
+Description~
+Setup path for HTML templates: >
+ let g:vimwiki_list = [{'path': '~/my_site/',
+ \ 'template_path': '~/public_html/templates/',
+ \ 'template_default': 'def_template',
+ \ 'template_ext': '.html'}]
+
+There could be a bunch of templates: >
+ def_template.html
+ index.html
+ bio.html
+ person.html
+etc.
+
+Each template could look like: >
+ <html>
+ <head>
+ <link rel="Stylesheet" type="text/css" href="%root_path%style.css" />
+ <title>%title%</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <div class="content">
+ %content%
+ </div>
+ <p><small>Page created on %date%</small></p>
+ </body>
+ </html>
+
+where
+ %title% is replaced by a wiki page name or by a |vimwiki-title|
+ %date% is replaced with the current date or by |vimwiki-date|
+ %root_path% is replaced by a count of ../ for pages buried in subdirs:
+ if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
+ %root_path% is replaced by '../../../'.
+
+ %content% is replaced by a wiki file content.
+
+
+The default template will be applied to all wiki pages unless a page specifies
+a template. Consider you have wiki page named 'Maxim.wiki' and you want apply
+'person.html' template to it. Just add: >
+ %template person
+to that page.
+
+
+*vimwiki-option-template_default*
+------------------------------------------------------------------------------
+Key Default value~
+template_default default
+
+Description~
+Setup default template name (without extension).
+
+See |vimwiki-option-template_path| for details.
+
+
+*vimwiki-option-template_ext*
+------------------------------------------------------------------------------
+Key Default value~
+template_ext .tpl
+
+Description~
+Setup template filename extension.
+
+See |vimwiki-option-template_path| for details.
+
+
+*vimwiki-option-css_name*
+------------------------------------------------------------------------------
+Key Default value~
+css_name style.css
+
+Description~
+Setup CSS file name: >
+ let g:vimwiki_list = [{'path': '~/my_pages/',
+ \ 'css_name': 'main.css'}]
+<
+or even >
+ let g:vimwiki_list = [{'path': '~/my_pages/',
+ \ 'css_name': 'css/main.css'}]
+<
+Vimwiki comes with a default CSS file "style.css".
+
+
+*vimwiki-option-maxhi*
+------------------------------------------------------------------------------
+Key Default value Values~
+maxhi 0 0, 1
+
+Description~
+If on, wiki links to non-existent wiki files are highlighted. However, it can
+be quite slow. If you still want it, set maxhi to 1: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'maxhi': 1}]
+
+
+*vimwiki-option-nested_syntaxes*
+------------------------------------------------------------------------------
+Key Default value Values~
+nested_syntaxes {} pairs of highlight keyword and Vim filetype
+
+Description~
+You can configure preformatted text to be highlighted with any syntax
+available for Vim.
+For example the following setup in your vimrc: >
+ let wiki = {}
+ let wiki.path = '~/my_wiki/'
+ let wiki.nested_syntaxes = {'python': 'python', 'c++': 'cpp'}
+ let g:vimwiki_list = [wiki]
+
+would give you Python and C++ highlighting in: >
+ {{{class="brush: python"
+ for i in range(1, 5):
+ print(i)
+ }}}
+
+ {{{class="brush: c++"
+ #include "helloworld.h"
+ int helloworld()
+ {
+ printf("hello world");
+ }
+ }}}
+
+or in: >
+ {{{c++
+ #include "helloworld.h"
+ int helloworld()
+ {
+ printf("hello world");
+ }
+ }}}
+
+ {{{python
+ for i in range(1, 5):
+ print(i)
+ }}}
+
+
+*vimwiki-option-automatic_nested_syntaxes*
+------------------------------------------------------------------------------
+Key Default value~
+automatic_nested_syntaxes 1
+
+Description~
+If set, the nested syntaxes (|vimwiki-option-nested_syntaxes|) are
+automatically derived when opening a buffer.
+Just write your preformatted text in your file like this >
+ {{{xxx
+ my preformatted text
+ }}}
+
+where xxx is a filetype which is known to Vim. For example, for C++
+highlighting, use "cpp" (not "c++"). For a list of known filetypes, type
+":setf " and hit Ctrl+d.
+
+Note that you may have to reload the file (|:edit|) to see the highlight.
+
+Since every file is scanned for the markers of preformatted text when it is
+opened, it can be slow when you have huge files. In this case, set this option
+to 0.
+
+
+*vimwiki-option-diary_rel_path*
+------------------------------------------------------------------------------
+Key Default value~
+diary_rel_path diary/
+
+Description~
+The path to the diary wiki files, relative to |vimwiki-option-path|.
+
+
+*vimwiki-option-diary_index*
+------------------------------------------------------------------------------
+Key Default value~
+diary_index diary
+
+Description~
+Name of wiki-file that holds all links to dated wiki files.
+
+
+*vimwiki-option-diary_header*
+------------------------------------------------------------------------------
+Key Default value~
+diary_header Diary
+
+Description~
+Name of the header in |vimwiki-option-diary_index| where links to dated
+wiki-files are located.
+
+
+*vimwiki-option-diary_sort*
+------------------------------------------------------------------------------
+Key Default value Values~
+diary_sort desc desc, asc
+
+Description~
+Sort links in a diary index page.
+
+
+*vimwiki-option-custom_wiki2html*
+------------------------------------------------------------------------------
+Key Default value~
+custom_wiki2html ''
+
+Description~
+The full path to an user-provided script that converts a wiki page to HTML.
+Vimwiki calls the provided |vimwiki-option-custom_wiki2html| script from the
+command-line, using |:!| invocation.
+
+The following arguments, in this order, are passed to the script:
+
+1. force : [0/1] overwrite an existing file
+2. syntax : the syntax chosen for this wiki
+3. extension : the file extension for this wiki
+4. output_dir : the full path of the output directory
+5. input_file : the full path of the wiki page
+6. css_file : the full path of the css file for this wiki
+7. template_path : the full path to the wiki's templates
+8. template_default : the default template name
+9. template_ext : the extension of template files
+10. root_path : a count of ../ for pages buried in subdirs
+ For example, if you have wikilink [[dir1/dir2/dir3/my page in a subdir]]
+ then this argument is '../../../'.
+11. custom_args : custom arguments that will be passed to the conversion
+ (can be defined in g:vimwiki_list as 'custom_wiki2html_args' parameter,
+ see |vimwiki-option-custom_wiki2html_args|)
+ script.
+
+Options 7-11 are experimental and may change in the future. If any of these
+parameters is empty, a hyphen "-" is passed to the script in its place.
+
+For an example and further instructions, refer to the following script:
+
+ $VIMHOME/autoload/vimwiki/customwiki2html.sh
+
+An alternative converter was developed by Jason6Anderson, and can
+be located at https://github.com/vimwiki-backup/vimwiki/issues/384
+
+To use the internal wiki2html converter, use an empty string (the default).
+
+
+vimwiki-option-custom_wiki2html_args
+-----------------------------------------------------------------------------
+Key Default value~
+custom_wiki2html_args ''
+
+Description
+If a custom script is called with |vimwiki-option-custom_wiki2html|, additional
+parameters can be passed by setting them using 'custom_wiki2html_args' in
+|g:vimwiki_list|.
+
+
+*vimwiki-option-list_margin*
+------------------------------------------------------------------------------
+Key Default value~
+list_margin -1
+
+Description~
+Width of left-hand margin for lists. When negative, the current 'shiftwidth'
+is used. This affects the appearance of the generated links (see
+|:VimwikiGenerateLinks|), the Table of contents (|vimwiki-toc|) and the
+behavior of the list manipulation commands |:VimwikiListChangeLevel| and the
+local mappings |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|,
+|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI| and
+|vimwiki_i_<C-L>_<C-M>|.
+
+Note: if you use Markdown or MediaWiki syntax, you probably would like to set
+this option to 0, because every indented line is considered verbatim text.
+
+
+*vimwiki-option-auto_tags*
+------------------------------------------------------------------------------
+Key Default value Values~
+auto_tags 0 0, 1
+
+Description~
+Set this option to 1 to automatically update the tags metadata when the
+current wiki page is saved: >
+ let g:vimwiki_list = [{'path': '~/my_site/', 'auto_tags': 1}]
+
+
+------------------------------------------------------------------------------
+12.4 Global Options *vimwiki-global-options*
+
+
+Global options are configured using the following pattern: >
+
+ let g:option_name = option_value
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_hl_headers*
+
+Highlight headers with =Reddish=, ==Greenish==, ===Blueish=== colors.
+
+Value Description~
+1 Use VimwikiHeader1-VimwikiHeader6 group colors to highlight
+ different header levels.
+0 Use |hl-Title| color for headers.
+Default: 0
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_hl_cb_checked*
+
+Highlight checked list items with a special color:
+
+ * [X] the whole line can be highlighted with the option set to 1.
+ * this line is highlighted as well with the option set to 2
+ * [ ] this line is never highlighted
+
+Value Description~
+0 Don't highlight anything.
+1 Highlight checked [X] list item with |group-name| "Comment".
+2 Highlight checked [X] list item and all its child items.
+
+Default: 0
+
+Note: Option 2 does not work perfectly. Specifically, it might break if the
+list item contains preformatted text or if you mix tabs and spaces for
+indenting. Also, indented headers can be highlighted erroneously.
+Furthermore, if your list is long, Vim's highlight can break. To solve this,
+consider putting >
+ au BufEnter *.wiki :syntax sync fromstart
+in your .vimrc
+
+------------------------------------------------------------------------------
+*g:vimwiki_global_ext*
+
+Control the creation of |vimwiki-temporary-wiki|s.
+
+If a file with a registered extension (see |vimwiki-register-extension|) is
+opened in a directory that is: 1) not listed in |g:vimwiki_list|, and 2) not a
+subdirectory of any such directory, then:
+
+Value Description~
+1 make temporary wiki and append it to |g:vimwiki_list|.
+0 don't make temporary wiki in that dir.
+
+If your preferred wiki extension is .txt then you can >
+ let g:vimwiki_global_ext = 0
+to restrict Vimwiki's operation to only those paths listed in g:vimwiki_list.
+Other text files wouldn't be treated as wiki pages.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_ext2syntax* *vimwiki-register-extension*
+
+A many-to-one mapping between file extensions and syntaxes whose purpose is to
+register the extensions with Vimwiki.
+
+E.g.: >
+ let g:vimwiki_ext2syntax = {'.md': 'markdown',
+ \ '.mkd': 'markdown',
+ \ '.wiki': 'media'}
+
+An extension that is registered with Vimwiki can trigger creation of a
+|vimwiki-temporary-wiki| with the associated syntax. File extensions used in
+|g:vimwiki_list| are automatically registered with Vimwiki using the default
+syntax.
+
+Default: {}
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_menu*
+
+Create a menu in the menu bar of GVim, where you can open the available wikis.
+
+Value Description~
+'' No menu
+'Vimwiki' Top level menu "Vimwiki"
+'Plugin.Vimwiki' "Vimwiki" submenu of top level menu "Plugin"
+etc.
+
+Default: 'Vimwiki'
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_listsyms*
+
+String of at least two symbols to show the progression of todo list items.
+Default value is ' .oOX'.
+
+The first char is for 0% done items.
+The last is for 100% done items.
+
+You can set it to some more fancy symbols like this:
+>
+ let g:vimwiki_listsyms = '✗○◐●✓'
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_listsym_rejected*
+
+Character that is used to show that an item of a todo list will not be done.
+Default value is '-'.
+
+The character used here must not be part of |g:vimwiki_listsyms|.
+
+You can set it to a more fancy symbol like this:
+>
+ let g:vimwiki_listsym_rejected = '✗'
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_use_mouse*
+
+Use local mouse mappings from |vimwiki-local-mappings|.
+
+Value Description~
+0 Do not use mouse mappings.
+1 Use mouse mappings.
+
+Default: 0
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_folding*
+
+Enable/disable Vimwiki's folding (outline) functionality. Folding in Vimwiki
+can uses either the 'expr' or the 'syntax' |foldmethod| of Vim.
+
+Value Description~
+'' Disable folding
+'expr' Folding based on expression (folds sections and code blocks)
+'syntax' Folding based on syntax (folds sections; slower than 'expr')
+'list' Folding based on expression (folds list subitems; much slower)
+'custom' Leave the folding settings as they are (e.g. set by another
+ plugin)
+
+Default: ''
+
+Limitations:
+ - Opening very large files may be slow when folding is enabled.
+ - 'list' folding is particularly slow with larger files.
+ - 'list' is intended to work with lists nicely indented with 'shiftwidth'.
+ - 'syntax' is only available for the default syntax so far.
+
+The options above can be suffixed with ':quick' (e.g.: 'expr:quick') in order
+to use some workarounds to make folds work faster.
+
+------------------------------------------------------------------------------
+*g:vimwiki_list_ignore_newline*
+
+This is HTML related.
+Convert newlines to <br />s in multiline list items.
+
+Value Description~
+0 Newlines in a list item are converted to <br />s.
+1 Ignore newlines.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_text_ignore_newline*
+
+This is HTML related.
+Convert newlines to <br />s in text.
+
+Value Description~
+0 Newlines in text are converted to <br />s.
+1 Ignore newlines.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_use_calendar*
+
+Create new or open existing diary wiki-file for the date selected in Calendar.
+See |vimwiki-calendar|.
+
+Value Description~
+0 Do not use calendar.
+1 Use calendar.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*VimwikiLinkHandler*
+
+A customizable link handler can be defined to override Vimwiki's behavior when
+opening links. Each recognized link, whether it is a wikilink, wiki-include
+link or a weblink, is first passed to |VimwikiLinkHandler| to see if it can be
+handled. The return value 1 indicates success.
+
+If the link is not handled successfully, the behavior of Vimwiki depends on
+the scheme. "wiki:", "diary:" or schemeless links are opened in Vim. "file:"
+and "local:" links are opened with a system default handler.
+
+You can redefine the VimwikiLinkHandler function in your .vimrc to do
+something else: >
+
+ function! VimwikiLinkHandler(link)
+ try
+ let browser = 'C:\Program Files\Firefox\firefox.exe'
+ execute '!start "'.browser.'" ' . a:link
+ return 1
+ catch
+ echo "This can happen for a variety of reasons ..."
+ endtry
+ return 0
+ endfunction
+
+A second example handles a new scheme, "vfile:", which behaves similar to
+"file:", but the files are always opened with Vim in a new tab: >
+
+ function! VimwikiLinkHandler(link)
+ " Use Vim to open external files with the 'vfile:' scheme. E.g.:
+ " 1) [[vfile:~/Code/PythonProject/abc123.py]]
+ " 2) [[vfile:./|Wiki Home]]
+ let link = a:link
+ if link =~# '^vfile:'
+ let link = link[1:]
+ else
+ return 0
+ endif
+ let link_infos = vimwiki#base#resolve_link(link)
+ if link_infos.filename == ''
+ echomsg 'Vimwiki Error: Unable to resolve link!'
+ return 0
+ else
+ exe 'tabnew ' . fnameescape(link_infos.filename)
+ return 1
+ endif
+ endfunction
+
+------------------------------------------------------------------------------
+*VimwikiLinkConverter*
+
+This function can be overridden in your .vimrc to specify what a link looks
+like when converted to HTML. The parameters of the function are:
+ - the link as a string
+ - the full path to the wiki file where the link is in
+ - the full path to the output HTML file
+It should return the HTML link if successful or an empty string '' otherwise.
+
+This example changes how relative links to external files using the "local:"
+scheme look like in HTML. Per default, they would become links relative to
+the HTML output directory. This function converts them to links relative to
+the wiki file, i.e. a link [[local:../document.pdf]] becomes
+<a href="../document.pdf">. Also, this function will copy document.pdf to the
+right place. >
+
+ function! VimwikiLinkConverter(link, source_wiki_file, target_html_file)
+ if a:link =~# '^local:'
+ let link_infos = vimwiki#base#resolve_link(a:link)
+ let html_link = vimwiki#path#relpath(
+ \ fnamemodify(a:source_wiki_file, ':h'), link_infos.filename)
+ let relative_link =
+ \ fnamemodify(a:target_html_file, ':h') . '/' . html_link
+ call system('cp ' . fnameescape(link_infos.filename) .
+ \ ' ' . fnameescape(relative_link))
+ return html_link
+ endif
+ return ''
+ endfunction
+
+------------------------------------------------------------------------------
+*VimwikiWikiIncludeHandler*
+
+Vimwiki includes the content of a wiki-include URL as an image by default.
+
+A trial feature allows you to supply your own handler for wiki-include links.
+The handler should return the empty string when it does not recognize or
+cannot otherwise convert the link. A customized handler might look like this: >
+
+ " Convert {{URL|#|ID}} -> URL#ID
+ function! VimwikiWikiIncludeHandler(value)
+ let str = a:value
+
+ " complete URL
+ let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl)
+ " URL parts
+ let link_infos = vimwiki#base#resolve_link(url_0)
+ let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1))
+ let arg2 = matchstr(str, VimwikiWikiInclMatchArg(2))
+
+ if arg1 =~ '#'
+ return link_infos.filename.'#'.arg2
+ endif
+
+ " Return the empty string when unable to process link
+ return ''
+ endfunction
+<
+
+------------------------------------------------------------------------------
+*g:vimwiki_table_mappings*
+
+Enable/disable table mappings for INSERT mode.
+
+Value Description~
+0 Disable table mappings.
+1 Enable table mappings.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_table_auto_fmt*
+
+Enable/disable table auto formatting after leaving INSERT mode.
+
+Value Description~
+0 Disable table auto formatting.
+1 Enable table auto formatting.
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_w32_dir_enc*
+
+Convert directory name from current 'encoding' into 'g:vimwiki_w32_dir_enc'
+before it is created.
+
+If you have 'enc=utf-8' and set up >
+ let g:vimwiki_w32_dir_enc = 'cp1251'
+<
+then following the next link with <CR>: >
+ [[привет/мир]]
+>
+would convert utf-8 'привет' to cp1251 and create directory with that name.
+
+Default: ''
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_CJK_length*
+
+Use a special method to calculate the correct length of the strings with
+double-wide characters (to align table cells properly).
+
+Value Description~
+0 Do not use it.
+1 Use it.
+
+Default: 0
+
+Note: Vim 7.3 has a new function |strdisplaywidth()|, so for users of an up to
+date Vim, this option is obsolete.
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_dir_link*
+
+This option is about what to do with links to directories, like
+[[directory/]], [[papers/]], etc.
+
+Value Description~
+'' Open 'directory/' using the standard netrw plugin.
+'index' Open 'directory/index.wiki', create if needed.
+'main' Open 'directory/main.wiki', create if needed.
+etc.
+
+Default: '' (empty string)
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_html_header_numbering*
+
+Set this option if you want headers to be auto-numbered in HTML.
+
+E.g.: >
+ 1 Header1
+ 1.1 Header2
+ 1.2 Header2
+ 1.2.1 Header3
+ 1.2.2 Header3
+ 1.3 Header2
+ 2 Header1
+ 3 Header1
+etc.
+
+Value Description~
+0 Header numbering is off.
+1 Header numbering is on. Headers are numbered starting from
+ header level 1.
+2 Header numbering is on. Headers are numbered starting from
+ header level 2.
+etc.
+
+Example when g:vimwiki_html_header_numbering = 2: >
+ Header1
+ 1 Header2
+ 2 Header2
+ 2.1 Header3
+ 2.1.1 Header4
+ 2.1.2 Header4
+ 2.2 Header3
+ 3 Header2
+ 4 Header2
+etc.
+
+Default: 0
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_html_header_numbering_sym*
+
+Ending symbol for |g:vimwiki_html_header_numbering|.
+
+Value Description~
+'.' Dot will be added after a header's number.
+')' Closing bracket will be added after a header's number.
+etc.
+
+With
+ let g:vimwiki_html_header_numbering_sym = '.'
+headers would look like: >
+ 1. Header1
+ 1.1. Header2
+ 1.2. Header2
+ 1.2.1. Header3
+ 1.2.2. Header3
+ 1.3. Header2
+ 2. Header1
+ 3. Header1
+
+
+Default: '' (empty)
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_valid_html_tags*
+
+Case-insensitive comma separated list of HTML tags that can be used in
+Vimwiki. When converting to HTML, these tags are left as they are, while
+every other tag is escaped.
+
+Default: 'b,i,s,u,sub,sup,kbd,br,hr'
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_user_htmls*
+
+Comma-separated list of HTML files that have no corresponding wiki files and
+should not be deleted after |:VimwikiAll2HTML|.
+
+Default: ''
+
+Example:
+Consider you have 404.html and search.html in your Vimwiki 'path_html'.
+With: >
+ let g:vimwiki_user_htmls = '404.html,search.html'
+they would not be deleted after |:VimwikiAll2HTML|.
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_conceallevel*
+
+In Vim 7.3 'conceallevel' is local to the current window, thus if you open a
+Vimwiki buffer in a new tab or window, it would be set to the default value.
+
+Vimwiki sets 'conceallevel' to g:vimwiki_conceallevel every time a Vimwiki
+buffer is entered.
+
+With default settings, Vimwiki conceals one-character markers, shortens long
+URLs and hides markers and URL for links that have a description.
+
+Default: 2
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_autowriteall*
+
+Automatically save a modified wiki buffer when switching wiki pages. Has the
+same effect like setting the Vim option 'autowriteall', but it works for wiki
+files only, while the Vim option is global.
+Hint: if you're just annoyed that you have to save files manually to switch
+wiki pages, consider setting the Vim option 'hidden' which makes that modified
+files don't need to be saved.
+
+Value Description~
+0 autowriteall is off
+1 autowriteall is on
+
+Default: 1
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_url_maxsave*
+
+Setting the value of |g:vimwiki_url_maxsave| to 0 will prevent any link
+shortening: you will see the full URL in all types of links, with no parts
+being concealed. Concealing of one-character markers is not affected.
+
+When positive, the value determines the maximum number of characters that
+are retained at the end after concealing the middle part of a long URL.
+It could be less: in case one of the characters /,#,? is found near the end,
+the URL will be concealed up to the last occurrence of that character.
+
+Note:
+ * The conceal feature works only with Vim >= 7.3.
+ * When using the default |wrap| option of Vim, the effect of concealed links
+ is not always pleasing, because the visible text on longer lines with
+ a lot of concealed parts may appear to be strangely broken across several
+ lines. This is a limitation of Vim's |conceal| feature.
+ * Many color schemes do not define an unobtrusive color for the Conceal
+ highlight group - this might be quite noticeable on shortened URLs.
+
+
+Default: 15
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_diary_months*
+
+It is a |Dictionary| with the numbers of months and corresponding names. Diary
+uses it.
+
+Redefine it in your .vimrc to get localized months in your diary:
+let g:vimwiki_diary_months = {
+ \ 1: 'Январь', 2: 'Февраль', 3: 'Март',
+ \ 4: 'Апрель', 5: 'Май', 6: 'Июнь',
+ \ 7: 'Июль', 8: 'Август', 9: 'Сентябрь',
+ \ 10: 'Октябрь', 11: 'Ноябрь', 12: 'Декабрь'
+ \ }
+
+Default:
+let g:vimwiki_diary_months = {
+ \ 1: 'January', 2: 'February', 3: 'March',
+ \ 4: 'April', 5: 'May', 6: 'June',
+ \ 7: 'July', 8: 'August', 9: 'September',
+ \ 10: 'October', 11: 'November', 12: 'December'
+ \ }
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_toc_header*
+
+A string with the magic header that tells Vimwiki where the Table of Contents
+(see |vimwiki-toc|) is located in a file. You can change it to the
+appropriate word in your mother tongue like this: >
+ let g:vimwiki_toc_header = 'Inhalt'
+
+The default is 'Contents'.
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_map_prefix*
+
+A string which specifies the prefix for all global mappings (and some local
+ones). Use it to avoid conflicts with other plugins. Note that it must be
+defined before the plugin loads. >
+ let g:vimwiki_map_prefix = '<Leader>e'
+
+The default is '<Leader>w'.
+
+
+------------------------------------------------------------------------------
+*g:vimwiki_auto_chdir*
+
+When set to 1, enables auto-cd feature. Whenever Vimwiki page is opened,
+Vimwiki performs an |:lcd| to the Vimwiki folder to where the page belongs.
+
+
+Value Description~
+0 Do not change directory.
+1 Change directory to Vimwiki folder on opening page.
+
+Default: 0
+
+==============================================================================
+13. Getting help *vimwiki-help*
+
+For questions, discussions, praise or rants there is a mailing list:
+https://groups.google.com/forum/#!forum/vimwiki
+
+Also, there is the IRC channel #vimwiki on Freenode which can be accessed via
+webchat: https://webchat.freenode.net/?channels=#vimwiki
+
+==============================================================================
+14. Contributing & Bug reports *vimwiki-contributing*
+
+Your help in making Vimwiki better is really appreciated!
+Any help, whether it is a spelling correction or a code snippet to patch --
+everything is welcomed.
+
+Before filing a bug or starting to write a patch, check the latest development
+version from https://github.com/vimwiki/vimwiki/tree/dev to see if your
+problem is already fixed.
+
+Issues can be filed at https://github.com/vimwiki/vimwiki/issues/.
+
+If you want to provide a pull request on GitHub, please start from the dev
+branch, not from the master branch.
+
+==============================================================================
+15. Development *vimwiki-development*
+
+Homepage: http://vimwiki.github.io/
+Github: https://github.com/vimwiki/vimwiki/
+Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226
+Old homepage: http://code.google.com/p/vimwiki/
+
+Contributors and their Github usernames in roughly chronological order:
+
+ - Maxim Kim (@habamax) <habamax@gmail.com> as original author
+ - the people here: http://code.google.com/p/vimwiki/people/list
+ - Stuart Andrews (@tub78)
+ - Tomas Pospichal
+ - Daniel Schemala (@EinfachToll) as current maintainer
+ - Larry Hynes (@larryhynes)
+ - Hector Arciga (@harciga)
+ - Alexey Radkov (@lyokha)
+ - Aaron Franks (@af)
+ - Dan Bernier (@danbernier)
+ - Carl Helmertz (@chelmertz)
+ - Karl Yngve Lervåg (@lervag)
+ - Patrick Davey (@patrickdavey)
+ - Ivan Tishchenko (@t7ko)
+ - 修昊 (@Svtter)
+ - Marcelo D Montu (@mMontu)
+ - John Kaul
+ - Hongbo Liu (@hiberabyss)
+ - @Tomsod
+ - @wangzq
+ - Jinzhou Zhang (@lotabout)
+ - Michael Riley (@optik-aper)
+ - Irfan Sharif (@irfansharif)
+ - John Conroy (@jconroy77)
+ - Christian Rondeau (@christianrondeau)
+ - Alex Thorne (@thornecc)
+ - Shafqat Bhuiyan (@priomsrb)
+ - Bradley Cicenas (@bcicen)
+ - Michael Thessel (@MichaelThessel)
+ - Michael F. Schönitzer (@nudin)
+ - @sqlwwx
+ - Guilherme Salazar (@salazar)
+ - Daniel Trnka (@trnila)
+ - Yuchen Pei (@ycpei)
+ - @maqiv
+
+
+==============================================================================
+16. Changelog *vimwiki-changelog*
+
+
+Issue numbers starting with '#' are issues from
+https://github.com/vimwiki/vimwiki/issues/, all others from
+http://code.google.com/p/vimwiki/issues/list. They may be accessible from
+https://github.com/vimwiki-backup/vimwiki/issues.
+
+
+2.3 (2016-03-31)~
+
+New:
+ * Add |:VimwikiMakeYesterdayDiaryNote| command
+ * Issue #128: add option |vimwiki-option-automatic_nested_syntaxes|
+ * Issue #192: Sort links in the list generated by |:VimwikiGenerateTags|
+
+Fixed:
+ * Issue #176: Fix issue when the wiki path contains spaces
+ * Also look for tags in wiki files in subdirectories
+ * Locate the .tags file correctly on Windows
+ * Issue #183: Fix HTML conversion of headers containing links
+ * Issue #64: create correct Markdown links when pressing CR on a word
+ * Issue #191: ignore headers inside preformatted text when creating the TOC
+ * Create the standard CSS file also if only one file is converted to HTML
+ * Fix #188: |vimwiki_+| on a raw url surrounds it with brackets
+ * various minor fixes
+
+
+2.2.1 (2015-12-10)~
+
+Removed:~
+ * Removed the option g:vimwiki_debug, which probably nobody used. If you
+ want it back, file an issue at Github.
+
+Fixed:~
+ * Issue #175: Don't do random things when the user has remapped the z key
+ * Don't ask for confirmation when following an URL in MacOS
+ * Always jump to the first occurrence of a tag in a file
+ * Don't move the cursor when updating the TOC
+ * Fix some issues with the TOC when folding is enabled
+
+
+2.2 (2015-11-25)~
+
+New:~
+ * Support for anchors, see |vimwiki-anchors|
+ * in this context, add support for TOC, see |vimwiki-toc|
+ * add omni completion of wiki links (files and anchors)
+ * new local option |vimwiki-option-auto_toc|
+ * new global option |g:vimwiki_toc_header|
+ * Support for tags, see |vimwiki-syntax-tags|
+ * List editing capabilities, see |vimwiki-lists|:
+ * support for auto incrementing numbered lists
+ * more key maps for list manipulation, see |vimwiki-list-manipulation|
+ * improved automatic adjustment of checkboxes
+ * text objects for list items, see |vimwiki-text-objects|
+ * New command |:VimwikiCheckLinks| to check for broken links
+ * New global option |g:vimwiki_auto_chdir|
+ * New global option |g:vimwiki_map_prefix|
+ * Support for wiki links absolute to the wiki root
+ * Added the |VimwikiLinkConverter| function
+ * Issue #24: Basic support for remote directories via netrw
+ * Issue #50: in HTML, tables can now be embedded in lists
+ * When converting to HTML, show a message with the output directory
+ * Add auto completion for |:VimwikiGoto|
+ * Add Chinese Readme file
+
+Changed:~
+ * Wiki files must not contain # anymore, because # is used to separate the
+ file from an anchor in a link.
+ * replace the function vimwiki#base#resolve_scheme() by
+ vimwiki#base#resolve_link() (relevant if you have a custom
+ |VimwikiLinkHandler| which used this function)
+ * The semantic of "file:" and "local:" links changed slightly, see
+ |vimwiki-syntax-links| for what they mean now
+ * The meaning of a link like [[/some/directory/]] changed. It used to be
+ a link to the actual directory /some/directory/, now it's relative to
+ the root of the current wiki. Use [[file:/some/directory/]] for the old
+ behavior.
+
+Removed:~
+ * the %toc placeholder is now useless, use |vimwiki-toc| instead
+ * the global option g:vimwiki_auto_checkbox is now useless and removed
+
+Fixed:~
+ * Issue 415: Disable folding if g:vimwiki_folding is set to ''
+ * Fix slowdown in Vim 7.4
+ * Issue #12: Separate diaries from different wikis
+ * Issue #13: Fix :VimwikiRenameLink on links containing a dot
+ * Always jump to previous link on <S-Tab>, not to beginning of link
+ * Issue #27: Fix <CR> on a visual selection sometimes not working
+ * |VimwikiBackLinks| now recognizes much more valid links
+ * Issue 424: make external links with #, % work under Linux
+ * Issue #39: don't htmlize stuff inside pre tags
+ * Issue #44: faster formatting of large tables
+ * Issue #52: Recognize markdown links when renaming wiki file
+ * Issue #54: Disable 'shellslash' on Windows to avoid problems
+ * Issue #81: Don't get stuck when converting a read-only file
+ * Issue #66: Better normalizing of links in diary
+ * Fix the menu in GVim, which was sometimes not shown correctly
+ * |VimwikiGenerateLinks| now also generates links for subdirectories
+ * Issue #93: Don't process placeholders inside preformatted text
+ * Issue #102: Add default values to some options like the doc says
+ * Issue #144: Fix bug with folds shortening on multibyte characters
+ * Issue #158: Detect the OS correctly
+ * |VimwikiGenerateLinks| now replaces a potentially existing old list
+ * Fix uneven indentation of list items with checkboxes in HTML
+ * Various small fixes
+ * Corrected website links in documentation. code.google is dead, long live
+ Github!
+
+2.1~
+
+ * Concealing of links can be turned off - set |g:vimwiki_url_maxsave| to 0.
+ The option g:vimwiki_url_mingain was removed
+ * |g:vimwiki_folding| also accepts value 'list'; with 'expr' both sections
+ and code blocks folded, g:vimwiki_fold_lists option was removed
+ * Issue 261: Syntax folding is back. |g:vimwiki_folding| values are
+ changed to '', 'expr', 'syntax'.
+ * Issue 372: Ignore case in g:vimwiki_valid_html_tags
+ * Issue 374: Make autowriteall local to vimwiki. It is not 100% local
+ though.
+ * Issue 384: Custom_wiki2html script now receives templating arguments
+ * Issue 393: Custom_wiki2html script path can contain tilde character
+ * Issue 392: Custom_wiki2html arguments are quoted, e.g names with spaces
+ * Various small bug fixes.
+
+2.0.1 'stu'~
+
+ * Follow (i.e. open target of) markdown reference-style links.
+ * Bug fixes.
+
+
+2.0 'stu'~
+
+This release is partly incompatible with previous.
+
+Summary ~
+
+ * Quick page-link creation.
+ * Redesign of link syntaxes (!)
+ * No more CamelCase links. Check the ways to convert them
+ https://groups.google.com/forum/?fromgroups#!topic/vimwiki/NdS9OBG2dys
+ * No more [[link][desc]] links.
+ * No more [http://link description] links.
+ * No more plain image links. Use transclusions.
+ * No more image links identified by extension. Use transclusions.
+ * Interwiki links
+ * More link schemes
+ * Transclusions
+ * Normalize link command. See |vimwiki_+|.
+ * Improved diary organization and generation. See |vimwiki-diary|.
+ * List manipulation. See |vimwiki-list-manipulation|.
+ * Markdown support.
+ * Mathjax support. See |vimwiki-syntax-math|.
+ * Improved handling of special characters and punctuation in filenames and
+ urls.
+ * Back links command: list links referring to the current page.
+ * Highlighting nonexisted links are off by default.
+ * Table syntax change. Row separator uses | instead of +.
+ * Fold multilined list items.
+ * Custom wiki to HTML converters. See |vimwiki-option-custom_wiki2html|.
+ * Conceal long weblinks. See g:vimwiki_url_mingain.
+ * Option to disable table mappings. See |g:vimwiki_table_mappings|.
+
+For detailed information see issues list on
+http://code.google.com/p/vimwiki/issues/list
+
+
+1.2~
+ * Issue 70: Table spanning cell support.
+ * Issue 72: Do not convert again for unchanged file. |:VimwikiAll2HTML|
+ converts only changed wiki files.
+ * Issue 117: |:VimwikiDiaryIndex| command that opens diary index wiki page.
+ * Issue 120: Links in headers are not highlighted in vimwiki but are
+ highlighted in HTML.
+ * Issue 138: Added possibility to remap table-column move bindings. See
+ |:VimwikiTableMoveColumnLeft| and |:VimwikiTableMoveColumnRight|
+ commands. For remap instructions see |vimwiki_<A-Left>|
+ and |vimwiki_<A-Right>|.
+ * Issue 125: Problem with 'o' command given while at the of the file.
+ * Issue 131: FileType is not set up when GUIEnter autocommand is used in
+ vimrc. Use 'nested' in 'au GUIEnter * nested VimwikiIndex'
+ * Issue 132: Link to perl (or any non-wiki) file in vimwiki subdirectory
+ doesn't work as intended.
+ * Issue 135: %title and %toc used together cause TOC to appear in an
+ unexpected place in HTML.
+ * Issue 139: |:VimwikiTabnewLink| command is added.
+ * Fix of g:vimwiki_stripsym = '' (i.e. an empty string) -- it removes bad
+ symbols from filenames.
+ * Issue 145: With modeline 'set ft=vimwiki' links are not correctly
+ highlighted when open wiki files.
+ * Issue 146: Filetype difficulty with ".txt" as a vimwiki extension.
+ * Issue 148: There are no mailto links.
+ * Issue 151: Use location list instead of quickfix list for :VimwikiSearch
+ command result. Use :lopen instead of :copen, :lnext instead of :cnext
+ etc.
+ * Issue 152: Add the list of HTML files that would not be deleted after
+ |:VimwikiAll2HTML|.
+ * Issue 153: Delete HTML files that has no corresponding wiki ones with
+ |:VimwikiAll2HTML|.
+ * Issue 156: Add multiple HTML templates. See
+ |vimwiki-option-template_path|. Options html_header and html_footer are
+ no longer exist.
+ * Issue 173: When virtualedit=all option is enabled the 'o' command behave
+ strange.
+ * Issue 178: Problem with alike wikie's paths.
+ * Issue 182: Browser command does not quote url.
+ * Issue 183: Spelling error highlighting is not possible with nested
+ syntaxes.
+ * Issue 184: Wrong foldlevel in some cases.
+ * Issue 195: Page renaming issue.
+ * Issue 196: vim: modeline bug -- syn=vim doesn't work.
+ * Issue 199: Generated HTML for sublists is invalid.
+ * Issue 200: Generated HTML for todo lists does not show completion status
+ the fix relies on CSS, thus your old stylesheets need to be updated!;
+ may not work in obsolete browsers or font-deficient systems.
+ * Issue 205: Block code: highlighting differs from processing. Inline code
+ block {{{ ... }}} is removed. Use `...` instead.
+ * Issue 208: Default highlight colors are problematic in many
+ colorschemes. Headers are highlighted as |hl-Title| by default, use
+ |g:vimwiki_hl_headers| to restore previous default Red, Green, Blue or
+ custom header colors. Some other changes in highlighting.
+ * Issue 209: Wild comments slow down html generation. Comments are
+ changed, use %% to comment out entire line.
+ * Issue 210: HTML: para enclose header.
+ * Issue 214: External links containing Chinese characters get trimmed.
+ * Issue 218: Command to generate HTML file and open it in webbrowser. See
+ |:Vimwiki2HTMLBrowse|(bind to <leader>whh)
+ * NEW: Added <Leader>wh mapping to call |:Vimwiki2HTML|
+
+
+...
+
+39 releases
+
+...
+
+0.1~
+ * First public version.
+
+==============================================================================
+17. License *vimwiki-license*
+
+The MIT License
+http://www.opensource.org/licenses/mit-license.php
+
+Copyright (c) 2008-2010 Maxim Kim
+ 2013-2017 Daniel Schemala
+
+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.
+
+
+
+ vim:tw=78:ts=8:ft=help
diff --git a/vim/.vim/plugged/vimwiki/ftplugin/vimwiki.vim b/vim/.vim/plugged/vimwiki/ftplugin/vimwiki.vim
new file mode 100644
index 0000000..6b517dc
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/ftplugin/vimwiki.vim
@@ -0,0 +1,699 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki filetype plugin file
+" Home: https://github.com/vimwiki/vimwiki/
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1 " Don't load another plugin for this buffer
+
+
+
+setlocal commentstring=%%%s
+
+if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
+ let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
+endif
+
+" This is for GOTO FILE: gf
+execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext')
+setlocal isfname-=[,]
+
+exe "setlocal tags+=" . escape(vimwiki#tags#metadata_file_path(), ' \|"')
+
+
+
+function! Complete_wikifiles(findstart, base)
+ if a:findstart == 1
+ let column = col('.')-2
+ let line = getline('.')[:column]
+ let startoflink = match(line, '\[\[\zs[^\\[\]]*$')
+ if startoflink != -1
+ let s:line_context = '['
+ return startoflink
+ endif
+ if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
+ let startofinlinelink = match(line, '\[.*\](\zs[^)]*$')
+ if startofinlinelink != -1
+ let s:line_context = '['
+ return startofinlinelink
+ endif
+ endif
+ let startoftag = match(line, ':\zs[^:[:space:]]*$')
+ if startoftag != -1
+ let s:line_context = ':'
+ return startoftag
+ endif
+ let s:line_context = ''
+ return -1
+ else
+ " Completion works for wikilinks/anchors, and for tags. s:line_content
+ " tells us which string came before a:base. There seems to be no easier
+ " solution, because calling col('.') here returns garbage.
+ if s:line_context == ''
+ return []
+ elseif s:line_context == ':'
+ " Tags completion
+ let tags = vimwiki#tags#get_tags()
+ if a:base != ''
+ call filter(tags,
+ \ "v:val[:" . (len(a:base)-1) . "] == '" . substitute(a:base, "'", "''", '') . "'" )
+ endif
+ return tags
+ elseif a:base !~# '#'
+ " we look for wiki files
+
+ if a:base =~# '^wiki\d:'
+ let wikinumber = eval(matchstr(a:base, '^wiki\zs\d'))
+ if wikinumber >= vimwiki#vars#number_of_wikis()
+ return []
+ endif
+ let prefix = matchstr(a:base, '^wiki\d:\zs.*')
+ let scheme = matchstr(a:base, '^wiki\d:\ze')
+ elseif a:base =~# '^diary:'
+ let wikinumber = -1
+ let prefix = matchstr(a:base, '^diary:\zs.*')
+ let scheme = matchstr(a:base, '^diary:\ze')
+ else " current wiki
+ let wikinumber = vimwiki#vars#get_bufferlocal('wiki_nr')
+ let prefix = a:base
+ let scheme = ''
+ endif
+
+ let links = vimwiki#base#get_wikilinks(wikinumber, 1)
+ let result = []
+ for wikifile in links
+ if wikifile =~ '^'.vimwiki#u#escape(prefix)
+ call add(result, scheme . wikifile)
+ endif
+ endfor
+ return result
+
+ else
+ " we look for anchors in the given wikifile
+
+ let segments = split(a:base, '#', 1)
+ let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0]
+ let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
+ let wikifile = link_infos.filename
+ let syntax = vimwiki#vars#get_wikilocal('syntax', link_infos.index)
+ let anchors = vimwiki#base#get_anchors(wikifile, syntax)
+
+ let filtered_anchors = []
+ let given_anchor = join(segments[1:], '#')
+ for anchor in anchors
+ if anchor =~# '^'.vimwiki#u#escape(given_anchor)
+ call add(filtered_anchors, segments[0].'#'.anchor)
+ endif
+ endfor
+ return filtered_anchors
+
+ endif
+ endif
+endfunction
+
+setlocal omnifunc=Complete_wikifiles
+
+
+
+" settings necessary for the automatic formatting of lists
+setlocal autoindent
+setlocal nosmartindent
+setlocal nocindent
+setlocal comments=""
+setlocal formatoptions-=c
+setlocal formatoptions-=r
+setlocal formatoptions-=o
+setlocal formatoptions-=2
+setlocal formatoptions+=n
+
+let &formatlistpat = vimwiki#vars#get_syntaxlocal('rxListItem')
+
+if !empty(&langmap)
+ " Valid only if langmap is a comma separated pairs of chars
+ let s:l_o = matchstr(&langmap, '\C,\zs.\zeo,')
+ if s:l_o
+ exe 'nnoremap <silent> <buffer> '.s:l_o.' :call vimwiki#lst#kbd_o()<CR>a'
+ endif
+
+ let s:l_O = matchstr(&langmap, '\C,\zs.\zeO,')
+ if s:l_O
+ exe 'nnoremap <silent> <buffer> '.s:l_O.' :call vimwiki#lst#kbd_O()<CR>a'
+ endif
+endif
+
+
+
+" ------------------------------------------------
+" Folding stuff
+" ------------------------------------------------
+
+function! VimwikiFoldListLevel(lnum)
+ return vimwiki#lst#fold_level(a:lnum)
+endfunction
+
+
+function! VimwikiFoldLevel(lnum)
+ let line = getline(a:lnum)
+
+ " Header/section folding...
+ if line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
+ return '>'.vimwiki#u#count_first_sym(line)
+ " Code block folding...
+ elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
+ return 'a1'
+ elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
+ return 's1'
+ else
+ return "="
+ endif
+endfunction
+
+
+" Constants used by VimwikiFoldText
+" use \u2026 and \u21b2 (or \u2424) if enc=utf-8 to save screen space
+let s:ellipsis = (&enc ==? 'utf-8') ? "\u2026" : "..."
+let s:ell_len = strlen(s:ellipsis)
+let s:newline = (&enc ==? 'utf-8') ? "\u21b2 " : " "
+let s:tolerance = 5
+
+
+" unused
+function! s:shorten_text_simple(text, len)
+ let spare_len = a:len - len(a:text)
+ return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
+endfunction
+
+
+" s:shorten_text(text, len) = [string, spare] with "spare" = len-strlen(string)
+" for long enough "text", the string's length is within s:tolerance of "len"
+" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
+function! s:shorten_text(text, len)
+ " returns [string, spare]
+ " strlen() returns lenght in bytes, not in characters, so we'll have to do a
+ " trick here -- replace all non-spaces with dot, calculate lengths and
+ " indexes on it, then use original string to break at selected index.
+ let text_pattern = substitute(a:text, '\m\S', '.', 'g')
+ let spare_len = a:len - strlen(text_pattern)
+ if (spare_len + s:tolerance >= 0)
+ return [a:text, spare_len]
+ endif
+ " try to break on a space; assumes a:len-s:ell_len >= s:tolerance
+ let newlen = a:len - s:ell_len
+ let idx = strridx(text_pattern, ' ', newlen + s:tolerance)
+ let break_idx = (idx + s:tolerance >= newlen) ? idx : newlen
+ return [matchstr(a:text, '\m^.\{'.break_idx.'\}').s:ellipsis, newlen - break_idx]
+endfunction
+
+
+function! VimwikiFoldText()
+ let line = getline(v:foldstart)
+ let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
+ let fold_len = v:foldend - v:foldstart + 1
+ let len_text = ' ['.fold_len.'] '
+ if line !~# vimwiki#vars#get_syntaxlocal('rxPreStart')
+ let [main_text, spare_len] = s:shorten_text(main_text, 50)
+ return main_text.len_text
+ else
+ " fold-text for code blocks: use one or two of the starting lines
+ let [main_text, spare_len] = s:shorten_text(main_text, 24)
+ let line1 = substitute(getline(v:foldstart+1), '^\s*', ' ', '')
+ let [content_text, spare_len] = s:shorten_text(line1, spare_len+20)
+ if spare_len > s:tolerance && fold_len > 3
+ let line2 = substitute(getline(v:foldstart+2), '^\s*', s:newline, '')
+ let [more_text, spare_len] = s:shorten_text(line2, spare_len+12)
+ let content_text .= more_text
+ endif
+ return main_text.len_text.content_text
+ endif
+endfunction
+
+
+
+" ------------------------------------------------
+" Commands
+" ------------------------------------------------
+
+command! -buffer Vimwiki2HTML
+ \ if filewritable(expand('%')) | silent noautocmd w | endif
+ \ <bar>
+ \ let res = vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')),
+ \ expand('%'))
+ \ <bar>
+ \ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '
+ \ . expand(vimwiki#vars#get_wikilocal('path_html')) | endif
+command! -buffer Vimwiki2HTMLBrowse
+ \ if filewritable(expand('%')) | silent noautocmd w | endif
+ \ <bar>
+ \ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
+ \ expand(vimwiki#vars#get_wikilocal('path_html')),
+ \ expand('%')))
+command! -buffer VimwikiAll2HTML
+ \ call vimwiki#html#WikiAll2HTML(expand(vimwiki#vars#get_wikilocal('path_html')))
+
+command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1)
+
+command! -buffer VimwikiNextLink call vimwiki#base#find_next_link()
+command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link()
+command! -buffer VimwikiDeleteLink call vimwiki#base#delete_link()
+command! -buffer VimwikiRenameLink call vimwiki#base#rename_link()
+command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1)
+command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
+command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('hsplit', 0, 1)
+command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', 0, 1)
+
+command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
+
+command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tab', 0, 1)
+
+command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
+
+command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
+command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
+
+exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
+ \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
+
+exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
+ \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
+
+command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped
+ \ VimwikiGoto call vimwiki#base#goto(<f-args>)
+
+command! -buffer VimwikiCheckLinks call vimwiki#base#check_links()
+
+" list commands
+command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
+command! -buffer -range -nargs=1 VimwikiChangeSymbolTo
+ \ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'n')
+command! -buffer -range -nargs=1 VimwikiListChangeSymbolI
+ \ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'i')
+command! -buffer -nargs=1 VimwikiChangeSymbolInListTo
+ \ call vimwiki#lst#change_marker_in_list(<f-args>)
+command! -buffer -range VimwikiToggleListItem call vimwiki#lst#toggle_cb(<line1>, <line2>)
+command! -buffer -range VimwikiToggleRejectedListItem
+ \ call vimwiki#lst#toggle_rejected_cb(<line1>, <line2>)
+command! -buffer -range VimwikiIncrementListItem call vimwiki#lst#increment_cb(<line1>, <line2>)
+command! -buffer -range VimwikiDecrementListItem call vimwiki#lst#decrement_cb(<line1>, <line2>)
+command! -buffer -range -nargs=+ VimwikiListChangeLvl
+ \ call vimwiki#lst#change_level(<line1>, <line2>, <f-args>)
+command! -buffer -range VimwikiRemoveSingleCB call vimwiki#lst#remove_cb(<line1>, <line2>)
+command! -buffer VimwikiRemoveCBInList call vimwiki#lst#remove_cb_in_list()
+command! -buffer VimwikiRenumberList call vimwiki#lst#adjust_numbered_list()
+command! -buffer VimwikiRenumberAllLists call vimwiki#lst#adjust_whole_buffer()
+command! -buffer VimwikiListToggle call vimwiki#lst#toggle_list_item()
+
+" table commands
+command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
+command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq')
+command! -buffer VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww')
+command! -buffer VimwikiTableMoveColumnLeft call vimwiki#tbl#move_column_left()
+command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right()
+
+" diary commands
+command! -buffer VimwikiDiaryNextDay call vimwiki#diary#goto_next_day()
+command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
+
+" tags commands
+command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
+command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
+ \ VimwikiSearchTags VimwikiSearch /:<args>:/
+command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
+ \ VimwikiGenerateTags call vimwiki#tags#generate_tags(<f-args>)
+
+command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
+command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
+
+
+" ------------------------------------------------
+" Keybindings
+" ------------------------------------------------
+
+if vimwiki#vars#get_global('use_mouse')
+ nmap <buffer> <S-LeftMouse> <NOP>
+ nmap <buffer> <C-LeftMouse> <NOP>
+ nnoremap <silent><buffer> <2-LeftMouse>
+ \ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR>
+ nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
+ nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
+ nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
+endif
+
+
+if !hasmapto('<Plug>Vimwiki2HTML')
+ exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'h <Plug>Vimwiki2HTML'
+endif
+nnoremap <script><buffer> <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
+
+if !hasmapto('<Plug>Vimwiki2HTMLBrowse')
+ exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'hh <Plug>Vimwiki2HTMLBrowse'
+endif
+nnoremap <script><buffer> <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
+
+if !hasmapto('<Plug>VimwikiFollowLink')
+ nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
+
+if !hasmapto('<Plug>VimwikiSplitLink')
+ nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
+
+if !hasmapto('<Plug>VimwikiVSplitLink')
+ nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
+
+if !hasmapto('<Plug>VimwikiNormalizeLink')
+ nmap <silent><buffer> + <Plug>VimwikiNormalizeLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink :VimwikiNormalizeLink 0<CR>
+
+if !hasmapto('<Plug>VimwikiNormalizeLinkVisual')
+ vmap <silent><buffer> + <Plug>VimwikiNormalizeLinkVisual
+endif
+vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual :<C-U>VimwikiNormalizeLink 1<CR>
+
+if !hasmapto('<Plug>VimwikiNormalizeLinkVisualCR')
+ vmap <silent><buffer> <CR> <Plug>VimwikiNormalizeLinkVisualCR
+endif
+vnoremap <silent><script><buffer>
+ \ <Plug>VimwikiNormalizeLinkVisualCR :<C-U>VimwikiNormalizeLink 1<CR>
+
+if !hasmapto('<Plug>VimwikiTabnewLink')
+ nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink
+ nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiTabnewLink :VimwikiTabnewLink<CR>
+
+if !hasmapto('<Plug>VimwikiGoBackLink')
+ nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
+
+if !hasmapto('<Plug>VimwikiNextLink')
+ nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiNextLink :VimwikiNextLink<CR>
+
+if !hasmapto('<Plug>VimwikiPrevLink')
+ nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
+
+if !hasmapto('<Plug>VimwikiDeleteLink')
+ exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'d <Plug>VimwikiDeleteLink'
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
+
+if !hasmapto('<Plug>VimwikiRenameLink')
+ exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'r <Plug>VimwikiRenameLink'
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
+
+if !hasmapto('<Plug>VimwikiDiaryNextDay')
+ nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
+
+if !hasmapto('<Plug>VimwikiDiaryPrevDay')
+ nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
+
+" List mappings
+if !hasmapto('<Plug>VimwikiToggleListItem')
+ nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
+ vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
+ if has("unix")
+ nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
+ vmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
+ endif
+endif
+if !hasmapto('<Plug>VimwikiToggleRejectedListItem')
+ nmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
+ vmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
+vnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
+nnoremap <silent><script><buffer>
+ \ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
+vnoremap <silent><script><buffer>
+ \ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
+
+if !hasmapto('<Plug>VimwikiIncrementListItem')
+ nmap <silent><buffer> gln <Plug>VimwikiIncrementListItem
+ vmap <silent><buffer> gln <Plug>VimwikiIncrementListItem
+endif
+if !hasmapto('<Plug>VimwikiDecrementListItem')
+ nmap <silent><buffer> glp <Plug>VimwikiDecrementListItem
+ vmap <silent><buffer> glp <Plug>VimwikiDecrementListItem
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem :VimwikiIncrementListItem<CR>
+vnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem :VimwikiIncrementListItem<CR>
+nnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem :VimwikiDecrementListItem<CR>
+vnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem :VimwikiDecrementListItem<CR>
+
+if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem', 'i')
+ imap <silent><buffer> <C-D> <Plug>VimwikiDecreaseLvlSingleItem
+endif
+inoremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlSingleItem
+ \ <C-O>:VimwikiListChangeLvl decrease 0<CR>
+
+if !hasmapto('<Plug>VimwikiIncreaseLvlSingleItem', 'i')
+ imap <silent><buffer> <C-T> <Plug>VimwikiIncreaseLvlSingleItem
+endif
+inoremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlSingleItem
+ \ <C-O>:VimwikiListChangeLvl increase 0<CR>
+
+if !hasmapto('<Plug>VimwikiListNextSymbol', 'i')
+ imap <silent><buffer> <C-L><C-J> <Plug>VimwikiListNextSymbol
+endif
+inoremap <silent><script><buffer> <Plug>VimwikiListNextSymbol
+ \ <C-O>:VimwikiListChangeSymbolI next<CR>
+
+if !hasmapto('<Plug>VimwikiListPrevSymbol', 'i')
+ imap <silent><buffer> <C-L><C-K> <Plug>VimwikiListPrevSymbol
+endif
+inoremap <silent><script><buffer> <Plug>VimwikiListPrevSymbol
+ \ <C-O>:VimwikiListChangeSymbolI prev<CR>
+
+if !hasmapto('<Plug>VimwikiListToggle', 'i')
+ imap <silent><buffer> <C-L><C-M> <Plug>VimwikiListToggle
+endif
+inoremap <silent><script><buffer> <Plug>VimwikiListToggle <Esc>:VimwikiListToggle<CR>
+
+nnoremap <silent> <buffer> o :<C-U>call vimwiki#lst#kbd_o()<CR>
+nnoremap <silent> <buffer> O :<C-U>call vimwiki#lst#kbd_O()<CR>
+
+if !hasmapto('<Plug>VimwikiRenumberList')
+ nmap <silent><buffer> glr <Plug>VimwikiRenumberList
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiRenumberList :VimwikiRenumberList<CR>
+
+if !hasmapto('<Plug>VimwikiRenumberAllLists')
+ nmap <silent><buffer> gLr <Plug>VimwikiRenumberAllLists
+ nmap <silent><buffer> gLR <Plug>VimwikiRenumberAllLists
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiRenumberAllLists :VimwikiRenumberAllLists<CR>
+
+if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem')
+ map <silent><buffer> glh <Plug>VimwikiDecreaseLvlSingleItem
+endif
+noremap <silent><script><buffer>
+ \ <Plug>VimwikiDecreaseLvlSingleItem :VimwikiListChangeLvl decrease 0<CR>
+
+if !hasmapto('<Plug>VimwikiIncreaseLvlSingleItem')
+ map <silent><buffer> gll <Plug>VimwikiIncreaseLvlSingleItem
+endif
+noremap <silent><script><buffer>
+ \ <Plug>VimwikiIncreaseLvlSingleItem :VimwikiListChangeLvl increase 0<CR>
+
+if !hasmapto('<Plug>VimwikiDecreaseLvlWholeItem')
+ map <silent><buffer> gLh <Plug>VimwikiDecreaseLvlWholeItem
+ map <silent><buffer> gLH <Plug>VimwikiDecreaseLvlWholeItem
+endif
+noremap <silent><script><buffer>
+ \ <Plug>VimwikiDecreaseLvlWholeItem :VimwikiListChangeLvl decrease 1<CR>
+
+if !hasmapto('<Plug>VimwikiIncreaseLvlWholeItem')
+ map <silent><buffer> gLl <Plug>VimwikiIncreaseLvlWholeItem
+ map <silent><buffer> gLL <Plug>VimwikiIncreaseLvlWholeItem
+endif
+noremap <silent><script><buffer>
+ \ <Plug>VimwikiIncreaseLvlWholeItem :VimwikiListChangeLvl increase 1<CR>
+
+if !hasmapto('<Plug>VimwikiRemoveSingleCB')
+ map <silent><buffer> gl<Space> <Plug>VimwikiRemoveSingleCB
+endif
+noremap <silent><script><buffer> <Plug>VimwikiRemoveSingleCB :VimwikiRemoveSingleCB<CR>
+
+if !hasmapto('<Plug>VimwikiRemoveCBInList')
+ map <silent><buffer> gL<Space> <Plug>VimwikiRemoveCBInList
+endif
+noremap <silent><script><buffer> <Plug>VimwikiRemoveCBInList :VimwikiRemoveCBInList<CR>
+
+for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
+ if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
+ exe 'noremap <silent><buffer> gl'.s:char.' :VimwikiChangeSymbolTo '.s:char.'<CR>'
+ endif
+ if !hasmapto(':VimwikiChangeSymbolInListTo '.s:char.'<CR>')
+ exe 'noremap <silent><buffer> gL'.s:char.' :VimwikiChangeSymbolInListTo '.s:char.'<CR>'
+ endif
+endfor
+
+for s:typ in vimwiki#vars#get_syntaxlocal('number_types')
+ if !hasmapto(':VimwikiChangeSymbolTo '.s:typ.'<CR>')
+ exe 'noremap <silent><buffer> gl'.s:typ[0].' :VimwikiChangeSymbolTo '.s:typ.'<CR>'
+ endif
+ if !hasmapto(':VimwikiChangeSymbolInListTo '.s:typ.'<CR>')
+ exe 'noremap <silent><buffer> gL'.s:typ[0].' :VimwikiChangeSymbolInListTo '.s:typ.'<CR>'
+ endif
+endfor
+
+
+function! s:CR(normal, just_mrkr)
+ if vimwiki#vars#get_global('table_mappings')
+ let res = vimwiki#tbl#kbd_cr()
+ if res != ""
+ exe "normal! " . res . "\<Right>"
+ startinsert
+ return
+ endif
+ endif
+ call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
+endfunction
+
+if !hasmapto('VimwikiReturn', 'i')
+ if maparg('<CR>', 'i') !~? '<Esc>:VimwikiReturn'
+ inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 5<CR>
+ endif
+ if maparg('<S-CR>', 'i') !~? '<Esc>:VimwikiReturn'
+ inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 2 2<CR>
+ endif
+endif
+
+"Table mappings
+ if vimwiki#vars#get_global('table_mappings')
+ inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
+ inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
+ endif
+
+
+
+nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
+nnoremap <buffer> gww :VimwikiTableAlignW<CR>
+if !hasmapto('<Plug>VimwikiTableMoveColumnLeft')
+ nmap <silent><buffer> <A-Left> <Plug>VimwikiTableMoveColumnLeft
+endif
+nnoremap <silent><script><buffer> <Plug>VimwikiTableMoveColumnLeft :VimwikiTableMoveColumnLeft<CR>
+if !hasmapto('<Plug>VimwikiTableMoveColumnRight')
+ nmap <silent><buffer> <A-Right> <Plug>VimwikiTableMoveColumnRight
+endif
+nnoremap <silent><script><buffer>
+ \ <Plug>VimwikiTableMoveColumnRight :VimwikiTableMoveColumnRight<CR>
+
+
+
+" ------------------------------------------------
+" Text objects
+" ------------------------------------------------
+
+onoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
+vnoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
+
+onoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
+vnoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
+
+onoremap <silent><buffer> aH :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
+vnoremap <silent><buffer> aH :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
+
+onoremap <silent><buffer> iH :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
+vnoremap <silent><buffer> iH :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
+
+onoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 0)<CR>
+vnoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 1)<CR>
+
+onoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 0)<CR>
+vnoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 1)<CR>
+
+onoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 0)<CR>
+vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
+
+onoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR>
+vnoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR>
+
+onoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 0)<CR>
+vnoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 1)<CR>
+
+onoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 0)<CR>
+vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
+
+if !hasmapto('<Plug>VimwikiAddHeaderLevel')
+ nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
+endif
+nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR>
+
+if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
+ nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
+endif
+nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
+ \<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
+
+if !hasmapto('<Plug>VimwikiGoToParentHeader')
+ nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader
+ nmap <silent><buffer> [u <Plug>VimwikiGoToParentHeader
+endif
+nnoremap <silent><buffer> <Plug>VimwikiGoToParentHeader :
+ \<C-u>call vimwiki#base#goto_parent_header()<CR>
+
+if !hasmapto('<Plug>VimwikiGoToNextHeader')
+ nmap <silent><buffer> ]] <Plug>VimwikiGoToNextHeader
+endif
+nnoremap <silent><buffer> <Plug>VimwikiGoToNextHeader :
+ \<C-u>call vimwiki#base#goto_next_header()<CR>
+
+if !hasmapto('<Plug>VimwikiGoToPrevHeader')
+ nmap <silent><buffer> [[ <Plug>VimwikiGoToPrevHeader
+endif
+nnoremap <silent><buffer> <Plug>VimwikiGoToPrevHeader :
+ \<C-u>call vimwiki#base#goto_prev_header()<CR>
+
+if !hasmapto('<Plug>VimwikiGoToNextSiblingHeader')
+ nmap <silent><buffer> ]= <Plug>VimwikiGoToNextSiblingHeader
+endif
+nnoremap <silent><buffer> <Plug>VimwikiGoToNextSiblingHeader :
+ \<C-u>call vimwiki#base#goto_sibling(+1)<CR>
+
+if !hasmapto('<Plug>VimwikiGoToPrevSiblingHeader')
+ nmap <silent><buffer> [= <Plug>VimwikiGoToPrevSiblingHeader
+endif
+nnoremap <silent><buffer> <Plug>VimwikiGoToPrevSiblingHeader :
+ \<C-u>call vimwiki#base#goto_sibling(-1)<CR>
+
+
+
+if vimwiki#vars#get_wikilocal('auto_export')
+ " Automatically generate HTML on page write.
+ augroup vimwiki
+ au BufWritePost <buffer>
+ \ call vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')),
+ \ expand('%'))
+ augroup END
+endif
+
+if vimwiki#vars#get_wikilocal('auto_toc')
+ " Automatically update the TOC *before* the file is written
+ augroup vimwiki
+ au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)
+ augroup END
+endif
+
+if vimwiki#vars#get_wikilocal('auto_tags')
+ " Automatically update tags metadata on page write.
+ augroup vimwiki
+ au BufWritePost <buffer> call vimwiki#tags#update_tags(0, '')
+ augroup END
+endif
+
diff --git a/vim/.vim/plugged/vimwiki/plugin/vimwiki.vim b/vim/.vim/plugged/vimwiki/plugin/vimwiki.vim
new file mode 100644
index 0000000..4e0ee91
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/plugin/vimwiki.vim
@@ -0,0 +1,396 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki plugin file
+" Home: https://github.com/vimwiki/vimwiki/
+" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
+
+
+if exists("g:loaded_vimwiki") || &cp
+ finish
+endif
+let g:loaded_vimwiki = 1
+
+" Set to version number for release, otherwise -1 for dev-branch
+let s:plugin_vers = -1
+
+" Get the directory the script is installed in
+let s:plugin_dir = expand('<sfile>:p:h:h')
+
+let s:old_cpo = &cpo
+set cpo&vim
+
+
+if exists('g:vimwiki_autowriteall')
+ let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
+else
+ let s:vimwiki_autowriteall_saved = 1
+endif
+
+
+" this is called when the cursor leaves the buffer
+function! s:setup_buffer_leave()
+ " don't do anything if it's not managed by Vimwiki (that is, when it's not in
+ " a registered wiki and not a temporary wiki)
+ if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
+ return
+ endif
+
+ let &autowriteall = s:vimwiki_autowriteall_saved
+
+ if vimwiki#vars#get_global('menu') != ""
+ exe 'nmenu disable '.vimwiki#vars#get_global('menu').'.Table'
+ endif
+endfunction
+
+
+" create a new temporary wiki for the current buffer
+function! s:create_temporary_wiki()
+ let path = expand('%:p:h')
+ let ext = '.'.expand('%:e')
+
+ let syntax_mapping = vimwiki#vars#get_global('ext2syntax')
+ if has_key(syntax_mapping, ext)
+ let syntax = syntax_mapping[ext]
+ else
+ let syntax = vimwiki#vars#get_wikilocal_default('syntax')
+ endif
+
+ let new_temp_wiki_settings = {'path': path,
+ \ 'ext': ext,
+ \ 'syntax': syntax,
+ \ }
+
+ call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
+
+ " Update the wiki number of the current buffer, because it may have changed when adding this
+ " temporary wiki.
+ call vimwiki#vars#set_bufferlocal('wiki_nr', vimwiki#base#find_wiki(expand('%:p')))
+endfunction
+
+
+" This function is called when Vim opens a new buffer with a known wiki
+" extension. Both when the buffer has never been opened in this session and
+" when it has.
+function! s:setup_new_wiki_buffer()
+ let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
+ if wiki_nr == -1 " it's not in a known wiki directory
+ if vimwiki#vars#get_global('global_ext')
+ call s:create_temporary_wiki()
+ else
+ " the user does not want a temporary wiki, so do nothing
+ return
+ endif
+ endif
+
+ if vimwiki#vars#get_wikilocal('maxhi')
+ call vimwiki#vars#set_bufferlocal('existing_wikifiles', vimwiki#base#get_wikilinks(wiki_nr, 1))
+ call vimwiki#vars#set_bufferlocal('existing_wikidirs',
+ \ vimwiki#base#get_wiki_directories(wiki_nr))
+ endif
+
+ " this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are
+ " sourced
+ setfiletype vimwiki
+
+endfunction
+
+
+" this is called when the cursor enters the buffer
+function! s:setup_buffer_enter()
+ " don't do anything if it's not managed by Vimwiki (that is, when it's not in
+ " a registered wiki and not a temporary wiki)
+ if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
+ return
+ endif
+
+ if &filetype != 'vimwiki'
+ setfiletype vimwiki
+ endif
+
+ call s:set_global_options()
+
+ call s:set_windowlocal_options()
+endfunction
+
+
+function! s:setup_cleared_syntax()
+ " highlight groups that get cleared
+ " on colorscheme change because they are not linked to Vim-predefined groups
+ hi def VimwikiBold term=bold cterm=bold gui=bold
+ hi def VimwikiItalic term=italic cterm=italic gui=italic
+ hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
+ hi def VimwikiUnderline gui=underline
+ if vimwiki#vars#get_global('hl_headers') == 1
+ for i in range(1,6)
+ execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
+ \ . vimwiki#vars#get_global('hcolor_guifg_'.&bg)[i-1]
+ \ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[i-1]
+ \ .' term=bold cterm=bold'
+ endfor
+ endif
+endfunction
+
+
+function! s:vimwiki_get_known_extensions()
+ " Getting all extensions that different wikis could have
+ let extensions = {}
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let ext = vimwiki#vars#get_wikilocal('ext', idx)
+ let extensions[ext] = 1
+ endfor
+ " append extensions from g:vimwiki_ext2syntax
+ for ext in keys(vimwiki#vars#get_global('ext2syntax'))
+ let extensions[ext] = 1
+ endfor
+ return keys(extensions)
+endfunction
+
+
+" Set settings which are global for Vim, but should only be executed for
+" Vimwiki buffers. So they must be set when the cursor enters a Vimwiki buffer
+" and reset when the cursor leaves the buffer.
+function! s:set_global_options()
+ let s:vimwiki_autowriteall_saved = &autowriteall
+ let &autowriteall = vimwiki#vars#get_global('autowriteall')
+
+ if vimwiki#vars#get_global('menu') !=# ''
+ exe 'nmenu enable '.vimwiki#vars#get_global('menu').'.Table'
+ endif
+endfunction
+
+
+" Set settings which are local to a window. In a new tab they would be reset to
+" Vim defaults. So we enforce our settings here when the cursor enters a
+" Vimwiki buffer.
+function! s:set_windowlocal_options()
+ let foldmethod = vimwiki#vars#get_global('folding')
+ if foldmethod =~? '^expr.*'
+ setlocal foldmethod=expr
+ setlocal foldexpr=VimwikiFoldLevel(v:lnum)
+ setlocal foldtext=VimwikiFoldText()
+ elseif foldmethod =~? '^list.*' || foldmethod =~? '^lists.*'
+ setlocal foldmethod=expr
+ setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
+ setlocal foldtext=VimwikiFoldText()
+ elseif foldmethod =~? '^syntax.*'
+ setlocal foldmethod=syntax
+ setlocal foldtext=VimwikiFoldText()
+ elseif foldmethod =~? '^custom.*'
+ " do nothing
+ else
+ setlocal foldmethod=manual
+ normal! zE
+ endif
+
+ if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
+ let &conceallevel = vimwiki#vars#get_global('conceallevel')
+ endif
+
+ if vimwiki#vars#get_global('auto_chdir')
+ exe 'lcd' vimwiki#vars#get_wikilocal('path')
+ endif
+endfunction
+
+
+function! s:get_version()
+ if s:plugin_vers != -1
+ echo "Stable version: " . s:plugin_vers
+ else
+ let a:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD")
+ let a:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD")
+ let a:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci")
+ if v:shell_error == 0
+ echo "Branch: " . a:plugin_branch
+ echo "Revision: " . a:plugin_rev
+ echo "Date: " . a:plugin_date
+ else
+ echo "Unknown version"
+ endif
+ endif
+endfunction
+
+
+
+" Initialization of Vimwiki starts here. Make sure everything below does not
+" cause autoload/vimwiki/base.vim to be loaded
+
+call vimwiki#vars#init()
+
+
+" Define callback functions which the user can redefine
+if !exists("*VimwikiLinkHandler")
+ function VimwikiLinkHandler(url)
+ return 0
+ endfunction
+endif
+
+if !exists("*VimwikiLinkConverter")
+ function VimwikiLinkConverter(url, source, target)
+ " Return the empty string when unable to process link
+ return ''
+ endfunction
+endif
+
+if !exists("*VimwikiWikiIncludeHandler")
+ function! VimwikiWikiIncludeHandler(value)
+ return ''
+ endfunction
+endif
+
+
+
+" Define autocommands for all known wiki extensions
+
+let s:known_extensions = s:vimwiki_get_known_extensions()
+
+if index(s:known_extensions, '.wiki') > -1
+ augroup filetypedetect
+ " clear FlexWiki's stuff
+ au! * *.wiki
+ augroup end
+endif
+
+augroup vimwiki
+ autocmd!
+ for s:ext in s:known_extensions
+ exe 'autocmd BufNewFile,BufRead *'.s:ext.' call s:setup_new_wiki_buffer()'
+ exe 'autocmd BufEnter *'.s:ext.' call s:setup_buffer_enter()'
+ exe 'autocmd BufLeave *'.s:ext.' call s:setup_buffer_leave()'
+ exe 'autocmd ColorScheme *'.s:ext.' call s:setup_cleared_syntax()'
+ " Format tables when exit from insert mode. Do not use textwidth to
+ " autowrap tables.
+ if vimwiki#vars#get_global('table_auto_fmt')
+ exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
+ exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
+ endif
+ if vimwiki#vars#get_global('folding') =~? ':quick$'
+ " from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
+ " Don't screw up folds when inserting text that might affect them, until
+ " leaving insert mode. Foldmethod is local to the window. Protect against
+ " screwing up folding when switching between windows.
+ exe 'autocmd InsertEnter *'.s:ext.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
+ \ ' | setlocal foldmethod=manual | endif'
+ exe 'autocmd InsertLeave,WinLeave *'.s:ext.' if exists("w:last_fdm") |'.
+ \ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
+ endif
+ endfor
+augroup END
+
+
+
+command! VimwikiUISelect call vimwiki#base#ui_select()
+" why not using <count> instead of v:count1?
+" See https://github.com/vimwiki-backup/vimwiki/issues/324
+command! -count=1 VimwikiIndex
+ \ call vimwiki#base#goto_index(v:count1)
+command! -count=1 VimwikiTabIndex
+ \ call vimwiki#base#goto_index(v:count1, 1)
+
+command! -count=1 VimwikiDiaryIndex
+ \ call vimwiki#diary#goto_diary_index(v:count1)
+command! -count=1 VimwikiMakeDiaryNote
+ \ call vimwiki#diary#make_note(v:count)
+command! -count=1 VimwikiTabMakeDiaryNote
+ \ call vimwiki#diary#make_note(v:count, 1)
+command! -count=1 VimwikiMakeYesterdayDiaryNote
+ \ call vimwiki#diary#make_note(v:count, 0,
+ \ vimwiki#diary#diary_date_link(localtime() - 60*60*24))
+command! -count=1 VimwikiMakeTomorrowDiaryNote
+ \ call vimwiki#diary#make_note(v:count, 0,
+ \ vimwiki#diary#diary_date_link(localtime() + 60*60*24))
+
+command! VimwikiDiaryGenerateLinks
+ \ call vimwiki#diary#generate_diary_section()
+
+command! VimwikiShowVersion call s:get_version()
+
+
+
+let s:map_prefix = vimwiki#vars#get_global('map_prefix')
+
+if !hasmapto('<Plug>VimwikiIndex')
+ exe 'nmap <silent><unique> '.s:map_prefix.'w <Plug>VimwikiIndex'
+endif
+nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
+
+if !hasmapto('<Plug>VimwikiTabIndex')
+ exe 'nmap <silent><unique> '.s:map_prefix.'t <Plug>VimwikiTabIndex'
+endif
+nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
+
+if !hasmapto('<Plug>VimwikiUISelect')
+ exe 'nmap <silent><unique> '.s:map_prefix.'s <Plug>VimwikiUISelect'
+endif
+nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
+
+if !hasmapto('<Plug>VimwikiDiaryIndex')
+ exe 'nmap <silent><unique> '.s:map_prefix.'i <Plug>VimwikiDiaryIndex'
+endif
+nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
+
+if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
+ exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>i <Plug>VimwikiDiaryGenerateLinks'
+endif
+nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
+
+if !hasmapto('<Plug>VimwikiMakeDiaryNote')
+ exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
+endif
+nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
+
+if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
+ exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>t <Plug>VimwikiTabMakeDiaryNote'
+endif
+nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
+ \ :VimwikiTabMakeDiaryNote<CR>
+
+if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote')
+ exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>y <Plug>VimwikiMakeYesterdayDiaryNote'
+endif
+nnoremap <unique><script> <Plug>VimwikiMakeYesterdayDiaryNote
+ \ :VimwikiMakeYesterdayDiaryNote<CR>
+
+if !hasmapto('<Plug>VimwikiMakeTomorrowDiaryNote')
+ exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>m <Plug>VimwikiMakeTomorrowDiaryNote'
+endif
+nnoremap <unique><script> <Plug>VimwikiMakeTomorrowDiaryNote
+ \ :VimwikiMakeTomorrowDiaryNote<CR>
+
+
+
+
+function! s:build_menu(topmenu)
+ for idx in range(vimwiki#vars#number_of_wikis())
+ let norm_path = fnamemodify(vimwiki#vars#get_wikilocal('path', idx), ':h:t')
+ let norm_path = escape(norm_path, '\ \.')
+ execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
+ \ ' :call vimwiki#base#goto_index('.(idx+1).')<CR>'
+ execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
+ \ ' :call vimwiki#diary#make_note('.(idx+1).')<CR>'
+ endfor
+endfunction
+
+function! s:build_table_menu(topmenu)
+ exe 'menu '.a:topmenu.'.-Sep- :'
+ exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
+ exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
+ exe 'nmenu '.a:topmenu.'.Table.Move\ column\ left<tab><A-Left> :VimwikiTableMoveColumnLeft<CR>'
+ exe 'nmenu '.a:topmenu.
+ \ '.Table.Move\ column\ right<tab><A-Right> :VimwikiTableMoveColumnRight<CR>'
+ exe 'nmenu disable '.a:topmenu.'.Table'
+endfunction
+
+
+if !empty(vimwiki#vars#get_global('menu'))
+ call s:build_menu(vimwiki#vars#get_global('menu'))
+ call s:build_table_menu(vimwiki#vars#get_global('menu'))
+endif
+
+
+" Hook for calendar.vim
+if vimwiki#vars#get_global('use_calendar')
+ let g:calendar_action = 'vimwiki#diary#calendar_action'
+ let g:calendar_sign = 'vimwiki#diary#calendar_sign'
+endif
+
+
+let &cpo = s:old_cpo
diff --git a/vim/.vim/plugged/vimwiki/syntax/vimwiki.vim b/vim/.vim/plugged/vimwiki/syntax/vimwiki.vim
new file mode 100644
index 0000000..512aad9
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/syntax/vimwiki.vim
@@ -0,0 +1,487 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki syntax file
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+" Quit if syntax file is already loaded
+if v:version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+
+let s:current_syntax = vimwiki#vars#get_wikilocal('syntax')
+
+
+call vimwiki#vars#populate_syntax_vars(s:current_syntax)
+
+
+" LINKS: highlighting is complicated due to "nonexistent" links feature
+function! s:add_target_syntax_ON(target, type)
+ let prefix0 = 'syntax match '.a:type.' `'
+ let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
+ let prefix1 = 'syntax match '.a:type.'T `'
+ let suffix1 = '` display contained'
+ execute prefix0. a:target. suffix0
+ execute prefix1. a:target. suffix1
+endfunction
+
+
+function! s:add_target_syntax_OFF(target)
+ let prefix0 = 'syntax match VimwikiNoExistsLink `'
+ let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
+ let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
+ let suffix1 = '` display contained'
+ execute prefix0. a:target. suffix0
+ execute prefix1. a:target. suffix1
+endfunction
+
+
+function! s:highlight_existing_links()
+ " Wikilink
+ " Conditional highlighting that depends on the existence of a wiki file or
+ " directory is only available for *schemeless* wiki links
+ " Links are set up upon BufEnter (see plugin/...)
+ let safe_links = '\%('.vimwiki#base#file_pattern(
+ \ vimwiki#vars#get_bufferlocal('existing_wikifiles')) . '\%(#[^|]*\)\?\|#[^|]*\)'
+ " Wikilink Dirs set up upon BufEnter (see plugin/...)
+ let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs'))
+
+ " match [[URL]]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
+ \ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+ " match [[URL|DESCRIPTION]]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
+ \ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+
+ " match {{URL}}
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
+ \ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+ " match {{URL|...}}
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
+ \ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+ " match [[DIRURL]]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
+ \ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+ " match [[DIRURL|DESCRIPTION]]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
+ \ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+ call s:add_target_syntax_ON(target, 'VimwikiLink')
+endfunction
+
+
+" use max highlighting - could be quite slow if there are too many wikifiles
+if vimwiki#vars#get_wikilocal('maxhi')
+ " WikiLink
+ call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
+ " WikiIncl
+ call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiIncl'))
+
+ " Subsequently, links verified on vimwiki's path are highlighted as existing
+ call s:highlight_existing_links()
+else
+ " Wikilink
+ call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink'), 'VimwikiLink')
+ " WikiIncl
+ call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiIncl'), 'VimwikiLink')
+endif
+
+
+" Weblink
+call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
+
+
+" WikiLink
+" All remaining schemes are highlighted automatically
+let s:rxSchemes = '\%('.
+ \ vimwiki#vars#get_global('schemes') . '\|'.
+ \ vimwiki#vars#get_global('web_schemes1').
+ \ '\):'
+
+" a) match [[nonwiki-scheme-URL]]
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
+ \ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
+ \ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+call s:add_target_syntax_ON(s:target, 'VimwikiLink')
+" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
+ \ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
+ \ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
+call s:add_target_syntax_ON(s:target, 'VimwikiLink')
+
+" a) match {{nonwiki-scheme-URL}}
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
+ \ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
+ \ vimwiki#vars#get_global('rxWikiInclArgs'), '')
+call s:add_target_syntax_ON(s:target, 'VimwikiLink')
+" b) match {{nonwiki-scheme-URL}[{...}]}
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
+ \ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
+ \ vimwiki#vars#get_global('rxWikiInclArgs'), '')
+call s:add_target_syntax_ON(s:target, 'VimwikiLink')
+
+
+
+" Header levels, 1-6
+for s:i in range(1,6)
+ execute 'syntax match VimwikiHeader'.s:i
+ \ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax).
+ \ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
+ \ 'VimwikiLink,@Spell'
+ execute 'syntax region VimwikiH'.s:i.'Folding start=/'.
+ \ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'.
+ \ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax).
+ \ '/me=s-1 transparent fold'
+endfor
+
+
+
+" possibly concealed chars
+let s:conceal = exists("+conceallevel") ? ' conceal' : ''
+
+execute 'syn match VimwikiEqInChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal
+execute 'syn match VimwikiBoldChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal
+execute 'syn match VimwikiItalicChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal
+execute 'syn match VimwikiBoldItalicChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal
+execute 'syn match VimwikiItalicBoldChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal
+execute 'syn match VimwikiCodeChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal
+execute 'syn match VimwikiDelTextChar contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal
+execute 'syn match VimwikiSuperScript contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal
+execute 'syn match VimwikiSubScript contained /'.
+ \ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal
+
+
+
+
+
+let s:options = ' contained transparent contains=NONE'
+
+" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
+" VimwikiLinkRest group is left undefined if link shortening is not desired
+if exists("+conceallevel") && vimwiki#vars#get_global('url_maxsave') > 0
+ let s:options .= s:conceal
+ execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
+ \.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options
+endif
+
+" VimwikiLinkChar is for syntax markers (and also URL when a description
+" is present) and may be concealed
+
+" conceal wikilinks
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix1').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix1').'/'.s:options
+
+" conceal wikiincls
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix1').'/'.s:options
+execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1').'/'.s:options
+
+
+" non concealed chars
+execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
+ \ vimwiki#vars#get_syntaxlocal('rxH').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH').
+ \ '\+\s*$\)/'
+execute 'syn match VimwikiEqInCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_eqin').'/'
+execute 'syn match VimwikiBoldCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_bold').'/'
+execute 'syn match VimwikiItalicCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_italic').'/'
+execute 'syn match VimwikiBoldItalicCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'
+execute 'syn match VimwikiItalicBoldCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_italicbold').'/'
+execute 'syn match VimwikiCodeCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_code').'/'
+execute 'syn match VimwikiDelTextCharT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_deltext').'/'
+execute 'syn match VimwikiSuperScriptT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_superscript').'/'
+execute 'syn match VimwikiSubScriptT contained /'
+ \ .vimwiki#vars#get_syntaxlocal('char_subscript').'/'
+
+
+execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_global('rxTodo') .'/'
+
+
+
+" Tables
+syntax match VimwikiTableRow /^\s*|.\+|\s*$/
+ \ transparent contains=VimwikiCellSeparator,
+ \ VimwikiLinkT,
+ \ VimwikiNoExistsLinkT,
+ \ VimwikiTodo,
+ \ VimwikiBoldT,
+ \ VimwikiItalicT,
+ \ VimwikiBoldItalicT,
+ \ VimwikiItalicBoldT,
+ \ VimwikiDelTextT,
+ \ VimwikiSuperScriptT,
+ \ VimwikiSubScriptT,
+ \ VimwikiCodeT,
+ \ VimwikiEqInT,
+ \ @Spell
+syntax match VimwikiCellSeparator
+ \ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
+
+
+" Lists
+execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
+execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
+execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
+
+if vimwiki#vars#get_global('hl_cb_checked') == 1
+ execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
+ \ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
+ \ . vimwiki#vars#get_global('listsym_rejected')
+ \ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
+elseif vimwiki#vars#get_global('hl_cb_checked') == 2
+ execute 'syntax match VimwikiCheckBoxDone /'
+ \ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
+ \ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
+endif
+
+
+execute 'syntax match VimwikiEqIn /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
+ \ '/ contains=VimwikiEqInChar'
+execute 'syntax match VimwikiEqInT /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
+ \ '/ contained contains=VimwikiEqInCharT'
+
+execute 'syntax match VimwikiBold /'.vimwiki#vars#get_syntaxlocal('rxBold').
+ \ '/ contains=VimwikiBoldChar,@Spell'
+execute 'syntax match VimwikiBoldT /'.vimwiki#vars#get_syntaxlocal('rxBold').
+ \ '/ contained contains=VimwikiBoldCharT,@Spell'
+
+execute 'syntax match VimwikiItalic /'.vimwiki#vars#get_syntaxlocal('rxItalic').
+ \ '/ contains=VimwikiItalicChar,@Spell'
+execute 'syntax match VimwikiItalicT /'.vimwiki#vars#get_syntaxlocal('rxItalic').
+ \ '/ contained contains=VimwikiItalicCharT,@Spell'
+
+execute 'syntax match VimwikiBoldItalic /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
+ \ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
+execute 'syntax match VimwikiBoldItalicT /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
+ \ '/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
+
+execute 'syntax match VimwikiItalicBold /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
+ \ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
+execute 'syntax match VimwikiItalicBoldT /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
+ \ '/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
+
+execute 'syntax match VimwikiDelText /'.vimwiki#vars#get_syntaxlocal('rxDelText').
+ \ '/ contains=VimwikiDelTextChar,@Spell'
+execute 'syntax match VimwikiDelTextT /'.vimwiki#vars#get_syntaxlocal('rxDelText').
+ \ '/ contained contains=VimwikiDelTextChar,@Spell'
+
+execute 'syntax match VimwikiSuperScript /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
+ \ '/ contains=VimwikiSuperScriptChar,@Spell'
+execute 'syntax match VimwikiSuperScriptT /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
+ \ '/ contained contains=VimwikiSuperScriptCharT,@Spell'
+
+execute 'syntax match VimwikiSubScript /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
+ \ '/ contains=VimwikiSubScriptChar,@Spell'
+execute 'syntax match VimwikiSubScriptT /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
+ \ '/ contained contains=VimwikiSubScriptCharT,@Spell'
+
+execute 'syntax match VimwikiCode /'.vimwiki#vars#get_syntaxlocal('rxCode').
+ \ '/ contains=VimwikiCodeChar'
+execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
+ \ '/ contained contains=VimwikiCodeCharT'
+
+
+" <hr> horizontal rule
+execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
+
+execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
+ \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'
+
+execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
+ \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell'
+
+
+" placeholders
+syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
+syntax match VimwikiPlaceholder
+ \ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
+syntax match VimwikiPlaceholder
+ \ /^\s*%date\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
+syntax match VimwikiPlaceholder
+ \ /^\s*%template\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
+syntax match VimwikiPlaceholderParam /.*/ contained
+
+
+" html tags
+if vimwiki#vars#get_global('valid_html_tags') != ''
+ let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
+ exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
+ execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
+ execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
+ execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
+
+ execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('rxComment').
+ \ '/ contains=@Spell,VimwikiTodo'
+endif
+
+" tags
+execute 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
+
+
+
+" header groups highlighting
+if vimwiki#vars#get_global('hl_headers') == 0
+ " Strangely in default colorscheme Title group is not set to bold for cterm...
+ if !exists("g:colors_name")
+ hi Title cterm=bold
+ endif
+ for s:i in range(1,6)
+ execute 'hi def link VimwikiHeader'.s:i.' Title'
+ endfor
+else
+ for s:i in range(1,6)
+ execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='
+ \ .vimwiki#vars#get_global('hcolor_guifg_'.&bg)[s:i-1].' gui=bold ctermfg='
+ \ .vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold'
+ endfor
+endif
+
+
+
+hi def link VimwikiMarkers Normal
+
+hi def link VimwikiEqIn Number
+hi def link VimwikiEqInT VimwikiEqIn
+
+hi def VimwikiBold term=bold cterm=bold gui=bold
+hi def link VimwikiBoldT VimwikiBold
+
+hi def VimwikiItalic term=italic cterm=italic gui=italic
+hi def link VimwikiItalicT VimwikiItalic
+
+hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
+hi def link VimwikiItalicBold VimwikiBoldItalic
+hi def link VimwikiBoldItalicT VimwikiBoldItalic
+hi def link VimwikiItalicBoldT VimwikiBoldItalic
+
+hi def VimwikiUnderline gui=underline
+
+hi def link VimwikiCode PreProc
+hi def link VimwikiCodeT VimwikiCode
+
+hi def link VimwikiPre PreProc
+hi def link VimwikiPreT VimwikiPre
+
+hi def link VimwikiMath Number
+hi def link VimwikiMathT VimwikiMath
+
+hi def link VimwikiNoExistsLink SpellBad
+hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
+
+hi def link VimwikiLink Underlined
+hi def link VimwikiLinkT VimwikiLink
+
+hi def link VimwikiList Identifier
+hi def link VimwikiListTodo VimwikiList
+hi def link VimwikiCheckBoxDone Comment
+hi def link VimwikiHR Identifier
+hi def link VimwikiTag Keyword
+
+hi def link VimwikiDelText Constant
+hi def link VimwikiDelTextT VimwikiDelText
+
+hi def link VimwikiSuperScript Number
+hi def link VimwikiSuperScriptT VimwikiSuperScript
+
+hi def link VimwikiSubScript Number
+hi def link VimwikiSubScriptT VimwikiSubScript
+
+hi def link VimwikiTodo Todo
+hi def link VimwikiComment Comment
+
+hi def link VimwikiPlaceholder SpecialKey
+hi def link VimwikiPlaceholderParam String
+hi def link VimwikiHTMLtag SpecialKey
+
+hi def link VimwikiEqInChar VimwikiMarkers
+hi def link VimwikiCellSeparator VimwikiMarkers
+hi def link VimwikiBoldChar VimwikiMarkers
+hi def link VimwikiItalicChar VimwikiMarkers
+hi def link VimwikiBoldItalicChar VimwikiMarkers
+hi def link VimwikiItalicBoldChar VimwikiMarkers
+hi def link VimwikiDelTextChar VimwikiMarkers
+hi def link VimwikiSuperScriptChar VimwikiMarkers
+hi def link VimwikiSubScriptChar VimwikiMarkers
+hi def link VimwikiCodeChar VimwikiMarkers
+hi def link VimwikiHeaderChar VimwikiMarkers
+
+hi def link VimwikiEqInCharT VimwikiMarkers
+hi def link VimwikiBoldCharT VimwikiMarkers
+hi def link VimwikiItalicCharT VimwikiMarkers
+hi def link VimwikiBoldItalicCharT VimwikiMarkers
+hi def link VimwikiItalicBoldCharT VimwikiMarkers
+hi def link VimwikiDelTextCharT VimwikiMarkers
+hi def link VimwikiSuperScriptCharT VimwikiMarkers
+hi def link VimwikiSubScriptCharT VimwikiMarkers
+hi def link VimwikiCodeCharT VimwikiMarkers
+hi def link VimwikiHeaderCharT VimwikiMarkers
+hi def link VimwikiLinkCharT VimwikiLinkT
+hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
+
+
+" Load syntax-specific functionality
+call vimwiki#u#reload_regexes_custom()
+
+
+" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
+let b:current_syntax="vimwiki"
+
+
+" EMBEDDED syntax setup
+let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
+if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
+ let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep")
+endif
+if !empty(s:nested)
+ for [s:hl_syntax, s:vim_syntax] in items(s:nested)
+ call vimwiki#base#nested_syntax(s:vim_syntax,
+ \ vimwiki#vars#get_syntaxlocal('rxPreStart').'\%(.*[[:blank:][:punct:]]\)\?'.
+ \ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
+ \ vimwiki#vars#get_syntaxlocal('rxPreEnd'), 'VimwikiPre')
+ endfor
+endif
+
+
+" LaTeX
+call vimwiki#base#nested_syntax('tex',
+ \ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
+ \ '\%([[:blank:][:punct:]].*\)\?',
+ \ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath')
+
+
+syntax spell toplevel
+
diff --git a/vim/.vim/plugged/vimwiki/syntax/vimwiki_default.vim b/vim/.vim/plugged/vimwiki/syntax/vimwiki_default.vim
new file mode 100644
index 0000000..1fcbdec
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/syntax/vimwiki_default.vim
@@ -0,0 +1,110 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki syntax file
+" Description: Defines default syntax
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+" s:default_syntax is kind of a reference to the dict in
+" g:vimwiki_syntax_variables['default']. It is used here simply as an
+" abbreviation for the latter.
+let s:default_syntax = g:vimwiki_syntax_variables['default']
+
+
+
+" text: $ equation_inline $
+let s:default_syntax.rxEqIn = '\$[^$`]\+\$'
+let s:default_syntax.char_eqin = '\$'
+
+" text: *strong*
+" let s:default_syntax.rxBold = '\*[^*]\+\*'
+let s:default_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'\*'.
+ \'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
+ \'\*'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.char_bold = '*'
+
+" text: _emphasis_
+" let s:default_syntax.rxItalic = '_[^_]\+_'
+let s:default_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'_'.
+ \'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
+ \'_'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.char_italic = '_'
+
+" text: *_bold italic_* or _*italic bold*_
+let s:default_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'\*_'.
+ \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
+ \'_\*'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.char_bolditalic = '\*_'
+
+let s:default_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'_\*'.
+ \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
+ \'\*_'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.char_italicbold = '_\*'
+
+" text: `code`
+let s:default_syntax.rxCode = '`[^`]\+`'
+let s:default_syntax.char_code = '`'
+
+" text: ~~deleted text~~
+let s:default_syntax.rxDelText = '\~\~[^~`]\+\~\~'
+let s:default_syntax.char_deltext = '\~\~'
+
+" text: ^superscript^
+let s:default_syntax.rxSuperScript = '\^[^^`]\+\^'
+let s:default_syntax.char_superscript = '^'
+
+" text: ,,subscript,,
+let s:default_syntax.rxSubScript = ',,[^,`]\+,,'
+let s:default_syntax.char_subscript = ',,'
+
+" generic headers
+let s:default_syntax.rxH = '='
+let s:default_syntax.symH = 1
+
+
+
+" <hr>, horizontal rule
+let s:default_syntax.rxHR = '^-----*$'
+
+" Tables. Each line starts and ends with '|'; each cell is separated by '|'
+let s:default_syntax.rxTableSep = '|'
+
+" Lists
+let s:default_syntax.bullet_types = ['-', '*', '#']
+" 1 means the bullets can be repeatet to indicate the level, like * ** ***
+" 0 means the bullets stand on their own and the level is indicated by the indentation
+let s:default_syntax.recurring_bullets = 0
+let s:default_syntax.number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)']
+"this should contain at least one element
+"it is used for i_<C-L><C-J> among other things
+let s:default_syntax.list_markers = ['-', '1.', '*', 'I)', 'a)']
+let s:default_syntax.rxListDefine = '::\(\s\|$\)'
+
+" Preformatted text
+let s:default_syntax.rxPreStart = '{{{'
+let s:default_syntax.rxPreEnd = '}}}'
+
+" Math block
+let s:default_syntax.rxMathStart = '{{\$'
+let s:default_syntax.rxMathEnd = '}}\$'
+
+let s:default_syntax.rxComment = '^\s*%%.*$'
+let s:default_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:''[:space:]]\+:\)\+\%(\s\|$\)\@='
+
+let s:default_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
+let s:default_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
+let s:default_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*'.
+ \ '[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
+ \ '\%([[:punct:]]\|\s\|$\)\@='
+let s:default_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
+let s:default_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
+let s:default_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
+ \ '\([^:[:space:]]\+:\)*\(\s\|$\)'
diff --git a/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown.vim b/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown.vim
new file mode 100644
index 0000000..5962699
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown.vim
@@ -0,0 +1,104 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki syntax file
+" Description: Defines markdown syntax
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+" see the comments in vimwiki_default.vim for some info about this file
+
+
+let s:markdown_syntax = g:vimwiki_syntax_variables['markdown']
+
+" text: $ equation_inline $
+let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$'
+let s:markdown_syntax.char_eqin = '\$'
+
+" text: *strong*
+" let s:markdown_syntax.rxBold = '\*[^*]\+\*'
+let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'\*'.
+ \'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
+ \'\*'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.char_bold = '*'
+
+" text: _emphasis_
+" let s:markdown_syntax.rxItalic = '_[^_]\+_'
+let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'_'.
+ \'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
+ \'_'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.char_italic = '_'
+
+" text: *_bold italic_* or _*italic bold*_
+let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'\*_'.
+ \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
+ \'_\*'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.char_bolditalic = '\*_'
+
+let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
+ \'_\*'.
+ \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
+ \'\*_'.
+ \'\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.char_italicbold = '_\*'
+
+" text: `code`
+let s:markdown_syntax.rxCode = '`[^`]\+`'
+let s:markdown_syntax.char_code = '`'
+
+" text: ~~deleted text~~
+let s:markdown_syntax.rxDelText = '\~\~[^~`]\+\~\~'
+let s:markdown_syntax.char_deltext = '\~\~'
+
+" text: ^superscript^
+let s:markdown_syntax.rxSuperScript = '\^[^^`]\+\^'
+let s:markdown_syntax.char_superscript = '^'
+
+" text: ,,subscript,,
+let s:markdown_syntax.rxSubScript = ',,[^,`]\+,,'
+let s:markdown_syntax.char_subscript = ',,'
+
+" generic headers
+let s:markdown_syntax.rxH = '#'
+let s:markdown_syntax.symH = 0
+
+
+
+" <hr>, horizontal rule
+let s:markdown_syntax.rxHR = '^-----*$'
+
+" Tables. Each line starts and ends with '|'; each cell is separated by '|'
+let s:markdown_syntax.rxTableSep = '|'
+
+" Lists
+let s:markdown_syntax.bullet_types = ['-', '*', '+']
+let s:markdown_syntax.recurring_bullets = 0
+let s:markdown_syntax.number_types = ['1.']
+let s:markdown_syntax.list_markers = ['-', '*', '+', '1.']
+let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
+
+" Preformatted text
+let s:markdown_syntax.rxPreStart = '```'
+let s:markdown_syntax.rxPreEnd = '```'
+
+" Math block
+let s:markdown_syntax.rxMathStart = '\$\$'
+let s:markdown_syntax.rxMathEnd = '\$\$'
+
+let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->'
+let s:markdown_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
+
+let s:markdown_syntax.header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
+let s:markdown_syntax.header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
+let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'.
+ \ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
+ \ '\%([[:punct:]]\|\s\|$\)\@='
+let s:markdown_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
+let s:markdown_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
+let s:markdown_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
+ \ '\([^:[:space:]]\+:\)*\(\s\|$\)'
diff --git a/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown_custom.vim b/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown_custom.vim
new file mode 100644
index 0000000..46f3ce1
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/syntax/vimwiki_markdown_custom.vim
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+function! s:add_target_syntax_ON(target, type)
+ let prefix0 = 'syntax match '.a:type.' `'
+ let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
+ let prefix1 = 'syntax match '.a:type.'T `'
+ let suffix1 = '` display contained'
+ execute prefix0. a:target. suffix0
+ execute prefix1. a:target. suffix1
+endfunction
+
+
+function! s:add_target_syntax_OFF(target, type)
+ let prefix0 = 'syntax match VimwikiNoExistsLink `'
+ let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
+ let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
+ let suffix1 = '` display contained'
+ execute prefix0. a:target. suffix0
+ execute prefix1. a:target. suffix1
+endfunction
+
+
+function! s:wrap_wikilink1_rx(target)
+ return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target.
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix')
+endfunction
+
+
+function! s:existing_mkd_refs()
+ return keys(vimwiki#markdown_base#scan_reflinks())
+endfunction
+
+
+function! s:highlight_existing_links()
+ " Wikilink1
+ " Conditional highlighting that depends on the existence of a wiki file or
+ " directory is only available for *schemeless* wiki links
+ " Links are set up upon BufEnter (see plugin/...)
+ let safe_links = '\%('.
+ \ vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikifiles')) .
+ \ '\%(#[^|]*\)\?\|#[^|]*\)'
+ " Wikilink1 Dirs set up upon BufEnter (see plugin/...)
+ let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs'))
+ " Ref links are cached
+ let safe_reflinks = vimwiki#base#file_pattern(s:existing_mkd_refs())
+
+
+ " match [URL][]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
+ \ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+ " match [DESCRIPTION][URL]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
+ \ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+
+ " match [DIRURL][]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
+ \ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+ " match [DESCRIPTION][DIRURL]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
+ \ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+
+ " match [MKDREF][]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
+ \ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+ " match [DESCRIPTION][MKDREF]
+ let target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
+ \ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
+endfunction
+
+
+" use max highlighting - could be quite slow if there are too many wikifiles
+if vimwiki#vars#get_wikilocal('maxhi')
+ " WikiLink
+ call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1')
+
+ " Subsequently, links verified on vimwiki's path are highlighted as existing
+ call s:highlight_existing_links()
+else
+ " Wikilink
+ call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1')
+endif
+
+
+" Weblink
+call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink1'), 'VimwikiWeblink1')
+
+
+" WikiLink
+" All remaining schemes are highlighted automatically
+let s:rxSchemes = '\%('.
+ \ vimwiki#vars#get_global('schemes') . '\|'.
+ \ vimwiki#vars#get_global('web_schemes1').
+ \ '\):'
+
+" a) match [nonwiki-scheme-URL]
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
+ \ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
+" b) match [DESCRIPTION][nonwiki-scheme-URL]
+let s:target = vimwiki#base#apply_template(
+ \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
+ \ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
+call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
+
+
+
+" Header levels, 1-6
+for s:i in range(1,6)
+ execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i).
+ \ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
+ \ 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
+endfor
+
+
+
+" concealed chars
+if exists("+conceallevel")
+ syntax conceal on
+endif
+
+syntax spell toplevel
+
+" VimwikiWikiLink1Char is for syntax markers (and also URL when a description
+" is present) and may be concealed
+let s:options = ' contained transparent contains=NONE'
+" conceal wikilink1
+execute 'syn match VimwikiWikiLink1Char /'.
+ \ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_prefix').'/'.s:options
+execute 'syn match VimwikiWikiLink1Char /'.
+ \ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_suffix').'/'.s:options
+execute 'syn match VimwikiWikiLink1Char /'.
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Prefix1').'/'.s:options
+execute 'syn match VimwikiWikiLink1Char /'.
+ \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Suffix1').'/'.s:options
+
+" conceal weblink1
+execute 'syn match VimwikiWeblink1Char "'.
+ \ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
+execute 'syn match VimwikiWeblink1Char "'.
+ \ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
+
+if exists("+conceallevel")
+ syntax conceal off
+endif
+
+
+
+" Tables
+syntax match VimwikiTableRow /^\s*|.\+|\s*$/
+ \ transparent contains=VimwikiCellSeparator,
+ \ VimwikiLinkT,
+ \ VimwikiWeblink1T,
+ \ VimwikiWikiLink1T,
+ \ VimwikiNoExistsLinkT,
+ \ VimwikiTodo,
+ \ VimwikiBoldT,
+ \ VimwikiItalicT,
+ \ VimwikiBoldItalicT,
+ \ VimwikiItalicBoldT,
+ \ VimwikiDelTextT,
+ \ VimwikiSuperScriptT,
+ \ VimwikiSubScriptT,
+ \ VimwikiCodeT,
+ \ VimwikiEqInT,
+ \ @Spell
+
+
+
+" syntax group highlighting
+hi def link VimwikiWeblink1 VimwikiLink
+hi def link VimwikiWeblink1T VimwikiLink
+
+hi def link VimwikiWikiLink1 VimwikiLink
+hi def link VimwikiWikiLink1T VimwikiLink
+
diff --git a/vim/.vim/plugged/vimwiki/syntax/vimwiki_media.vim b/vim/.vim/plugged/vimwiki/syntax/vimwiki_media.vim
new file mode 100644
index 0000000..6287c7c
--- /dev/null
+++ b/vim/.vim/plugged/vimwiki/syntax/vimwiki_media.vim
@@ -0,0 +1,85 @@
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki syntax file
+" Description: Defines mediaWiki syntax
+" Home: https://github.com/vimwiki/vimwiki/
+
+
+" see the comments in vimwiki_default.vim for some info about this file
+
+
+let s:media_syntax = g:vimwiki_syntax_variables['media']
+
+" text: $ equation_inline $
+let s:media_syntax.rxEqIn = '\$[^$`]\+\$'
+let s:media_syntax.char_eqin = '\$'
+
+" text: '''strong'''
+let s:media_syntax.rxBold = "'''[^']\\+'''"
+let s:media_syntax.char_bold = "'''"
+
+" text: ''emphasis''
+let s:media_syntax.rxItalic = "''[^']\\+''"
+let s:media_syntax.char_italic = "''"
+
+" text: '''''strong italic'''''
+let s:media_syntax.rxBoldItalic = "'''''[^']\\+'''''"
+let s:media_syntax.rxItalicBold = s:media_syntax.rxBoldItalic
+let s:media_syntax.char_bolditalic = "'''''"
+let s:media_syntax.char_italicbold = s:media_syntax.char_bolditalic
+
+" text: `code`
+let s:media_syntax.rxCode = '`[^`]\+`'
+let s:media_syntax.char_code = '`'
+
+" text: ~~deleted text~~
+let s:media_syntax.rxDelText = '\~\~[^~]\+\~\~'
+let s:media_syntax.char_deltext = '\~\~'
+
+" text: ^superscript^
+let s:media_syntax.rxSuperScript = '\^[^^]\+\^'
+let s:media_syntax.char_superscript = '^'
+
+" text: ,,subscript,,
+let s:media_syntax.rxSubScript = ',,[^,]\+,,'
+let s:media_syntax.char_subscript = ',,'
+
+" generic headers
+let s:media_syntax.rxH = '='
+let s:media_syntax.symH = 1
+
+
+
+" <hr>, horizontal rule
+let s:media_syntax.rxHR = '^-----*$'
+
+" Tables. Each line starts and ends with '|'; each cell is separated by '|'
+let s:media_syntax.rxTableSep = '|'
+
+" Lists
+let s:media_syntax.bullet_types = ['*', '#']
+let s:media_syntax.recurring_bullets = 1
+let s:media_syntax.number_types = []
+let s:media_syntax.list_markers = ['*', '#']
+let s:media_syntax.rxListDefine = '^\%(;\|:\)\s'
+
+" Preformatted text
+let s:media_syntax.rxPreStart = '<pre>'
+let s:media_syntax.rxPreEnd = '<\/pre>'
+
+" Math block
+let s:media_syntax.rxMathStart = '{{\$'
+let s:media_syntax.rxMathEnd = '}}\$'
+
+let s:media_syntax.rxComment = '^\s*%%.*$'
+let s:media_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
+
+let s:media_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
+let s:media_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
+let s:media_syntax.bold_search = "'''\\zs[^']\\+\\ze'''"
+let s:media_syntax.bold_match = '''''''__Text__'''''''
+" ^- this strange looking thing is equivalent to "'''__Text__'''" but since we later
+" want to call escape() on this string, we must keep it in single quotes
+let s:media_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
+let s:media_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
+let s:media_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
+ \ '\([^:[:space:]]\+:\)*\(\s\|$\)'
diff --git a/vim/.vim/plugged/wal.vim/LICENSE.md b/vim/.vim/plugged/wal.vim/LICENSE.md
new file mode 100644
index 0000000..e17de65
--- /dev/null
+++ b/vim/.vim/plugged/wal.vim/LICENSE.md
@@ -0,0 +1,9 @@
+The MIT License (MIT)
+
+Copyright (c) 2016-2017 Dylan Araps
+
+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.
diff --git a/vim/.vim/plugged/wal.vim/README.md b/vim/.vim/plugged/wal.vim/README.md
new file mode 100644
index 0000000..09b52ce
--- /dev/null
+++ b/vim/.vim/plugged/wal.vim/README.md
@@ -0,0 +1,15 @@
+# wal.vim
+
+[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)
+
+A vim colorscheme for use with **[pywal](https://github.com/dylanaraps/pywal)**.
+
+
+## Installation
+
+```vim
+" Using plug
+Plug 'dylanaraps/wal.vim'
+
+colorscheme wal
+```
diff --git a/vim/.vim/plugged/wal.vim/autoload/airline/themes/wal.vim b/vim/.vim/plugged/wal.vim/autoload/airline/themes/wal.vim
new file mode 100644
index 0000000..c334ee5
--- /dev/null
+++ b/vim/.vim/plugged/wal.vim/autoload/airline/themes/wal.vim
@@ -0,0 +1,62 @@
+" wal Airline
+let g:airline#themes#wal#palette = {}
+
+" Normal mode
+let s:N = [ '', '', 232, 4, 'BOLD' ]
+let s:N2 = [ '', '', 4, 0, 'BOLD' ]
+
+" Insert mode
+let s:I = [ '', '', 232, 2, 'BOLD' ]
+let s:I2 = [ '', '', 2, 0, 'BOLD' ]
+
+" Visual mode
+let s:V = [ '', '', 232, 1, 'BOLD' ]
+let s:V2 = [ '', '', 1, 0, 'BOLD' ]
+
+" Replace mode
+let s:R = [ '', '', 232, 5, 'BOLD' ]
+let s:R2 = [ '', '', 5, 0, 'BOLD' ]
+
+let g:airline#themes#wal#palette.normal = airline#themes#generate_color_map(s:N, s:N2, s:N2)
+let g:airline#themes#wal#palette.insert = airline#themes#generate_color_map(s:I, s:I2, s:I2)
+let g:airline#themes#wal#palette.visual = airline#themes#generate_color_map(s:V, s:V2, s:V2)
+let g:airline#themes#wal#palette.replace = airline#themes#generate_color_map(s:R, s:R2, s:R2)
+
+let g:airline#themes#wal#palette.accents = { 'red': [ '', '', 0, 2, 'BOLD' ] }
+
+" Inactive mode
+let s:IN1 = [ '', '', 0, 8 ]
+let s:IN2 = [ '', '', 0, 0 ]
+
+let s:IA = [ s:IN1[1], s:IN2[1], s:IN1[3], s:IN2[3], '' ]
+let g:airline#themes#wal#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
+
+" Warnings
+let s:WI = [ '', '', 232, 1, 'BOLD' ]
+let g:airline#themes#wal#palette.normal.airline_warning = s:WI
+let g:airline#themes#wal#palette.insert.airline_warning = s:WI
+let g:airline#themes#wal#palette.visual.airline_warning = s:WI
+let g:airline#themes#wal#palette.replace.airline_warning = s:WI
+
+let g:airline#themes#wal#palette.normal.airline_error = s:WI
+let g:airline#themes#wal#palette.insert.airline_error = s:WI
+let g:airline#themes#wal#palette.visual.airline_error = s:WI
+let g:airline#themes#wal#palette.replace.airline_error = s:WI
+
+" Tabline
+let g:airline#themes#wal#palette.tabline = {
+ \ 'airline_tab': [ '', '', 4, 0, 'BOLD' ],
+ \ 'airline_tabsel': [ '', '', 232, 4, 'BOLD' ],
+ \ 'airline_tabtype': [ '', '', 232, 4, 'BOLD' ],
+ \ 'airline_tabfill': [ '', '', 4, 0, 'BOLD' ],
+ \ 'airline_tabmod': [ '', '', 232, 4, 'BOLD' ]
+\ }
+
+if !get(g:, 'loaded_ctrlp', 0)
+ finish
+endif
+
+let g:airline#themes#wal#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
+ \ [ '', '', 0, 0, 'BOLD' ],
+ \ [ '', '', 0, 0, 'BOLD' ],
+ \ [ '', '', 0, 0, 'BOLD' ] )
diff --git a/vim/.vim/plugged/wal.vim/autoload/lightline/colorscheme/wal.vim b/vim/.vim/plugged/wal.vim/autoload/lightline/colorscheme/wal.vim
new file mode 100644
index 0000000..74dde60
--- /dev/null
+++ b/vim/.vim/plugged/wal.vim/autoload/lightline/colorscheme/wal.vim
@@ -0,0 +1,36 @@
+" =============================================================================
+" Filename: autoload/lightline/colorscheme/wal.vim
+" Author: Dylan Araps
+" License: MIT License
+" Last Change: 2017/10/28 12:21:04.
+" =============================================================================
+
+let s:black = [ '', 232 ]
+let s:gray = [ '', 0 ]
+let s:white = [ '', 7 ]
+let s:darkblue = [ '', 4 ]
+let s:cyan = [ '', 6 ]
+let s:green = [ '', 2 ]
+let s:orange = [ '', 5 ]
+let s:purple = [ '', 1 ]
+let s:red = [ '', 1 ]
+let s:yellow = [ '', 3 ]
+
+let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
+let s:p.normal.left = [ [ s:black, s:purple ], [ s:cyan, s:gray ] ]
+let s:p.normal.right = [ [ s:black, s:purple ], [ s:black, s:darkblue ] ]
+let s:p.inactive.right = [ [ s:black, s:gray ], [ s:white, s:black ] ]
+let s:p.inactive.left = [ [ s:cyan, s:black ], [ s:white, s:black ] ]
+let s:p.insert.left = [ [ s:black, s:green ], [ s:cyan, s:gray ] ]
+let s:p.replace.left = [ [ s:black, s:red ], [ s:cyan, s:gray ] ]
+let s:p.visual.left = [ [ s:black, s:orange ], [ s:cyan, s:gray ] ]
+let s:p.normal.middle = [ [ s:white, s:gray ] ]
+let s:p.inactive.middle = [ [ s:white, s:gray ] ]
+let s:p.tabline.left = [ [ s:darkblue, s:gray ] ]
+let s:p.tabline.tabsel = [ [ s:cyan, s:black ] ]
+let s:p.tabline.middle = [ [ s:darkblue, s:gray ] ]
+let s:p.tabline.right = copy(s:p.normal.right)
+let s:p.normal.error = [ [ s:red, s:black ] ]
+let s:p.normal.warning = [ [ s:yellow, s:black ] ]
+
+let g:lightline#colorscheme#wal#palette = lightline#colorscheme#flatten(s:p)
diff --git a/vim/.vim/plugged/wal.vim/colors/wal.vim b/vim/.vim/plugged/wal.vim/colors/wal.vim
new file mode 100644
index 0000000..53390be
--- /dev/null
+++ b/vim/.vim/plugged/wal.vim/colors/wal.vim
@@ -0,0 +1,195 @@
+" wal.vim -- Vim color scheme.
+" Author: Dylan Araps
+" Webpage: https://github.com/dylanaraps/wal
+" Description: A colorscheme that uses your terminal colors, made to work with 'wal'.
+
+hi clear
+set background=dark
+
+if exists('syntax_on')
+ syntax reset
+endif
+
+" Colorscheme name
+let g:colors_name = 'wal'
+
+" highlight groups {{{
+
+" set t_Co=16
+hi Normal ctermbg=NONE ctermfg=7
+hi NonText ctermbg=NONE ctermfg=0
+hi Comment ctermbg=NONE ctermfg=8
+hi Constant ctermbg=NONE ctermfg=3
+hi Error ctermbg=1 ctermfg=7
+hi Identifier ctermbg=NONE ctermfg=1 cterm=BOLD
+hi Ignore ctermbg=8 ctermfg=0
+hi PreProc ctermbg=NONE ctermfg=3
+hi Special ctermbg=NONE ctermfg=6
+hi Statement ctermbg=NONE ctermfg=1
+hi String ctermbg=NONE ctermfg=2
+hi Number ctermbg=NONE ctermfg=3
+hi Todo ctermbg=2 ctermfg=0
+hi Type ctermbg=NONE ctermfg=3
+hi Underlined ctermbg=NONE ctermfg=1 cterm=underline
+hi StatusLine ctermbg=7 ctermfg=0
+hi StatusLineNC ctermbg=NONE ctermfg=NONE
+hi TabLine ctermbg=NONE ctermfg=8
+hi TabLineFill ctermbg=NONE ctermfg=8
+hi TabLineSel ctermbg=4 ctermfg=0
+hi TermCursorNC ctermbg=3 ctermfg=0
+hi VertSplit ctermbg=NONE ctermfg=NONE
+hi Title ctermbg=NONE ctermfg=4
+hi CursorLine ctermbg=8 ctermfg=0
+hi LineNr ctermbg=NONE ctermfg=8
+hi CursorLineNr ctermbg=NONE ctermfg=8
+hi helpLeadBlank ctermbg=NONE ctermfg=7
+hi helpNormal ctermbg=NONE ctermfg=7
+hi Visual ctermbg=0 ctermfg=15 cterm=reverse term=reverse
+hi VisualNOS ctermbg=NONE ctermfg=1
+hi Pmenu ctermbg=8 ctermfg=7
+hi PmenuSbar ctermbg=6 ctermfg=7
+hi PmenuSel ctermbg=4 ctermfg=0
+hi PmenuThumb ctermbg=8 ctermfg=8
+hi FoldColumn ctermbg=NONE ctermfg=7
+hi Folded ctermbg=NONE ctermfg=8
+hi WildMenu ctermbg=2 ctermfg=0
+hi SpecialKey ctermbg=NONE ctermfg=8
+hi DiffAdd ctermbg=NONE ctermfg=2
+hi DiffChange ctermbg=NONE ctermfg=8
+hi DiffDelete ctermbg=NONE ctermfg=1
+hi DiffText ctermbg=NONE ctermfg=4
+hi IncSearch ctermbg=3 ctermfg=0
+hi Search ctermbg=3 ctermfg=0
+hi Directory ctermbg=NONE ctermfg=4
+hi MatchParen ctermbg=8 ctermfg=0
+hi ColorColumn ctermbg=4 ctermfg=0
+hi signColumn ctermbg=NONE ctermfg=4
+hi ErrorMsg ctermbg=NONE ctermfg=8
+hi ModeMsg ctermbg=NONE ctermfg=2
+hi MoreMsg ctermbg=NONE ctermfg=2
+hi Question ctermbg=NONE ctermfg=4
+hi WarningMsg ctermbg=1 ctermfg=0
+hi Cursor ctermbg=NONE ctermfg=8
+hi Structure ctermbg=NONE ctermfg=5
+hi CursorColumn ctermbg=8 ctermfg=7
+hi ModeMsg ctermbg=NONE ctermfg=7
+hi SpellBad ctermbg=NONE ctermfg=1 cterm=underline
+hi SpellCap ctermbg=NONE ctermfg=4 cterm=underline
+hi SpellLocal ctermbg=NONE ctermfg=5 cterm=underline
+hi SpellRare ctermbg=NONE ctermfg=6 cterm=underline
+hi Boolean ctermbg=NONE ctermfg=5
+hi Character ctermbg=NONE ctermfg=1
+hi Conditional ctermbg=NONE ctermfg=5
+hi Define ctermbg=NONE ctermfg=5
+hi Delimiter ctermbg=NONE ctermfg=5
+hi Float ctermbg=NONE ctermfg=5
+hi Include ctermbg=NONE ctermfg=4
+hi Keyword ctermbg=NONE ctermfg=5
+hi Label ctermbg=NONE ctermfg=3
+hi Operator ctermbg=NONE ctermfg=7
+hi Repeat ctermbg=NONE ctermfg=3
+hi SpecialChar ctermbg=NONE ctermfg=5
+hi Tag ctermbg=NONE ctermfg=3
+hi Typedef ctermbg=NONE ctermfg=3
+hi vimUserCommand ctermbg=NONE ctermfg=1 cterm=BOLD
+ hi link vimMap vimUserCommand
+ hi link vimLet vimUserCommand
+ hi link vimCommand vimUserCommand
+ hi link vimFTCmd vimUserCommand
+ hi link vimAutoCmd vimUserCommand
+ hi link vimNotFunc vimUserCommand
+hi vimNotation ctermbg=NONE ctermfg=4
+hi vimMapModKey ctermbg=NONE ctermfg=4
+hi vimBracket ctermbg=NONE ctermfg=7
+hi vimCommentString ctermbg=NONE ctermfg=8
+hi htmlLink ctermbg=NONE ctermfg=1 cterm=underline
+hi htmlBold ctermbg=NONE ctermfg=3 cterm=BOLD
+hi htmlItalic ctermbg=NONE ctermfg=5
+hi htmlEndTag ctermbg=NONE ctermfg=7
+hi htmlTag ctermbg=NONE ctermfg=7
+hi htmlTagName ctermbg=NONE ctermfg=1 cterm=BOLD
+hi htmlH1 ctermbg=NONE ctermfg=7
+ hi link htmlH2 htmlH1
+ hi link htmlH3 htmlH1
+ hi link htmlH4 htmlH1
+ hi link htmlH5 htmlH1
+ hi link htmlH6 htmlH1
+hi cssMultiColumnAttr ctermbg=NONE ctermfg=2
+ hi link cssFontAttr cssMultiColumnAttr
+ hi link cssFlexibleBoxAttr cssMultiColumnAttr
+hi cssBraces ctermbg=NONE ctermfg=7
+ hi link cssAttrComma cssBraces
+hi cssValueLength ctermbg=NONE ctermfg=7
+hi cssUnitDecorators ctermbg=NONE ctermfg=7
+hi cssValueNumber ctermbg=NONE ctermfg=7
+ hi link cssValueLength cssValueNumber
+hi cssNoise ctermbg=NONE ctermfg=8
+hi cssTagName ctermbg=NONE ctermfg=1
+hi cssFunctionName ctermbg=NONE ctermfg=4
+hi scssSelectorChar ctermbg=NONE ctermfg=7
+hi scssAttribute ctermbg=NONE ctermfg=7
+ hi link scssDefinition cssNoise
+hi sassidChar ctermbg=NONE ctermfg=1
+hi sassClassChar ctermbg=NONE ctermfg=5
+hi sassInclude ctermbg=NONE ctermfg=5
+hi sassMixing ctermbg=NONE ctermfg=5
+hi sassMixinName ctermbg=NONE ctermfg=4
+hi javaScript ctermbg=NONE ctermfg=7
+hi javaScriptBraces ctermbg=NONE ctermfg=7
+hi javaScriptNumber ctermbg=NONE ctermfg=5
+hi markdownH1 ctermbg=NONE ctermfg=7
+ hi link markdownH2 markdownH1
+ hi link markdownH3 markdownH1
+ hi link markdownH4 markdownH1
+ hi link markdownH5 markdownH1
+ hi link markdownH6 markdownH1
+hi markdownAutomaticLink ctermbg=NONE ctermfg=2 cterm=underline
+ hi link markdownUrl markdownAutomaticLink
+hi markdownError ctermbg=NONE ctermfg=7
+hi markdownCode ctermbg=NONE ctermfg=3
+hi markdownCodeBlock ctermbg=NONE ctermfg=3
+hi markdownCodeDelimiter ctermbg=NONE ctermfg=5
+hi markdownItalic cterm=Italic
+hi markdownBold cterm=Bold
+hi xdefaultsValue ctermbg=NONE ctermfg=7
+hi rubyInclude ctermbg=NONE ctermfg=4
+hi rubyDefine ctermbg=NONE ctermfg=5
+hi rubyFunction ctermbg=NONE ctermfg=4
+hi rubyStringDelimiter ctermbg=NONE ctermfg=2
+hi rubyInteger ctermbg=NONE ctermfg=3
+hi rubyAttribute ctermbg=NONE ctermfg=4
+hi rubyConstant ctermbg=NONE ctermfg=3
+hi rubyInterpolation ctermbg=NONE ctermfg=2
+hi rubyInterpolationDelimiter ctermbg=NONE ctermfg=3
+hi rubyRegexp ctermbg=NONE ctermfg=6
+hi rubySymbol ctermbg=NONE ctermfg=2
+hi rubyTodo ctermbg=NONE ctermfg=8
+hi rubyRegexpAnchor ctermbg=NONE ctermfg=7
+ hi link rubyRegexpQuantifier rubyRegexpAnchor
+hi pythonOperator ctermbg=NONE ctermfg=5
+hi pythonFunction ctermbg=NONE ctermfg=4
+hi pythonRepeat ctermbg=NONE ctermfg=5
+hi pythonStatement ctermbg=NONE ctermfg=1 cterm=Bold
+hi pythonBuiltIn ctermbg=NONE ctermfg=4
+hi phpMemberSelector ctermbg=NONE ctermfg=7
+hi phpComparison ctermbg=NONE ctermfg=7
+hi phpParent ctermbg=NONE ctermfg=7
+hi cOperator ctermbg=NONE ctermfg=6
+hi cPreCondit ctermbg=NONE ctermfg=5
+hi SignifySignAdd ctermbg=NONE ctermfg=2
+hi SignifySignChange ctermbg=NONE ctermfg=4
+hi SignifySignDelete ctermbg=NONE ctermfg=1
+hi NERDTreeDirSlash ctermbg=NONE ctermfg=4
+hi NERDTreeExecFile ctermbg=NONE ctermfg=7
+hi ALEErrorSign ctermbg=NONE ctermfg=1
+hi ALEWarningSign ctermbg=NONE ctermfg=3
+hi ALEError ctermbg=NONE ctermfg=1
+hi ALEWarning ctermbg=NONE ctermfg=3
+
+" }}}
+
+" Plugin options {{{
+
+let g:limelight_conceal_ctermfg = 8
+
+" }}}
diff --git a/vim/.vim/spell/en.utf-8.add b/vim/.vim/spell/en.utf-8.add
new file mode 100644
index 0000000..dcbec26
--- /dev/null
+++ b/vim/.vim/spell/en.utf-8.add
@@ -0,0 +1,12 @@
+armour
+Pradyumn
+Damani
+derivational
+embiggen
+affixation
+compositionality
+compositional
+superconducts
+dimensionality
+technofossil
+convolutional
diff --git a/vim/.vim/spell/en.utf-8.add.spl b/vim/.vim/spell/en.utf-8.add.spl
new file mode 100644
index 0000000..78374bf
--- /dev/null
+++ b/vim/.vim/spell/en.utf-8.add.spl
Binary files differ
diff --git a/vim/.vim/spell/es.utf-8.spl b/vim/.vim/spell/es.utf-8.spl
new file mode 100644
index 0000000..62d848d
--- /dev/null
+++ b/vim/.vim/spell/es.utf-8.spl
Binary files differ
diff --git a/vim/.vim/spell/es.utf-8.sug b/vim/.vim/spell/es.utf-8.sug
new file mode 100644
index 0000000..9064321
--- /dev/null
+++ b/vim/.vim/spell/es.utf-8.sug
Binary files differ
diff --git a/vim/.vim/syntax/i3.vim b/vim/.vim/syntax/i3.vim
new file mode 100644
index 0000000..fb93437
--- /dev/null
+++ b/vim/.vim/syntax/i3.vim
@@ -0,0 +1,110 @@
+" Vim syntax file
+" Language: i3-wm config file
+" Maintainer: Emanuel Guével
+" Latest Revision: 16 October 2012
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Symbols
+syn match i3Operators "+\|→"
+syn match i3ChainDelimiter ";"
+
+syn match i3Var "\$\w\+"
+
+" Key modifiers
+syn keyword i3KeyModifier Shift Control Mod1 Mod2 Mod3 Mod4 Mod5
+
+" Strings
+syn region i3SimpleString keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var
+syn match i3QuotedString '"[^"]\+"' contained
+syn cluster i3String contains=i3SimpleString,i3QuotedString
+
+" Config commands
+syn keyword i3ConfigCommand bind bindcode bindsym assign new_window popup_during_fullscreen font floating_modifier floating_minimum_size floating_maximum_size default_orientation workspace_layout for_window focus_folows_mouse bar position colors output tray_output workspace_buttons
+syn match i3IpcSocket "ipc-socket" nextgroup=@i3String skipwhite
+
+" Command keywords
+syn keyword i3Command exit reload restart kill fullscreen global layout border focus move open split append_layout mark resize grow shrink restore show
+syn keyword i3Param 1pixel default stacked tabbed normal none tiling stacking floating enable disable up down horizontal vertical both up down left right parent child px or ppt leave_fullscreen toggle mode_toggle scratchpad width height top bottom client dock hide primary yes no all window container to
+syn keyword i3WsSpecialParam next prev
+
+" Exec commands
+syn region i3ExecCommand keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var
+syn match i3QuotedExecCommand '"[^"]\+"' contained
+syn keyword i3ExecKeyword exec exec_always nextgroup=i3QuotedExecCommand,i3ExecCommand skipwhite
+
+" Status command
+syn match i3StatusCommand ".*$" contained
+syn keyword i3StatusCommandKeyword status_command nextgroup=i3StatusCommand skipwhite
+
+" Font statement
+syn keyword i3FontStatement font nextgroup=@i3String skipwhite
+
+" Set statement
+syn match i3SetVar "\$\w\+" contained nextgroup=@i3String skipwhite
+syn keyword i3SetKeyword set nextgroup=i3SetVar skipwhite
+
+" Workspaces
+syn keyword i3WsKeyword workspace nextgroup=i3WsSpecialParam,@i3String skipwhite
+
+" Mode
+syn keyword i3ModeKeyword mode nextgroup=@i3String skipwhite
+
+" Comments
+syn keyword i3Todo contained TODO FIXME XXX NOTE
+syn match i3Comment "^\s*#.*$" contains=i3Todo
+
+" Error (at end of line)
+syn match i3Error ".*$" contained
+
+" Hex color code
+syn match i3ColorLast "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Error skipwhite
+syn match i3Color2nd "#[0-9a-fA-F]\{6\}" contained nextgroup=i3ColorLast skipwhite
+syn match i3Color1st "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Color2nd skipwhite
+
+syn match i3ColorDef1 "client\.background\|statusline\|background\|separator" nextgroup=i3ColorLast skipwhite
+syn match i3ColorDef3 "client\.\(focused_inactive\|focused\|unfocused\|urgent\)\|inactive_workspace\|urgent_workspace\|focused_workspace\|active_workspace" nextgroup=i3Color1st skipwhite
+
+highlight link i3ChainDelimiter Operator
+highlight link i3Operators Operator
+
+highlight link i3ExecCommand Special
+highlight link i3QuotedExecCommand Special
+highlight link i3StatusCommand Special
+
+highlight link i3Param Constant
+highlight link i3Color1st Constant
+highlight link i3Color2nd Constant
+highlight link i3ColorLast Constant
+highlight link i3WsSpecialParam Constant
+
+highlight link i3Var Identifier
+highlight link i3SetVar Identifier
+
+highlight link i3KeyModifier Function
+
+highlight link i3SimpleString String
+highlight link i3QuotedString String
+highlight link i3WsName String
+highlight link i3QuotedWsName String
+highlight link i3SetValue String
+highlight link i3Font String
+
+highlight link i3ExecKeyword Keyword
+highlight link i3Command Keyword
+highlight link i3WsKeyword Keyword
+
+highlight link i3ColorDef1 Define
+highlight link i3ColorDef3 Define
+highlight link i3ConfigCommand Define
+highlight link i3IpcSocket Define
+highlight link i3SetKeyword Define
+highlight link i3ModeKeyword Define
+highlight link i3FontStatement Define
+highlight link i3StatusCommandKeyword Define
+
+highlight link i3Todo Todo
+highlight link i3Comment Comment
+highlight link i3Error Error
diff --git a/vim/.vim/view/~=+dotfiles=+README.md= b/vim/.vim/view/~=+dotfiles=+README.md=
new file mode 100644
index 0000000..4a1a530
--- /dev/null
+++ b/vim/.vim/view/~=+dotfiles=+README.md=
@@ -0,0 +1,235 @@
+let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
+argglobal
+let s:cpo_save=&cpo
+set cpo&vim
+inoremap <buffer> <expr> <S-Tab> vimwiki#tbl#kbd_shift_tab()
+inoremap <buffer> <silent> <S-CR> :VimwikiReturn 2 2
+nmap <buffer> <silent>  <Plug>VimwikiNextLink
+vmap <buffer> <silent>  <Plug>VimwikiNormalizeLinkVisualCR
+nmap <buffer> <silent>  <Plug>VimwikiFollowLink
+vmap <buffer> <silent> + <Plug>VimwikiNormalizeLinkVisual
+nmap <buffer> <silent> + <Plug>VimwikiNormalizeLink
+nmap <buffer> ,hp <Plug>GitGutterPreviewHunk
+nmap <buffer> ,hu <Plug>GitGutterUndoHunk
+nmap <buffer> ,hs <Plug>GitGutterStageHunk
+nmap <buffer> <silent> ,wr <Plug>VimwikiRenameLink
+nmap <buffer> <silent> ,wd <Plug>VimwikiDeleteLink
+nmap <buffer> ,whh <Plug>Vimwiki2HTMLBrowse
+nmap <buffer> ,wh <Plug>Vimwiki2HTML
+nmap <buffer> <silent> - <Plug>VimwikiRemoveHeaderLevel
+nmap <buffer> <silent> <D-CR> <Plug>VimwikiTabnewLink
+nmap <buffer> <silent> = <Plug>VimwikiAddHeaderLevel
+nnoremap <buffer> <silent> O :call vimwiki#lst#kbd_O()
+nmap <buffer> [c <Plug>GitGutterPrevHunk
+nmap <buffer> <silent> [= <Plug>VimwikiGoToPrevSiblingHeader
+nmap <buffer> <silent> [[ <Plug>VimwikiGoToPrevHeader
+nmap <buffer> <silent> [u <Plug>VimwikiGoToParentHeader
+nmap <buffer> ]c <Plug>GitGutterNextHunk
+nmap <buffer> <silent> ]= <Plug>VimwikiGoToNextSiblingHeader
+nmap <buffer> <silent> ]] <Plug>VimwikiGoToNextHeader
+nmap <buffer> <silent> ]u <Plug>VimwikiGoToParentHeader
+vnoremap <buffer> <silent> al :call vimwiki#lst#TO_list_item(0, 1)
+onoremap <buffer> <silent> al :call vimwiki#lst#TO_list_item(0, 0)
+vnoremap <buffer> <silent> ac :call vimwiki#base#TO_table_col(0, 1)
+onoremap <buffer> <silent> ac :call vimwiki#base#TO_table_col(0, 0)
+vnoremap <buffer> <silent> a\ :call vimwiki#base#TO_table_cell(0, 1)
+onoremap <buffer> <silent> a\ :call vimwiki#base#TO_table_cell(0, 0)
+vnoremap <buffer> <silent> aH :call vimwiki#base#TO_header(0, 1, v:count1)
+onoremap <buffer> <silent> aH :call vimwiki#base#TO_header(0, 1, v:count1)
+vnoremap <buffer> <silent> ah :call vimwiki#base#TO_header(0, 0, v:count1)
+onoremap <buffer> <silent> ah :call vimwiki#base#TO_header(0, 0, v:count1)
+nnoremap <buffer> gww :VimwikiTableAlignW
+nnoremap <buffer> gqq :VimwikiTableAlignQ
+noremap <buffer> <silent> gL1 :VimwikiChangeSymbolInListTo 1.
+noremap <buffer> <silent> gl1 :VimwikiChangeSymbolTo 1.
+noremap <buffer> <silent> gL+ :VimwikiChangeSymbolInListTo +
+noremap <buffer> <silent> gl+ :VimwikiChangeSymbolTo +
+noremap <buffer> <silent> gL\* :VimwikiChangeSymbolInListTo \*
+noremap <buffer> <silent> gl\* :VimwikiChangeSymbolTo \*
+noremap <buffer> <silent> gL- :VimwikiChangeSymbolInListTo -
+noremap <buffer> <silent> gl- :VimwikiChangeSymbolTo -
+map <buffer> <silent> gL <Plug>VimwikiRemoveCBInList
+map <buffer> <silent> gl <Plug>VimwikiRemoveSingleCB
+map <buffer> <silent> gLL <Plug>VimwikiIncreaseLvlWholeItem
+map <buffer> <silent> gLl <Plug>VimwikiIncreaseLvlWholeItem
+map <buffer> <silent> gLH <Plug>VimwikiDecreaseLvlWholeItem
+map <buffer> <silent> gLh <Plug>VimwikiDecreaseLvlWholeItem
+map <buffer> <silent> gll <Plug>VimwikiIncreaseLvlSingleItem
+map <buffer> <silent> glh <Plug>VimwikiDecreaseLvlSingleItem
+nmap <buffer> <silent> gLR <Plug>VimwikiRenumberAllLists
+nmap <buffer> <silent> gLr <Plug>VimwikiRenumberAllLists
+nmap <buffer> <silent> glr <Plug>VimwikiRenumberList
+vmap <buffer> <silent> glp <Plug>VimwikiDecrementListItem
+nmap <buffer> <silent> glp <Plug>VimwikiDecrementListItem
+vmap <buffer> <silent> gln <Plug>VimwikiIncrementListItem
+nmap <buffer> <silent> gln <Plug>VimwikiIncrementListItem
+vmap <buffer> <silent> glx <Plug>VimwikiToggleRejectedListItem
+nmap <buffer> <silent> glx <Plug>VimwikiToggleRejectedListItem
+vnoremap <buffer> <silent> il :call vimwiki#lst#TO_list_item(1, 1)
+onoremap <buffer> <silent> il :call vimwiki#lst#TO_list_item(1, 0)
+vnoremap <buffer> <silent> ic :call vimwiki#base#TO_table_col(1, 1)
+onoremap <buffer> <silent> ic :call vimwiki#base#TO_table_col(1, 0)
+vnoremap <buffer> <silent> i\ :call vimwiki#base#TO_table_cell(1, 1)
+onoremap <buffer> <silent> i\ :call vimwiki#base#TO_table_cell(1, 0)
+vnoremap <buffer> <silent> iH :call vimwiki#base#TO_header(1, 1, v:count1)
+onoremap <buffer> <silent> iH :call vimwiki#base#TO_header(1, 1, v:count1)
+vnoremap <buffer> <silent> ih :call vimwiki#base#TO_header(1, 0, v:count1)
+onoremap <buffer> <silent> ih :call vimwiki#base#TO_header(1, 0, v:count1)
+nnoremap <buffer> <silent> o :call vimwiki#lst#kbd_o()
+nnoremap <buffer> <silent> <Plug>VimwikiGoToPrevSiblingHeader :call vimwiki#base#goto_sibling(-1)
+nnoremap <buffer> <silent> <Plug>VimwikiGoToNextSiblingHeader :call vimwiki#base#goto_sibling(+1)
+nnoremap <buffer> <silent> <Plug>VimwikiGoToPrevHeader :call vimwiki#base#goto_prev_header()
+nnoremap <buffer> <silent> <Plug>VimwikiGoToNextHeader :call vimwiki#base#goto_next_header()
+nnoremap <buffer> <silent> <Plug>VimwikiGoToParentHeader :call vimwiki#base#goto_parent_header()
+nnoremap <buffer> <silent> <Plug>VimwikiRemoveHeaderLevel :call vimwiki#base#RemoveHeaderLevel()
+nnoremap <buffer> <silent> <Plug>VimwikiAddHeaderLevel :call vimwiki#base#AddHeaderLevel()
+nmap <buffer> <silent> <M-Right> <Plug>VimwikiTableMoveColumnRight
+nmap <buffer> <silent> <M-Left> <Plug>VimwikiTableMoveColumnLeft
+vmap <buffer> <silent> <Nul> <Plug>VimwikiToggleListItem
+nmap <buffer> <silent> <Nul> <Plug>VimwikiToggleListItem
+vmap <buffer> <silent> <C-Space> <Plug>VimwikiToggleListItem
+nmap <buffer> <silent> <C-Space> <Plug>VimwikiToggleListItem
+nmap <buffer> <silent> <C-Up> <Plug>VimwikiDiaryPrevDay
+nmap <buffer> <silent> <C-Down> <Plug>VimwikiDiaryNextDay
+nmap <buffer> <silent> <S-Tab> <Plug>VimwikiPrevLink
+nmap <buffer> <silent> <BS> <Plug>VimwikiGoBackLink
+nmap <buffer> <silent> <C-S-CR> <Plug>VimwikiTabnewLink
+nmap <buffer> <silent> <C-CR> <Plug>VimwikiVSplitLink
+nmap <buffer> <silent> <S-CR> <Plug>VimwikiSplitLink
+imap <buffer> <silent>  <Plug>VimwikiDecreaseLvlSingleItem
+inoremap <buffer> <expr>  vimwiki#tbl#kbd_tab()
+imap <buffer> <silent>   <Plug>VimwikiListToggle
+imap <buffer> <silent>   <Plug>VimwikiListPrevSymbol
+imap <buffer> <silent>  <NL> <Plug>VimwikiListNextSymbol
+inoremap <buffer> <silent>  :VimwikiReturn 1 5
+imap <buffer> <silent>  <Plug>VimwikiIncreaseLvlSingleItem
+let &cpo=s:cpo_save
+unlet s:cpo_save
+setlocal keymap=
+setlocal noarabic
+setlocal autoindent
+setlocal backupcopy=
+setlocal balloonexpr=
+setlocal nobinary
+setlocal nobreakindent
+setlocal breakindentopt=
+setlocal bufhidden=
+setlocal buflisted
+setlocal buftype=
+setlocal nocindent
+setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e
+setlocal cinoptions=
+setlocal cinwords=if,else,while,do,for,switch
+setlocal colorcolumn=
+setlocal comments=
+setlocal commentstring=%%%s
+setlocal complete=.,w,b,u,t,i
+setlocal concealcursor=
+setlocal conceallevel=2
+setlocal completefunc=
+setlocal nocopyindent
+setlocal cryptmethod=
+setlocal nocursorbind
+setlocal nocursorcolumn
+setlocal nocursorline
+setlocal define=
+setlocal dictionary=
+setlocal nodiff
+setlocal equalprg=
+setlocal errorformat=
+setlocal noexpandtab
+if &filetype != 'vimwiki'
+setlocal filetype=vimwiki
+endif
+setlocal fixendofline
+setlocal foldcolumn=0
+setlocal foldenable
+setlocal foldexpr=0
+setlocal foldignore=#
+setlocal foldlevel=0
+setlocal foldmarker={{{,}}}
+setlocal foldmethod=manual
+setlocal foldminlines=1
+setlocal foldnestmax=20
+setlocal foldtext=foldtext()
+setlocal formatexpr=
+setlocal formatoptions=tqn
+setlocal formatlistpat=^\\s*\\%(\\(-\\|\\*\\|+\\)\\|\\(\\C\\%(\\d\\+\\.\\)\\)\\)\\s\\+\\%(\\[\\([\ .oOX-]\\)\\]\\s\\)\\?
+setlocal formatprg=
+setlocal grepprg=
+setlocal iminsert=0
+setlocal imsearch=-1
+setlocal include=
+setlocal includeexpr=
+setlocal indentexpr=
+setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e
+setlocal noinfercase
+setlocal iskeyword=@,48-57,_,192-255
+setlocal keywordprg=
+setlocal nolinebreak
+setlocal nolisp
+setlocal lispwords=
+setlocal list
+setlocal makeencoding=
+setlocal makeprg=
+setlocal matchpairs=(:),{:},[:]
+setlocal modeline
+setlocal modifiable
+setlocal nrformats=bin,octal,hex
+setlocal number
+setlocal numberwidth=4
+setlocal omnifunc=Complete_wikifiles
+setlocal path=
+setlocal nopreserveindent
+setlocal nopreviewwindow
+setlocal quoteescape=\\
+setlocal noreadonly
+setlocal norelativenumber
+setlocal norightleft
+setlocal rightleftcmd=search
+setlocal noscrollbind
+setlocal scrolloff=-1
+setlocal shiftwidth=8
+setlocal noshortname
+setlocal sidescrolloff=-1
+setlocal signcolumn=auto
+setlocal nosmartindent
+setlocal softtabstop=0
+setlocal nospell
+setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
+setlocal spellfile=
+setlocal spelllang=en
+setlocal statusline=%{lightline#link()}%#LightlineLeft_active_0#%(\ %{lightline#mode()}\ %)%{(&paste)?\"|\":\"\"}%(\ %{&paste?\"PASTE\":\"\"}\ %)%#LightlineLeft_active_0_1#%#LightlineLeft_active_1#%(\ %R\ %)%{(&readonly)&&(1||(&modified||!&modifiable))?\"|\":\"\"}%(\ %t\ %)%{(&modified||!&modifiable)?\"|\":\"\"}%(\ %M\ %)%#LightlineLeft_active_1_2#%#LightlineMiddle_active#%=%#LightlineRight_active_2_3#%#LightlineRight_active_2#%(\ %{&ff}\ %)%{1?\"|\":\"\"}%(\ %{&fenc!=#\"\"?&fenc:&enc}\ %)%#LightlineRight_active_1_2#%#LightlineRight_active_1#%(\ %3p%%\ %)%#LightlineRight_active_0_1#%#LightlineRight_active_0#%(\ %3l:%-2v\ %)
+setlocal suffixesadd=.md
+setlocal swapfile
+setlocal synmaxcol=3000
+if &syntax != 'vimwiki'
+setlocal syntax=vimwiki
+endif
+setlocal tabstop=4
+setlocal tagcase=
+setlocal tags=./tags,./TAGS,tags,TAGS,~/dotfiles/.tags
+setlocal termwinkey=
+setlocal termwinscroll=10000
+setlocal termwinsize=
+setlocal textwidth=0
+setlocal thesaurus=
+setlocal noundofile
+setlocal undolevels=-123456
+setlocal varsofttabstop=
+setlocal vartabstop=
+setlocal nowinfixheight
+setlocal nowinfixwidth
+setlocal wrap
+setlocal wrapmargin=0
+silent! normal! zE
+let s:l = 1 - ((0 * winheight(0) + 8) / 16)
+if s:l < 1 | let s:l = 1 | endif
+exe s:l
+normal! zt
+1
+normal! 0
+let &so = s:so_save | let &siso = s:siso_save
+nohlsearch
+doautoall SessionLoadPost
+" vim: set ft=vim :