diff --git a/README.md b/README.md index bc0fba7b..77b710d0 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,7 @@ I recommend reading the docs of these plugins to understand them better. Each of * [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim * [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Buffer Explorer / Browser. This plugin can be opened with `` * [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim -* [ack.vim](github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack' -* [vim-powerline](https://github.com/Lokaltog/vim-powerline): The ultimate vim statusline utility +* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack' * [ctrlp.vim](https://github.com/kien/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to ``, because `` is used by YankRing * [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. Includes my own fork which adds syntax highlighting to MRU. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` @@ -73,6 +72,8 @@ I recommend reading the docs of these plugins to understand them better. Each of * [taglist.vim](https://github.com/vim-scripts/taglist.vim): Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc) * [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing) * [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination. +* [vim-airline](https://github.com/bling/vim-airline): Lean & mean status/tabline for vim that's light as air (replacing powerline) +* [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal ## What color schemes are included? diff --git a/sources_forked/vim-powerline/Powerline_default_default_compatible.cache b/sources_forked/vim-powerline/Powerline_default_default_compatible.cache deleted file mode 100644 index 498b4f63..00000000 --- a/sources_forked/vim-powerline/Powerline_default_default_compatible.cache +++ /dev/null @@ -1,4 +0,0 @@ -let g:Powerline_cache_revision = 7 -let g:Pl#HL = ['hi Ple7ffffffa0d70000b ctermfg=231 ctermbg=160 cterm=bold guifg=#ffffff guibg=#d70000 gui=bold', 'hi Pla0d70000f0585858N ctermfg=160 ctermbg=240 cterm=NONE guifg=#d70000 guibg=#585858 gui=NONE', 'hi Plc4ff0000f0585858b ctermfg=196 ctermbg=240 cterm=bold guifg=#ff0000 guibg=#585858 gui=bold', 'hi Plfcd0d0d0f0585858N ctermfg=252 ctermbg=240 cterm=NONE guifg=#d0d0d0 guibg=#585858 gui=NONE', 'hi Ple7fffffff0585858b ctermfg=231 ctermbg=240 cterm=bold guifg=#ffffff guibg=#585858 gui=bold', 'hi Plf0585858ec303030N ctermfg=240 ctermbg=236 cterm=NONE guifg=#585858 guibg=#303030 gui=NONE', 'hi Ple7ffffffec303030N ctermfg=231 ctermbg=236 cterm=NONE guifg=#ffffff guibg=#303030 gui=NONE', 'hi Plf79e9e9eec303030N ctermfg=247 ctermbg=236 cterm=NONE guifg=#9e9e9e guibg=#303030 gui=NONE', 'hi Plec303030ec303030N ctermfg=236 ctermbg=236 cterm=NONE guifg=#303030 guibg=#303030 gui=NONE', 'hi Plfabcbcbcf0585858N ctermfg=250 ctermbg=240 cterm=NONE guifg=#bcbcbc guibg=#585858 gui=NONE', 'hi Plec303030fcd0d0d0b ctermfg=236 ctermbg=252 cterm=bold guifg=#303030 guibg=#d0d0d0 gui=bold', 'hi Plf4808080fcd0d0d0N ctermfg=244 ctermbg=252 cterm=NONE guifg=#808080 guibg=#d0d0d0 gui=NONE', 'hi Pla0d70000f1626262N ctermfg=160 ctermbg=241 cterm=NONE guifg=#d70000 guibg=#626262 gui=NONE', 'hi Ple7fffffff1626262b ctermfg=231 ctermbg=241 cterm=bold guifg=#ffffff guibg=#626262 gui=bold', 'hi Plf1626262f0585858N ctermfg=241 ctermbg=240 cterm=NONE guifg=#626262 guibg=#585858 gui=NONE', 'hi Pl58870000e9121212N ctermfg=88 ctermbg=233 cterm=NONE guifg=#870000 guibg=#121212 gui=NONE', 'hi Plf1626262e9121212N ctermfg=241 ctermbg=233 cterm=NONE guifg=#626262 guibg=#121212 gui=NONE', 'hi Plf58a8a8ae9121212b ctermfg=245 ctermbg=233 cterm=bold guifg=#8a8a8a guibg=#121212 gui=bold', 'hi Ple9121212e9121212N ctermfg=233 ctermbg=233 cterm=NONE guifg=#121212 guibg=#121212 gui=NONE', 'hi Ple7ffffffe9121212N ctermfg=231 ctermbg=233 cterm=NONE guifg=#ffffff guibg=#121212 gui=NONE', 'hi Plf0585858eb262626N ctermfg=240 ctermbg=235 cterm=NONE guifg=#585858 guibg=#262626 gui=NONE', 'hi Pleb262626e9121212N ctermfg=235 ctermbg=233 cterm=NONE guifg=#262626 guibg=#121212 gui=NONE', 'hi Plf58a8a8aeb262626b ctermfg=245 ctermbg=235 cterm=bold guifg=#8a8a8a guibg=#262626 gui=bold', 'hi Plf1626262eb262626N ctermfg=241 ctermbg=235 cterm=NONE guifg=#626262 guibg=#262626 gui=NONE', 'hi Pla0d70000d0ff8700N ctermfg=160 ctermbg=208 cterm=NONE guifg=#d70000 guibg=#ff8700 gui=NONE', 'hi Pl58870000d0ff8700b ctermfg=88 ctermbg=208 cterm=bold guifg=#870000 guibg=#ff8700 gui=bold', 'hi Pld0ff8700f0585858N ctermfg=208 ctermbg=240 cterm=NONE guifg=#ff8700 guibg=#585858 gui=NONE', 'hi Pla0d70000e7ffffffN ctermfg=160 ctermbg=231 cterm=NONE guifg=#d70000 guibg=#ffffff gui=NONE', 'hi Pl17005f5fe7ffffffb ctermfg=23 ctermbg=231 cterm=bold guifg=#005f5f guibg=#ffffff gui=bold', 'hi Ple7ffffff1f0087afN ctermfg=231 ctermbg=31 cterm=NONE guifg=#ffffff guibg=#0087af gui=NONE', 'hi Plc4ff00001f0087afb ctermfg=196 ctermbg=31 cterm=bold guifg=#ff0000 guibg=#0087af gui=bold', 'hi Pl7587d7ff1f0087afN ctermfg=117 ctermbg=31 cterm=NONE guifg=#87d7ff guibg=#0087af gui=NONE', 'hi Ple7ffffff1f0087afb ctermfg=231 ctermbg=31 cterm=bold guifg=#ffffff guibg=#0087af gui=bold', 'hi Pl1f0087af18005f87N ctermfg=31 ctermbg=24 cterm=NONE guifg=#0087af guibg=#005f87 gui=NONE', 'hi Ple7ffffff18005f87N ctermfg=231 ctermbg=24 cterm=NONE guifg=#ffffff guibg=#005f87 gui=NONE', 'hi Pl7587d7ff18005f87N ctermfg=117 ctermbg=24 cterm=NONE guifg=#87d7ff guibg=#005f87 gui=NONE', 'hi Pl18005f8718005f87N ctermfg=24 ctermbg=24 cterm=NONE guifg=#005f87 guibg=#005f87 gui=NONE', 'hi Pl17005f5f7587d7ffb ctermfg=23 ctermbg=117 cterm=bold guifg=#005f5f guibg=#87d7ff gui=bold', 'hi Pl17005f5f7587d7ffN ctermfg=23 ctermbg=117 cterm=NONE guifg=#005f5f guibg=#87d7ff gui=NONE', 'hi Pla0d7000094afd700N ctermfg=160 ctermbg=148 cterm=NONE guifg=#d70000 guibg=#afd700 gui=NONE', 'hi Pl16005f0094afd700b ctermfg=22 ctermbg=148 cterm=bold guifg=#005f00 guibg=#afd700 gui=bold', 'hi Pl94afd700f0585858N ctermfg=148 ctermbg=240 cterm=NONE guifg=#afd700 guibg=#585858 gui=NONE', 'hi Ple7ffffff7caf0000b ctermfg=231 ctermbg=124 cterm=bold guifg=#ffffff guibg=#af0000 gui=bold', 'hi Pl7caf000058870000N ctermfg=124 ctermbg=88 cterm=NONE guifg=#af0000 guibg=#870000 gui=NONE', 'hi Ple7ffffff58870000N ctermfg=231 ctermbg=88 cterm=NONE guifg=#ffffff guibg=#870000 gui=NONE', 'hi Pl5887000058870000N ctermfg=88 ctermbg=88 cterm=NONE guifg=#870000 guibg=#870000 gui=NONE', 'hi Pla0d70000345f0000b ctermfg=160 ctermbg=52 cterm=bold guifg=#d70000 guibg=#5f0000 gui=bold', 'hi Pl345f0000345f0000N ctermfg=52 ctermbg=52 cterm=NONE guifg=#5f0000 guibg=#5f0000 gui=NONE', 'hi Ple7ffffff345f0000N ctermfg=231 ctermbg=52 cterm=NONE guifg=#ffffff guibg=#5f0000 gui=NONE', 'hi Pla0d70000345f0000N ctermfg=160 ctermbg=52 cterm=NONE guifg=#d70000 guibg=#5f0000 gui=NONE', 'hi Ple7fffffff0585858N ctermfg=231 ctermbg=240 cterm=NONE guifg=#ffffff guibg=#585858 gui=NONE', 'hi Plf58a8a8aeb262626N ctermfg=245 ctermbg=235 cterm=NONE guifg=#8a8a8a guibg=#262626 gui=NONE', 'hi Ple7ffffff465faf00b ctermfg=231 ctermbg=70 cterm=bold guifg=#ffffff guibg=#5faf00 gui=bold', 'hi Pl465faf001c008700N ctermfg=70 ctermbg=28 cterm=NONE guifg=#5faf00 guibg=#008700 gui=NONE', 'hi Pl94afd7001c008700N ctermfg=148 ctermbg=28 cterm=NONE guifg=#afd700 guibg=#008700 gui=NONE', 'hi Pl1c0087001c008700N ctermfg=28 ctermbg=28 cterm=NONE guifg=#008700 guibg=#008700 gui=NONE', 'hi Ple7ffffff1c008700N ctermfg=231 ctermbg=28 cterm=NONE guifg=#ffffff guibg=#008700 gui=NONE', 'hi Pl465faf0016005f00b ctermfg=70 ctermbg=22 cterm=bold guifg=#5faf00 guibg=#005f00 gui=bold', 'hi Pl465faf0016005f00N ctermfg=70 ctermbg=22 cterm=NONE guifg=#5faf00 guibg=#005f00 gui=NONE', 'hi Pl16005f0016005f00N ctermfg=22 ctermbg=22 cterm=NONE guifg=#005f00 guibg=#005f00 gui=NONE', 'hi Ple7ffffff16005f00N ctermfg=231 ctermbg=22 cterm=NONE guifg=#ffffff guibg=#005f00 gui=NONE', 'hi Ple7ffffff62875fd7N ctermfg=231 ctermbg=98 cterm=NONE guifg=#ffffff guibg=#875fd7 gui=NONE', 'hi Pl62875fd7e7ffffffN ctermfg=98 ctermbg=231 cterm=NONE guifg=#875fd7 guibg=#ffffff gui=NONE', 'hi Pl375f00afe7ffffffb ctermfg=55 ctermbg=231 cterm=bold guifg=#5f00af guibg=#ffffff gui=bold', 'hi Pl62875fd7375f00afN ctermfg=98 ctermbg=55 cterm=NONE guifg=#875fd7 guibg=#5f00af gui=NONE', 'hi Plc4ff0000375f00afb ctermfg=196 ctermbg=55 cterm=bold guifg=#ff0000 guibg=#5f00af gui=bold', 'hi Pl375f00af375f00afN ctermfg=55 ctermbg=55 cterm=NONE guifg=#5f00af guibg=#5f00af gui=NONE', 'hi Ple7ffffff375f00afN ctermfg=231 ctermbg=55 cterm=NONE guifg=#ffffff guibg=#5f00af gui=NONE', 'hi Plbdd7d7ff375f00afN ctermfg=189 ctermbg=55 cterm=NONE guifg=#d7d7ff guibg=#5f00af gui=NONE', 'hi Pl375f00afe7ffffffN ctermfg=55 ctermbg=231 cterm=NONE guifg=#5f00af guibg=#ffffff gui=NONE', 'hi Pla0d7000000000000N ctermfg=160 ctermbg=0 cterm=NONE guifg=#d70000 guibg=#000000 gui=NONE', 'hi Ple7ffffff00000000b ctermfg=231 ctermbg=0 cterm=bold guifg=#ffffff guibg=#000000 gui=bold', 'hi Pl00000000f0585858N ctermfg=0 ctermbg=240 cterm=NONE guifg=#000000 guibg=#585858 gui=NONE', 'hi Pla0d70000e9121212N ctermfg=160 ctermbg=233 cterm=NONE guifg=#d70000 guibg=#121212 gui=NONE', 'hi Plfcd0d0d0e9121212b ctermfg=252 ctermbg=233 cterm=bold guifg=#d0d0d0 guibg=#121212 gui=bold', 'hi Ple9121212f0585858N ctermfg=233 ctermbg=240 cterm=NONE guifg=#121212 guibg=#585858 gui=NONE', 'hi Pla0d7000018005f87N ctermfg=160 ctermbg=24 cterm=NONE guifg=#d70000 guibg=#005f87 gui=NONE', 'hi Ple7ffffff18005f87b ctermfg=231 ctermbg=24 cterm=bold guifg=#ffffff guibg=#005f87 gui=bold', 'hi Pl18005f87f0585858N ctermfg=24 ctermbg=240 cterm=NONE guifg=#005f87 guibg=#585858 gui=NONE'] -let g:Pl#THEME = [{'mode_statuslines': {'r': '%(%(%#Ple7ffffffa0d70000b# %{&paste ? "PASTE" : ""} %)%#Ple7ffffffa0d70000b#│%)%(%(%#Ple7ffffffa0d70000b# %{Powerline#Functions#GetMode()} %)%#Pla0d70000f0585858N#%)%( %(%#Plc4ff0000f0585858b#%{&readonly ? "RO" : ""} %)%(%#Plfcd0d0d0f0585858N#%{Powerline#Functions#GetFilepath()}%)%(%#Ple7fffffff0585858b#%t %)%(%#Plc4ff0000f0585858b#%M %)%(%#Plc4ff0000f0585858b#%H%W %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plec303030ec303030N#%(%#Plf79e9e9eec303030N# %{&fileformat} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{(&fenc == "" ? &enc : &fenc)} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{strlen(&ft) ? &ft : "no ft"} %)%)%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)%(%#Plfcd0d0d0f0585858N#%(%#Plec303030fcd0d0d0b# LN %3l%)%(%#Plf4808080fcd0d0d0N#:%-2v%) %)', 's': '%(%(%#Ple7ffffffa0d70000b# %{&paste ? "PASTE" : ""} %)%#Pla0d70000f1626262N#%)%(%(%#Ple7fffffff1626262b# %{Powerline#Functions#GetMode()} %)%#Plf1626262f0585858N#%)%( %(%#Plc4ff0000f0585858b#%{&readonly ? "RO" : ""} %)%(%#Plfcd0d0d0f0585858N#%{Powerline#Functions#GetFilepath()}%)%(%#Ple7fffffff0585858b#%t %)%(%#Plc4ff0000f0585858b#%M %)%(%#Plc4ff0000f0585858b#%H%W %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plec303030ec303030N#%(%#Plf79e9e9eec303030N# %{&fileformat} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{(&fenc == "" ? &enc : &fenc)} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{strlen(&ft) ? &ft : "no ft"} %)%)%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)%(%#Plfcd0d0d0f0585858N#%(%#Plec303030fcd0d0d0b# LN %3l%)%(%#Plf4808080fcd0d0d0N#:%-2v%) %)', 'N': '%( %(%#Pl58870000e9121212N#%{&readonly ? "RO" : ""} %)%(%#Plf1626262e9121212N#%{Powerline#Functions#GetFilepath()}%)%(%#Plf58a8a8ae9121212b#%t %)%(%#Pl58870000e9121212N#%M %)%(%#Pl58870000e9121212N#%H%W %)%#Ple9121212e9121212N#%)%<%#Ple7ffffffe9121212N#%=%(%#Pleb262626e9121212N#%(%#Plf0585858eb262626N# %3p%% %)%)%(%#Plf58a8a8aeb262626b#│%(%#Plf58a8a8aeb262626b# LN %3l%)%(%#Plf1626262eb262626N#:%-2v%) %)', 'v': '%(%(%#Ple7ffffffa0d70000b# %{&paste ? "PASTE" : ""} %)%#Pla0d7000018005f87N#%)%(%(%#Ple7ffffff18005f87b# %{Powerline#Functions#GetMode()} %)%#Pl18005f87f0585858N#%)%( %(%#Plc4ff0000f0585858b#%{&readonly ? "RO" : ""} %)%(%#Plfcd0d0d0f0585858N#%{Powerline#Functions#GetFilepath()}%)%(%#Ple7fffffff0585858b#%t %)%(%#Plc4ff0000f0585858b#%M %)%(%#Plc4ff0000f0585858b#%H%W %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plec303030ec303030N#%(%#Plf79e9e9eec303030N# %{&fileformat} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{(&fenc == "" ? &enc : &fenc)} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{strlen(&ft) ? &ft : "no ft"} %)%)%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)%(%#Plfcd0d0d0f0585858N#%(%#Plec303030fcd0d0d0b# LN %3l%)%(%#Plf4808080fcd0d0d0N#:%-2v%) %)', 'i': '%(%(%#Ple7ffffffa0d70000b# %{&paste ? "PASTE" : ""} %)%#Pla0d70000e7ffffffN#%)%(%(%#Pl17005f5fe7ffffffb# %{Powerline#Functions#GetMode()} %)%#Ple7ffffff1f0087afN#%)%( %(%#Plc4ff00001f0087afb#%{&readonly ? "RO" : ""} %)%(%#Pl7587d7ff1f0087afN#%{Powerline#Functions#GetFilepath()}%)%(%#Ple7ffffff1f0087afb#%t %)%(%#Plc4ff00001f0087afb#%M %)%(%#Plc4ff00001f0087afb#%H%W %)%#Pl1f0087af18005f87N#%)%<%#Ple7ffffff18005f87N#%=%(%#Pl18005f8718005f87N#%(%#Pl7587d7ff18005f87N# %{&fileformat} %)%)%(%#Pl7587d7ff18005f87N#│%(%#Pl7587d7ff18005f87N# %{(&fenc == "" ? &enc : &fenc)} %)%)%(%#Pl7587d7ff18005f87N#│%(%#Pl7587d7ff18005f87N# %{strlen(&ft) ? &ft : "no ft"} %)%)%(%#Pl1f0087af18005f87N#%(%#Pl7587d7ff1f0087afN# %3p%% %)%)%(%#Pl7587d7ff1f0087afN#%(%#Pl17005f5f7587d7ffb# LN %3l%)%(%#Pl17005f5f7587d7ffN#:%-2v%) %)', 'n': '%(%(%#Ple7ffffffa0d70000b# %{&paste ? "PASTE" : ""} %)%#Pla0d70000e9121212N#%)%(%(%#Plfcd0d0d0e9121212b# %{Powerline#Functions#GetMode()} %)%#Ple9121212f0585858N#%)%( %(%#Plc4ff0000f0585858b#%{&readonly ? "RO" : ""} %)%(%#Plfcd0d0d0f0585858N#%{Powerline#Functions#GetFilepath()}%)%(%#Ple7fffffff0585858b#%t %)%(%#Plc4ff0000f0585858b#%M %)%(%#Plc4ff0000f0585858b#%H%W %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plec303030ec303030N#%(%#Plf79e9e9eec303030N# %{&fileformat} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{(&fenc == "" ? &enc : &fenc)} %)%)%(%#Plf79e9e9eec303030N#│%(%#Plf79e9e9eec303030N# %{strlen(&ft) ? &ft : "no ft"} %)%)%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)%(%#Plfcd0d0d0f0585858N#%(%#Plec303030fcd0d0d0b# LN %3l%)%(%#Plf4808080fcd0d0d0N#:%-2v%) %)'}, 'matches': ['match', 'any', []]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff7caf0000b# %{"Command-T"} %)%#Pl7caf000058870000N#%)%<%#Ple7ffffff58870000N#%=%(%#Pl5887000058870000N#%(%#Ple7ffffff58870000N# %10(Match #%l%) %)%)', 's': '%(%(%#Ple7ffffff7caf0000b# %{"Command-T"} %)%#Pl7caf000058870000N#%)%<%#Ple7ffffff58870000N#%=%(%#Pl5887000058870000N#%(%#Ple7ffffff58870000N# %10(Match #%l%) %)%)', 'N': '%(%(%#Pla0d70000345f0000b# %{"Command-T"} %)%#Pl345f0000345f0000N#%)%<%#Ple7ffffff345f0000N#%=%(%#Pl345f0000345f0000N#%(%#Pla0d70000345f0000N# %10(Match #%l%) %)%)', 'v': '%(%(%#Ple7ffffff7caf0000b# %{"Command-T"} %)%#Pl7caf000058870000N#%)%<%#Ple7ffffff58870000N#%=%(%#Pl5887000058870000N#%(%#Ple7ffffff58870000N# %10(Match #%l%) %)%)', 'i': '%(%(%#Ple7ffffff7caf0000b# %{"Command-T"} %)%#Pl7caf000058870000N#%)%<%#Ple7ffffff58870000N#%=%(%#Pl5887000058870000N#%(%#Ple7ffffff58870000N# %10(Match #%l%) %)%)', 'n': '%(%(%#Ple7ffffff7caf0000b# %{"Command-T"} %)%#Pl7caf000058870000N#%)%<%#Ple7ffffff58870000N#%=%(%#Pl5887000058870000N#%(%#Ple7ffffff58870000N# %10(Match #%l%) %)%)'}, 'matches': ['match', 'any', [['bufname("%")', 'GoToFile']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Undo tree"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 's': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Undo tree"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'N': '%(%(%#Pla0d70000345f0000b# %{"Gundo"} %)%#Pla0d70000345f0000b#│%)%(%(%#Pla0d70000345f0000N# %{"Undo tree"} %)%#Pl345f0000345f0000N#%)%<%#Ple7ffffff345f0000N#%=', 'v': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Undo tree"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'i': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Undo tree"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'n': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Undo tree"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%='}, 'matches': ['match', 'any', [['bufname("%")', '__Gundo__']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Diff preview"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 's': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Diff preview"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'N': '%(%(%#Pla0d70000345f0000b# %{"Gundo"} %)%#Pla0d70000345f0000b#│%)%(%(%#Pla0d70000345f0000N# %{"Diff preview"} %)%#Pl345f0000345f0000N#%)%<%#Ple7ffffff345f0000N#%=', 'v': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Diff preview"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'i': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Diff preview"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%=', 'n': '%(%(%#Ple7ffffff7caf0000b# %{"Gundo"} %)%#Pl7caf000058870000N#%)%(%(%#Ple7ffffff58870000N# %{"Diff preview"} %)%#Pl5887000058870000N#%)%<%#Ple7ffffff58870000N#%='}, 'matches': ['match', 'any', [['bufname("%")', '__Gundo_Preview__']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7fffffff0585858N# %{"Help"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 's': '%(%(%#Ple7fffffff0585858N# %{"Help"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'N': '%(%(%#Plf58a8a8aeb262626N# %{"Help"} %)%#Pleb262626e9121212N#%)%(%(%#Plf58a8a8ae9121212b# %t %)%#Ple9121212e9121212N#%)%<%#Ple7ffffffe9121212N#%=%(%#Pleb262626e9121212N#%(%#Plf0585858eb262626N# %3p%% %)%)', 'v': '%(%(%#Ple7fffffff0585858N# %{"Help"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'i': '%(%(%#Ple7ffffff1f0087afN# %{"Help"} %)%#Ple7ffffff1f0087afN#│%)%(%(%#Ple7ffffff1f0087afb# %t %)%#Pl1f0087af18005f87N#%)%<%#Ple7ffffff18005f87N#%=%(%#Pl1f0087af18005f87N#%(%#Pl7587d7ff1f0087afN# %3p%% %)%)', 'n': '%(%(%#Ple7fffffff0585858N# %{"Help"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)'}, 'matches': ['match', 'any', [['&bt', 'help']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7fffffff0585858N# %{"Pager"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 's': '%(%(%#Ple7fffffff0585858N# %{"Pager"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'N': '%(%(%#Plf58a8a8aeb262626N# %{"Pager"} %)%#Pleb262626e9121212N#%)%(%(%#Plf58a8a8ae9121212b# %t %)%#Ple9121212e9121212N#%)%<%#Ple7ffffffe9121212N#%=%(%#Pleb262626e9121212N#%(%#Plf0585858eb262626N# %3p%% %)%)', 'v': '%(%(%#Ple7fffffff0585858N# %{"Pager"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'i': '%(%(%#Ple7ffffff1f0087afN# %{"Pager"} %)%#Ple7ffffff1f0087afN#│%)%(%(%#Ple7ffffff1f0087afb# %t %)%#Pl1f0087af18005f87N#%)%<%#Ple7ffffff18005f87N#%=%(%#Pl1f0087af18005f87N#%(%#Pl7587d7ff1f0087afN# %3p%% %)%)', 'n': '%(%(%#Ple7fffffff0585858N# %{"Pager"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %t %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)'}, 'matches': ['match', 'any', [['&ft', 'vimpager']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff465faf00b# %{"LustyExplorer"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Buffer list"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 's': '%(%(%#Ple7ffffff465faf00b# %{"LustyExplorer"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Buffer list"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'N': '%(%(%#Pl465faf0016005f00b# %{"LustyExplorer"} %)%#Pl465faf0016005f00b#│%)%(%(%#Pl465faf0016005f00N# %{"Buffer list"} %)%#Pl16005f0016005f00N#%)%<%#Ple7ffffff16005f00N#%=', 'v': '%(%(%#Ple7ffffff465faf00b# %{"LustyExplorer"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Buffer list"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'i': '%(%(%#Ple7ffffff465faf00b# %{"LustyExplorer"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Buffer list"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'n': '%(%(%#Ple7ffffff465faf00b# %{"LustyExplorer"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Buffer list"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%='}, 'matches': ['match', 'any', [['bufname("%")', '\[LustyExplorer-Buffers\]']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7fffffff0585858N# %{"Man page"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %{Powerline#Functions#ft_man#GetName()} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 's': '%(%(%#Ple7fffffff0585858N# %{"Man page"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %{Powerline#Functions#ft_man#GetName()} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'N': '%(%(%#Plf58a8a8aeb262626N# %{"Man page"} %)%#Pleb262626e9121212N#%)%(%(%#Plf58a8a8ae9121212b# %{Powerline#Functions#ft_man#GetName()} %)%#Ple9121212e9121212N#%)%<%#Ple7ffffffe9121212N#%=%(%#Pleb262626e9121212N#%(%#Plf0585858eb262626N# %3p%% %)%)', 'v': '%(%(%#Ple7fffffff0585858N# %{"Man page"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %{Powerline#Functions#ft_man#GetName()} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)', 'i': '%(%(%#Ple7ffffff1f0087afN# %{"Man page"} %)%#Ple7ffffff1f0087afN#│%)%(%(%#Ple7ffffff1f0087afb# %{Powerline#Functions#ft_man#GetName()} %)%#Pl1f0087af18005f87N#%)%<%#Ple7ffffff18005f87N#%=%(%#Pl1f0087af18005f87N#%(%#Pl7587d7ff1f0087afN# %3p%% %)%)', 'n': '%(%(%#Ple7fffffff0585858N# %{"Man page"} %)%#Ple7fffffff0585858N#│%)%(%(%#Ple7fffffff0585858b# %{Powerline#Functions#ft_man#GetName()} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=%(%#Plf0585858ec303030N#%(%#Plfabcbcbcf0585858N# %3p%% %)%)'}, 'matches': ['match', 'any', [['&ft', 'man']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff465faf00b# %{"MiniBufExplorer"} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 's': '%(%(%#Ple7ffffff465faf00b# %{"MiniBufExplorer"} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'N': '%(%(%#Pl465faf0016005f00b# %{"MiniBufExplorer"} %)%#Pl16005f0016005f00N#%)%<%#Ple7ffffff16005f00N#%=', 'v': '%(%(%#Ple7ffffff465faf00b# %{"MiniBufExplorer"} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'i': '%(%(%#Ple7ffffff465faf00b# %{"MiniBufExplorer"} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'n': '%(%(%#Ple7ffffff465faf00b# %{"MiniBufExplorer"} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%='}, 'matches': ['match', 'any', [['bufname("%")', '\-MiniBufExplorer\-']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7fffffff0585858N# %{"Quickfix"} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=', 's': '%(%(%#Ple7fffffff0585858N# %{"Quickfix"} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=', 'N': '%(%(%#Plf58a8a8aeb262626N# %{"Quickfix"} %)%#Pleb262626e9121212N#%)%<%#Ple7ffffffe9121212N#%=', 'v': '%(%(%#Ple7fffffff0585858N# %{"Quickfix"} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%=', 'i': '%(%(%#Ple7ffffff1f0087afN# %{"Quickfix"} %)%#Pl1f0087af18005f87N#%)%<%#Ple7ffffff18005f87N#%=', 'n': '%(%(%#Ple7fffffff0585858N# %{"Quickfix"} %)%#Plf0585858ec303030N#%)%<%#Ple7ffffffec303030N#%='}, 'matches': ['match', 'any', [['&ft', 'qf']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff465faf00b# %{"Tagbar"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Tree"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 's': '%(%(%#Ple7ffffff465faf00b# %{"Tagbar"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Tree"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'N': '%(%(%#Pl465faf0016005f00b# %{"Tagbar"} %)%#Pl465faf0016005f00b#│%)%(%(%#Pl465faf0016005f00N# %{"Tree"} %)%#Pl16005f0016005f00N#%)%<%#Ple7ffffff16005f00N#%=', 'v': '%(%(%#Ple7ffffff465faf00b# %{"Tagbar"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Tree"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'i': '%(%(%#Ple7ffffff465faf00b# %{"Tagbar"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Tree"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'n': '%(%(%#Ple7ffffff465faf00b# %{"Tagbar"} %)%#Pl465faf001c008700N#%)%(%(%#Pl94afd7001c008700N# %{"Tree"} %)%#Pl1c0087001c008700N#%)%<%#Ple7ffffff1c008700N#%='}, 'matches': ['match', 'any', [['&ft', 'tagbar']]]}, {'mode_statuslines': {'r': '%(%(%#Ple7ffffff465faf00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 's': '%(%(%#Ple7ffffff465faf00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'N': '%(%(%#Pl465faf0016005f00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl16005f0016005f00N#%)%<%#Ple7ffffff16005f00N#%=', 'v': '%(%(%#Ple7ffffff465faf00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'i': '%(%(%#Ple7ffffff465faf00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%=', 'n': '%(%(%#Ple7ffffff465faf00b# %{Powerline#Functions#GetShortPath(4)} %)%#Pl465faf001c008700N#%)%<%#Ple7ffffff1c008700N#%='}, 'matches': ['match', 'any', [['&ft', 'nerdtree']]]}] -let g:Pl#THEME_CALLBACKS = [['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"'], ['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"'], ['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"'], ['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"'], ['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"'], ['function! PowerlineStatuslineCallback_ctrlp_main(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Ple7ffffff62875fd7N# %-3{"%3"} %)%#Pl62875fd7e7ffffffN#%)%(%(%#Pl375f00afe7ffffffb# %-9{"%4"} %)%#Ple7ffffff62875fd7N#%)%(%(%#Ple7ffffff62875fd7N# %-3{"%5"} %)%#Pl62875fd7375f00afN#%)%(%(%#Plc4ff0000375f00afb# %{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)} %)%#Pl375f00af375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl375f00af375f00afN#%(%#Plbdd7d7ff375f00afN# %{"%0"} %)%)%(%#Plbdd7d7ff375f00afN#│%(%#Plbdd7d7ff375f00afN# %{"%1"} %)%)%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "PowerlineStatuslineCallback_ctrlp_main"'], ['function! PowerlineStatuslineCallback_ctrlp_prog(...){{NEWLINE}}return Pl#StatuslineCallback(''%(%(%#Pl375f00afe7ffffffN# %-6{"%0"} %)%#Ple7ffffff375f00afN#%)%<%#Ple7ffffff375f00afN#%=%(%#Pl62875fd7375f00afN#%(%#Ple7ffffff62875fd7N# %{substitute(getcwd(), expand("$HOME"), "~", "g")} %)%)'', a:000){{NEWLINE}}endfunction', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "PowerlineStatuslineCallback_ctrlp_prog"']] diff --git a/sources_forked/vim-powerline/README.md b/sources_forked/vim-powerline/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/sources_forked/vim-powerline/README.rst b/sources_forked/vim-powerline/README.rst deleted file mode 100755 index 72cd84f2..00000000 --- a/sources_forked/vim-powerline/README.rst +++ /dev/null @@ -1,107 +0,0 @@ -================= -Powerline for vim -================= - -:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) -:Source: https://github.com/Lokaltog/vim-powerline -:Version: β - -Introduction ------------- - -Powerline is a utility plugin which allows you to create better-looking, -more functional vim statuslines. See the screenshots below for -a demonstration of the plugin's capabilities. - -It's recommended that you install the plugin using Pathogen_ or Vundle_. -After the plugin is installed update your help tags and see ``:help -Powerline`` for instructions on how to enable and configure the plugin. - -See the `Troubleshooting`_ section below if you're having any issues with -the plugin or the font patcher. - -**Note:** You need a patched font to be able to use the symbols in the -statusline. An experimental Python/fontforge-based font patcher is included -in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage -instructions. - -.. _Pathogen: https://github.com/tpope/vim-pathogen -.. _Vundle: https://github.com/gmarik/vundle - -Screenshots ------------ - -.. image:: http://i.imgur.com/MsuIB.png - -Troubleshooting ---------------- - -I can't see the fancy symbols, what's wrong? - Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your - ``vimrc`` file. The settings may be loaded too late if you have this in - ``gvimrc``, so always put this in your ``vimrc``. - - Clear the cache using ``:PowerlineClearCache`` and restart vim. - - Make sure that you've configured gvim or your terminal emulator to use - a patched font. - - Make sure that vim is compiled with the ``--with-features=big`` flag. - -The fancy symbols look a bit blurry or "off"! - Make sure that you have patched all variants of your font (i.e. both the - regular and the bold font files). - -I'm unable to patch my font, what should I do? - Font patching is only known to work on most Linux and OS X machines. If - you have followed the instructions in the fontpatcher README and still - have problems, please submit an issue on GitHub. - - You can download some community-contributed patched fonts from the - `Powerline wiki`_ if you don't want to mess around with the font - patcher. - -The Syntastic/Fugitive statusline flags don't work! - These flags should work without any configuration. If you installed - either plugin after Powerline, you'll have to clear the cache using - ``:PowerlineClearCache`` and restart vim. - -The colors are weird in the default OS X Terminal app! - The default OS X Terminal app is known to have some issues with the - Powerline colors. Please use another terminal emulator. iTerm2 should - work fine. - - The arrows may have the wrong colors if you have changed the "minimum - contrast" slider in the color tab of your OS X settings. - -The statusline has strange characters like ``^B`` in it! - Please add ``set encoding=utf-8`` to your ``vimrc``. - - You may also need to set your ``LANG`` and ``LC_*`` environment - variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your - Linux distro's documentation for information about setting these - variables correctly. - -The statusline has a lot of ``^`` or underline characters in it! - You need to configure the ``fillchars`` setting to disable statusline - fillchars (see ``:h fillchars`` for details). Add this to your - ``vimrc`` to solve this issue:: - - set fillchars+=stl:\ ,stlnc:\ - -The statusline is hidden/only appears in split windows! - Make sure that you have ``set laststatus=2`` in your ``vimrc``. - -I'm using tmux and Powerline looks like crap, what's wrong? - You need to tell tmux that it has 256-color capabilities. Add this to - your ``.tmux.conf`` to solve this issue:: - - set -g default-terminal "screen-256color" - - If you use iTerm2, make sure that you have enabled the setting 'Set - locale variables automatically' in Profiles > Terminal > Environment. - -If you have any other issues and you can't find the answer in the docs, -please submit an issue on GitHub. - -.. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts diff --git a/sources_forked/vim-powerline/autoload/Pl.vim b/sources_forked/vim-powerline/autoload/Pl.vim deleted file mode 100755 index c933030d..00000000 --- a/sources_forked/vim-powerline/autoload/Pl.vim +++ /dev/null @@ -1,183 +0,0 @@ -" Powerline - The ultimate statusline utility -" -" Author: Kim Silkebækken -" Source repository: https://github.com/Lokaltog/vim-powerline - -" Script variables {{{ - let g:Pl#OLD_STL = '' - let g:Pl#THEME = [] - let g:Pl#THEME_CALLBACKS = [] - let g:Pl#HL = [] - - " Cache revision, this must be incremented whenever the cache format is changed - let s:CACHE_REVISION = 7 -" }}} -" Script initialization {{{ - function! Pl#LoadCache() " {{{ - if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled - exec 'source' escape(g:Powerline_cache_file, ' \') - - if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION - " Cache revision differs, cache is invalid - unlet! g:Powerline_cache_revision - - return 0 - endif - - " Create highlighting groups - for hi_cmd in g:Pl#HL - exec hi_cmd - endfor - - " Run theme callbacks - for callback in g:Pl#THEME_CALLBACKS - " Substitute {{NEWLINE}} with newlines (strings must be - " stored without newlines characters to avoid vim errors) - exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g') - exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g') - endfor - - return 1 - endif - - return 0 - endfunction " }}} - function! Pl#ClearCache() " {{{ - if filereadable(g:Powerline_cache_file) - " Delete the cache file - call delete(g:Powerline_cache_file) - endif - - echo 'Powerline cache cleared. Please restart vim for the changes to take effect.' - endfunction " }}} - function! Pl#ReloadColorscheme() " {{{ - call Pl#ClearCache() - - " The colorscheme and theme files must be manually sourced because - " vim won't reload previously autoloaded files - " - " This is a bit hackish, but it works - unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme - exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0] - - unlet! g:Powerline#Themes#{g:Powerline_theme}#theme - exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0] - - let g:Pl#THEME = [] - - call Pl#Load() - endfunction " }}} - function! Pl#Load() " {{{ - if empty(g:Pl#OLD_STL) - " Store old statusline - let g:Pl#OLD_STL = &statusline - endif - - if ! Pl#LoadCache() - try - " Autoload the theme dict first - let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme - catch - echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.' - - return - endtry - - " Create list with parsed statuslines - for buffer_statusline in raw_theme - unlet! mode_statuslines - let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments) - - if ! empty(buffer_statusline.callback) - " The callback function passes its arguments on to - " Pl#StatuslineCallback along with the normal/current mode - " statusline. - let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n" - let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n" - let s:cb_func .= "endfunction" - - " The callback expression should be used to initialize any - " variables that will use the callback function. The - " expression requires a %s which will be replaced by the - " callback function name. - let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1]) - - exec s:cb_func - exec s:cb_expr - - " Newlines must be substituted with another character - " because vim doesn't like newlines in strings - call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')]) - - unlet! s:cb_func s:cb_expr - - continue - endif - - " Store the statuslines for matching specific buffers - call add(g:Pl#THEME, { - \ 'matches': buffer_statusline.matches, - \ 'mode_statuslines': mode_statuslines - \ }) - endfor - - if ! g:Powerline_cache_enabled - " Don't cache anything if caching is disabled or cache file isn't writeable - return - endif - - " Prepare commands and statuslines for caching - let cache = [ - \ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION), - \ 'let g:Pl#HL = '. string(g:Pl#HL), - \ 'let g:Pl#THEME = '. string(g:Pl#THEME), - \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS), - \ ] - - call writefile(cache, g:Powerline_cache_file) - endif - endfunction " }}} -" }}} -" Statusline updater {{{ - function! Pl#Statusline(statusline, current) " {{{ - let mode = mode() - - if ! a:current - let mode = 'N' " Normal (non-current) - elseif mode =~# '\v(v|V|)' - let mode = 'v' " Visual mode - elseif mode =~# '\v(s|S|)' - let mode = 's' " Select mode - elseif mode =~# '\vi' - let mode = 'i' " Insert mode - elseif mode =~# '\v(R|Rv)' - let mode = 'r' " Replace mode - else - " Fallback to normal mode - let mode = 'n' " Normal (current) - endif - - return g:Pl#THEME[a:statusline].mode_statuslines[mode] - endfunction " }}} - function! Pl#StatuslineCallback(statusline, args) " {{{ - " Replace %1, %2, etc. in the statusline with the callback args - return substitute( - \ a:statusline, - \ '\v\%(\d+)', - \ '\=a:args[submatch(1)]', - \ 'g') - endfunction " }}} - function! Pl#UpdateStatusline(current) " {{{ - if empty(g:Pl#THEME) - " Load statuslines if they aren't loaded yet - call Pl#Load() - endif - - for i in range(0, len(g:Pl#THEME) - 1) - if Pl#Match#Validate(g:Pl#THEME[i]) - " Update window-local statusline - let &l:statusline = '%!Pl#Statusline('. i .','. a:current .')' - endif - endfor - endfunction " }}} -" }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Colorscheme.vim b/sources_forked/vim-powerline/autoload/Pl/Colorscheme.vim deleted file mode 100755 index ec15e461..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Colorscheme.vim +++ /dev/null @@ -1,145 +0,0 @@ -function! Pl#Colorscheme#Init(hi) " {{{ - let colorscheme = {} - - for hi in a:hi - " Ensure that the segments are a list - let segments = type(hi[0]) == type('') ? [ hi[0] ] : hi[0] - let mode_hi_dict = hi[1] - - for segment in segments - let colorscheme[segment] = mode_hi_dict - endfor - endfor - - return colorscheme -endfunction " }}} -function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{ - " Set color parameters for all segments in a:buffer_segments - - " TODO This function should be recursive and work on both segments and groups - " TODO We could probably handle the NS stuff here... - - try - let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme - catch - echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!' - - return - endtry - - let buffer_segments = a:buffer_segments - - " This is a bit complex, I'll walk you through exactly what happens here... - " - " First of all we loop through the buffer_segments, which are the segments that - " this specific buffer will have. - for buffer_segment in buffer_segments - " The buffer_segment consists of a 'matches' list and a 'segments' list. - " The 'matches' list has conditions to limit this statusline to specific buffers/windows. - " The 'segments' list has each segment and segment group for this buffer - for segment in buffer_segment.segments - let type = get(segment, 'type', '') - - if type == 'segment_group' - " We're going to handle segment groups different from single segments. Segment groups - " have child segments which may have their own highlighting (e.g. fileinfo.flags), - " and these child segments may be grouped (e.g. fileinfo.flags.ro) to provide very - " specific highlighting. So here we'll handle all that: - - " Set the default/fallback colors for this group - for i in range(len(segment.variants), 0, -1) - " Check for available highlighting for the main group segment - " - " This works like the segment highlighting below - " TODO Create a function for this - let seg_variants = join(segment.variants[0:i], '.') - - let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name - let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name - - if has_key(colorscheme, seg_ns_name) - " We have a namespaced highlight group - let segment.colors = colorscheme[seg_ns_name] - break - elseif has_key(colorscheme, seg_name) - " We have a non-namespaced group - let segment.colors = colorscheme[seg_name] - break - endif - endfor - - " The reason why we need to deepcopy the group's segments is that the child segments - " all point to the same base segments and that screws up highlighting if we highlight - " some child segments with different namespaced colors - let segment.segments = deepcopy(segment.segments) - - " Apply colors to each child segment - for child_segment in segment.segments - " Check if this child segment is grouped (e.g. fileinfo.flags.group.subgroup) - " We're going to prioritize the most specific grouping and then work back to the - " most common group (e.g. fileinfo.flags) - - " FIXME We don't have the variants from before because group children aren't run through Pl#Segment#Get - let child_segment.variants = [seg_name] + split(child_segment.name, '\.') - - " Use the parent group's namespace - let child_segment.ns = segment.ns - - for i in range(len(child_segment.variants), 0, -1) - " Check for available highlighting for the main group segment - let child_seg_name = join(child_segment.variants[0:i], '.') - - let child_seg_ns_name = len(child_segment.ns) > 0 ? child_segment.ns .':'. child_seg_name : child_seg_name - - if has_key(colorscheme, child_seg_ns_name) - " We have a namespaced highlight group - let child_segment.colors = colorscheme[child_seg_ns_name] - break - elseif has_key(colorscheme, child_seg_name) - " We have a non-namespaced group - let child_segment.colors = colorscheme[child_seg_name] - break - endif - endfor - endfor - elseif type == 'segment' - for i in range(len(segment.variants), 0, -1) - " Check for available highlighting - " - " This is done in the following manner, using the segment gundo:static_filename.text.buffer as an example: - " - " * Look for the hl group: gundo:static_filename.text.buffer - " * Look for the hl group: static_filename.text.buffer - " * Look for the hl group: gundo:static_filename.text - " * Look for the hl group: static_filename.text - " * Look for the hl group: gundo:static_filename - " * Look for the hl group: static_filename - " * Return the segment without highlighting, causing an error in the parser - let seg_variants = join(segment.variants[0:i], '.') - - let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name - let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name - - if has_key(colorscheme, seg_ns_name) - " We have a namespaced highlight group - let segment.colors = colorscheme[seg_ns_name] - break - elseif has_key(colorscheme, seg_name) - " We have a non-namespaced group - let segment.colors = colorscheme[seg_name] - break - endif - endfor - endif - - unlet! segment - endfor - endfor - - " Good luck parsing this return value - " - " It's a huge dict with all segments for all buffers with their respective syntax highlighting. - " It will be parsed by the main Powerline code, where all the data will be shortened to a simple - " array consiting of a statusline for each mode, with generated highlighting groups and dividers. - return buffer_segments -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Hi.vim b/sources_forked/vim-powerline/autoload/Pl/Hi.vim deleted file mode 100755 index f6b3eea2..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Hi.vim +++ /dev/null @@ -1,140 +0,0 @@ -" cterm -> gui color dict {{{ -let s:cterm2gui_dict = { - \ 16: 0x000000, 17: 0x00005f, 18: 0x000087, 19: 0x0000af, 20: 0x0000d7, 21: 0x0000ff, - \ 22: 0x005f00, 23: 0x005f5f, 24: 0x005f87, 25: 0x005faf, 26: 0x005fd7, 27: 0x005fff, - \ 28: 0x008700, 29: 0x00875f, 30: 0x008787, 31: 0x0087af, 32: 0x0087d7, 33: 0x0087ff, - \ 34: 0x00af00, 35: 0x00af5f, 36: 0x00af87, 37: 0x00afaf, 38: 0x00afd7, 39: 0x00afff, - \ 40: 0x00d700, 41: 0x00d75f, 42: 0x00d787, 43: 0x00d7af, 44: 0x00d7d7, 45: 0x00d7ff, - \ 46: 0x00ff00, 47: 0x00ff5f, 48: 0x00ff87, 49: 0x00ffaf, 50: 0x00ffd7, 51: 0x00ffff, - \ 52: 0x5f0000, 53: 0x5f005f, 54: 0x5f0087, 55: 0x5f00af, 56: 0x5f00d7, 57: 0x5f00ff, - \ 58: 0x5f5f00, 59: 0x5f5f5f, 60: 0x5f5f87, 61: 0x5f5faf, 62: 0x5f5fd7, 63: 0x5f5fff, - \ 64: 0x5f8700, 65: 0x5f875f, 66: 0x5f8787, 67: 0x5f87af, 68: 0x5f87d7, 69: 0x5f87ff, - \ 70: 0x5faf00, 71: 0x5faf5f, 72: 0x5faf87, 73: 0x5fafaf, 74: 0x5fafd7, 75: 0x5fafff, - \ 76: 0x5fd700, 77: 0x5fd75f, 78: 0x5fd787, 79: 0x5fd7af, 80: 0x5fd7d7, 81: 0x5fd7ff, - \ 82: 0x5fff00, 83: 0x5fff5f, 84: 0x5fff87, 85: 0x5fffaf, 86: 0x5fffd7, 87: 0x5fffff, - \ 88: 0x870000, 89: 0x87005f, 90: 0x870087, 91: 0x8700af, 92: 0x8700d7, 93: 0x8700ff, - \ 94: 0x875f00, 95: 0x875f5f, 96: 0x875f87, 97: 0x875faf, 98: 0x875fd7, 99: 0x875fff, - \ 100: 0x878700, 101: 0x87875f, 102: 0x878787, 103: 0x8787af, 104: 0x8787d7, 105: 0x8787ff, - \ 106: 0x87af00, 107: 0x87af5f, 108: 0x87af87, 109: 0x87afaf, 110: 0x87afd7, 111: 0x87afff, - \ 112: 0x87d700, 113: 0x87d75f, 114: 0x87d787, 115: 0x87d7af, 116: 0x87d7d7, 117: 0x87d7ff, - \ 118: 0x87ff00, 119: 0x87ff5f, 120: 0x87ff87, 121: 0x87ffaf, 122: 0x87ffd7, 123: 0x87ffff, - \ 124: 0xaf0000, 125: 0xaf005f, 126: 0xaf0087, 127: 0xaf00af, 128: 0xaf00d7, 129: 0xaf00ff, - \ 130: 0xaf5f00, 131: 0xaf5f5f, 132: 0xaf5f87, 133: 0xaf5faf, 134: 0xaf5fd7, 135: 0xaf5fff, - \ 136: 0xaf8700, 137: 0xaf875f, 138: 0xaf8787, 139: 0xaf87af, 140: 0xaf87d7, 141: 0xaf87ff, - \ 142: 0xafaf00, 143: 0xafaf5f, 144: 0xafaf87, 145: 0xafafaf, 146: 0xafafd7, 147: 0xafafff, - \ 148: 0xafd700, 149: 0xafd75f, 150: 0xafd787, 151: 0xafd7af, 152: 0xafd7d7, 153: 0xafd7ff, - \ 154: 0xafff00, 155: 0xafff5f, 156: 0xafff87, 157: 0xafffaf, 158: 0xafffd7, 159: 0xafffff, - \ 160: 0xd70000, 161: 0xd7005f, 162: 0xd70087, 163: 0xd700af, 164: 0xd700d7, 165: 0xd700ff, - \ 166: 0xd75f00, 167: 0xd75f5f, 168: 0xd75f87, 169: 0xd75faf, 170: 0xd75fd7, 171: 0xd75fff, - \ 172: 0xd78700, 173: 0xd7875f, 174: 0xd78787, 175: 0xd787af, 176: 0xd787d7, 177: 0xd787ff, - \ 178: 0xd7af00, 179: 0xd7af5f, 180: 0xd7af87, 181: 0xd7afaf, 182: 0xd7afd7, 183: 0xd7afff, - \ 184: 0xd7d700, 185: 0xd7d75f, 186: 0xd7d787, 187: 0xd7d7af, 188: 0xd7d7d7, 189: 0xd7d7ff, - \ 190: 0xd7ff00, 191: 0xd7ff5f, 192: 0xd7ff87, 193: 0xd7ffaf, 194: 0xd7ffd7, 195: 0xd7ffff, - \ 196: 0xff0000, 197: 0xff005f, 198: 0xff0087, 199: 0xff00af, 200: 0xff00d7, 201: 0xff00ff, - \ 202: 0xff5f00, 203: 0xff5f5f, 204: 0xff5f87, 205: 0xff5faf, 206: 0xff5fd7, 207: 0xff5fff, - \ 208: 0xff8700, 209: 0xff875f, 210: 0xff8787, 211: 0xff87af, 212: 0xff87d7, 213: 0xff87ff, - \ 214: 0xffaf00, 215: 0xffaf5f, 216: 0xffaf87, 217: 0xffafaf, 218: 0xffafd7, 219: 0xffafff, - \ 220: 0xffd700, 221: 0xffd75f, 222: 0xffd787, 223: 0xffd7af, 224: 0xffd7d7, 225: 0xffd7ff, - \ 226: 0xffff00, 227: 0xffff5f, 228: 0xffff87, 229: 0xffffaf, 230: 0xffffd7, 231: 0xffffff, - \ 232: 0x080808, 233: 0x121212, 234: 0x1c1c1c, 235: 0x262626, 236: 0x303030, 237: 0x3a3a3a, - \ 238: 0x444444, 239: 0x4e4e4e, 240: 0x585858, 241: 0x626262, 242: 0x6c6c6c, 243: 0x767676, - \ 244: 0x808080, 245: 0x8a8a8a, 246: 0x949494, 247: 0x9e9e9e, 248: 0xa8a8a8, 249: 0xb2b2b2, - \ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee -\ } -" }}} -" Allocated color dict {{{ -let s:allocated_colors = { - \ 'NONE': 'NONE', - \ } -" }}} -function! s:Cterm2GUI(cterm) " {{{ - if toupper(a:cterm) == 'NONE' - return 'NONE' - endif - - if ! has_key(s:cterm2gui_dict, a:cterm) - return 0xff0000 - endif - - return s:cterm2gui_dict[a:cterm] -endfunction " }}} -function! Pl#Hi#Segments(segments, mode_colors) " {{{ - let mode_translate = { - \ 'normal': 'n', - \ 'noncurrent': 'N', - \ 'insert': 'i', - \ 'visual': 'v', - \ 'replace': 'r', - \ 'select': 's', - \ } - - let attributes = ['bold', 'italic', 'underline'] - - let segments = a:segments - let mode_hi_dict = {} - - " Mode dict - for [mode, colors] in items(a:mode_colors) - if has_key(mode_translate, mode) - let mode = mode_translate[mode] - endif - - unlet! fg - let fg = s:allocated_colors[colors[0]] - - let hi = { - \ 'cterm': [fg['cterm'], ''], - \ 'gui' : [fg['gui'], ''], - \ 'attr' : [] - \ } - - if exists('colors[1]') - if type(colors[1]) == type([]) - " We don't have a BG color, but we have attributes - let hi.attr = colors[1] - else - " The second parameter is the background color - unlet! bg - let bg = s:allocated_colors[colors[1]] - - let hi.cterm[1] = bg['cterm'] - let hi.gui[1] = bg['gui'] - endif - endif - - if exists('colors[2]') && type(colors[2]) == type([]) - " The third parameter is always an attribute list - let hi.attr = colors[2] - endif - - let mode_hi_dict[mode] = { - \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])), - \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])), - \ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])), - \ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])), - \ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ',')) - \ } - endfor - - return [segments, mode_hi_dict] -endfunction " }}} -function! Pl#Hi#Allocate(colors) " {{{ - for [key, color] in items(a:colors) - if type(color) == type(0) - " Only terminal color - let cterm = color - let gui = s:Cterm2GUI(color) - elseif type(color) == type([]) && len(color) == 2 - " Terminal and GUI colors - let cterm = color[0] - let gui = color[1] - endif - - let s:allocated_colors[key] = { - \ 'cterm': cterm, - \ 'gui': gui, - \ } - - unlet! color - endfor -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Match.vim b/sources_forked/vim-powerline/autoload/Pl/Match.vim deleted file mode 100755 index b05f5851..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Match.vim +++ /dev/null @@ -1,43 +0,0 @@ -function! Pl#Match#Add(pat, expr) " {{{ - return [a:pat, a:expr] -endfunction " }}} -function! Pl#Match#Any(...) " {{{ - let matches = [] - - for match_name in a:000 - if empty(match_name) - " Skip empty match parameters - continue - endif - - if has_key(g:Powerline#Matches#matches, match_name) - call add(matches, g:Powerline#Matches#matches[match_name]) - endif - - unlet! match_name - endfor - - return ['match', 'any', matches] -endfunction " }}} -function! Pl#Match#Validate(theme) " {{{ - let match = a:theme.matches[1] - - if match == 'none' - return 0 - elseif match == 'any' - let matches = a:theme.matches[2] - - if ! len(matches) - " Empty match array matches everything - return 1 - endif - - for [eval, re] in matches - if match(eval(eval), '\v'. re) != -1 - return 1 - endif - endfor - - return 0 - endif -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Mod.vim b/sources_forked/vim-powerline/autoload/Pl/Mod.vim deleted file mode 100755 index fdfb5718..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Mod.vim +++ /dev/null @@ -1,40 +0,0 @@ -let s:segment_mods = [] - -function! Pl#Mod#AddSegmentMod(action, properties) " {{{ - call add(s:segment_mods, [a:action, a:properties]) -endfunction " }}} -function! Pl#Mod#ApplySegmentMods(theme) " {{{ - let theme = deepcopy(a:theme) - - for mod in s:segment_mods - let [action, properties] = mod - - " We have to loop through the segments instead of using index() because some - " segments are lists! - let target_seg_idx = -1 - - for i in range(0, len(theme) - 1) - unlet! segment - let segment = theme[i] - - if type(segment) == type(properties.target_segment) && segment == properties.target_segment - let target_seg_idx = i - break - endif - endfor - - if action == 'insert_segment' - " Insert segment - if target_seg_idx != -1 - call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1)) - endif - elseif action == 'remove_segment' - " Remove segment - if target_seg_idx != -1 - call remove(theme, target_seg_idx) - endif - endif - endfor - - return theme -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Parser.vim b/sources_forked/vim-powerline/autoload/Pl/Parser.vim deleted file mode 100755 index a6f3428a..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Parser.vim +++ /dev/null @@ -1,371 +0,0 @@ -let g:Pl#Parser#Symbols = { - \ 'compatible': { - \ 'dividers': [ '', [0x2502], '', [0x2502] ] - \ , 'symbols' : { - \ 'BRANCH': 'BR:' - \ , 'RO' : 'RO' - \ , 'FT' : 'FT' - \ , 'LINE' : 'LN' - \ } - \ }, - \ 'unicode': { - \ 'dividers': [ [0x25b6], [0x276f], [0x25c0], [0x276e] ] - \ , 'symbols' : { - \ 'BRANCH': [0x26a1] - \ , 'RO' : [0x2613] - \ , 'FT' : [0x2691] - \ , 'LINE' : [0x204b] - \ }, - \ }, - \ 'fancy': { - \ 'dividers': [ [0x2b80], [0x2b81], [0x2b82], [0x2b83] ] - \ , 'symbols' : { - \ 'BRANCH': [0x2b60] - \ , 'RO' : [0x2b64] - \ , 'FT' : [0x2b62, 0x2b63] - \ , 'LINE' : [0x2b61] - \ } - \ } -\ } - -" Handle symbol overrides -for [s:key, s:value] in items(g:Powerline_symbols_override) - let g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[s:key] = s:value - - unlet! s:key s:value -endfor - -" Handle divider overrides -if len(g:Powerline_dividers_override) == 4 - let g:Pl#Parser#Symbols[g:Powerline_symbols].dividers = g:Powerline_dividers_override -endif - -let s:LEFT_SIDE = 0 -let s:RIGHT_SIDE = 2 - -let s:PADDING = 1 - -let s:EMPTY_SEGMENT = { 'type': 'empty' } - -let s:HARD_DIVIDER = 0 -let s:SOFT_DIVIDER = 1 - -function! Pl#Parser#GetStatusline(segments) " {{{ - let statusline = { - \ 'n': '' - \ , 'N': '' - \ , 'v': '' - \ , 'i': '' - \ , 'r': '' - \ , 's': '' - \ } - - " Run through the different modes and create the statuslines - for mode in keys(statusline) - " Create an empty statusline list - let stl = [] - - call extend(stl, s:ParseSegments(mode, s:LEFT_SIDE, a:segments)) - - let statusline[mode] .= join(stl, '') - endfor - - return statusline -endfunction " }}} -function! Pl#Parser#ParseChars(arg) " {{{ - " Handles symbol arrays which can be either an array of hex values, - " or a string. Will convert the hex array to a string, or return the - " string as-is. - let arg = a:arg - - if type(arg) == type([]) - " Hex array - call map(arg, 'nr2char(v:val)') - - return join(arg, '') - endif - - " Anything else, just return it as it is - return arg -endfunction " }}} -function! s:ParseSegments(mode, side, segments, ...) " {{{ - let mode = a:mode - let side = a:side - let segments = a:segments - - let level = exists('a:1') ? a:1 : 0 - let base_color = exists('a:2') ? a:2 : {} - - let ret = [] - - for i in range(0, len(segments) - 1) - unlet! seg_prev seg_curr seg_next - - " Prepare some resources (fetch previous, current and next segment) - let seg_curr = deepcopy(get(segments, i)) - - " Find previous segment - let seg_prev = s:EMPTY_SEGMENT - - " If we're currently at i = 0 we have to start on 0 or else we will start on the last segment (list[-1]) - let range_start = (i == 0 ? i : i - 1) - for j in range(range_start, 0, -1) - let seg = deepcopy(get(segments, j)) - if get(seg, 'name') ==# 'TRUNCATE' - " Skip truncate segments - continue - endif - - " Look ahead for another segment that's visible in this mode - if index(get(seg, 'modes'), mode) != -1 - " Use this segment - let seg_prev = seg - - break - endif - endfor - - "" Find next segment - let seg_next = s:EMPTY_SEGMENT - - " If we're currently at i = len(segments) - 1 we have to start on i or else we will get an error because the index doesn't exist - let range_start = (i == len(segments) - 1 ? i : i + 1) - for j in range(range_start, len(segments) - 1, 1) - let seg = deepcopy(get(segments, j)) - if get(seg, 'name') ==# 'TRUNCATE' - " Skip truncate segments - continue - endif - - " Look ahead for another segment that's visible in this mode - if index(get(seg, 'modes'), mode) != -1 - " Use this segment - let seg_next = seg - - break - endif - endfor - - if index(get(seg_curr, 'modes', []), mode) == -1 - " The segment is invisible in this mode, skip it - " FIXME When two segments after each other are hidden, a gap appears where the segments would be, this is probably due to segment padding - continue - endif - - " Handle the different segment types - if seg_curr.type == 'segment' - if seg_curr.name ==# 'TRUNCATE' - " Truncate statusline - call add(ret, '%<') - elseif seg_curr.name ==# 'SPLIT' - " Split statusline - - " Switch sides - let side = s:RIGHT_SIDE - - " Handle highlighting - let mode_colors = get(seg_curr.colors, mode, seg_curr.colors['n']) - let hl_group = s:HlCreate(mode_colors) - - " Add segment text - call add(ret, '%#'. hl_group .'#%=') - else - " Add segment text - let text = seg_curr.text - - " Decide on whether to use the group's colors or the segment's colors - let colors = get(seg_curr, 'colors', base_color) - - " Fallback to normal (current) highlighting if we don't have mode-specific highlighting - let mode_colors = get(colors, mode, get(colors, 'n', {})) - - if empty(mode_colors) - echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"' - - continue - endif - - " Check if we're in a group (level > 0) - if level > 0 - " If we're in a group we don't have dividers between - " segments, so we should only pad one side, but only pad - " if the segment doesn't have Pl#Segment#NoPadding() set - let padding_right = (seg_curr.padding && side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') - let padding_left = (seg_curr.padding && side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') - - " Check if we lack a bg/fg color for this segment - " If we do, use the bg/fg color from base_color - let base_color_mode = ! has_key(base_color, mode) ? base_color['n'] : base_color[mode] - - for col in ['ctermbg', 'ctermfg', 'guibg', 'guifg'] - if empty(mode_colors[col]) - let mode_colors[col] = base_color_mode[col] - endif - endfor - else - "" If we're outside a group we have dividers and must pad both sides - let padding_left = repeat(' ', s:PADDING) - let padding_right = repeat(' ', s:PADDING) - endif - - " Get main hl group for segment - let hl_group = s:HlCreate(mode_colors) - - " Prepare segment text - let text = '%(%#'. hl_group .'#'. padding_left . text . padding_right . '%)' - - if level == 0 - " Add divider to single segments - let text = s:AddDivider(text, side, mode, colors, seg_prev, seg_curr, seg_next) - endif - - call add(ret, text) - endif - elseif seg_curr.type == 'segment_group' - " Recursively parse segment group - let func_params = [mode, side, seg_curr.segments, level + 1] - - if has_key(seg_curr, 'colors') - " Pass the base colors on to the child segments - call add(func_params, seg_curr.colors) - endif - - " Get segment group string - let text = join(call('s:ParseSegments', func_params), '') - - " Pad on the opposite side of the divider - let padding_right = (side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') - let padding_left = (side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') - - let text = s:AddDivider(padding_left . text . padding_right, side, mode, seg_curr.colors, seg_prev, seg_curr, seg_next) - - call add(ret, text) - endif - endfor - - return ret -endfunction " }}} -function! s:HlCreate(hl) " {{{ - " Create a short and unique highlighting group name - " It uses the hex values of all the color properties and an attribute flag at the end - " NONE colors are translated to NN for cterm and NNNNNN for gui colors - let hi_group = printf('Pl%s%s%s%s%s' - \ , (a:hl['ctermfg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermfg'])) - \ , (a:hl['guifg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guifg'] )) - \ , (a:hl['ctermbg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermbg'])) - \ , (a:hl['guibg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guibg'] )) - \ , substitute(a:hl['attr'], '\v([a-zA-Z])[a-zA-Z]*,?', '\1', 'g') - \ ) - - if ! s:HlExists(hi_group) - let ctermbg = a:hl['ctermbg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermbg']) - if (has('win32') || has('win64')) && !has('gui_running') && ctermbg != 'NONE' && ctermbg > 128 - let ctermbg -= 128 - endif - let hi_cmd = printf('hi %s ctermfg=%s ctermbg=%s cterm=%s guifg=%s guibg=%s gui=%s' - \ , hi_group - \ , a:hl['ctermfg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermfg']) - \ , ctermbg - \ , a:hl['attr'] - \ , (a:hl['guifg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guifg'])) - \ , (a:hl['guibg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guibg'])) - \ , a:hl['attr'] - \ ) - - exec hi_cmd - - " Add command to Pl#HL list for caching - call add(g:Pl#HL, hi_cmd) - endif - - " Return only the highlighting group name - return hi_group -endfunction " }}} -function! s:HlExists(hl) " {{{ - if ! hlexists(a:hl) - return 0 - endif - - redir => hlstatus - silent exec 'hi' a:hl - redir END - - return (hlstatus !~ 'cleared') -endfunction " }}} -function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{ - let seg_prev = a:prev - let seg_curr = a:curr - let seg_next = a:next - - " Set default color/type for the divider - let div_colors = get(a:colors, a:mode, a:colors['n']) - let div_type = s:SOFT_DIVIDER - - " Define segment to compare - let cmp_seg = a:side == s:LEFT_SIDE ? seg_next : seg_prev - - let cmp_all_colors = get(cmp_seg, 'colors', {}) - let cmp_colors = get(cmp_all_colors, a:mode, get(cmp_all_colors, 'n', {})) - - if ! empty(cmp_colors) - " Compare the highlighting groups - " - " If the background color for cterm is equal, use soft divider with the current segment's highlighting - " If not, use hard divider with a new highlighting group - " - " Note that if the previous/next segment is the split, a hard divider is always used - if get(div_colors, 'ctermbg') != get(cmp_colors, 'ctermbg') || get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT' - let div_type = s:HARD_DIVIDER - - " Create new highlighting group - if div_colors['attr'] =~ 'reverse' && cmp_colors['attr'] =~ 'reverse' - " Use FG = CURRENT FG, BG = CMP FG - let div_colors['ctermbg'] = get(cmp_colors, 'ctermfg') - let div_colors['guibg'] = get(cmp_colors, 'guifg') - - let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' - elseif div_colors['attr'] =~ 'reverse' - " Use FG = CURRENT FG, BG = CMP BG - let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') - let div_colors['guibg'] = get(cmp_colors, 'guibg') - - let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' - elseif cmp_colors['attr'] =~ 'reverse' - " Use FG = CMP FG, BG = CURRENT BG : reversed - let div_colors['ctermfg'] = get(cmp_colors, 'ctermfg') - let div_colors['guifg'] = get(cmp_colors, 'guifg') - - let div_colors['attr'] = 'reverse' - - else - " Use FG = CURRENT BG, BG = CMP BG - let div_colors['ctermfg'] = get(div_colors, 'ctermbg') - let div_colors['guifg'] = get(div_colors, 'guibg') - - let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') - let div_colors['guibg'] = get(cmp_colors, 'guibg') - - let div_colors['attr'] = 'NONE' - endif - endif - endif - - " Prepare divider - let divider_raw = deepcopy(g:Pl#Parser#Symbols[g:Powerline_symbols].dividers[a:side + div_type]) - let divider = Pl#Parser#ParseChars(divider_raw) - - " Don't add dividers for segments adjacent to split (unless it's a hard divider) - if ((get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT') && div_type != s:HARD_DIVIDER) - return '' - endif - - if a:side == s:LEFT_SIDE - " Left side - " Divider to the right - return printf('%%(%s%%#%s#%s%%)', a:text, s:HlCreate(div_colors), divider) - else - " Right side - " Divider to the left - return printf('%%(%%#%s#%s%s%%)', s:HlCreate(div_colors), divider, a:text) - endif -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Segment.vim b/sources_forked/vim-powerline/autoload/Pl/Segment.vim deleted file mode 100755 index bb09438c..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Segment.vim +++ /dev/null @@ -1,188 +0,0 @@ -let s:default_modes = ['n', 'N', 'v', 'i', 'r', 's'] - -function! s:CheckConditions(params) " {{{ - " Check conditions for a segment/group - " Integer parameters are always conditions - for param in a:params - if type(param) == type(0) && param == 0 - " Break here if it's an integer parameter and it's false (0) - return 0 - endif - unlet! param - endfor - - return 1 -endfunction " }}} -function! Pl#Segment#Create(name, ...) " {{{ - " Check condition parameters - if ! s:CheckConditions(a:000) - return {} - endif - - let name = a:name - let modes = s:default_modes - let padding = 1 - let segments = [] - - for param in a:000 - " Lookup modes for this segment/group - if type(param) == type([]) && param[0] == 'modes' - let modes = param[1] - elseif type(param) == type([]) && param[0] == 'nopadding' - let padding = 0 - elseif type(a:1) == type([]) && a:1[0] == 'segment' - call add(segments, param[1]) - endif - - unlet! param - endfor - - if type(a:1) == type([]) && a:1[0] == 'segment' - " This is a segment group - return ['segment_group', { - \ 'type': 'segment_group' - \ , 'name': name - \ , 'segments': segments - \ , 'modes': modes - \ , 'padding': padding - \ }] - else - " This is a single segment - let text = a:1 - - " Search/replace symbols - for [key, symbol] in items(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols) - let text = substitute( - \ text, - \ '\v\$('. key .')', - \ '\=Pl#Parser#ParseChars(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[submatch(1)])', - \ 'g') - - unlet! key symbol - endfor - - return ['segment', { - \ 'type': 'segment' - \ , 'name': name - \ , 'text': text - \ , 'modes': modes - \ , 'padding': padding - \ }] - endif - -endfunction " }}} -function! Pl#Segment#Init(params) " {{{ - " Check condition parameters - if ! s:CheckConditions(a:params) - return {} - endif - - let segments = {} - let ns = '' - - for param in a:params - if type(param) == type('') - " String parameters is the namespace - let ns = param - elseif type(param) == type([]) - " The data dict is in param[1] - " By default we don't have a namespace for the segment - let segment = param[1] - - if ! empty(ns) - " Update segment so that it includes the namespace - " Add the namespace to the segment dict key - let segment.ns = ns - let segment.name = join([segment.ns, segment.name], ':') - endif - - let key = segment.name - - let segments[key] = segment - endif - - unlet! param - endfor - - return segments -endfunction " }}} -function! Pl#Segment#Modes(modes) " {{{ - " Handle modes for both segments and groups - let modes = split(a:modes, '\zs') - - if modes[0] == '!' - " Filter modes (e.g. "!nr" will ignore the segment in normal and replace modes) - let modes = filter(deepcopy(s:default_modes), 'v:val !~# "['. join(modes[1:]) .']"') - endif - - return ['modes', modes] -endfunction " }}} -function! Pl#Segment#NoPadding() " {{{ - return ['nopadding'] -endfunction " }}} -function! Pl#Segment#Split(...) " {{{ - return a:0 ? a:1 .':SPLIT' : 'SPLIT' -endfunction " }}} -function! Pl#Segment#Truncate() " {{{ - return 'TRUNCATE' -endfunction " }}} -function! Pl#Segment#Get(name) " {{{ - " Return a segment data dict - let args = [] - - " Check for printf segments (lists) - if type(a:name) == type([]) - " We're dealing with a segment with printf arguments - let seg_orig_name = a:name[0] - let args = a:name[1:] - else - let seg_orig_name = a:name - endif - - " Fetch namespace and variants for storing in the segment dict - let seg_ns = '' - let seg_variants = [] - - " Retrieve color scheme variants - let seg_name_split = split(seg_orig_name, '\v\.') - if len(seg_name_split) > 1 - let seg_variants = seg_name_split[1:] - endif - - " Retrieve segment name and namespace - " Use the first piece of the split string, we can't have variants in the final segment name - let seg_name_split = split(seg_name_split[0], '\v:') - let seg_name = seg_name_split[0] - - if len(seg_name_split) > 1 - let seg_ns = seg_name_split[0] - let seg_name = seg_name_split[-1] - endif - - try - " If we have a namespace, try to use the namespaced segment first (i.e. search for the segment in the namespaced file first) - let return_segment = deepcopy(g:Powerline#Segments#{seg_ns}#segments[seg_ns .':'. seg_name]) - catch - try - " We didn't find a namespaced segment, fall back to common segments - let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name]) - catch - " Didn't find the segment among the common segments either, just skip it - return {} - endtry - endtry - - if len(args) && has_key(return_segment, 'text') - " Handle segment printf arguments - " printf doesn't accept lists as its second argument, so we have to work around that - let return_segment.text = call('printf', [ return_segment.text ] + args) - endif - - " Assign namespace, name and variants - let return_segment.ns = seg_ns - let return_segment.name = seg_name - let return_segment.orig_name = seg_orig_name - let return_segment.variants = seg_variants - - return return_segment -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Pl/Theme.vim b/sources_forked/vim-powerline/autoload/Pl/Theme.vim deleted file mode 100755 index da1581e2..00000000 --- a/sources_forked/vim-powerline/autoload/Pl/Theme.vim +++ /dev/null @@ -1,100 +0,0 @@ -function! Pl#Theme#Create(...) " {{{ - let buffer_segments = [] - - for buffer_segment in a:000 - " Remove empty segments (e.g. 'Pl#Theme#Function's) - if empty(buffer_segment) - continue - endif - - call add(buffer_segments, buffer_segment) - endfor - - let buffer_segments = Pl#Colorscheme#Apply(g:Powerline_colorscheme, buffer_segments) - - return buffer_segments -endfunction " }}} -function! Pl#Theme#Callback(name, expr) " {{{ - return ['callback', a:name, a:expr] -endfunction " }}} -function! Pl#Theme#Buffer(ns, ...) " {{{ - let segments = [] - let ns = ! empty(a:ns) ? a:ns .':' : '' - - " Match namespace parameter by default - let matches = Pl#Match#Any(a:ns) - let callback = [] - - let args = a:000 - let args = Pl#Mod#ApplySegmentMods(args) - - " Fetch segment data dicts - for item in args - if type(item) == type([]) - if item[0] == 'match' - " Match item, overrides default namespace match - let matches = item - - unlet! item - continue - elseif item[0] == 'callback' - " Store the item as a callback expression - let matches = ['match', 'none'] - let callback = [a:ns, item[1], item[2]] - - unlet! item - continue - endif - - " printf segment, append ns to first item in list - let item[0] = ns . item[0] - else - let item = ns . item - endif - - let segment = Pl#Segment#Get(item) - - if ! empty(segment) - " Skip empty (possible disabled) segments - call add(segments, segment) - endif - - unlet! item - endfor - - return { - \ 'matches': matches - \ , 'callback': callback - \ , 'segments': segments - \ } -endfunction " }}} -function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{ - " It's very important to NOT refer to the theme dict until everything's loaded! - " - " Because these functions are called from the vimrc, we need to put the - " actions in a list which will be parsed later. - " - " These functions don't accept a name parameter, because they work on the - " currently selected theme (will change any selected theme) - call Pl#Mod#AddSegmentMod('insert_segment', { - \ 'new_segment': a:new_segment, - \ 'where': a:where, - \ 'target_segment': a:target_segment - \ }) -endfunction " }}} -function! Pl#Theme#RemoveSegment(target_segment) " {{{ - " It's very important to NOT refer to the theme dict until everything's loaded! - " - " Because these functions are called from the vimrc, we need to put the - " actions in a list which will be parsed later. - " - " These functions don't accept a name parameter, because they work on the - " currently selected theme (will change any selected theme) - call Pl#Mod#AddSegmentMod('remove_segment', { - \ 'target_segment': a:target_segment - \ }) -endfunction " }}} -function! Pl#Theme#ReplaceSegment(old_segment, new_segment) " {{{ - call Pl#Theme#InsertSegment(a:new_segment, 'after', a:old_segment) - call Pl#Theme#RemoveSegment(a:old_segment) -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim b/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim deleted file mode 100755 index b28a4871..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim +++ /dev/null @@ -1,166 +0,0 @@ -call Pl#Hi#Allocate({ - \ '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, - \ }) - -let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([ - \ Pl#Hi#Segments(['SPLIT'], { - \ 'n': ['white', 'gray2'], - \ 'N': ['white', 'gray0'], - \ 'i': ['white', 'darkestblue'], - \ }), - \ - \ Pl#Hi#Segments(['mode_indicator'], { - \ 'n': ['gray10', 'gray0', ['bold']], - \ 'i': ['darkestcyan', 'white', ['bold']], - \ 'v': ['white', 'darkestblue', ['bold']], - \ 'r': ['white', 'brightred', ['bold']], - \ 's': ['white', 'gray5', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], { - \ 'n': ['gray9', 'gray4'], - \ 'N': ['gray4', 'gray1'], - \ 'i': ['mediumcyan', 'darkblue'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo', 'filename'], { - \ 'n': ['white', 'gray4', ['bold']], - \ 'N': ['gray7', 'gray0', ['bold']], - \ 'i': ['white', 'darkblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.filepath'], { - \ 'n': ['gray10'], - \ 'N': ['gray5'], - \ 'i': ['mediumcyan'], - \ }), - \ - \ Pl#Hi#Segments(['static_str'], { - \ 'n': ['white', 'gray4'], - \ 'N': ['gray7', 'gray1'], - \ 'i': ['white', 'darkblue'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.flags'], { - \ 'n': ['brightestred', ['bold']], - \ 'N': ['darkred'], - \ 'i': ['brightestred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { - \ 'n': ['gray8', 'gray2'], - \ 'i': ['mediumcyan', 'darkestblue'], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo'], { - \ 'n': ['gray2', 'gray10', ['bold']], - \ 'N': ['gray7', 'gray1', ['bold']], - \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['errors'], { - \ 'n': ['brightestorange', 'gray2', ['bold']], - \ 'i': ['brightestorange', 'darkestblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo.line.tot'], { - \ 'n': ['gray6'], - \ 'N': ['gray5'], - \ 'i': ['darkestcyan'], - \ }), - \ - \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { - \ 'n': ['white', 'brightred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { - \ 'n': ['white', 'mediumred', ['bold']], - \ 'N': ['brightred', 'darkestred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { - \ 'n': ['white', 'darkred'], - \ 'N': ['brightred', 'darkestred'], - \ }), - \ - \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { - \ 'n': ['white', 'darkred'], - \ 'N': ['white', 'darkestred'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { - \ 'n': ['white', 'mediumgreen', ['bold']], - \ 'N': ['mediumgreen', 'darkestgreen', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { - \ 'n': ['brightgreen', 'darkgreen'], - \ 'N': ['mediumgreen', 'darkestgreen'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { - \ 'n': ['white', 'darkgreen'], - \ 'N': ['white', 'darkestgreen'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { - \ 'n': ['brightpurple', 'darkestpurple'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { - \ 'n': ['white', 'mediumpurple'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:item'], { - \ 'n': ['darkestpurple', 'white', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:marked'], { - \ 'n': ['brightestred', 'darkestpurple', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:count'], { - \ 'n': ['darkestpurple', 'white'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:SPLIT'], { - \ 'n': ['white', 'darkestpurple'], - \ }), - \ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim b/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim deleted file mode 100755 index 798caa44..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim +++ /dev/null @@ -1,192 +0,0 @@ -" This theme is based on Solarized-dark colors, combined -" with Powerline native colors -call Pl#Hi#Allocate({ - \ '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, - \ - \ 'base00' : [241, 0x657b83], - \ 'base01' : [240, 0x586e75], - \ 'base02' : [0, 0x073642], - \ 'base03' : [234, 0x002b36], - \ 'base0' : [244, 0x839496], - \ 'base1' : [245, 0x93a1a1], - \ 'base2' : [254, 0xeee8d5], - \ 'base3' : [230, 0xfdf6e3], - \ 'yellow' : [136, 0xb58900], - \ 'orange' : [166, 0xcb4b16], - \ 'red' : [160, 0xdc322f], - \ 'magenta' : [125, 0xd33682], - \ 'violet' : [61, 0x6c71c4], - \ 'blue' : [33, 0x268bd2], - \ 'cyan' : [37, 0x2aa198], - \ 'green' : [64, 0x859900], - \ }) - -let g:Powerline#Colorschemes#skwp#colorscheme = Pl#Colorscheme#Init([ - \ Pl#Hi#Segments(['SPLIT'], { - \ 'n': ['white', 'base02'], - \ 'N': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['mode_indicator'], { - \ 'n': ['darkestgreen', 'brightgreen', ['bold']], - \ 'i': ['darkestcyan', 'white', ['bold']], - \ 'v': ['red', 'brightorange', ['bold']], - \ 'r': ['white', 'violet', ['bold']], - \ 's': ['white', 'gray5', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { - \ 'n': ['base03', 'blue'], - \ 'N': ['gray5', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['scrollpercent'], { - \ 'n': ['gray7', 'gray2'], - \ 'N': ['base2', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { - \ 'n': ['base2', 'darkestblue', ['bold']], - \ 'N': ['base1', 'base02', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.filepath'], { - \ 'n': ['gray10'], - \ 'N': ['gray5'], - \ 'i': ['mediumcyan'], - \ }), - \ - \ Pl#Hi#Segments(['static_str'], { - \ 'n': ['base3', 'violet'], - \ 'N': ['base1', 'base02'], - \ 'i': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.flags'], { - \ 'n': ['base03', ['bold']], - \ 'N': ['gray5'], - \ 'i': ['base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { - \ 'n': ['gray5', 'gray2'], - \ 'i': ['mediumcyan', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo'], { - \ 'n': ['gray2', 'gray10', ['bold']], - \ 'N': ['gray7', 'gray1', ['bold']], - \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['errors'], { - \ 'n': ['orange', 'base02', ['bold']], - \ 'N': ['gray5', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo.line.tot'], { - \ 'n': ['gray6'], - \ 'N': ['gray5'], - \ 'i': ['darkestcyan'], - \ }), - \ - \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { - \ 'n': ['base3', 'red', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { - \ 'n': ['base3', 'darkblue', ['bold']], - \ 'N': ['base1', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { - \ 'n': ['white', 'base02'], - \ 'N': ['gray5', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { - \ 'n': ['white', 'base02'], - \ 'N': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { - \ 'n': ['gray10', 'darkestblue', ['bold']], - \ 'N': ['gray3', 'base02', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { - \ 'n': ['base3', 'blue'], - \ 'N': ['gray5', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { - \ 'n': ['gray3', 'base02'], - \ 'N': ['gray3', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { - \ 'n': ['green', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { - \ 'n': ['green', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:item'], { - \ 'n': ['base2', 'darkestblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:marked'], { - \ 'n': ['brightgreen', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:count'], { - \ 'n': ['base0', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:SPLIT'], { - \ 'n': ['white', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['status'], { - \ 'n': ['green', 'base02'], - \ 'N': ['gray5', 'base02'], - \ }), -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Functions.vim b/sources_forked/vim-powerline/autoload/Powerline/Functions.vim deleted file mode 100755 index 26db9b36..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Functions.vim +++ /dev/null @@ -1,141 +0,0 @@ -" Recalculate the trailing whitespace warning when idle, and after saving -autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning - -function! Powerline#Functions#GetFilepath() " {{{ - " Recalculate the filepath when cwd changes. - let cwd = getcwd() - if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd - unlet! b:Powerline_filepath - endif - let b:Powerline_cwd = cwd - - if exists('b:Powerline_filepath') - return b:Powerline_filepath - endif - - let dirsep = has('win32') && ! &shellslash ? '\' : '/' - let filepath = expand('%:p') - - if empty(filepath) - return '' - endif - - let ret = '' - - if g:Powerline_stl_path_style == 'short' - " Display a short path where the first directory is displayed with its - " full name, and the subsequent directories are shortened to their - " first letter, i.e. "/home/user/foo/foo/bar/baz.vim" becomes - " "~/foo/f/b/baz.vim" - " - " This displays the shortest possible path, relative to ~ or the - " current directory. - let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h' - let fpath = split(fnamemodify(filepath, mod), dirsep) - let fpath_shortparts = map(fpath[1:], 'v:val[0]') - let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep - elseif g:Powerline_stl_path_style == 'relative' - " Display a relative path, similar to the %f statusline item - let ret = fnamemodify(filepath, ':~:.:h') . dirsep - elseif g:Powerline_stl_path_style == 'full' - " Display the full path, similar to the %F statusline item - let ret = fnamemodify(filepath, ':h') . dirsep - endif - - if ret == ('.' . dirsep) - let ret = '' - endif - - let b:Powerline_filepath = ret - return ret -endfunction " }}} -function! Powerline#Functions#GetShortPath(threshold) " {{{ - let fullpath = split(substitute(expand('%:p:h'), $HOME, '~', 'g'), '/') - - if len(fullpath) > a:threshold - let fullpath = [fullpath[0], '…'] + fullpath[-a:threshold + 1 :] - endif - - return join(fullpath, '/') -endfunction " }}} -function! Powerline#Functions#GetMode() " {{{ - let mode = mode() - - if mode ==# 'v' - let mode = get(g:, "Powerline_mode_v", "VISUAL") - elseif mode ==# 'V' - let mode = get(g:, "Powerline_mode_V", "V⋅LINE") - elseif mode ==# '' - let mode = get(g:, "Powerline_mode_cv", "V⋅BLOCK") - elseif mode ==# 's' - let mode = get(g:, "Powerline_mode_s", "SELECT") - elseif mode ==# 'S' - let mode = get(g:, "Powerline_mode_S", "S⋅LINE") - elseif mode ==# '' - let mode = get(g:, "Powerline_mode_cs", "S⋅BLOCK") - elseif mode =~# '\vi' - let mode = get(g:, "Powerline_mode_i", "INSERT") - elseif mode =~# '\v(R|Rv)' - let mode = get(g:, "Powerline_mode_R", "REPLACE") - else - " Fallback to normal mode - let mode = get(g:, "Powerline_mode_n", "NORMAL") - endif - - return mode -endfunction " }}} -function! Powerline#Functions#GetFilesize() " {{{ - let bytes = getfsize(expand("%:p")) - - if bytes <= 0 - return '' - endif - - if bytes < 1024 - return bytes . 'B' - else - return (bytes / 1024) . 'kB' - endif -endfunction "}}} -function! Powerline#Functions#GetCharCode() " {{{ - " Get the output of :ascii - redir => ascii - silent! ascii - redir END - - if match(ascii, 'NUL') != -1 - return 'NUL' - endif - - " Zero pad hex values - let nrformat = '0x%02x' - - let encoding = (&fenc == '' ? &enc : &fenc) - - if encoding == 'utf-8' - " Zero pad with 4 zeroes in unicode files - let nrformat = '0x%04x' - endif - - " Get the character and the numeric value from the return value of :ascii - " This matches the two first pieces of the return value, e.g. - " " 70" => char: 'F', nr: '70' - let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)') - - " Format the numeric value - let nr = printf(nrformat, nr) - - return "'". char ."' ". nr -endfunction "}}} -function! Powerline#Functions#GetWSMarker() " {{{ - " Return '...' if trailing white space is detected - " Return '' otherwise - if ! exists("b:statusline_trailing_space_warning") - if search('\s$', 'nw') != 0 - let b:statusline_trailing_space_warning = ' … ' - else - let b:statusline_trailing_space_warning = '' - endif - endif - return b:statusline_trailing_space_warning -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim b/sources_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim deleted file mode 100755 index 29135e43..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim +++ /dev/null @@ -1,12 +0,0 @@ -function! Powerline#Functions#ft_man#GetName() " {{{ - let matches = matchlist(getline(1), '\v^([a-zA-Z_\.\-]+)\((\d+)\)') - - if ! len(matches) - return 'n/a' - endif - - let file = tolower(matches[1]) - let num = matches[2] - - return file -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim b/sources_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim deleted file mode 100755 index bb001315..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim +++ /dev/null @@ -1,7 +0,0 @@ -function! Powerline#Functions#fugitive#GetBranch(symbol) " {{{ - let ret = fugitive#statusline() - - let ret = substitute(ret, '\c\v\[?GIT\(([a-z0-9\-_\./:]+)\)\]?', a:symbol .' \1', 'g') - - return ret -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim b/sources_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim deleted file mode 100755 index 61d94adf..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim +++ /dev/null @@ -1,17 +0,0 @@ -function! Powerline#Functions#hgrev#Status(symbol) " {{{ - if ! exists('*HGRev') - " HGRev hasn't been loaded yet - return '' - endif - if !exists("b:statusline_hg_status") - silent execute "RefreshMercurialRev" - endif - let b:statusline_hg_status=HGRev() - if b:statusline_hg_status != '-' - let ret = "\u26A1". '' . substitute(b:statusline_hg_status, '^[^ ]*', '\1', 'g') - let ret=substitute(ret,' M$','+','g') - else - let ret='' - endif - return ret -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim b/sources_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim deleted file mode 100755 index 70c8849e..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim +++ /dev/null @@ -1,16 +0,0 @@ -function! Powerline#Functions#syntastic#GetErrors(line_symbol) " {{{ - if ! exists('g:syntastic_stl_format') - " Syntastic hasn't been loaded yet - return '' - endif - - " Temporarily change syntastic output format - let old_stl_format = g:syntastic_stl_format - let g:syntastic_stl_format = '%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }' - - let ret = SyntasticStatuslineFlag() - - let g:syntastic_stl_format = old_stl_format - - return ret -endfunction " }}} diff --git a/sources_forked/vim-powerline/autoload/Powerline/Matches.vim b/sources_forked/vim-powerline/autoload/Powerline/Matches.vim deleted file mode 100755 index 5cce4756..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Matches.vim +++ /dev/null @@ -1,13 +0,0 @@ -let g:Powerline#Matches#matches = { - \ 'command_t' : Pl#Match#Add('bufname("%")', 'GoToFile'), - \ 'bt_help' : Pl#Match#Add('&bt' , 'help'), - \ 'ft_man' : Pl#Match#Add('&ft' , 'man'), - \ 'ft_qf' : Pl#Match#Add('&ft' , 'qf'), - \ 'ft_vimpager' : Pl#Match#Add('&ft' , 'vimpager'), - \ 'gundo_preview' : Pl#Match#Add('bufname("%")', '__Gundo_Preview__'), - \ 'gundo_tree' : Pl#Match#Add('bufname("%")', '__Gundo__'), - \ 'lustyexplorer' : Pl#Match#Add('bufname("%")', '\[LustyExplorer-Buffers\]'), - \ 'minibufexplorer' : Pl#Match#Add('bufname("%")', '\-MiniBufExplorer\-'), - \ 'tagbar' : Pl#Match#Add('&ft' , 'tagbar'), - \ 'nerdtree' : Pl#Match#Add('&ft' , 'nerdtree'), -\ } diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments.vim deleted file mode 100755 index c74c34f3..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments.vim +++ /dev/null @@ -1,30 +0,0 @@ -let g:Powerline#Segments#segments = Pl#Segment#Init([ - \ Pl#Segment#Create('SPLIT' , '__split__'), - \ Pl#Segment#Create('TRUNCATE', '__truncate__'), - \ - \ Pl#Segment#Create('paste_indicator' , '%{&paste ? "PASTE" : ""}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('mode_indicator' , '%{Powerline#Functions#GetMode()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fileinfo', - \ Pl#Segment#Create('flags.ro' , '%{&readonly ? "$RO" : ""}'), - \ Pl#Segment#Create('filepath' , '%{Powerline#Functions#GetFilepath()}', Pl#Segment#NoPadding()), - \ Pl#Segment#Create('filename' , '%t'), - \ Pl#Segment#Create('flags.mod' , '%M'), - \ Pl#Segment#Create('flags.type' , '%H%W'), - \ ), - \ Pl#Segment#Create('filename' , '%t'), - \ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'), - \ Pl#Segment#Create('static_str' , '%%{"%s"}'), - \ Pl#Segment#Create('raw' , '%s'), - \ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fileencoding' , '%{(&fenc == "" ? &enc : &fenc)}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('filetype' , '%{strlen(&ft) ? &ft : "no ft"}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('scrollpercent' , '%3p%%'), - \ Pl#Segment#Create('lineinfo', - \ Pl#Segment#Create('line.cur' , '$LINE %3l'), - \ Pl#Segment#Create('line.tot' , ':%-2v', Pl#Segment#NoPadding()), - \ ), - \ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')), -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim deleted file mode 100755 index 41c5ebfc..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim +++ /dev/null @@ -1,20 +0,0 @@ -if !exists("g:Powerline#Segments#ctrlp#segments#focus ") - let g:Powerline#Segments#ctrlp#segments#focus = '%{"%0"}' -endif -if !exists("g:Powerline#Segments#ctrlp#segments#prev ") - let g:Powerline#Segments#ctrlp#segments#prev = '%-3{"%3"}' -endif -if !exists("g:Powerline#Segments#ctrlp#segments#next ") - let g:Powerline#Segments#ctrlp#segments#next = '%-3{"%5"}' -endif - -let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp' - \ , Pl#Segment#Create('focus', g:Powerline#Segments#ctrlp#segments#focus) - \ , Pl#Segment#Create('byfname', '%{"%1"}') - \ , Pl#Segment#Create('prev', g:Powerline#Segments#ctrlp#segments#prev) - \ , Pl#Segment#Create('item', '%-9{"%4"}') - \ , Pl#Segment#Create('next', g:Powerline#Segments#ctrlp#segments#next) - \ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}') - \ - \ , Pl#Segment#Create('count', '%-6{"%0"}') -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim deleted file mode 100755 index 6ed0cc30..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim +++ /dev/null @@ -1,3 +0,0 @@ -let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init(['ft_man', - \ Pl#Segment#Create('filename', '%{Powerline#Functions#ft_man#GetName()}') -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim deleted file mode 100755 index bb46eeca..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init(['fugitive', - \ (exists('g:loaded_fugitive') && g:loaded_fugitive == 1), - \ - \ Pl#Segment#Create('branch', '%{Powerline#Functions#fugitive#GetBranch("$BRANCH")}') -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim deleted file mode 100755 index 3e651d13..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim +++ /dev/null @@ -1,4 +0,0 @@ -let g:Powerline#Segments#hgrev#segments = Pl#Segment#Init(['hgrev', - \ (exists('hgrev_loaded')), - \ Pl#Segment#Create('branch', '%{Powerline#Functions#hgrev#Status("$BRANCH")}') - \ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim deleted file mode 100755 index c840632d..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:Powerline#Segments#rvm#segments = Pl#Segment#Init(['rvm', - \ (exists('g:loaded_rvm') && g:loaded_rvm == 1), - \ - \ Pl#Segment#Create('string', '%{rvm#string()}'), - \ Pl#Segment#Create('statusline', '%{rvm#statusline()}') -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim deleted file mode 100755 index 5a893d6e..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic', - \ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1), - \ - \ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N')) -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim deleted file mode 100755 index 5db8cd95..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:Powerline#Segments#tagbar#segments = Pl#Segment#Init(['tagbar', - \ (exists(':Tagbar') > 0), - \ - \ Pl#Segment#Create('currenttag', '%{tagbar#currenttag("%s", "")}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fullcurrenttag', '%{tagbar#currenttag("%s", "", "f")}', Pl#Segment#Modes('!N')) -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim b/sources_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim deleted file mode 100755 index 8c7d6fb5..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init(['virtualenv', - \ has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1), - \ - \ Pl#Segment#Create('statusline', '%{virtualenv#statusline()}') -\ ]) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Themes/default.vim b/sources_forked/vim-powerline/autoload/Powerline/Themes/default.vim deleted file mode 100755 index a97d5b9c..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Themes/default.vim +++ /dev/null @@ -1,116 +0,0 @@ -let g:Powerline#Themes#default#theme = Pl#Theme#Create( - \ Pl#Theme#Buffer('' - \ , 'paste_indicator' - \ , 'mode_indicator' - \ , 'fugitive:branch' - \ , 'hgrev:branch' - \ , 'fileinfo' - \ , 'syntastic:errors' - \ , Pl#Segment#Truncate() - \ , 'tagbar:currenttag' - \ , Pl#Segment#Split() - \ , 'rvm:string' - \ , 'virtualenv:statusline' - \ , 'fileformat' - \ , 'fileencoding' - \ , 'filetype' - \ , 'scrollpercent' - \ , 'lineinfo' - \ ), - \ - \ Pl#Theme#Buffer('command_t' - \ , ['static_str.name', 'Command-T'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , ['raw.line', '%10(Match #%l%)'] - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Undo tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Diff preview'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('bt_help' - \ , ['static_str.name', 'Help'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('ft_vimpager' - \ , ['static_str.name', 'Pager'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('lustyexplorer' - \ , ['static_str.name', 'LustyExplorer'] - \ , ['static_str.buffer', 'Buffer list'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_man' - \ , ['static_str.name', 'Man page'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('minibufexplorer' - \ , ['static_str.name', 'MiniBufExplorer'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_qf' - \ , ['static_str.name', 'Quickfix'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('tagbar' - \ , ['static_str.name', 'Tagbar'] - \ , ['static_str.buffer', 'Tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') - \ , 'ctrlp:prev' - \ , 'ctrlp:item' - \ , 'ctrlp:next' - \ , 'ctrlp:marked' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'ctrlp:focus' - \ , 'ctrlp:byfname' - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') - \ , 'ctrlp:count' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('nerdtree' - \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ) -\ ) diff --git a/sources_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim b/sources_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim deleted file mode 100755 index 64ed1342..00000000 --- a/sources_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim +++ /dev/null @@ -1,116 +0,0 @@ -" Disabled: -" Add the following line into the first theme group to see the highlight -" group -" \ , 'currhigroup' -" -" Line info taken out - I know which line number I'm on from the gutter -"\ , 'lineinfo' -let g:Powerline#Themes#skwp#theme = Pl#Theme#Create( - \ Pl#Theme#Buffer('' - \ , 'fugitive:branch' - \ , 'fileinfo' - \ , 'flags.mod' - \ , 'syntastic:errors' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'sass:status' - \ , 'rvm:string' - \ , 'paste_indicator' - \ ), - \ - \ Pl#Theme#Buffer('command_t' - \ , ['static_str.name', 'Command-T'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , ['raw.line', '%10(Match #%l%)'] - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Undo tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Diff preview'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('bt_help' - \ , ['static_str.name', 'Help'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('ft_vimpager' - \ , ['static_str.name', 'Pager'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('lustyexplorer' - \ , ['static_str.name', 'LustyExplorer'] - \ , ['static_str.buffer', 'Buffer list'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_man' - \ , ['static_str.name', 'Man page'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('minibufexplorer' - \ , ['static_str.name', 'MiniBufExplorer'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_qf' - \ , ['static_str.name', 'Quickfix'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('tagbar' - \ , ['static_str.name', 'Tagbar'] - \ , ['static_str.buffer', 'Tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') - \ , 'ctrlp:prev' - \ , 'ctrlp:item' - \ , 'ctrlp:next' - \ , 'ctrlp:marked' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'ctrlp:focus' - \ , 'ctrlp:byfname' - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') - \ , 'ctrlp:count' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('nerdtree' - \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ) -\ ) diff --git a/sources_forked/vim-powerline/doc/Powerline.txt b/sources_forked/vim-powerline/doc/Powerline.txt deleted file mode 100755 index 33d136fd..00000000 --- a/sources_forked/vim-powerline/doc/Powerline.txt +++ /dev/null @@ -1,429 +0,0 @@ -*Powerline.txt* For Vim version 7.3. Last change: 2011 Nov 23 - - ______ - _________ \ /__ - \_____ \______ _ _____________ / /'__' ___ ____ - | ___/ _ \ \/ \/ / __ \_ ___\ / | |/ \_/ __ \ - | | | (_) \ _ / ___/| | / /__| | | \ ___/ - '___' \____/ \/ \/ \___ |__' /___ /'__'__| /\___ \ - \/ / / \/ \/ - | / - |/ - ' - -============================================================================== -CONTENTS *Powerline-contents* - - 1. Introduction ....................... |Powerline-introduction| - 2. Usage .............................. |Powerline-usage| - 3. Requirements ....................... |Powerline-requirements| - 3.1 Recommended settings ........... |Powerline-recommended-settings| - 4. Configuration ...................... |Powerline-configuration| - 4.1 Powerline_cache_file ........... |Powerline_cache_file| - 4.1.1 Clearing the cache ....... |:PowerlineClearCache| - 4.2 Powerline_cache_enabled ........ |Powerline_cache_enabled| - 4.3 Powerline_symbols .............. |Powerline_symbols| - 4.3.1 Compatible symbols ....... |Powerline-symbols-compatible| - 4.3.2 Fancy symbols ............ |Powerline-symbols-fancy| - 4.3.3 Overriding symbols ....... |Powerline_symbols_override| - 4.3.4 Overriding dividers ...... |Powerline_dividers_override| - 4.4 Powerline_theme ................ |Powerline_theme| - 4.5 Powerline_colorscheme .......... |Powerline_colorscheme| - 4.6 Powerline_stl_path_style ....... |Powerline_stl_path_style| - 5. Fonts .............................. |Powerline-fonts| - 6. Customization ...................... |Powerline-customization| - 6.1 Basic customization ............ |Powerline-basic-customization| - 6.2 Advanced customization ......... |Powerline-advanced-customization| - 6.2.1 Colorschemes ............. |Powerline-cust-colorschemes| - 6.2.2 Functions ................ |Powerline-cust-functions| - 6.2.3 Segments ................. |Powerline-cust-segments| - 6.2.4 Themes ................... |Powerline-cust-themes| - 7. License ............................ |Powerline-license| - 8. Known issues ....................... |Powerline-known-issues| - 9. Contributing ....................... |Powerline-contributing| - -============================================================================== -1. Introduction *Powerline* *Powerline-introduction* - -Powerline is a utility plugin which allows you to create better-looking, more -functional Vim statuslines. - -============================================================================== -2. Usage *Powerline-usage* - -Powerline is automatically enabled when it's installed, either by unzipping -the provided archive or by adding it as a Pathogen/Vundle bundle. - -Powerline replaces the standard Vim 'statusline' with a custom statusline made -up of Powerline segments. - -Powerline ignores any 'statusline' customizations you have defined in your -|vimrc|. If you remove Powerline, your 'statusline' customizations are -restored. - -============================================================================== -3. Requirements *Powerline-requirements* - -Powerline has been developed and tested in Vim 7.3, but it should run without -any problems in Vim 7.2. The default configuration requires a Unix-like system -to work properly. - -The plugin only works with Vim running in an 88/256-color terminal or Gvim. - -Vi-compatible mode must be disabled. - ------------------------------------------------------------------------------- -3.1 Recommended settings *Powerline-recommended-settings* - -The following configuration options should be set in your |vimrc|: > - - set nocompatible " Disable vi-compatibility - set laststatus=2 " Always show the statusline - set encoding=utf-8 " Necessary to show Unicode glyphs - -Note: If you're using an 88/256-color terminal but still don't see the colored -statusline, you may have to set the following option as well: > - - set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors - -============================================================================== -4. Configuration *Powerline-configuration* - -Powerline will work fine without any user configuration, but default behavior -can be overridden by setting configuration variables globally in your |vimrc| -file. - ------------------------------------------------------------------------------- -4.1 Powerline_cache_file *Powerline_cache_file* - -By default Powerline caches all the statuslines and colors in a cache file in -the plugin's directory (or the Vim directory, depending on the installation -method used). - -It's recommended that you enable the cache, as this dramatically improves Vim -startup time after the cache file has been generated (the plugin usually loads -within ~100ms without the cache and ~1ms with the cache). - -Note: The default cache filename includes the current theme, colorscheme and -symbol settings in order to tie the cache file to your current configuration, -so the cache file will be regenerated when you change any settings. This may -leave several old cache files in your Vim folder, and these may safely be -deleted. - -Defaults: "/Powerline___.cache" - ------------------------------------------------------------------------------- -4.1.1 Clearing the cache *:PowerlineClearCache* - -Powerline provides a command to easily clear the cache after changing your -settings or updating your theme. Simply run the following command to clear -your cache, and restart Vim afterwards: > - - :PowerlineClearCache -< ------------------------------------------------------------------------------- -4.2 Powerline_cache_enabled *Powerline_cache_enabled* - -It's possible to disable statusline caching by setting this option to 0. This -is mostly useful when developing statuslines. - -Example: > - - let g:Powerline_cache_enabled = 0 -< - -Default: 1 - ------------------------------------------------------------------------------- -4.3 Powerline_symbols *Powerline_symbols* - -This option defines which set of symbols and dividers you want to use. There -are currently three available options: "compatible", "unicode" and "fancy". - - TYPE DESCRIPTION ~ - compatible Doesn't use any special characters. - unicode Simulates icons and arrows using similar Unicode glyphs. - fancy Custom icons and arrows. Requires a patched font. - -Example: > - - let g:Powerline_symbols = 'fancy' -< - -Default: "compatible" - -Symbols can be inserted into statuslines by using the following variables -(just insert the variables as text in your segments): - - VARIABLE DESCRIPTION ~ - $BRANCH Inserts a branch symbol - $RO Inserts a read-only symbol - $FT Inserts a filetype symbol - $LINE Inserts a line number symbol - ------------------------------------------------------------------------------- -4.3.1 Compatible symbols *Powerline-symbols-compatible* - -These symbols will work in any configuration, and do not require a special -font to work. This option will replace the fancy icons with plain text, and -the pointy dividers with straight lines. - ------------------------------------------------------------------------------- -4.3.2 Fancy symbols *Powerline-symbols-fancy* - -These symbols require a custom font to work. A font patcher is provided for -adding the required symbols to any outline font and some bitmap fonts, see -|Powerline-fonts| and the provided README file for usage details. - ------------------------------------------------------------------------------- -4.3.3 Overriding symbols *Powerline_symbols_override* - -You can override symbols by adding your symbols to the -g:Powerline_symbols_override dictionary. Example: If you want the branch -symbol to be "∓" (hex code 0x2213) and the line symbol to be "L" you can add -the following to your |vimrc|: > - - let g:Powerline_symbols_override = { - \ 'BRANCH': [0x2213], - \ 'LINE': 'L', - \ } -< ------------------------------------------------------------------------------- -4.3.4 Overriding dividers *Powerline_dividers_override* - -If you for some reason want to override the dividers then you can set -g:Powerline_dividers_override to a list with exactly four elements: - - 1: Hard right-pointing arrow - 2: Soft right-pointing arrow - 3: Hard left-pointing arrow - 4: Soft left-pointing arrow - -Example: > - - let g:Powerline_dividers_override = ['>>', '>', '<<', '<'] -< - ------------------------------------------------------------------------------- -4.3.5 Overriding mode names *Powerline_mode* - -You can change the names used for modes at the far left by setting some -variables in your |vimrc|. For example you can change "N" to "NORMAL" with: > - - let g:Powerline_mode_n = 'NORMAL' -< -The variables are all named beginning with 'g:Powerline_mode_', as follows: - -mode name default note ~ -Normal n ' N ' (surrounded by spaces) -Insert i INSERT -Replace R REPLACE |Replace-mode| -Visual v VISUAL |Visual-mode| -Visual linewise V V⋅LINE -Visual blockwise cv V⋅BLOCK -Select s SELECT |Select-mode| -Select linewise S S⋅LINE -Select blockwise cs S⋅BLOCK - ------------------------------------------------------------------------------ -4.4 Powerline_theme *Powerline_theme* - -This option defines the theme Powerline uses. The available themes are located -in autoload/Powerline/Themes/. A theme is a pre-defined set of Powerline -segments which make up the statusline. - -Example: > - - let g:Powerline_theme = 'skwp' -< - -Default: "default" - ------------------------------------------------------------------------------- -4.5 Powerline_colorscheme *Powerline_colorscheme* - -This option defines the colorscheme Powerline uses. The available colorschemes -are located in autoload/Powerline/Colorschemes/. - -Example: > - - let g:Powerline_colorscheme = 'skwp' -< - -Default: "default" - ------------------------------------------------------------------------------- -4.6 Powerline_stl_path_style *Powerline_stl_path_style* - -There are currently four ways to display the current path and file name. The -default is to only display the file name like the %t statusline item. By -setting this configuration value you can choose from the following ways -display the current path and file name: - - VALUE DESCRIPTION ~ - filename Display only the file name using the %t statusline item. - short Display a short path. The home directory is substituted with - "~", the first directory is displayed with its full name, and - subsequent directories are shortened to their first letter. - I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and - "long/relative/path/foo/bar/baz.vim becomes - "long/r/p/f/b/baz.vim". - relative Display a relative path, similar to the %f statusline item. - full Display the full path, similar to the %F statusline item. - -Example: > - - let g:Powerline_stl_path_style = 'full' -< - -Default: "relative" - -============================================================================== -5. Fonts *Powerline-fonts* - -TODO - -============================================================================== -6. Customization *Powerline-customization* - -There are currently two ways of customizing Powerline: Basic customization -using a couple of functions to insert and remove existing segments from the -statusline, and advanced customization using your own autoload files. The -customization features of Powerline allow you to create your own statuslines -without ever touching the original source code. - ------------------------------------------------------------------------------- -6.1 Basic customization *Powerline-basic-customization* - -Powerline provides the following functions to alter the default statusline -look. These functions should be called from your |vimrc| file or another file -which is sourced at Vim startup. - -Note: These functions are currently applied to all statuslines, so if you -insert a segment after a segment which is present in many statuslines (e.g. -the "filename" segment), all the statuslines will have the inserted segment. -This behavior may be changed in a future version of Powerline. - -Note: Remember to clear your cache with |:PowerlineClearCache| after changing -your statusline! - -Example: > - - " Insert the charcode segment after the filetype segment - call Pl#Theme#InsertSegment('charcode', 'after', 'filetype') - - " Replace the scrollpercent segment with the charcode segment - call Pl#Theme#ReplaceSegment('scrollpercent', 'fileinfo') -< - *Pl#Theme#InsertSegment* -Pl#Theme#InsertSegment({newsegment}, {location}, {targetsegment}) - -This function inserts {newsegment} before or after {targetsegment}. The -{location} parameter specifies the location of the new segment, valid values -are "before" and "after". You can see all the available segments in -autoload/Powerline/Segments.vim and the files specified in -|Powerline-cust-segments|. - -Pl#Theme#RemoveSegment({targetsegment}) *Pl#Theme#RemoveSegment* - -This function removes the {targetsegment} segment entirely. - -Pl#Theme#ReplaceSegment({oldsegment}, {newsegment}) *Pl#Theme#ReplaceSegment* - -This function replaces {oldsegment} with {newsegment}. - ------------------------------------------------------------------------------- -6.2 Advanced customization *Powerline-advanced-customization* - -Because Powerline utilizes Vim's autoload functionality, you can easily create -your own segments, themes, functions and colorschemes without touching the -original source code. This is a bit more complex than using the utility -functions, but it allows you to do a lot more with your statusline. - -Your custom autoload files should be stored in your |runtimepath| (usually in -"~/.vim/autoload/Powerline/*"). - -Note: Remember to clear your cache with |:PowerlineClearCache| after changing -your statusline! - -6.2.1 Colorschemes *Powerline-cust-colorschemes* ------------------------------------------------------------------------------- - -Colorschemes should be stored as separate files in -{runtimepath}/autoload/Powerline/Colorschemes/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.2 Functions *Powerline-cust-functions* ------------------------------------------------------------------------------- - -Functions should be stored as separate files in -{runtimepath}/autoload/Powerline/Functions/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.3 Segments *Powerline-cust-segments* ------------------------------------------------------------------------------- - -Segments should be stored as separate files in -{runtimepath}/autoload/Powerline/Segments/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.4 Themes *Powerline-cust-themes* ------------------------------------------------------------------------------- - -Themes should be stored as separate files in -{runtimepath}/autoload/Powerline/Themes/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -============================================================================== -7. License *Powerline-license* - -Creative Commons Attribution-ShareAlike 3.0 Unported - -http://creativecommons.org/licenses/by-sa/3.0/ - -============================================================================== -8. Known issues *Powerline-known-issues* - -See the issue tracker at -https://github.com/Lokaltog/vim-powerline/issues - -============================================================================== -9. Contributing *Powerline-contributing* - -If you experience any bugs or have feature requests, please open an issue on -GitHub. Fork the source repository on GitHub and send a pull request if you -have any code improvements. - -Author: Kim Silkebækken -Source repository: https://github.com/Lokaltog/vim-powerline - -============================================================================== -vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/sources_forked/vim-powerline/doc/tags b/sources_forked/vim-powerline/doc/tags deleted file mode 100644 index c81aba9a..00000000 --- a/sources_forked/vim-powerline/doc/tags +++ /dev/null @@ -1,34 +0,0 @@ -:PowerlineClearCache Powerline.txt /*:PowerlineClearCache* -Pl#Theme#InsertSegment Powerline.txt /*Pl#Theme#InsertSegment* -Pl#Theme#RemoveSegment Powerline.txt /*Pl#Theme#RemoveSegment* -Pl#Theme#ReplaceSegment Powerline.txt /*Pl#Theme#ReplaceSegment* -Powerline Powerline.txt /*Powerline* -Powerline-advanced-customization Powerline.txt /*Powerline-advanced-customization* -Powerline-basic-customization Powerline.txt /*Powerline-basic-customization* -Powerline-configuration Powerline.txt /*Powerline-configuration* -Powerline-contents Powerline.txt /*Powerline-contents* -Powerline-contributing Powerline.txt /*Powerline-contributing* -Powerline-cust-colorschemes Powerline.txt /*Powerline-cust-colorschemes* -Powerline-cust-functions Powerline.txt /*Powerline-cust-functions* -Powerline-cust-segments Powerline.txt /*Powerline-cust-segments* -Powerline-cust-themes Powerline.txt /*Powerline-cust-themes* -Powerline-customization Powerline.txt /*Powerline-customization* -Powerline-fonts Powerline.txt /*Powerline-fonts* -Powerline-introduction Powerline.txt /*Powerline-introduction* -Powerline-known-issues Powerline.txt /*Powerline-known-issues* -Powerline-license Powerline.txt /*Powerline-license* -Powerline-recommended-settings Powerline.txt /*Powerline-recommended-settings* -Powerline-requirements Powerline.txt /*Powerline-requirements* -Powerline-symbols-compatible Powerline.txt /*Powerline-symbols-compatible* -Powerline-symbols-fancy Powerline.txt /*Powerline-symbols-fancy* -Powerline-usage Powerline.txt /*Powerline-usage* -Powerline.txt Powerline.txt /*Powerline.txt* -Powerline_cache_enabled Powerline.txt /*Powerline_cache_enabled* -Powerline_cache_file Powerline.txt /*Powerline_cache_file* -Powerline_colorscheme Powerline.txt /*Powerline_colorscheme* -Powerline_dividers_override Powerline.txt /*Powerline_dividers_override* -Powerline_mode Powerline.txt /*Powerline_mode* -Powerline_stl_path_style Powerline.txt /*Powerline_stl_path_style* -Powerline_symbols Powerline.txt /*Powerline_symbols* -Powerline_symbols_override Powerline.txt /*Powerline_symbols_override* -Powerline_theme Powerline.txt /*Powerline_theme* diff --git a/sources_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd b/sources_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd deleted file mode 100755 index 34d7d0c8..00000000 --- a/sources_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd +++ /dev/null @@ -1,319 +0,0 @@ -SplineFontDB: 3.0 -FontName: PowerlineSymbols -FullName: PowerlineSymbols -FamilyName: PowerlineSymbols -Weight: Medium -Copyright: -UComments: "2011-11-21: Created." -Version: 001.000 -ItalicAngle: 0 -UnderlinePosition: -98.6328 -UnderlineWidth: 48.8281 -Ascent: 800 -Descent: 200 -LayerCount: 2 -Layer: 0 0 "Back" 1 -Layer: 1 0 "Fore" 0 -XUID: [1021 211 26716215 11021609] -FSType: 0 -OS2Version: 0 -OS2_WeightWidthSlopeOnly: 0 -OS2_UseTypoMetrics: 1 -CreationTime: 1321867751 -ModificationTime: 1326665029 -OS2TypoAscent: 0 -OS2TypoAOffset: 1 -OS2TypoDescent: 0 -OS2TypoDOffset: 1 -OS2TypoLinegap: 90 -OS2WinAscent: 0 -OS2WinAOffset: 1 -OS2WinDescent: 0 -OS2WinDOffset: 1 -HheadAscent: 0 -HheadAOffset: 1 -HheadDescent: 0 -HheadDOffset: 1 -OS2Vendor: 'PfEd' -MarkAttachClasses: 1 -DEI: 91125 -Encoding: UnicodeFull -Compacted: 1 -UnicodeInterp: none -NameList: Adobe Glyph List -DisplaySize: -24 -AntiAlias: 1 -FitToEm: 1 -WinInfo: 0 31 18 -BeginPrivate: 0 -EndPrivate -BeginChars: 1114112 9 - -StartChar: uni2B80 -Encoding: 11136 11136 0 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 1000 m 1 - 621 379 l 1 - 0 -243 l 1 - 0 1000 l 1 -EndSplineSet -EndChar - -StartChar: uni2B81 -Encoding: 11137 11137 1 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -10 991 m 0 - 16 997 23 1000 32 1000 c 0 - 41 1000 48 996 54 990 c 2 - 613 400 l 2 - 619 394 621 386 621 378 c 0 - 621 370 618 362 613 357 c 2 - 54 -233 l 2 - 48 -239 41 -242 32 -242 c 0 - 23 -242 16 -240 10 -234 c 0 - 4 -228 0 -221 0 -212 c 0 - 0 -203 3 -196 8 -190 c 2 - 547 379 l 1 - 8 948 l 2 - 3 954 0 961 0 970 c 0 - 0 979 4 985 10 991 c 0 -EndSplineSet -EndChar - -StartChar: uni2B82 -Encoding: 11138 11138 2 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -621 1000 m 5 - 621 -243 l 5 - 0 379 l 5 - 621 1000 l 5 -EndSplineSet -EndChar - -StartChar: uni2B83 -Encoding: 11139 11139 3 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -612 991 m 0 - 618 985 621 979 621 970 c 0 - 621 961 619 954 613 948 c 2 - 74 379 l 1 - 613 -190 l 2 - 619 -196 621 -203 621 -212 c 0 - 621 -221 618 -228 612 -234 c 0 - 606 -240 598 -242 589 -242 c 0 - 580 -242 574 -239 568 -233 c 2 - 8 357 l 2 - 3 362 0 370 0 378 c 0 - 0 386 3 394 8 400 c 2 - 568 990 l 2 - 574 996 580 1000 589 1000 c 0 - 598 1000 606 997 612 991 c 0 -EndSplineSet -EndChar - -StartChar: uni2B61 -Encoding: 11105 11105 4 -Width: 555 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 800 m 5 - 92 800 l 5 - 92 513 l 5 - 253 513 l 5 - 253 444 l 5 - 0 444 l 5 - 0 800 l 5 -236 312 m 5 - 339 312 l 5 - 468 67 l 5 - 468 312 l 5 - 555 312 l 5 - 555 -44 l 5 - 453 -44 l 5 - 323 200 l 5 - 323 -44 l 5 - 236 -44 l 5 - 236 312 l 5 -EndSplineSet -EndChar - -StartChar: uni2B60 -Encoding: 11104 11104 5 -Width: 676 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 197 m 1 - 94 207 419 279 419 384 c 2 - 419 537 l 1 - 278 501 l 1 - 478 794 l 1 - 677 501 l 1 - 536 537 l 1 - 536 384 l 2 - 536 196 208 126 208 21 c 2 - 208 -244 l 1 - 0 -244 l 1 - 0 197 l 1 -0 288 m 1 - 0 405 0 944 0 944 c 1 - 208 944 l 1 - 208 944 208 451 208 334 c 1 - 185 311 12 288 0 288 c 1 -EndSplineSet -EndChar - -StartChar: uni2B62 -Encoding: 11106 11106 6 -Width: 428 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -88 677 m 2 - 429 677 l 1 - 429 589 l 1 - 88 589 l 1 - 88 162 l 1 - 198 162 l 1 - 198 343 l 1 - 374 343 l 1 - 374 427 l 1 - 198 427 l 1 - 198 506 l 1 - 429 506 l 1 - 429 274 l 1 - 416 263 391 255 374 255 c 2 - 286 255 l 1 - 286 162 l 2 - 286 114 246 74 198 74 c 2 - 88 74 l 2 - 40 74 0 114 0 162 c 2 - 0 589 l 2 - 0 637 40 677 88 677 c 2 -EndSplineSet -EndChar - -StartChar: uni2B63 -Encoding: 11107 11107 7 -Width: 428 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 677 m 5 - 341 677 l 6 - 389 677 429 637 429 589 c 6 - 429 506 l 6 - 429 458 389 418 341 418 c 6 - 287 418 l 5 - 287 162 l 6 - 287 114 247 74 199 74 c 6 - 89 74 l 6 - 41 74 1 114 1 162 c 6 - 1 274 l 6 - 0 274 l 6 - 0 506 l 5 - 89 506 l 5 - 89 162 l 5 - 199 162 l 5 - 199 506 l 5 - 341 506 l 5 - 341 589 l 5 - 0 589 l 5 - 0 677 l 5 -EndSplineSet -EndChar - -StartChar: uni2B64 -Encoding: 11108 11108 8 -Width: 546 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -273 733 m 4 - 429 733 430 538 430 538 c 5 - 430 420 l 5 - 547 420 l 5 - 547 303 l 5 - 547 303 546 -9 273 -9 c 4 - 0 -9 0 303 0 303 c 5 - 0 420 l 5 - 117 420 l 5 - 117 538 l 5 - 117 538 117 733 273 733 c 4 -273 655 m 4 - 195 655 195 576 195 420 c 5 - 352 420 l 5 - 352 576 351 655 273 655 c 4 -273 342 m 4 - 195 342 195 147 273 147 c 4 - 351 147 351 342 273 342 c 4 -EndSplineSet -EndChar -EndChars -BitmapFont: 10 10 8 2 1 -BDFChar: 0 11136 6 0 4 -2 7 -JAC+4q"X@:^jlCb -BDFChar: 1 11137 6 0 4 -2 7 -J3Y4g#RCta5_&h7 -BDFChar: 2 11138 6 1 5 -2 7 -#T,OGq"T(n(^L*A -BDFChar: 3 11139 6 1 5 -2 7 -#S8+DJ:Km-&-r79 -BDFChar: 4 11105 6 1 4 -1 7 -J:N1>!0GR3O8o7\ -BDFChar: 5 11104 7 0 5 -2 7 -^rYQ3 -BDFChar: 8 11108 5 0 5 0 6 -0M"b4bku\c -EndBitmapFont -BitmapFont: 12 10 10 2 1 -BDFChar: 0 11136 7 0 6 -2 11 -!!%Pbi:-O>r:od>^jlCb -BDFChar: 1 11137 7 0 6 -3 11 -!!%O7+:ne]":,P]5_&h7 -BDFChar: 2 11138 7 0 6 -2 11 -!!!-1*'AWHr-UUH$j6P1 -BDFChar: 3 11139 7 0 6 -2 11 -!!!--&0O5gJ3Y4g#Qt,- -BDFChar: 4 11105 7 0 5 0 8 -J:N1>!$jBP,QIfE -BDFChar: 5 11104 8 0 8 -3 11 -z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz -BDFChar: 6 11106 5 1 6 0 8 -!-j$]R"1Qc?iU0, -BDFChar: 7 11107 5 0 5 0 7 -p]QtGOH>Q3 -BDFChar: 8 11108 7 0 5 0 8 -0M"`*r63C_GQ7^D -EndBitmapFont -EndSplineFont diff --git a/sources_forked/vim-powerline/fontpatcher/README.rst b/sources_forked/vim-powerline/fontpatcher/README.rst deleted file mode 100755 index 35b3d5d0..00000000 --- a/sources_forked/vim-powerline/fontpatcher/README.rst +++ /dev/null @@ -1,164 +0,0 @@ -====================== -Powerline font patcher -====================== - -:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) - -Description ------------ - -This font patcher creates dividers and symbols for use with Powerline. The -script requires Python 2 and FontForge compiled with Python bindings. - -Patched fonts are renamed by default (" for Powerline" is added to the font -name) so they don't conflict with existing fonts. Use the ``--no-rename`` -option to disable font renaming. - -Glyph table ------------ - -All the glyphs are stored in the ``U+2B60``-``U+2BFF`` range ("Misc symbols -and arrows"). - -+------------+-------------------+ -| Code point | Description | -+============+===================+ -| ``U+2B60`` | Branch symbol | -+------------+-------------------+ -| ``U+2B61`` | LN (line) symbol | -+------------+-------------------+ -| ``U+2B62`` | FT symbol, part 1 | -+------------+-------------------+ -| ``U+2B63`` | FT symbol, part 2 | -+------------+-------------------+ -| ``U+2B64`` | Padlock (closed) | -+------------+-------------------+ -| ``U+2B80`` | Hard right arrow | -+------------+-------------------+ -| ``U+2B81`` | Soft right arrow | -+------------+-------------------+ -| ``U+2B82`` | Hard left arrow | -+------------+-------------------+ -| ``U+2B83`` | Soft left arrow | -+------------+-------------------+ - -=================== -Font patching guide -=================== - -There's a `GitHub wiki page`_ dedicated to community-contributed patched -fonts. You may download one of the fonts on that page if you don't want to -patch the fonts yourself. - -If you do patch a font that's not included in the wiki (and you have -permission to distribute it), please include it on the wiki page. - -**Note:** The fonts in the wiki may be outdated, and may have different -glyphs than the ones provided in the latest version of Powerline. It's -recommended that you always patch your fonts yourself if you have the -required software. - -.. _`GitHub wiki page`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts - -Linux ------ - -1. Install fontforge with Python bindings. For Ubuntu users the required - package is ``python-fontforge``, for Arch Linux users the required - package is ``fontforge``. It should be something similar for other - distros. - -2. Run the font patcher:: - - $ /path/to/fontpatcher MyFontFile.ttf - -3. Copy the font file into ``~/.fonts`` (or another X font directory):: - - $ cp MyFontFile-Powerline.otf ~/.fonts - - **Note:** If the font is a pure bitmap font (e.g. a PCF font) it will be - stored in the BDF format. This is usually not a problem, and you may - convert the font back to the PCF format using ``bdftopcf`` if you want - to. All other fonts will be stored in the OTF format regardless of the - original format. - -4. Update your font cache:: - - $ sudo fc-cache -vf - - **Note:** If you use vim in rxvt-unicode in the client/daemon mode, you - may need to close all running terminals as well for the font to be - updated. - -5. **For gvim users:** Update the GUI font in your ``vimrc`` file:: - - set guifont=MyFont\ for\ Powerline - - **For terminal users:** Update your terminal configuration to use the - patched font. - -6. Update your ``vimrc`` configuration to use the new symbols:: - - let g:Powerline_symbols = 'fancy' - -7. Make sure that the cache file is deleted:: - - $ rm /tmp/Powerline.cache - -8. Start vim and enjoy your new statusline! - -OS X ----- - -1. Check if you have a FontForge version with Python support by running - ``fontforge -version``. You should see something like this:: - - $ fontforge -version - Copyright (c) 2000-2011 by George Williams. - Executable based on sources from 13:48 GMT 22-Feb-2011-D. - Library based on sources from 13:48 GMT 22-Feb-2011. - fontforge 20110222 - libfontforge 20110222 - - Make sure that the executable version number doesn't have ``NoPython`` in - it. If everything looks OK, skip ahead to step 4. - -2. If you have FontForge but with ``NoPython`` in the version number, please - try to update to a later version:: - - $ brew uninstall fontforge - $ brew update - $ brew install --use-gcc fontforge - - **Note:** You may have to use ``--use-clang`` instead of ``--use-gcc`` - when compiling FontForge. - -3. If you don't have FontForge, install it with Homebrew:: - - $ brew update - $ brew install --use-gcc fontforge - -4. Patch your fonts by passing the ``fontpatcher`` script as a parameter to - FontForge:: - - $ fontforge -script /path/to/fontpatcher MyFontFile.ttf - -5. Install the font by double-clicking the font file in Finder and click - "Install this font" from the preview window. - -6. **For gvim users:** Update the GUI font in your ``vimrc`` file:: - - set guifont=MyFont\ for\ Powerline - - **For terminal users:** Update your terminal configuration to use the - patched font. - -7. Update your ``vimrc`` configuration to use the new symbols:: - - let g:Powerline_symbols = 'fancy' - -8. Make sure that the cache file is deleted:: - - $ rm /tmp/Powerline.cache - -9. Start vim and enjoy your new statusline! diff --git a/sources_forked/vim-powerline/fontpatcher/fontpatcher b/sources_forked/vim-powerline/fontpatcher/fontpatcher deleted file mode 100755 index 2c54a3fa..00000000 --- a/sources_forked/vim-powerline/fontpatcher/fontpatcher +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env python - -"""Font patcher for Powerline. - -Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings. - -Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows"). - -[2b60] Branch symbol -[2b61] LN (line) symbol -[2b62] FT symbol 1 -[2b63] FT symbol 2 -[2b64] Padlock (closed) symbol -[2b80] Hard right arrow -[2b81] Soft right arrow -[2b82] Hard left arrow -[2b83] Soft left arrow -""" - -from __future__ import division - -import argparse -import os -import sys -import re - -try: - import fontforge - import psMat -except ImportError: - sys.stderr.write('The required FontForge modules could not be loaded.\n\n') - - if sys.version_info.major > 2: - sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0])) - else: - sys.stderr.write('You need FontForge with Python bindings for this script to work.\n') - - sys.exit(1) - -# Handle command-line arguments -parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.') - -parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') -parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') -parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) -parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono') -parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin') - -args = parser.parse_args() - -SYM_ATTR = { - # Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly - 0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False }, - 0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False }, - 0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False }, - 0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False }, - 0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False }, - 0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, - 0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, - 0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, - 0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, -} - -# Open symbol font -try: - symbols = fontforge.open(args.symbol_font) -except EnvironmentError: - sys.exit(1) - -# Patch provided fonts -for font_path in args.fonts: - try: - font = fontforge.open(font_path) - except EnvironmentError: - sys.exit(1) - - # Rename font - if args.rename: - font.familyname += ' for Powerline' - font.fullname += ' for Powerline' - font.fontname += 'ForPowerline' - font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) - font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) - if args.fixwin: - font.fontname = re.sub(r'\W', '', font.familyname) - - # Force the em size to be equal - symbols.em = font.em - - # Initial font dimensions - font_dim = { - 'xmin' : 0, - 'ymin' : -font.descent, - 'xmax' : 0, - 'ymax' : font.ascent, - - 'width' : 0, - 'height': 0, - } - - # Find the biggest char width and height - # - # 0x00-0x17f is the Latin Extended-A range - # 0x2500-0x2600 is the box drawing range - for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600): - try: - (xmin, ymin, xmax, ymax) = font[glyph].boundingBox() - except TypeError: - continue - - if font_dim['width'] == 0: - font_dim['width'] = font[glyph].width - - if ymin < font_dim['ymin']: font_dim['ymin'] = ymin - if ymax > font_dim['ymax']: font_dim['ymax'] = ymax - if xmax > font_dim['xmax']: font_dim['xmax'] = xmax - - # Calculate font height - font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax'] - - # Update the font encoding to ensure that the Unicode glyphs are available - font.encoding = 'ISO10646' - - # Fetch this property before adding outlines - onlybitmaps = font.onlybitmaps - - def get_dim(glyph): - bbox = glyph.boundingBox() - - return { - 'xmin' : bbox[0], - 'ymin' : bbox[1], - 'xmax' : bbox[2], - 'ymax' : bbox[3], - - 'width' : bbox[2] + (-bbox[0]), - 'height': bbox[3] + (-bbox[1]), - } - - # Create glyphs from symbol font - for sym_glyph in symbols.glyphs(): - sym_attr = SYM_ATTR[sym_glyph.unicode] - - # Prepare symbol glyph dimensions - sym_dim = get_dim(sym_glyph) - - # Select and copy symbol from its encoding point - symbols.selection.select(sym_glyph.encoding) - symbols.copy() - - # Select and paste symbol to its unicode code point - font.selection.select(sym_glyph.unicode) - font.paste() - - # Now that we have copy/pasted the glyph, it's time to scale and move it - - # Handle glyph stretching - if 'x' in sym_attr['stretch']: - # Stretch the glyph horizontally - scale_ratio = font_dim['width'] / sym_dim['width'] - - font.transform(psMat.scale(scale_ratio, 1)) - if 'y' in sym_attr['stretch']: - # Stretch the glyph vertically - scale_ratio = font_dim['height'] / sym_dim['height'] - - font.transform(psMat.scale(1, scale_ratio)) - - # Use the dimensions from the pasted and stretched glyph - sym_dim = get_dim(font[sym_glyph.unicode]) - - # Center-align the glyph vertically - font_ycenter = font_dim['height'] / 2 - sym_ycenter = sym_dim['height'] / 2 - - # First move it to the ymax (top) - font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax'])) - - # Then move it the y center difference - font.transform(psMat.translate(0, sym_ycenter - font_ycenter)) - - # Ensure that the glyph doesn't extend outside the font's bounding box - if sym_dim['width'] > font_dim['width']: - # The glyph is too wide, scale it down to fit - scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1) - - font.transform(scale_matrix) - - # Use the dimensions from the stretched glyph - sym_dim = get_dim(font[sym_glyph.unicode]) - - # Handle glyph alignment - if sym_attr['align'] == 'c': - # Center align - align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0) - elif sym_attr['align'] == 'r': - # Right align - align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0) - else: - # No alignment (left alignment) - align_matrix = psMat.translate(0, 0) - - font.transform(align_matrix) - - if sym_attr['overlap'] is True: - overlap_width = font.em / 48 - - # Stretch the glyph slightly horizontally if it should overlap - font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1)) - - if sym_attr['align'] == 'l': - # The glyph should be left-aligned, so it must be moved overlap_width to the left - # This only applies to left-aligned glyphs because the glyph is scaled to the right - font.transform(psMat.translate(-overlap_width, 0)) - - # Ensure the font is considered monospaced on Windows - font[sym_glyph.unicode].width = font_dim['width'] - - if font.bitmapSizes and not onlybitmaps: - # If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs - font.selection.changed() - - for size in font.bitmapSizes: - font.regenBitmaps((size, )) - - output_name, extension = os.path.split(font_path)[1].rsplit('.', 1) - if extension.lower() not in ['ttf', 'otf']: - # Default to OpenType if input is not TrueType/OpenType - extension = 'otf' - if args.fixmono: - for glyph in font.glyphs(): - if glyph.width == 0: glyph.width = font_dim['width'] - - if onlybitmaps: - # Generate BDF font - font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf')) - else: - # Generate OTF/TTF font - font.generate('{0}-Powerline.{1}'.format(output_name, extension)) - diff --git a/sources_forked/vim-powerline/plugin/Powerline.vim b/sources_forked/vim-powerline/plugin/Powerline.vim deleted file mode 100755 index 5454aa49..00000000 --- a/sources_forked/vim-powerline/plugin/Powerline.vim +++ /dev/null @@ -1,69 +0,0 @@ -" Powerline - The ultimate statusline utility -" -" Author: Kim Silkebækken -" Source repository: https://github.com/Lokaltog/vim-powerline - -" Script initialization {{{ - if exists('g:Powerline_loaded') || &compatible || version < 702 - finish - endif - - let g:Powerline_loaded = 1 -" }}} -" Commands {{{ - command! PowerlineClearCache call Pl#ClearCache() - command! PowerlineReloadColorscheme call Pl#ReloadColorscheme() -" }}} -" Set default options {{{ - for [s:key, s:value] in items({ - \ 'theme' : 'default' - \ , 'colorscheme' : 'default' - \ , 'symbols' : 'compatible' - \ , 'symbols_override' : {} - \ , 'dividers_override': [] - \ , 'stl_path_style' : 'relative' - \ , 'cache_enabled' : 1 - \ }) - - if ! exists('g:Powerline_' . s:key) - exec printf('let g:Powerline_%s = %s', s:key, string(s:value)) - endif - - unlet! s:key s:value - endfor - - if ! exists('g:Powerline_cache_file') - exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache' - \ , simplify(expand(':p:h') .'/..') - \ , g:Powerline_theme - \ , g:Powerline_colorscheme - \ , g:Powerline_symbols - \ )) - endif -" }}} -" Autocommands {{{ - function! s:CreateAutocmds() - augroup PowerlineMain - autocmd! - - " Reload statuslines when changing color scheme - autocmd ColorScheme * - \ call Pl#Load() - - autocmd BufEnter,WinEnter,FileType,BufUnload * - \ call Pl#UpdateStatusline(1) - - autocmd BufLeave,WinLeave * - \ call Pl#UpdateStatusline(0) - - autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim - \ :PowerlineReloadColorscheme - augroup END - endfunction - - augroup PowerlineStartup - autocmd! - - autocmd VimEnter * call s:CreateAutocmds() | call Pl#UpdateStatusline(1) - augroup END -" }}} diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index f233c197..19ac1463 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -68,6 +68,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = \ 'key_loop': ['s:keyloop', 0], \ 'lazy_update': ['s:lazy', 0], \ 'match_func': ['s:matcher', {}], + \ 'match_window': ['s:mw', ''], \ 'match_window_bottom': ['s:mwbottom', 1], \ 'match_window_reversed': ['s:mwreverse', 1], \ 'max_depth': ['s:maxdepth', 40], @@ -102,7 +103,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = " Global options let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0, - \ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'mouse': 'n', + \ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'ttimeout': 0, \ 'gcr': 'a:blinkon0', 'ic': 1, 'lmap': '', 'mousef': 0, 'imd': 1 } " Keymaps @@ -181,7 +182,7 @@ let s:hlgrps = { \ 'PrtText': 'Normal', \ 'PrtCursor': 'Constant', \ } -" s:opts() {{{2 +" Get the options {{{2 fu! s:opts(...) unl! s:usrign s:usrcmd s:urprtmaps for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) @@ -201,6 +202,9 @@ fu! s:opts(...) let {va} = {s:bpref.ke} en endfo + " Match window options + cal s:match_window_opts() + " One-time values if a:0 && a:1 != {} unl va for [ke, va] in items(a:1) @@ -217,7 +221,6 @@ fu! s:opts(...) en | endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) - let s:mxheight = max([s:mxheight, 1]) let s:glob = s:showhidden ? '.*\|*' : '*' let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) let s:lash = ctrlp#utils#lash() @@ -238,13 +241,36 @@ fu! s:opts(...) cal extend(s:prtmaps, s:urprtmaps) en endf + +fu! s:match_window_opts() + let s:mw_pos = + \ s:mw =~ 'top\|bottom' ? matchstr(s:mw, 'top\|bottom') : + \ exists('g:ctrlp_match_window_bottom') ? ( s:mwbottom ? 'bottom' : 'top' ) + \ : 'bottom' + let s:mw_order = + \ s:mw =~ 'order:[^,]\+' ? matchstr(s:mw, 'order:\zs[^,]\+') : + \ exists('g:ctrlp_match_window_reversed') ? ( s:mwreverse ? 'btt' : 'ttb' ) + \ : 'btt' + let s:mw_max = + \ s:mw =~ 'max:[^,]\+' ? str2nr(matchstr(s:mw, 'max:\zs\d\+')) : + \ exists('g:ctrlp_max_height') ? s:mxheight + \ : 10 + let s:mw_min = + \ s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1 + let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])] + let s:mw_min = min([s:mw_min, s:mw_max]) + let s:mw_res = + \ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+')) + \ : min([s:mw_max, &lines]) + let s:mw_res = max([s:mw_res, 1]) +endf "}}}1 " * Open & Close {{{1 fu! s:Open() cal s:log(1) cal s:getenv() cal s:execextvar('enter') - sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' + sil! exe 'keepa' ( s:mw_pos == 'top' ? 'to' : 'bo' ) '1new ControlP' cal s:buffunc(1) let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)] let [s:focus, s:prompt] = [1, ['', '', '']] @@ -297,7 +323,7 @@ fu! ctrlp#clra() if isdirectory(cadir) let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n") let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$''' - sil! cal map(filter(cafiles, eval), 'delete(v:val)') + sil! cal map(s:ifilter(cafiles, eval), 'delete(v:val)') en cal ctrlp#clr() endf @@ -362,7 +388,7 @@ fu! s:UserCmd(lscmd) let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] en if has('win32') || has('win64') - let lscmd = substitute(lscmd, '\v(^|&&\s*)\zscd (/d)@!', 'cd /d ', '') + let lscmd = substitute(lscmd, '\v(^|\&\&\s*)\zscd (/d)@!', 'cd /d ', '') en let path = exists('*shellescape') ? shellescape(path) : path let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n") @@ -433,7 +459,7 @@ endf fu! s:MatchIt(items, pat, limit, exc) let [lines, id] = [[], 0] let pat = - \ s:byfname ? map(split(a:pat, '^[^;]\+\\\@ 0 + if s:byfname() && index(lst, ';') > 0 let fbar = index(lst, ';') let lst_1 = s:sublist(lst, 0, fbar - 1) let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : [''] @@ -494,15 +529,19 @@ fu! s:SplitPattern(str) endf " * BuildPrompt() {{{1 fu! s:Render(lines, pat) - let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])] - let pat = s:byfname ? split(a:pat, '^[^;]\+\\\@' ).( s:byfname ? 'd' : '>' ).'> ' + let base = ( s:regexp ? 'r' : '>' ).( s:byfname() ? 'd' : '>' ).'> ' let str = escape(s:getinput(), '\') let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp') @@ -581,11 +620,8 @@ fu! s:SetDefTxt() if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en let txt = s:deftxt if !type(txt) - let txt = txt && !stridx(s:crfpath, s:dyncwd) - \ ? ctrlp#rmbasedir([s:crfpath])[0] : '' - let txt = txt != '' ? txt.s:lash(s:crfpath) : '' - el - let txt = expand(txt, 1) + let path = s:crfpath.s:lash(s:crfpath) + let txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : '' en let s:prompt[0] = txt endf @@ -735,7 +771,7 @@ endf fu! s:PrtSelectJump(char) let lines = copy(s:lines) - if s:byfname + if s:byfname() cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]') en " Cycle through matches, use s:jmpchr to store last jump @@ -904,6 +940,11 @@ fu! s:ToggleKeyLoop() en endf +fu! s:ToggleMRURelative() + cal ctrlp#mrufiles#tgrel() + cal s:PrtClearCache() +endf + fu! s:PrtSwitcher() let [s:force, s:matches] = [1, 1] cal s:BuildPrompt(1) @@ -937,14 +978,21 @@ fu! s:SetWD(args) en endf " * AcceptSelection() {{{1 -fu! ctrlp#acceptfile(mode, line, ...) - let [md, useb] = [a:mode, 0] - if !type(a:line) - let [filpath, bufnr, useb] = [a:line, a:line, 1] +fu! ctrlp#acceptfile(...) + let useb = 0 + if a:0 == 1 && type(a:1) == 4 + let [md, line] = [a:1['action'], a:1['line']] + let atl = has_key(a:1, 'tail') ? a:1['tail'] : '' el - let filpath = fnamemodify(a:line, ':p') - if s:nonamecond(a:line, filpath) - let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + let [md, line] = [a:1, a:2] + let atl = a:0 > 2 ? a:3 : '' + en + if !type(line) + let [filpath, bufnr, useb] = [line, line, 1] + el + let filpath = fnamemodify(line, ':p') + if s:nonamecond(line, filpath) + let bufnr = str2nr(matchstr(line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) let [filpath, useb] = [bufnr, 1] el let bufnr = bufnr('^'.filpath.'$') @@ -952,7 +1000,7 @@ fu! ctrlp#acceptfile(mode, line, ...) en cal s:PrtExit() let tail = s:tail() - let j2l = a:0 ? a:1 : matchstr(tail, '^ +\zs\d\+$') + let j2l = atl != '' ? atl : matchstr(tail, '^ +\zs\d\+$') if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0 \ && !( md == 'e' && bufnr == bufnr('%') ) let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)] @@ -980,7 +1028,7 @@ fu! ctrlp#acceptfile(mode, line, ...) " Reset &switchbuf option let [swb, &swb] = [&swb, ''] " Open new window/buffer - let [fid, tail] = [( useb ? bufnr : filpath ), ( a:0 ? ' +'.a:1 : tail )] + let [fid, tail] = [( useb ? bufnr : filpath ), ( atl != '' ? ' +'.atl : tail )] let args = [cmd, fid, tail, 1, [useb, j2l]] cal call('s:openfile', args) let &swb = swb @@ -1011,24 +1059,34 @@ fu! s:SpecInputs(str) retu 0 endf -fu! s:AcceptSelection(mode) - if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en +fu! s:AcceptSelection(action) + let [md, icr] = [a:action[0], match(a:action, 'r') >= 0] + let subm = icr || ( !icr && md == 'e' ) + if !subm && s:OpenMulti(md) != -1 | retu | en let str = s:getinput() - if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en + if subm | if s:SpecInputs(str) | retu | en | en " Get the selected line let line = ctrlp#getcline() - if a:mode != 'e' && !s:itemtype && line == '' + if !subm && !s:itemtype && line == '' && line('.') > s:offset \ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$' - cal s:CreateNewFile(a:mode) | retu + cal s:CreateNewFile(md) | retu en if empty(line) | retu | en " Do something with it if s:openfunc != {} && has_key(s:openfunc, s:ctype) let actfunc = s:openfunc[s:ctype] + let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list' el - let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' : s:getextvar('accept') + if s:itemtype < 3 + let [actfunc, type] = ['ctrlp#acceptfile', 'dict'] + el + let [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')] + let type = exttype == 'dict' ? exttype : 'list' + en en - cal call(actfunc, [a:mode, line]) + let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }] + \ : [md, line] + cal call(actfunc, actargs) endf " - CreateNewFile() {{{1 fu! s:CreateNewFile(...) @@ -1187,7 +1245,10 @@ fu! s:OpenNoMarks(md, line) cal s:remarksigns() cal s:BuildPrompt(0) elsei a:md == 'x' - cal call(s:openfunc[s:ctype], [a:md, a:line], s:openfunc) + let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'dict' + let argms = type == 'dict' ? [{ 'action': a:md, 'line': a:line }] + \ : [a:md, a:line] + cal call(s:openfunc[s:ctype], argms, s:openfunc) elsei a:md == 'd' let dir = fnamemodify(a:line, ':h') if isdirectory(dir) @@ -1278,7 +1339,7 @@ fu! s:mixedsort(...) let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] if s:ispath let ms = [] - if s:height < 21 + if s:res_count < 21 let ms += [s:compfnlen(a:1, a:2)] if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en @@ -1324,12 +1385,21 @@ fu! ctrlp#statusline() let prv = tps[s:walker(max, s:itemtype, -1)][1] let s:ctype = tps[s:itemtype][0] let focus = s:focus ? 'prt' : 'win' - let byfname = s:byfname ? 'file' : 'path' + let byfname = s:ispath ? s:byfname ? 'file' : 'path' : 'line' let marked = s:opmul != '0' ? \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' if s:status != {} - let args = [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] - let &l:stl = call(s:status['main'], args, s:status) + let argms = + \ has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ + \ 'focus': focus, + \ 'byfname': byfname, + \ 'regex': s:regexp, + \ 'prev': prv, + \ 'item': s:ctype, + \ 'next': nxt, + \ 'marked': marked, + \ }] : [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] + let &l:stl = call(s:status['main'], argms, s:status) el let item = '%#CtrlPMode1# '.s:ctype.' %*' let focus = '%#CtrlPMode2# '.focus.' %*' @@ -1349,8 +1419,13 @@ endf fu! ctrlp#progress(enum, ...) if has('macunix') || has('mac') | sl 1m | en let txt = a:0 ? '(press ctrl-c to abort)' : '' - let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum], s:status) - \ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' + if s:status != {} + let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' + \ ? [{ 'str': a:enum }] : [a:enum] + let &l:stl = call(s:status['prog'], argms, s:status) + el + let &l:stl = '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' + en redraws endf " *** Paths {{{2 @@ -1376,6 +1451,11 @@ fu! s:pathshorten(str) retu matchstr(a:str, '^.\{9}').'...' \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') endf + +fu! s:offset(lines, height) + let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 + retu s:offset > 0 ? ( repeat([''], s:offset) + a:lines ) : a:lines +endf " Directory completion {{{3 fu! s:dircompl(be, sd) if a:sd == '' | retu [] | en @@ -1464,7 +1544,7 @@ fu! s:samerootsyml(each, isfile, cwd) endf fu! ctrlp#rmbasedir(items) - let cwd = s:dyncwd.( s:dyncwd !~ '[\/]$' ? s:lash : '' ) + let cwd = s:dyncwd.s:lash() if a:items != [] && !stridx(a:items[0], cwd) let idx = strlen(cwd) retu map(a:items, 'strpart(v:val, idx)') @@ -1529,8 +1609,7 @@ endf fu! ctrlp#syntax() if ctrlp#nosy() | retu | en for [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo - if !hlexists('CtrlPLinePre') - \ && synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' + if synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' en sy match CtrlPNoEntries '^ == NO ENTRIES ==$' @@ -1599,6 +1678,18 @@ fu! s:dosigns() retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs') endf " Lists & Dictionaries {{{2 +fu! s:ifilter(list, str) + let [rlist, estr] = [[], substitute(a:str, 'v:val', 'each', 'g')] + for each in a:list + try + if eval(estr) + cal add(rlist, each) + en + cat | con | endt + endfo + retu rlist +endf + fu! s:dictindex(dict, expr) for key in keys(a:dict) if a:dict[key] == a:expr | retu key | en @@ -1808,7 +1899,6 @@ endf fu! s:modevar() let s:matchtype = s:mtype() let s:ispath = s:ispathitem() - if !s:ispath | let s:byfname = 0 | en let s:mfunc = s:mfunc() let s:nolim = s:getextvar('nolim') let s:dosort = s:getextvar('sort') @@ -1820,6 +1910,10 @@ fu! s:nosort() \ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort endf +fu! s:byfname() + retu s:ispath && s:byfname +endf + fu! s:narrowable() retu exists('s:act_add') && exists('s:matched') && s:matched != [] \ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp] @@ -1834,7 +1928,7 @@ fu! s:getinput(...) if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k' retu join(prt, '') en - let [pf, rz] = [( s:byfname ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )] + let [pf, rz] = [( s:byfname() ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )] for dict in s:abbrev['abbrevs'] let dmd = has_key(dict, 'mode') ? dict['mode'] : '' let pat = escape(dict['pattern'], '~') @@ -1916,7 +2010,7 @@ fu! s:getenv() let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] let [s:crword, s:crnbword] = [expand('', 1), expand('', 1)] let [s:crgfile, s:crline] = [expand('', 1), getline('.')] - let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')] + let [s:winmaxh, s:crcursor] = [min([s:mw_max, &lines]), getpos('.')] let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] let s:crfile = bufname('%') == '' \ ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1) @@ -1939,7 +2033,8 @@ endf fu! s:log(m) if exists('g:ctrlp_log') && g:ctrlp_log | if a:m let cadir = ctrlp#utils#cachedir() - sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log' + let apd = g:ctrlp_log > 1 ? '>' : '' + sil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log' el sil! redi END en | en @@ -2023,7 +2118,7 @@ endf fu! s:mfunc() let mfunc = 'match' - if s:byfname && s:ispath + if s:byfname() let mfunc = 's:matchfname' elsei s:itemtype > 2 let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } @@ -2102,7 +2197,9 @@ fu! s:getextvar(key) endf fu! ctrlp#getcline() - retu !empty(s:lines) ? s:lines[line('.') - 1] : '' + let [linenr, offset] = [line('.'), ( s:offset > 0 ? s:offset : 0 )] + retu !empty(s:lines) && !( offset && linenr <= offset ) + \ ? s:lines[linenr - 1 - offset] : '' endf fu! ctrlp#getmarkedlist() @@ -2134,6 +2231,10 @@ endf fu! ctrlp#call(func, ...) retu call(a:func, a:000) endf + +fu! ctrlp#getvar(var) + retu {a:var} +endf "}}}1 " * Initialization {{{1 fu! ctrlp#setlines(...) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim index 7d955b57..89bda895 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim @@ -112,12 +112,12 @@ fu! ctrlp#bookmarkdir#accept(mode, str) en endf -fu! ctrlp#bookmarkdir#add(dir) +fu! ctrlp#bookmarkdir#add(dir, ...) let str = 'Directory to bookmark: ' let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir') if cwd == '' | retu | en let cwd = fnamemodify(cwd, ':p') - let name = s:getinput('Bookmark as: ', cwd) + let name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd) if name == '' | retu | en let name = tr(name, ' ', ' ') cal s:savebookmark(name, cwd) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim index aa67afa6..a38cad56 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim @@ -62,6 +62,7 @@ let s:types = { \ 'lisp' : '%slisp%slisp%sf', \ 'lua' : '%slua%slua%sf', \ 'make' : '%smake%smake%sm', + \ 'ocaml' : '%socaml%socaml%scmMvtfCre', \ 'pascal' : '%spascal%spascal%sfp', \ 'perl' : '%sperl%sperl%sclps', \ 'php' : '%sphp%sphp%scdvf', @@ -248,7 +249,9 @@ endf fu! ctrlp#buffertag#cmd(mode, ...) let s:btmode = a:mode if a:0 && !empty(a:1) - let s:bufname = fnamemodify(a:1, ':p') + let s:btmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufname = fnamemodify(bname, ':p') en retu s:id endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim index 67a299c6..313d8c2f 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim @@ -83,7 +83,9 @@ endf fu! ctrlp#changes#cmd(mode, ...) let s:clmode = a:mode if a:0 && !empty(a:1) - let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$') + let s:clmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$') en retu s:id endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim index 091e66c2..4e6d4adc 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim @@ -74,7 +74,7 @@ fu! ctrlp#dir#init(...) endf fu! ctrlp#dir#accept(mode, str) - let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str + let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#call('s:lash', s:cwd).a:str if a:mode =~ 't\|v\|h' cal ctrlp#exit() en diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim index e82bf1b5..5bec47ee 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim @@ -11,7 +11,7 @@ en let g:loaded_ctrlp_line = 1 cal add(g:ctrlp_ext_vars, { - \ 'init': 'ctrlp#line#init()', + \ 'init': 'ctrlp#line#init(s:crbufnr)', \ 'accept': 'ctrlp#line#accept', \ 'lname': 'lines', \ 'sname': 'lns', @@ -29,8 +29,9 @@ fu! s:syntax() en endf " Public {{{1 -fu! ctrlp#line#init() - let [bufs, lines] = [ctrlp#buffers('id'), []] +fu! ctrlp#line#init(bufnr) + let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr] + let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr] for bufnr in bufs let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] if lfb == [] && bufn != '' @@ -57,7 +58,13 @@ fu! ctrlp#line#accept(mode, str) en endf -fu! ctrlp#line#id() +fu! ctrlp#line#cmd(mode, ...) + let s:lnmode = a:mode + if a:0 && !empty(a:1) + let s:lnmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$') + en retu s:id endf "}}} diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim index e34f4504..a1821114 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim @@ -126,6 +126,10 @@ fu! ctrlp#mrufiles#bufs() retu s:mrbs endf +fu! ctrlp#mrufiles#tgrel() + let {s:re} = !{s:re} +endf + fu! ctrlp#mrufiles#cachefile() if !exists('s:cadir') || !exists('s:cafile') let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim index cd4d9097..626363a4 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim @@ -22,32 +22,36 @@ cal add(g:ctrlp_ext_vars, { let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 fu! s:findcount(str) - let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$') + let [tg, ofname] = split(a:str, '\t\+\ze[^\t]\+$') let tgs = taglist('^'.tg.'$') if len(tgs) < 2 - retu [1, 1] + retu [0, 0, 0, 0] en let bname = fnamemodify(bufname('%'), ':p') - let fname = expand(fnamemodify(simplify(fname), ':s?^[.\/]\+??:p:.'), 1) - let [fnd, ct, pos, idx] = [0, 0, 0, 0] - wh idx < len(tgs) - if bname == fnamemodify(tgs[idx]["filename"], ':p') - cal insert(tgs, remove(tgs, idx)) - brea - en - let idx += 1 - endw - for each in tgs - let ct += 1 - let fulname = fnamemodify(each["filename"], ':p') + let fname = expand(fnamemodify(simplify(ofname), ':s?^[.\/]\+??:p:.'), 1) + let [fnd, cnt, pos, ctgs, otgs] = [0, 0, 0, [], []] + for tgi in tgs + let lst = bname == fnamemodify(tgi["filename"], ':p') ? 'ctgs' : 'otgs' + cal call('add', [{lst}, tgi]) + endfo + let ntgs = ctgs + otgs + for tgi in ntgs + let cnt += 1 + let fulname = fnamemodify(tgi["filename"], ':p') if stridx(fulname, fname) >= 0 \ && strlen(fname) + stridx(fulname, fname) == strlen(fulname) let fnd += 1 - let pos = ct + let pos = cnt en - if fnd > 1 | brea | en endfo - retu [fnd, pos] + let cnt = 0 + for tgi in ntgs + let cnt += 1 + if tgi["filename"] == ofname + let [fnd, pos] = [0, cnt] + en + endfo + retu [1, fnd, pos, len(ctgs)] endf fu! s:filter(tags) @@ -89,27 +93,33 @@ endf fu! ctrlp#tag#accept(mode, str) cal ctrlp#exit() let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t') - let [tg, fnd] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)] + let [tg, fdcnt] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)] let cmds = { \ 't': ['tab sp', 'tab stj'], \ 'h': ['sp', 'stj'], \ 'v': ['vs', 'vert stj'], \ 'e': ['', 'tj'], \ } - let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1] + let utg = fdcnt[3] < 2 && fdcnt[0] == 1 && fdcnt[1] == 1 + let cmd = !fdcnt[0] || utg ? cmds[a:mode][0] : cmds[a:mode][1] let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw) \ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd - if fnd[0] == 1 + if !fdcnt[0] || utg if cmd != '' exe cmd en let save_cst = &cst set cst& - cal feedkeys(":".fnd[1]."ta ".tg."\r", 'nt') + cal feedkeys(":".( utg ? fdcnt[2] : "" )."ta ".tg."\r", 'nt') let &cst = save_cst el - cal feedkeys(":".cmd." ".tg."\r", 'nt') + let ext = "" + if fdcnt[1] < 2 && fdcnt[2] + let [sav_more, &more] = [&more, 0] + let ext = fdcnt[2]."\r".":let &more = ".sav_more."\r" + en + cal feedkeys(":".cmd." ".tg."\r".ext, 'nt') en cal ctrlp#setlcdir() endf diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index cf3e23a4..e697b937 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -40,9 +40,7 @@ Overview:~ |ctrlp_cmd|...................Default command used for the default mapping. |ctrlp_by_filename|...........Default to filename mode or not. |ctrlp_regexp|................Default to regexp mode or not. - |ctrlp_match_window_bottom|...Where to show the match window. - |ctrlp_match_window_reversed|.Sort order in the match window. - |ctrlp_max_height|............Max height of the match window. + |ctrlp_match_window|..........Order, height and position of the match window. |ctrlp_switch_buffer|.........Jump to an open buffer if already opened. |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc). |ctrlp_tabpage_position|......Where to put the new tab page. @@ -77,6 +75,11 @@ Overview:~ |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not. |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added. + BufferTag mode: (to enable, see |ctrlp-extensions|) + |g:ctrlp_buftag_ctags_bin|....The location of the ctags-compatible binary. + |g:ctrlp_buftag_systemenc|....The encoding used for the ctags command. + |g:ctrlp_buftag_types|........Add new filetypes and set the cmd arguments. + Advanced options: |ctrlp_open_func|.............Use custom file opening functions. |ctrlp_status_func|...........Change CtrlP's two statuslines. @@ -114,21 +117,30 @@ Set this to 1 to set regexp search as the default: > < Can be toggled on/off by pressing inside the prompt. - *'g:ctrlp_match_window_bottom'* -Set this to 0 to show the match window at the top of the screen: > - let g:ctrlp_match_window_bottom = 1 + *'g:ctrlp_match_window'* +Change the postion, the listing order of results, the minimum and the maximum +heights of the match window: > + let g:ctrlp_match_window = '' < +Example: > + let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10' +< +The position: (default: bottom) + top - show the match window at the top of the screen. + bottom - show the match window at the bottom of the screen. - *'g:ctrlp_match_window_reversed'* -Change the listing order of the files in the match window. The default setting -(1) is from bottom to top: > - let g:ctrlp_match_window_reversed = 1 -< +The listing order of results: (default: btt) + order:ttb - from top to bottom. + order:btt - from bottom to top. - *'g:ctrlp_max_height'* -Set the maximum height of the match window: > - let g:ctrlp_max_height = 10 -< +The minimum and maximum heights: + min:{n} - show minimum {n} lines (default: 1). + max:{n} - show maximum {n} lines (default: 10). + +The maximum number of results: + results:{n} - list maximum {n} results (default: sync with max height). + +Note: When a setting isn't set, its default value will be used. *'g:ctrlp_switch_buffer'* When opening a file, if it's already open in a window somewhere, CtrlP will try @@ -323,18 +335,21 @@ Some examples: > let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') ' \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows < -Note #1: if the fallback_command is empty or the 'fallback' key is not defined, +Note #1: in the |Dictionary| format, 'fallback' and 'ignore' are optional. In +the |List| format, fallback_command is optional. + +Note #2: if the fallback_command is empty or the 'fallback' key is not defined, |globpath()| will then be used when scanning outside of a repository. -Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set +Note #3: unless the |Dictionary| format is used and 'ignore' is defined and set to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when these custom commands are being used. When not present, 'ignore' is set to 0 by default to retain the performance advantage of using external commands. -Note #3: when changing the option's variable type, remember to |:unlet| it +Note #4: when changing the option's variable type, remember to |:unlet| it first or restart Vim to avoid the "E706: Variable type mismatch" error. -Note #4: you can use a |b:var| to set this option on a per buffer basis. +Note #5: you can use a |b:var| to set this option on a per buffer basis. *'g:ctrlp_max_history'* The maximum number of input strings you want CtrlP to remember. The default @@ -563,6 +578,9 @@ Example: > Set this to 1 to show only MRU files in the current working directory: > let g:ctrlp_mruf_relative = 0 < +Note: you can use a custom mapping to toggle this option inside the prompt: > + let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': [''] } +< *'g:ctrlp_mruf_default_order'* Set this to 1 to disable sorting when searching in MRU mode: > @@ -734,6 +752,27 @@ Structure of the function: > endfunction < +Note: you can extend any of the above options with { 'arg_type': 'dict' } to +enable passing all the function arguments in a single Dictionary argument. Use +the existing argument names as keys in this Dictionary. + +Example: > + let g:ctrlp_status_func = { + \ 'arg_type' : 'dict', + \ 'enter': 'Function_Name_1', + \ 'exit': 'Function_Name_2', + \ } + + function! Function_Name_1(dict) + " where dict == { + " \ 'focus': value, + " \ 'byfname': value, + " \ 'regex': value, + " \ ... + " } + endfunction +< + =============================================================================== COMMANDS *ctrlp-commands* @@ -1076,8 +1115,8 @@ Available extensions:~ *:CtrlPLine* * Line mode:~ - Name: 'line' - - Command: ":CtrlPLine" - - Search for a line in all listed buffers. + - Command: ":CtrlPLine [buffer]" + - Search for a line in all listed buffers or in the specified [buffer]. *:CtrlPChange* *:CtrlPChangeAll* @@ -1164,7 +1203,7 @@ Highlighting:~ Statuslines:~ * Highlight groups: - CtrlPMode1 : 'file' or 'path', and the current mode (Character) + CtrlPMode1 : 'file' or 'path' or 'line', and the current mode (Character) CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|) CtrlPStats : the scanning status (Function) @@ -1249,10 +1288,16 @@ Special thanks:~ * Christopher Fredén * Zahary Karadjov * Jo De Boeck + * Rudi Grinberg + * Timothy Mellor =============================================================================== CHANGELOG *ctrlp-changelog* + + Combine *g:ctrlp_match_window_bottom* *g:ctrlp_match_window_reversed* and + *g:ctrlp_max_height* into |g:ctrlp_match_window|. + + New option: |g:ctrlp_match_window|. + Before 2012/11/30~ + New options: |g:ctrlp_abbrev|, diff --git a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim index b6f9a27e..c7b8fa3f 100644 --- a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim @@ -51,7 +51,9 @@ com! -n=? -com=buffer CtrlPBufTag com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1)) com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id()) com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id()) -com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id()) + +com! -n=? -com=buffer CtrlPLine + \ cal ctrlp#init(ctrlp#line#cmd(1, )) com! -n=? -com=buffer CtrlPChange \ cal ctrlp#init(ctrlp#changes#cmd(0, )) diff --git a/sources_non_forked/tlib/autoload/tlib.vim b/sources_non_forked/tlib/autoload/tlib.vim index 008740f2..2ed32001 100644 --- a/sources_non_forked/tlib/autoload/tlib.vim +++ b/sources_non_forked/tlib/autoload/tlib.vim @@ -3,10 +3,9 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-07-17. -" @Last Change: 2010-01-03. -" @Revision: 0.0.7 +" @Last Change: 2013-09-25. +" @Revision: 0.0.12 -" call tlog#Log('Load: '. expand('')) " vimtlib-sfile - -" Dummy file for backwards compatibility. +" :nodefault: +TLet g:tlib#debug = 0 diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim index 0abc7067..0093c8b0 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim @@ -3,11 +3,11 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2012-09-26. -" @Revision: 0.0.90 +" @Last Change: 2013-09-25. +" @Revision: 0.0.92 let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 -let s:prototype.highlight = g:tlib_inputlist_higroup +let s:prototype.highlight = g:tlib#input#higroup " The search pattern for |tlib#input#List()| is in conjunctive normal " form: (P1 OR P2 ...) AND (P3 OR P4 ...) ... @@ -33,7 +33,7 @@ endf " :nodoc: function! s:prototype.Help(world) dict "{{{3 call a:world.PushHelp( - \ printf('"%s", "%s", "%sWORD"', g:tlib_inputlist_and, g:tlib_inputlist_or, g:tlib_inputlist_not), + \ printf('"%s", "%s", "%sWORD"', g:tlib#input#and, g:tlib#input#or, g:tlib#input#not), \ 'AND, OR, NOT') endf diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim index b141b733..0bac3c42 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim @@ -3,11 +3,11 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2012-09-20. -" @Revision: 0.0.50 +" @Last Change: 2013-09-25. +" @Revision: 0.0.51 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2 -let s:prototype.highlight = g:tlib_inputlist_higroup +let s:prototype.highlight = g:tlib#input#higroup " The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'. diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim index 95abdae7..1f48c5f4 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim @@ -2,11 +2,11 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2012-09-20. -" @Revision: 0.0.61 +" @Last Change: 2013-09-25. +" @Revision: 0.0.62 let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2 -let s:prototype.highlight = g:tlib_inputlist_higroup +let s:prototype.highlight = g:tlib#input#higroup " A character that should be expanded to '\.\{-}'. diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim b/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim index 39e09844..349bfd57 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim @@ -3,11 +3,11 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2012-09-20. -" @Revision: 0.0.46 +" @Last Change: 2013-09-25. +" @Revision: 0.0.47 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_fuzzy'], 'name': 'fuzzy'}) "{{{2 -let s:prototype.highlight = g:tlib_inputlist_higroup +let s:prototype.highlight = g:tlib#input#higroup " Support for "fuzzy" pattern matching in |tlib#input#List()|. diff --git a/sources_non_forked/tlib/autoload/tlib/World.vim b/sources_non_forked/tlib/autoload/tlib/World.vim index 296f2d41..daedb559 100644 --- a/sources_non_forked/tlib/autoload/tlib/World.vim +++ b/sources_non_forked/tlib/autoload/tlib/World.vim @@ -3,14 +3,34 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-05-01. -" @Last Change: 2012-10-03. -" @Revision: 0.1.1203 +" @Last Change: 2013-09-26. +" @Revision: 0.1.1297 " :filedoc: " A prototype used by |tlib#input#List|. " Inherits from |tlib#Object#New|. +" Size of the input list window (in percent) from the main size (of &lines). +" See |tlib#input#List()|. +TLet g:tlib_inputlist_pct = 50 + +" Size of filename columns when listing filenames. +" See |tlib#input#List()|. +TLet g:tlib_inputlist_width_filename = '&co / 3' +" TLet g:tlib_inputlist_width_filename = 25 + +" If true, |tlib#input#List()| will show some indicators about the +" status of a filename (e.g. buflisted(), bufloaded() etc.). +" This is disabled by default because vim checks also for the file on +" disk when doing this. +TLet g:tlib_inputlist_filename_indicators = 0 + +" If not null, display only a short info about the filter. +TLet g:tlib_inputlist_shortmessage = 0 + + + " Known keys & values: " scratch_split ... See |tlib#scratch#UseScratch()| let s:prototype = tlib#Object#New({ @@ -19,6 +39,7 @@ let s:prototype = tlib#Object#New({ \ 'allow_suspend': 1, \ 'base': [], \ 'bufnr': -1, + \ 'buffer_local': 1, \ 'cache_var': '', \ 'display_format': '', \ 'fileencoding': &fileencoding, @@ -40,22 +61,26 @@ let s:prototype = tlib#Object#New({ \ 'key_handlers': [], \ 'list': [], \ 'matcher': {}, + \ 'next_agent': '', + \ 'next_eval': '', \ 'next_state': '', - \ 'numeric_chars': tlib#var#Get('tlib_numeric_chars', 'bg'), + \ 'numeric_chars': g:tlib#input#numeric_chars, \ 'offset': 1, \ 'offset_horizontal': 0, \ 'on_leave': [], - \ 'pick_last_item': tlib#var#Get('tlib_pick_last_item', 'bg'), + \ 'pick_last_item': tlib#var#Get('tlib#input#pick_last_item', 'bg'), \ 'post_handlers': [], \ 'query': '', \ 'resize': 0, \ 'resize_vertical': 0, \ 'restore_from_cache': [], + \ 'filtered_items': [], \ 'retrieve_eval': '', \ 'return_agent': '', \ 'rv': '', \ 'scratch': '__InputList__', \ 'scratch_filetype': 'tlibInputList', + \ 'scratch_hidden': g:tlib#scratch#hidden, \ 'scratch_vertical': 0, \ 'scratch_split': 1, \ 'sel_idx': [], @@ -63,6 +88,7 @@ let s:prototype = tlib#Object#New({ \ 'state': 'display', \ 'state_handlers': [], \ 'sticky': 0, + \ 'temp_lines': [], \ 'temp_prompt': [], \ 'timeout': 0, \ 'timeout_resolution': 2, @@ -77,7 +103,7 @@ let s:prototype = tlib#Object#New({ function! tlib#World#New(...) let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) - call object.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'g', 'cnf')) + call object.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'g', 'cnf')) return object endf @@ -113,7 +139,7 @@ if g:tlib#input#format_filename == 'r' function! s:prototype.FormatFilename(file) dict "{{{3 if !has_key(self.fmt_options, 'maxlen') let maxco = &co - len(len(self.base)) - eval(g:tlib#input#filename_padding_r) - let maxfi = max(map(copy(self.base), 'len(v:val)')) + let maxfi = max(map(copy(self.base), 'strwidth(v:val)')) let self.fmt_options.maxlen = min([maxco, maxfi]) " TLogVAR maxco, maxfi, self.fmt_options.maxlen endif @@ -135,11 +161,11 @@ else let self.width_filename = min([ \ get(self, 'width_filename', &co), \ empty(g:tlib#input#filename_max_width) ? &co : eval(g:tlib#input#filename_max_width), - \ max(map(copy(self.base), 'len(fnamemodify(v:val, ":t"))')) + \ max(map(copy(self.base), 'strwidth(fnamemodify(v:val, ":t"))')) \ ]) " TLogVAR self.width_filename exec 'syntax match TLibFilename /[^\/]\+$/ contained containedin=TLibDir' - exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir' hi def link TLibMarker Special hi def link TLibDir Directory @@ -154,10 +180,11 @@ else " :nodoc: function! s:prototype.FormatFilename(file) dict "{{{3 + " TLogVAR a:file let width = self.width_filename let split = match(a:file, '[/\\]\zs[^/\\]\+$') if split == -1 - let fname = '' + let fname = a:file let dname = a:file else let fname = strpart(a:file, split) @@ -167,15 +194,17 @@ else if strwidth(fname) > width let fname = strpart(fname, 0, width - 3) .'...' endif - let dnmax = &co - max([width, len(fname)]) - 10 - self.index_width - &fdc + let dnmax = &co - max([width, strwidth(fname)]) - 10 - self.index_width - &fdc if g:tlib_inputlist_filename_indicators let dnmax -= 2 endif - if len(dname) > dnmax + if strwidth(dname) > dnmax let dname = '...'. strpart(dname, len(dname) - dnmax) endif let marker = [] - if g:tlib_inputlist_filename_indicators + let use_indicators = g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') + " TLogVAR use_indicators + if use_indicators call insert(marker, '[') let bnr = bufnr(a:file) " TLogVAR a:file, bnr, self.bufnr @@ -194,14 +223,24 @@ else " if !buflisted(bnr) " call add(marker, 'u') " endif - else + " echom "DBG" a:file string(get(self,'filename_indicators')) + endif + if has_key(self, 'filename_indicators') && has_key(self.filename_indicators, a:file) + if len(marker) > 1 + call add(marker, '|') + endif + call add(marker, self.filename_indicators[a:file]) + endif + if len(marker) <= 1 call add(marker, ' ') endif call add(marker, ']') else call add(marker, '|') endif - return printf("%-". self.width_filename ."s %s %s", fname, join(marker, ''), dname) + return printf("%-*s %s %s", + \ self.width_filename + len(fname) - strwidth(fname), + \ fname, join(marker, ''), dname) endf endif @@ -250,6 +289,26 @@ function! s:InsertSelectedItems(rv, current) "{{{3 endf +" :nodoc: +function! s:prototype.SelectItemsByNames(mode, items) dict "{{{3 + for item in a:items + let bi = index(self.base, item) + 1 + " TLogVAR item, bi + if bi > 0 + let si = index(self.sel_idx, bi) + " TLogVAR self.sel_idx + " TLogVAR si + if si == -1 + call add(self.sel_idx, bi) + elseif a:mode == 'toggle' + call remove(self.sel_idx, si) + endif + endif + endfor + return 1 +endf + + " :nodoc: function! s:prototype.SelectItem(mode, index) dict "{{{3 let bi = self.GetBaseIdx(a:index) @@ -292,7 +351,7 @@ function! s:prototype.GetRx0(...) dict "{{{3 " TLogVAR filter let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|') " TLogVAR rx - if !empty(rx) && (negative ? rx[0] == g:tlib_inputlist_not : rx[0] != g:tlib_inputlist_not) + if !empty(rx) && (negative ? rx[0] == g:tlib#input#not : rx[0] != g:tlib#input#not) call add(rx0, rx) endif endfor @@ -478,7 +537,7 @@ function! s:prototype.SetFilter() dict "{{{3 let mrx1 = mrx endif " TLogVAR rx - if rx[0] == g:tlib_inputlist_not + if rx[0] == g:tlib#input#not if len(rx) > 1 call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)') endif @@ -513,7 +572,7 @@ function! s:prototype.SetMatchMode(match_mode) dict "{{{3 let self.matcher = tlib#Filter_{a:match_mode}#New() call self.matcher.Init(self) catch /^Vim\%((\a\+)\)\=:E117/ - throw 'tlib: Unknown mode for tlib_inputlist_match: '. a:match_mode + throw 'tlib: Unknown mode for tlib#input#filter_mode: '. a:match_mode endtry endif endf @@ -542,18 +601,21 @@ function! s:prototype.BuildTableList() dict "{{{3 " TLogVAR time0 call self.SetFilter() " TLogVAR self.filter_neg, self.filter_pos - if empty(self.filter_pos) && empty(self.filter_neg) - let self.table = range(1, len(self.base)) + let self.table = range(1, len(self.base)) + " TLogVAR self.filtered_items + let copy_base = 1 + if !empty(self.filtered_items) + let self.table = filter(self.table, 'index(self.filtered_items, v:val) != -1') + let copy_base = 0 + endif + if !empty(self.filter_pos) || !empty(self.filter_neg) + let self.table = filter(self.table, 'self.MatchBaseIdx(v:val)') + let copy_base = 0 + endif + if copy_base let self.list = copy(self.base) else - " let time1 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time1, time1 - time0 - let self.table = filter(range(1, len(self.base)), 'self.MatchBaseIdx(v:val)') - " let time2 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time2, time2 - time0 let self.list = map(copy(self.table), 'self.GetBaseItem(v:val)') - " let time3 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time3, time3 - time0 endif endf @@ -634,7 +696,18 @@ endf " :nodoc: function! s:prototype.UseScratch() dict "{{{3 - keepalt return tlib#scratch#UseScratch(self) + " if type(self.scratch) != 0 && get(self, 'buffer_local', 1) + " if self.scratch != fnamemodify(self.scratch, ':p') + " let self.scratch = tlib#file#Join([expand('%:p:h'), self.scratch]) + " " TLogVAR self.scratch + " endif + " " let self.scratch_hidden = 'wipe' + " endif + keepjumps keepalt let rv = tlib#scratch#UseScratch(self) + " if expand('%:t') == self.scratch + let b:tlib_world = self + " endif + return rv endf @@ -828,12 +901,12 @@ function! s:prototype.PushHelp(...) dict "{{{3 " TLogVAR a:000 if a:0 == 1 if type(a:1) == 3 - let self._help += a:1 + let self.temp_lines += a:1 else - call add(self._help, a:1) + call add(self.temp_lines, a:1) endif elseif a:0 == 2 - call add(self._help, a:000) + call add(self.temp_lines, a:000) else throw "TLIB: PushHelp: Wrong number of arguments: ". string(a:000) endif @@ -843,7 +916,7 @@ endf " :nodoc: function! s:prototype.DisplayHelp() dict "{{{3 - let self._help = self.InitHelp() + let self.temp_lines = self.InitHelp() call self.PushHelp('', self.key_mode == 'default' ? 'Abort' : 'Reset keymap') call self.PushHelp('Enter, ', 'Pick the current item') call self.PushHelp('', 'Pick an item') @@ -861,14 +934,15 @@ function! s:prototype.DisplayHelp() dict "{{{3 call self.PushHelp('', 'Switch to origin') endif if stridx(self.type, 'm') != -1 - call self.PushHelp('', '(Un)Select items') + call self.PushHelp('', '(Un)Select items') call self.PushHelp('#, ', '(Un)Select the current item') call self.PushHelp('', '(Un)Select all items') + call self.PushHelp('', '(Un)Restrict view to selection') " \ ' ... Show only selected', endif endif - " TLogVAR len(self._help) + " TLogVAR len(self.temp_lines) call self.matcher.Help(self) " TLogVAR self.key_mode @@ -893,20 +967,24 @@ function! s:prototype.DisplayHelp() dict "{{{3 call self.PushHelp(self.help_extra) endif - " TLogVAR len(self._help) + " TLogVAR len(self.temp_lines) call self.PushHelp([ \ '', \ 'Matches at word boundaries are prioritized.', \ ]) - let self._help = s:FormatHelp(self._help) + let self.temp_lines = s:FormatHelp(self.temp_lines) + call self.PrintLines() +endf + + +function! s:prototype.PrintLines() dict "{{{3 let self.temp_prompt = ['Press any key to continue.', 'Question'] - " call tlib#normal#WithRegister('gg"tdG', 't') call tlib#buffer#DeleteRange('1', '$') - call append(0, self._help) - " call tlib#normal#WithRegister('G"tddgg', 't') + call append(0, self.temp_lines) call tlib#buffer#DeleteRange('$', '$') 1 - call self.Resize(len(self._help), 0) + call self.Resize(len(self.temp_lines), 0) + let self.temp_lines = [] endf @@ -914,12 +992,14 @@ endf function! s:prototype.Resize(hsize, vsize) dict "{{{3 " TLogVAR self.scratch_vertical, a:hsize, a:vsize let world_resize = '' + let winpos = '' let scratch_split = get(self, 'scratch_split', 1) " TLogVAR scratch_split if scratch_split > 0 if self.scratch_vertical if a:vsize let world_resize = 'vert resize '. a:vsize + let winpos = tlib#fixes#Winpos() " let w:winresize = {'v': a:vsize} setlocal winfixwidth endif @@ -932,8 +1012,11 @@ function! s:prototype.Resize(hsize, vsize) dict "{{{3 endif endif if !empty(world_resize) - " TLogVAR world_resize + " TLogVAR world_resize, winpos exec world_resize + if !empty(winpos) + exec winpos + endif " redraw! endif endf @@ -971,6 +1054,9 @@ function! s:prototype.DisplayList(...) dict "{{{3 elseif self.state == 'help' call self.DisplayHelp() call self.SetStatusline(query) + elseif self.state == 'printlines' + call self.PrintLines() + call self.SetStatusline(query) else " TLogVAR query " let ll = len(list) @@ -1042,6 +1128,13 @@ function! s:prototype.SetStatusline(query) dict "{{{3 if self.key_mode != 'default' call add(options, 'map:'. self.key_mode) endif + if !empty(self.filtered_items) + if g:tlib_inputlist_shortmessage + call add(options, 'R') + else + call add(options, 'restricted') + endif + endif if !empty(options) let sopts = printf('[%s]', join(options, ', ')) " let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts diff --git a/sources_non_forked/tlib/autoload/tlib/agent.vim b/sources_non_forked/tlib/autoload/tlib/agent.vim index 56365c11..c0d9566a 100644 --- a/sources_non_forked/tlib/autoload/tlib/agent.vim +++ b/sources_non_forked/tlib/autoload/tlib/agent.vim @@ -3,13 +3,16 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-24. -" @Last Change: 2012-10-03. -" @Revision: 0.1.208 +" @Last Change: 2013-09-26. +" @Revision: 0.1.240 " :filedoc: " Various agents for use as key handlers in tlib#input#List() +" Number of items to move when pressing in the input list window. +TLet g:tlib_scroll_lines = 10 + " General {{{1 @@ -111,6 +114,36 @@ function! tlib#agent#Reset(world, selected) "{{{3 endf +function! tlib#agent#ToggleRestrictView(world, selected) "{{{3 + if empty(a:world.filtered_items) + return tlib#agent#RestrictView(a:world, a:selected) + else + return tlib#agent#UnrestrictView(a:world, a:selected) + endif +endf + + +function! tlib#agent#RestrictView(world, selected) "{{{3 + " TLogVAR a:selected + let filtered_items = map(copy(a:selected), 'index(a:world.base, v:val) + 1') + " TLogVAR 1, filtered_items + let filtered_items = filter(filtered_items, 'v:val > 0') + " TLogVAR 2, filtered_items + if !empty(filtered_items) + let a:world.filtered_items = filtered_items + endif + let a:world.state = 'display' + return a:world +endf + + +function! tlib#agent#UnrestrictView(world, selected) "{{{3 + let a:world.filtered_items = [] + let a:world.state = 'display' + return a:world +endf + + function! tlib#agent#Input(world, selected) "{{{3 let flt0 = a:world.CleanFilter(a:world.filter[0][0]) let flt1 = input('Filter: ', flt0) @@ -401,7 +434,11 @@ function! tlib#agent#EditFileInVSplit(world, selected) "{{{3 call a:world.CloseScratch() " call tlib#file#With('edit', 'buffer', a:selected[0:0], a:world) " call tlib#file#With('vertical split', 'vertical sbuffer', a:selected[1:-1], a:world) + let winpos = tlib#fixes#Winpos() call tlib#file#With('vertical split', 'vertical sbuffer', a:selected, a:world) + if !empty(winpos) + exec winpos + endif return tlib#agent#Exit(a:world, a:selected) endf @@ -419,19 +456,18 @@ function! tlib#agent#ToggleScrollbind(world, selected) "{{{3 return a:world endf + function! tlib#agent#ShowInfo(world, selected) + let lines = [] for f in a:selected if filereadable(f) let desc = [getfperm(f), strftime('%c', getftime(f)), getfsize(f) .' bytes', getftype(f)] - echo fnamemodify(f, ':t') .':' - echo ' '. join(desc, '; ') + call add(lines, fnamemodify(f, ':t') .':') + call add(lines, ' '. join(desc, '; ')) endif endfor - echohl MoreMsg - echo 'Press any key to continue' - echohl NONE - call getchar() - let a:world.state = 'redisplay' + let a:world.temp_lines = lines + let a:world.state = 'printlines' return a:world endf @@ -530,8 +566,8 @@ function! tlib#agent#ExecAgentByName(world, selected) "{{{3 let agent_names[def.help] = def.agent endif endfor - let s:agent_names = join(sort(keys(agent_names)), "\n") - let command = input('Command: ', '', 'custom,tlib#agent#CompleteAgentNames') + let s:agent_names = sort(keys(agent_names)) + let command = input('Command: ', '', 'customlist,tlib#agent#CompleteAgentNames') " TLogVAR command if !has_key(agent_names, command) " TLogVAR command @@ -558,6 +594,6 @@ endf function! tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) - return s:agent_names + return filter(copy(s:agent_names), 'stridx(v:val, a:ArgLead) != -1') endf diff --git a/sources_non_forked/tlib/autoload/tlib/autocmdgroup.vim b/sources_non_forked/tlib/autoload/tlib/autocmdgroup.vim index d1ade9f1..84395248 100644 --- a/sources_non_forked/tlib/autoload/tlib/autocmdgroup.vim +++ b/sources_non_forked/tlib/autoload/tlib/autocmdgroup.vim @@ -2,13 +2,7 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Created: 2008-08-19. -" @Last Change: 2010-01-05. -" @Revision: 0.0.6 - -let s:save_cpo = &cpo -set cpo&vim - +" @Revision: 7 augroup TLib autocmd! @@ -18,6 +12,3 @@ augroup END function! tlib#autocmdgroup#Init() "{{{3 endf - -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/sources_non_forked/tlib/autoload/tlib/balloon.vim b/sources_non_forked/tlib/autoload/tlib/balloon.vim index 4b7c2eee..cc70d038 100644 --- a/sources_non_forked/tlib/autoload/tlib/balloon.vim +++ b/sources_non_forked/tlib/autoload/tlib/balloon.vim @@ -4,7 +4,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-08-30. " @Last Change: 2010-09-05. -" @Revision: 23 +" @Revision: 27 function! tlib#balloon#Register(expr) "{{{3 @@ -37,10 +37,12 @@ endf function! tlib#balloon#Expr() "{{{3 + " TLogVAR exists('b:tlib_balloons') if !exists('b:tlib_balloons') return '' endif let text = map(copy(b:tlib_balloons), 'eval(v:val)') + " TLogVAR b:tlib_balloons, text call filter(text, '!empty(v:val)') if has('balloon_multiline') return join(text, "\n----------------------------------\n") diff --git a/sources_non_forked/tlib/autoload/tlib/bitwise.vim b/sources_non_forked/tlib/autoload/tlib/bitwise.vim new file mode 100644 index 00000000..54a4258d --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/bitwise.vim @@ -0,0 +1,141 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Revision: 124 + + +function! tlib#bitwise#Num2Bits(num) "{{{3 + if type(a:num) <= 1 || type(a:num) == 5 + let bits = reverse(tlib#number#ConvertBase(a:num, 2, 'list')) + elseif type(a:num) == 3 + let bits = copy(a:num) + else + throw "tlib#bitwise#Num2Bits: Must be number of list: ". string(a:num) + endif + return bits +endf + + +function! tlib#bitwise#Bits2Num(bits, ...) "{{{3 + let base = a:0 >= 1 ? a:1 : 10 + " TLogVAR a:bits + let num = 0.0 + for i in range(len(a:bits)) + if get(a:bits, i, 0) + let num += pow(2, i) + endif + endfor + " TLogVAR num + if base == 10 + if type(base) == 5 + return num + else + return float2nr(num) + endif + else + return tlib#number#ConvertBase(num, base) + endif +endf + + +function! tlib#bitwise#AND(num1, num2, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'num' + return s:BitwiseComparison(a:num1, a:num2, rtype, + \ 'get(bits1, v:val) && get(bits2, v:val)') +endf + + +function! tlib#bitwise#OR(num1, num2, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'num' + return s:BitwiseComparison(a:num1, a:num2, rtype, + \ 'get(bits1, v:val) || get(bits2, v:val)') +endf + + +function! tlib#bitwise#XOR(num1, num2, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'num' + return s:BitwiseComparison(a:num1, a:num2, rtype, + \ 'get(bits1, v:val) ? !get(bits2, v:val) : get(bits2, v:val)') +endf + + +function! s:BitwiseComparison(num1, num2, rtype, expr) "{{{3 + let bits1 = tlib#bitwise#Num2Bits(a:num1) + let bits2 = tlib#bitwise#Num2Bits(a:num2) + let range = range(max([len(bits1), len(bits2)])) + let bits = map(range, a:expr) + if a:rtype == 'num' || (a:rtype == 'auto' && type(a:num1) <= 1) + return tlib#bitwise#Bits2Num(bits) + else + return bits + endif +endf + + +function! tlib#bitwise#ShiftRight(bits, n) "{{{3 + let bits = a:bits[a:n : -1] + if empty(bits) + let bits = [0] + endif + return bits +endf + + +function! tlib#bitwise#ShiftLeft(bits, n) "{{{3 + let bits = repeat([0], a:n) + a:bits + return bits +endf + + +function! tlib#bitwise#Add(num1, num2, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'num' + let bits1 = tlib#bitwise#Num2Bits(a:num1) + let bits2 = tlib#bitwise#Num2Bits(a:num2) + let range = range(max([len(bits1), len(bits2)])) + " TLogVAR bits1, bits2, range + let carry = 0 + let bits = [] + for i in range + let sum = get(bits1, i) + get(bits2, i) + carry + if sum == 3 + let bit = 1 + let carry = 1 + elseif sum == 2 + let bit = 0 + let carry = 1 + elseif sum == 1 + let bit = 1 + let carry = 0 + elseif sum == 0 + let bit = 0 + let carry = 0 + endif + call add(bits, bit) + " TLogVAR i, bits, bit + endfor + if carry == 1 + call add(bits, carry) + endif + if rtype == 'num' || (rtype == 'auto' && type(a:num1) <= 1) + return tlib#bitwise#Bits2Num(bits) + else + return bits + endif +endf + + +function! tlib#bitwise#Sub(num1, num2, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'num' + let bits1 = tlib#bitwise#Num2Bits(a:num1) + let bits2 = tlib#bitwise#Num2Bits(a:num2) + let range = range(max([len(bits1), len(bits2)])) + let bits2 = map(range, '!get(bits2, v:val)') + let bits2 = tlib#bitwise#Add(bits2, [1], 'bits') + let bits3 = tlib#bitwise#Add(bits1, bits2, 'bits') + let bits = bits3[0 : -2] + if rtype == 'num' || (rtype == 'auto' && type(a:num1) <= 1) + return tlib#bitwise#Bits2Num(bits) + else + return bits + endif +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/buffer.vim b/sources_non_forked/tlib/autoload/tlib/buffer.vim index de151a49..8920f758 100644 --- a/sources_non_forked/tlib/autoload/tlib/buffer.vim +++ b/sources_non_forked/tlib/autoload/tlib/buffer.vim @@ -3,8 +3,13 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2012-02-09. -" @Revision: 0.0.351 +" @Last Change: 2013-09-25. +" @Revision: 0.0.352 + + +" Where to display the line when using |tlib#buffer#ViewLine|. +" For possible values for position see |scroll-cursor|. +TLet g:tlib_viewline_position = 'zz' let s:bmru = [] diff --git a/sources_non_forked/tlib/autoload/tlib/cache.vim b/sources_non_forked/tlib/autoload/tlib/cache.vim index c480495c..7380d6dd 100644 --- a/sources_non_forked/tlib/autoload/tlib/cache.vim +++ b/sources_non_forked/tlib/autoload/tlib/cache.vim @@ -3,10 +3,16 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2012-05-11. -" @Revision: 0.1.192 +" @Last Change: 2013-09-25. +" @Revision: 0.1.220 +" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. +" You might want to delete old files from this directory from time to +" time with a command like: > +" find ~/vimfiles/cache/ -atime +31 -type f -print -delete +TLet g:tlib_cache = '' + " |tlib#cache#Purge()|: Remove cache files older than N days. TLet g:tlib#cache#purge_days = 31 @@ -24,15 +30,21 @@ TLet g:tlib#cache#script_encoding = &enc " 2 ... Yes TLet g:tlib#cache#run_script = 1 -" If non-nil, don't display a message that files were deleted from the -" cache. -TLet g:tlib#cache#silent = 0 +" Verbosity level: +" 0 ... Be quiet +" 1 ... Display informative message +" 2 ... Display detailed messages +TLet g:tlib#cache#verbosity = 1 " A list of regexps that are matched against partial filenames of the " cached files. If a regexp matches, the file won't be removed by " |tlib#cache#Purge()|. TLet g:tlib#cache#dont_purge = ['[\/]\.last_purge$'] +" If the cache filename is longer than N characters, use +" |pathshorten()|. +TLet g:tlib#cache#max_filename = 200 + " :display: tlib#cache#Dir(?mode = 'bg') " The default cache directory. @@ -49,7 +61,8 @@ endf " :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') function! tlib#cache#Filename(type, ...) "{{{3 " TLogDBG 'bufname='. bufname('.') - let dir = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir() + let dir0 = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir() + let dir = dir0 if a:0 >= 1 && !empty(a:1) let file = a:1 else @@ -73,18 +86,23 @@ function! tlib#cache#Filename(type, ...) "{{{3 " TLogVAR dir let file = fnamemodify(file, ':t') " TLogVAR file, dir, mkdir - if mkdir && !isdirectory(dir) - try - call mkdir(dir, 'p') - catch /^Vim\%((\a\+)\)\=:E739:/ - if filereadable(dir) && !isdirectory(dir) - echoerr 'TLib: Cannot create directory for cache file because a file with the same name exists (please delete it):' dir - " call delete(dir) - " call mkdir(dir, 'p') - endif - endtry - endif let cache_file = tlib#file#Join([dir, file]) + if len(cache_file) > g:tlib#cache#max_filename + let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file) + let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0) + else + if mkdir && !isdirectory(dir) + try + call mkdir(dir, 'p') + catch /^Vim\%((\a\+)\)\=:E739:/ + if filereadable(dir) && !isdirectory(dir) + echoerr 'TLib: Cannot create directory for cache file because a file with the same name exists (please delete it):' dir + " call delete(dir) + " call mkdir(dir, 'p') + endif + endtry + endif + endif " TLogVAR cache_file return cache_file endf @@ -101,6 +119,22 @@ function! tlib#cache#Get(cfile) "{{{3 endf +" Get a cached value from cfile. If it is outdated (compared to ftime) +" or does not exist, create it calling a generator function. +function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 + if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime) + let args = a:0 >= 1 ? a:1 : [] + let val = call(a:generator, args) + " TLogVAR a:generator, args, val + call tlib#cache#Save(a:cfile, {'val': val}) + return val + else + let val = tlib#cache#Get(a:cfile) + return val.val + endif +endf + + " Call |tlib#cache#Purge()| if the last purge was done before " |g:tlib#cache#purge_every_days|. function! tlib#cache#MaybePurge() "{{{3 @@ -144,7 +178,7 @@ endf function! tlib#cache#Purge() "{{{3 let threshold = localtime() - g:tlib#cache#purge_days * g:tlib#date#dayshift let dir = tlib#cache#Dir('g') - if !g:tlib#cache#silent + if g:tlib#cache#verbosity >= 1 echohl WarningMsg echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir echohl NONE @@ -165,7 +199,7 @@ function! tlib#cache#Purge() "{{{3 if getftime(file) < threshold if delete(file) call add(msg, "TLib: Could not delete cache file: ". file) - else + elseif g:tlib#cache#verbosity >= 2 call add(msg, "TLib: Delete cache file: ". file) endif else @@ -176,7 +210,7 @@ function! tlib#cache#Purge() "{{{3 finally let &more = more endtry - if !empty(msg) && !g:tlib#cache#silent + if !empty(msg) && g:tlib#cache#verbosity >= 1 echo join(msg, "\n") endif if !empty(deldir) @@ -202,12 +236,14 @@ function! tlib#cache#Purge() "{{{3 call writefile(script, scriptfile) call inputsave() if g:tlib#cache#run_script == 0 - echohl WarningMsg - if g:tlib#cache#silent - echom "TLib: Purged cache. Need to run script to delete directories" + if g:tlib#cache#verbosity >= 1 + echohl WarningMsg + if g:tlib#cache#verbosity >= 2 + echom "TLib: Purged cache. Need to run script to delete directories" + endif + echom "TLib: Please review and execute: ". scriptfile + echohl NONE endif - echom "TLib: Please review and execute: ". scriptfile - echohl NONE else try let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') diff --git a/sources_non_forked/tlib/autoload/tlib/cmd.vim b/sources_non_forked/tlib/autoload/tlib/cmd.vim index 478e4bb6..e6ab3e88 100644 --- a/sources_non_forked/tlib/autoload/tlib/cmd.vim +++ b/sources_non_forked/tlib/autoload/tlib/cmd.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-08-23. -" @Last Change: 2012-02-10. -" @Revision: 0.0.35 +" @Last Change: 2013-05-14. +" @Revision: 0.0.46 if &cp || exists("loaded_tlib_cmd_autoload") finish @@ -17,12 +17,20 @@ let g:tlib#cmd#last_output = [] function! tlib#cmd#OutputAsList(command) "{{{3 " TLogVAR a:command - " let lines = '' - redir => lines + if exists('s:redir_lines') + redir END + let cache = s:redir_lines + endif + let s:redir_lines = '' + redir =>> s:redir_lines silent! exec a:command redir END - " TLogVAR lines - let g:tlib#cmd#last_output = split(lines, '\n') + let g:tlib#cmd#last_output = split(s:redir_lines, '\n') + unlet s:redir_lines + if exists('cache') + let s:redir_lines = cache + redir =>> s:redir_lines + endif return g:tlib#cmd#last_output endf diff --git a/sources_non_forked/tlib/autoload/tlib/dir.vim b/sources_non_forked/tlib/autoload/tlib/dir.vim index 855ce101..c3902972 100644 --- a/sources_non_forked/tlib/autoload/tlib/dir.vim +++ b/sources_non_forked/tlib/autoload/tlib/dir.vim @@ -3,14 +3,18 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2009-08-04. -" @Revision: 0.0.32 +" @Last Change: 2013-09-25. +" @Revision: 0.0.37 if &cp || exists("loaded_tlib_dir_autoload") finish endif let loaded_tlib_dir_autoload = 1 +" TLet g:tlib#dir#sep = '/' +TLet g:tlib#dir#sep = exists('+shellslash') && !&shellslash ? '\' : '/' + + let s:dir_stack = [] " EXAMPLES: > @@ -18,12 +22,25 @@ let s:dir_stack = [] " => 'foo/bar/' function! tlib#dir#CanonicName(dirname) "{{{3 if a:dirname !~ '[/\\]$' - return a:dirname . g:tlib_filename_sep + return a:dirname . g:tlib#dir#sep endif return a:dirname endf +" EXAMPLES: > +" tlib#dir#NativeName('foo/bar/') +" On Windows: +" => 'foo\bar\' +" On Linux: +" => 'foo/bar/' +function! tlib#dir#NativeName(dirname) "{{{3 + let sep = tlib#rx#EscapeReplace(g:tlib#dir#sep) + let dirname = substitute(a:dirname, '[\/]', sep, 'g') + return dirname +endf + + " EXAMPLES: > " tlib#dir#PlainName('foo/bar/') " => 'foo/bar' @@ -33,7 +50,7 @@ function! tlib#dir#PlainName(dirname) "{{{3 let dirname = dirname[0 : -2] endwh return dirname - " return substitute(a:dirname, tlib#rx#Escape(g:tlib_filename_sep).'\+$', '', '') + " return substitute(a:dirname, tlib#rx#Escape(g:tlib#dir#sep).'\+$', '', '') endf diff --git a/sources_non_forked/tlib/autoload/tlib/file.vim b/sources_non_forked/tlib/autoload/tlib/file.vim index f768abdd..e7ea855a 100644 --- a/sources_non_forked/tlib/autoload/tlib/file.vim +++ b/sources_non_forked/tlib/autoload/tlib/file.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2012-03-23. -" @Revision: 0.0.106 +" @Last Change: 2013-09-25. +" @Revision: 0.0.141 if &cp || exists("loaded_tlib_file_autoload") finish @@ -42,13 +42,15 @@ endf " => 'foo/bar/filename.txt' function! tlib#file#Join(filename_parts, ...) "{{{3 TVarArg 'strip_slashes' + " TLogVAR a:filename_parts, strip_slashes if strip_slashes - " let rx = tlib#rx#Escape(g:tlib_filename_sep) .'$' - let rx = '[/\\]$' + " let rx = tlib#rx#Escape(g:tlib#dir#sep) .'$' + let rx = '[/\\]\+$' let parts = map(copy(a:filename_parts), 'substitute(v:val, rx, "", "")') - return join(parts, g:tlib_filename_sep) + " TLogVAR parts + return join(parts, g:tlib#dir#sep) else - return join(a:filename_parts, g:tlib_filename_sep) + return join(a:filename_parts, g:tlib#dir#sep) endif endf @@ -60,14 +62,14 @@ function! tlib#file#Relative(filename, basedir) "{{{3 " TLogVAR a:filename, a:basedir " TLogDBG getcwd() " TLogDBG expand('%:p') - let f0 = fnamemodify(a:filename, ':p') + let b0 = tlib#file#Absolute(a:basedir) + let b = tlib#file#Split(b0) + " TLogVAR b + let f0 = tlib#file#Absolute(a:filename) let fn = fnamemodify(f0, ':t') let fd = fnamemodify(f0, ':h') let f = tlib#file#Split(fd) - " TLogVAR f - let b0 = fnamemodify(a:basedir, ':p') - let b = tlib#file#Split(b0) - " TLogVAR b + " TLogVAR f0, fn, fd, f if f[0] != b[0] let rv = f0 else @@ -78,6 +80,7 @@ function! tlib#file#Relative(filename, basedir) "{{{3 call remove(f, 0) call remove(b, 0) endwh + " TLogVAR f, b let rv = tlib#file#Join(repeat(['..'], len(b)) + f + [fn]) endif " TLogVAR rv @@ -85,6 +88,21 @@ function! tlib#file#Relative(filename, basedir) "{{{3 endf +function! tlib#file#Absolute(filename, ...) "{{{3 + if filereadable(a:filename) + let filename = fnamemodify(a:filename, ':p') + elseif a:filename =~ '^\(/\|[^\/]\+:\)' + let filename = a:filename + else + let cwd = a:0 >= 1 ? a:1 : getcwd() + let filename = tlib#file#Join([cwd, a:filename]) + endif + let filename = substitute(filename, '\(^\|[\/]\)\zs\.[\/]', '', 'g') + let filename = substitute(filename, '[\/]\zs[^\/]\+[\/]\.\.[\/]', '', 'g') + return filename +endf + + function! s:SetScrollBind(world) "{{{3 let sb = get(a:world, 'scrollbind', &scrollbind) if sb != &scrollbind @@ -118,7 +136,7 @@ function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3 if filereadable(f) if !empty(a:fcmd) " TLogDBG a:fcmd .' '. tlib#arg#Ex(f) - exec 'autocmd TLibFileRead BufRead' escape(f, ' ') 'let s:bufread=expand(":p")' + exec 'autocmd TLibFileRead BufRead' escape(f, '\ ') 'let s:bufread=expand(":p")' try exec a:fcmd .' '. tlib#arg#Ex(f) finally diff --git a/sources_non_forked/tlib/autoload/tlib/fixes.vim b/sources_non_forked/tlib/autoload/tlib/fixes.vim new file mode 100644 index 00000000..e9247dd6 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/fixes.vim @@ -0,0 +1,14 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2013-02-22. +" @Revision: 3 + + +function! tlib#fixes#Winpos() "{{{3 + if has('gui_win32') + return 'winpos '. getwinposx() .' '. getwinposy() + else + return '' + endif +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/grep.vim b/sources_non_forked/tlib/autoload/tlib/grep.vim new file mode 100644 index 00000000..894b1ee7 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/grep.vim @@ -0,0 +1,38 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2013-10-16. +" @Revision: 31 + + +function! tlib#grep#Do(cmd, rx, files) "{{{3 + " TLogVAR a:cmd, a:rx, a:files + let files = join(map(copy(a:files), 'tlib#arg#Ex(v:val, "")'), ' ') + let rx = '/'. escape(a:rx, '/') .'/j' + " TLogVAR rx, files + silent exec a:cmd rx files +endf + + +function! tlib#grep#LocList(rx, files) "{{{3 + return tlib#grep#Do('noautocmd lvimgrep', a:rx, a:files) +endf + + +function! tlib#grep#QuickFixList(rx, files) "{{{3 + return tlib#grep#Do('noautocmd vimgrep', a:rx, a:files) +endf + + +function! tlib#grep#List(rx, files) "{{{3 + call setqflist([]) + call tlib#grep#Do('noautocmd vimgrepadd', a:rx, a:files) + let qfl = getqflist() + " TLogVAR qfl + " try + silent! colder + " catch + " call setqflist([], 'r') + " endtry + return qfl +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/hash.vim b/sources_non_forked/tlib/autoload/tlib/hash.vim new file mode 100644 index 00000000..29c9ef67 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/hash.vim @@ -0,0 +1,145 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Revision: 276 + + +if !exists('g:tlib#hash#use_crc32') + let g:tlib#hash#use_crc32 = '' "{{{2 +endif + + +if !exists('g:tlib#hash#use_adler32') + let g:tlib#hash#use_adler32 = '' "{{{2 +endif + + +function! tlib#hash#CRC32B(chars) "{{{3 + if !empty(g:tlib#hash#use_crc32) + let use = g:tlib#hash#use_crc32 + elseif has('ruby') + let use = 'ruby' + else + let use = 'vim' + endif + if exists('*tlib#hash#CRC32B_'. use) + return tlib#hash#CRC32B_{use}(a:chars) + else + throw "Unknown version of tlib#hash#CRC32B: ". use + endif +endf + + +function! tlib#hash#CRC32B_ruby(chars) "{{{3 + if has('ruby') + let rv = '' + if !exists('s:loaded_ruby_zlib') + ruby require 'zlib' + let s:loaded_ruby_zlib = 1 + endif + ruby VIM::command('let rv = "%08X"' % Zlib.crc32(VIM::evaluate("a:chars"))) + return rv + else + throw "tlib#hash#CRC32B_ruby not supported in this version of vim" + endif +endf + + +function! tlib#hash#CRC32B_vim(chars) "{{{3 + if !exists('s:crc_table') + let cfile = tlib#persistent#Filename('tlib', 'crc_table', 1) + let s:crc_table = tlib#persistent#Value(cfile, 'tlib#hash#CreateCrcTable', 0) + endif + let xFFFF_FFFF = repeat([1], 32) + let crc = tlib#bitwise#XOR([0], xFFFF_FFFF, 'bits') + for char in split(a:chars, '\zs') + let octet = char2nr(char) + let r1 = tlib#bitwise#ShiftRight(crc, 8) + let i0 = tlib#bitwise#AND(crc, xFFFF_FFFF, 'bits') + let i1 = tlib#bitwise#XOR(i0, octet, 'bits') + let i2 = tlib#bitwise#Bits2Num(tlib#bitwise#AND(i1, 0xff, 'bits')) + let r2 = s:crc_table[i2] + let crc = tlib#bitwise#XOR(r1, r2, 'bits') + endfor + let crc = tlib#bitwise#XOR(crc, xFFFF_FFFF, 'bits') + let rv = tlib#bitwise#Bits2Num(crc, 16) + if len(rv) < 8 + let rv = repeat('0', 8 - len(rv)) . rv + endif + return rv +endf + + +" :nodoc: +function! tlib#hash#CreateCrcTable() "{{{3 + let sum = 0.0 + for exponent in [0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26, 32] + let exp = tlib#bitwise#Bits2Num(repeat([0], 32 - exponent) + [1], 10.0) + let sum += exp + endfor + let divisor = tlib#bitwise#Num2Bits(sum) + let crc_table = [] + for octet in range(256) + let remainder = tlib#bitwise#Num2Bits(octet) + for i in range(8) + if get(remainder, i) != 0 + let remainder = tlib#bitwise#XOR(remainder, tlib#bitwise#ShiftLeft(divisor, i), "bits") + endif + endfor + let remainder = tlib#bitwise#ShiftRight(remainder, 8) + call add(crc_table, remainder) + endfor + return crc_table +endf + + +function! tlib#hash#Adler32(chars) "{{{3 + if !empty(g:tlib#hash#use_adler32) + let use = g:tlib#hash#use_adler32 + elseif exists('*or') + let use = 'vim' + else + let use = 'tlib' + endif + if exists('*tlib#hash#Adler32_'. use) + return tlib#hash#Adler32_{use}(a:chars) + else + throw "Unknown version of tlib#hash#Adler32_: ". use + endif +endf + + +function! tlib#hash#Adler32_vim(chars) "{{{3 + if exists('*or') + let mod_adler = 65521 + let a = 1 + let b = 0 + for index in range(len(a:chars)) + let c = char2nr(a:chars[index]) + let a = (a + c) % mod_adler + let b = (b + a) % mod_adler + endfor + let bb = b * float2nr(pow(2, 16)) + let checksum = or(bb, a) + " TLogVAR checksum, a, b, bb + return printf("%08X", checksum) + else + throw "TLIB: Vim version doesn't support bitwise or()" + endif +endf + + +function! tlib#hash#Adler32_tlib(chars) "{{{3 + let mod_adler = 65521 + let a = 1 + let b = 0 + for index in range(len(a:chars)) + let c = char2nr(a:chars[index]) + let a = (a + c) % mod_adler + let b = (b + a) % mod_adler + endfor + let bb = tlib#bitwise#ShiftLeft(tlib#bitwise#Num2Bits(b), 16) + let checksum = tlib#bitwise#OR(bb, a, "bits") + return printf('%08s', tlib#bitwise#Bits2Num(checksum, 16)) +endf + + diff --git a/sources_non_forked/tlib/autoload/tlib/input.vim b/sources_non_forked/tlib/autoload/tlib/input.vim index 302aca88..b756f783 100644 --- a/sources_non_forked/tlib/autoload/tlib/input.vim +++ b/sources_non_forked/tlib/autoload/tlib/input.vim @@ -3,13 +3,188 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2012-10-01. -" @Revision: 0.0.966 +" @Last Change: 2013-09-30. +" @Revision: 0.0.1262 " :filedoc: " Input-related, select from a list etc. +" If a list is bigger than this value, don't try to be smart when +" selecting an item. Be slightly faster instead. +" See |tlib#input#List()|. +TLet g:tlib#input#sortprefs_threshold = 200 + + +" If a list contains more items, |tlib#input#List()| does not perform an +" incremental "live search" but uses |input()| to query the user for a +" filter. This is useful on slower machines or with very long lists. +TLet g:tlib#input#livesearch_threshold = 1000 + + +" Determine how |tlib#input#List()| and related functions work. +" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: +" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted +" as a wildcard (this is the default method) +" - A plus character ("+") acts as a wildcard as if ".\{-}" (see +" |/\{-|) were entered. +" - Examples: +" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match +" "far". +" - Otherwise it is a derivate of the cnf method (see below). +" - See also |tlib#Filter_cnfx#New()|. +" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is +" expanded to "\.\{-}" +" - A period character (".") acts as a wildcard as if ".\{-}" (see +" |/\{-|) were entered. +" - Examples: +" - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match +" "far". +" - Otherwise it is a derivate of the cnf method (see below). +" - See also |tlib#Filter_cnfd#New()|. +" cnf .... Match substrings +" - A blank creates an AND conjunction, i.e. the next pattern has to +" match too. +" - A pipe character ("|") creates an OR conjunction, either this or +" the next next pattern has to match. +" - Patterns are very 'nomagic' |regexp| with a |\V| prefix. +" - A pattern starting with "-" makes the filter exclude items +" matching that pattern. +" - Examples: +" - "foo bar" matches items that contain the strings "foo" AND +" "bar". +" - "foo|bar boo|far" matches items that contain either ("foo" OR +" "bar") AND ("boo" OR "far"). +" - See also |tlib#Filter_cnf#New()|. +" seq .... Match sequences of characters +" - |tlib#Filter_seq#New()| +" fuzzy .. Match fuzzy character sequences +" - |tlib#Filter_fuzzy#New()| +TLet g:tlib#input#filter_mode = 'cnfx' + + +" The highlight group to use for showing matches in the input list +" window. +" See |tlib#input#List()|. +TLet g:tlib#input#higroup = 'IncSearch' + +" When 1, automatically select the last remaining item only if the list +" had only one item to begin with. +" When 2, automatically select a last remaining item after applying +" any filters. +" See |tlib#input#List()|. +TLet g:tlib_pick_last_item = 1 + + +" :doc: +" Keys for |tlib#input#List|~ + +TLet g:tlib#input#and = ' ' +TLet g:tlib#input#or = '|' +TLet g:tlib#input#not = '-' + +" When editing a list with |tlib#input#List|, typing these numeric chars +" (as returned by getchar()) will select an item based on its index, not +" based on its name. I.e. in the default setting, typing a "4" will +" select the fourth item, not the item called "4". +" In order to make keys 0-9 filter the items in the list and make +" select an item by its index, remove the keys 48 to 57 from +" this dictionary. +" Format: [KEY] = BASE ... the number is calculated as KEY - BASE. +" :nodefault: +TLet g:tlib#input#numeric_chars = { + \ 176: 176, + \ 177: 176, + \ 178: 176, + \ 179: 176, + \ 180: 176, + \ 181: 176, + \ 182: 176, + \ 183: 176, + \ 184: 176, + \ 185: 176, + \} + " \ 48: 48, + " \ 49: 48, + " \ 50: 48, + " \ 51: 48, + " \ 52: 48, + " \ 53: 48, + " \ 54: 48, + " \ 55: 48, + " \ 56: 48, + " \ 57: 48, + + +" :nodefault: +" The default key bindings for single-item-select list views. If you +" want to use , to move the cursor up and down, add these two +" lines to after/plugin/02tlib.vim: > +" +" let g:tlib#input#keyagents_InputList_s[10] = 'tlib#agent#Down' " +" let g:tlib#input#keyagents_InputList_s[11] = 'tlib#agent#Up' " +TLet g:tlib#input#keyagents_InputList_s = { + \ "\": 'tlib#agent#PageUp', + \ "\": 'tlib#agent#PageDown', + \ "\": 'tlib#agent#Up', + \ "\": 'tlib#agent#Down', + \ "\": 'tlib#agent#UpN', + \ "\": 'tlib#agent#DownN', + \ "\": 'tlib#agent#ShiftLeft', + \ "\": 'tlib#agent#ShiftRight', + \ 18: 'tlib#agent#Reset', + \ 242: 'tlib#agent#Reset', + \ 17: 'tlib#agent#Input', + \ 241: 'tlib#agent#Input', + \ 27: 'tlib#agent#Exit', + \ 26: 'tlib#agent#Suspend', + \ 250: 'tlib#agent#Suspend', + \ 15: 'tlib#agent#SuspendToParentWindow', + \ 63: 'tlib#agent#Help', + \ "\": 'tlib#agent#Help', + \ "\": 'tlib#agent#ExecAgentByName', + \ "\": 'tlib#agent#ExecAgentByName', + \ "\": 'tlib#agent#ReduceFilter', + \ "\": 'tlib#agent#ReduceFilter', + \ "\": 'tlib#agent#PopFilter', + \ "\": 'tlib#agent#PopFilter', + \ "\": 'tlib#agent#PopFilter', + \ "\": 'tlib#agent#PopFilter', + \ "\": 'tlib#agent#Wildcard', + \ 191: 'tlib#agent#Debug', + \ char2nr(g:tlib#input#or): 'tlib#agent#OR', + \ char2nr(g:tlib#input#and): 'tlib#agent#AND', + \ } + + +" :nodefault: +TLet g:tlib#input#keyagents_InputList_m = { + \ 35: 'tlib#agent#Select', + \ "\": 'tlib#agent#SelectUp', + \ "\": 'tlib#agent#SelectDown', + \ 1: 'tlib#agent#SelectAll', + \ 225: 'tlib#agent#SelectAll', + \ "\": 'tlib#agent#ToggleRestrictView', + \ } +" "\": 'tlib#agent#Select' + + +" :nodefault: +TLet g:tlib#input#handlers_EditList = [ + \ {'key': 5, 'agent': 'tlib#agent#EditItem', 'key_name': '', 'help': 'Edit item'}, + \ {'key': 4, 'agent': 'tlib#agent#DeleteItems', 'key_name': '', 'help': 'Delete item(s)'}, + \ {'key': 14, 'agent': 'tlib#agent#NewItem', 'key_name': '', 'help': 'New item'}, + \ {'key': 24, 'agent': 'tlib#agent#Cut', 'key_name': '', 'help': 'Cut item(s)'}, + \ {'key': 3, 'agent': 'tlib#agent#Copy', 'key_name': '', 'help': 'Copy item(s)'}, + \ {'key': 22, 'agent': 'tlib#agent#Paste', 'key_name': '', 'help': 'Paste item(s)'}, + \ {'pick_last_item': 0}, + \ {'return_agent': 'tlib#agent#EditReturnValue'}, + \ {'help_extra': [ + \ 'Submit changes by pressing ENTER or or ', + \ 'Cancel editing by pressing c' + \ ]}, + \ ] + " If true, define a popup menu for |tlib#input#List()| and related " functions. @@ -40,7 +215,7 @@ TLet g:tlib#input#filename_max_width = '&co / 2' " of selected elements or its indexes. " " By default, typing numbers will select an item by its index. See -" |g:tlib_numeric_chars| to find out how to change this. +" |g:tlib#input#numeric_chars| to find out how to change this. " " The item is automatically selected if the numbers typed equals the " number of digits of the list length. I.e. if a list contains 20 items, @@ -58,7 +233,7 @@ TLet g:tlib#input#filename_max_width = '&co / 2' " mi ... Return a list of indexes " " Several pattern matching styles are supported. See -" |g:tlib_inputlist_match|. +" |g:tlib#input#filter_mode|. " " EXAMPLES: > " echo tlib#input#List('s', 'Select one item', [100,200,300]) @@ -110,7 +285,7 @@ function! tlib#input#List(type, ...) "{{{3 let world.pick_last_item = tlib#list#Find(handlers, 'has_key(v:val, "pick_last_item")', \ tlib#var#Get('tlib_pick_last_item', 'bg'), 'v:val.pick_last_item') let world.numeric_chars = tlib#list#Find(handlers, 'has_key(v:val, "numeric_chars")', - \ tlib#var#Get('tlib_numeric_chars', 'bg'), 'v:val.numeric_chars') + \ g:tlib#input#numeric_chars, 'v:val.numeric_chars') let world.key_handlers = filter(copy(handlers), 'has_key(v:val, "key")') let filter = tlib#list#Find(handlers, 'has_key(v:val, "filter")', '', 'v:val.filter') if !empty(filter) @@ -157,10 +332,12 @@ function! tlib#input#ListW(world, ...) "{{{3 let &l:scrolloff = 0 let @/ = '' let dlist = [] + let post_keys = '' " let &laststatus = 2 try while !empty(world.state) && world.state !~ '^exit' && (world.show_empty || !empty(world.base)) + let post_keys = '' " TLogDBG 'while' " TLogVAR world.state " let time01 = str2float(reltimestr(reltime())) " DBG @@ -249,7 +426,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogVAR world.idx, world.llen, world.state " TLogDBG world.FilterIsEmpty() if world.state == 'display' - if world.idx == '' && world.llen < g:tlib_sortprefs_threshold && !world.FilterIsEmpty() + if world.idx == '' && world.llen < g:tlib#input#sortprefs_threshold && !world.FilterIsEmpty() call world.SetPrefIdx() else let world.prefidx = world.idx == '' ? world.initial_index : world.idx @@ -333,7 +510,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " let world.prefidx = world.offset " endif call world.DisplayList() - if world.state == 'help' + if world.state == 'help' || world.state == 'printlines' let world.state = 'display' else let world.state = '' @@ -343,7 +520,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " TAssert IsNotEmpty(world.scratch) let world.list_wnr = winnr() - " TLogVAR world.next_state, world.state + " TLogVAR world.state, world.next_state if !empty(world.next_state) let world.state = world.next_state let world.next_state = '' @@ -354,11 +531,49 @@ function! tlib#input#ListW(world, ...) "{{{3 continue endif - " TLogVAR world.timeout - let c = tlib#char#Get(world.timeout, world.timeout_resolution) - " TLogVAR c, has_key(world.key_map[world.key_mode],c) + if world.state =~ '\' + let query = matchstr(world.state, '\ 0 && cmod != 0 + let c = printf("<%s-%s>", cmod, c) + endif + endif + else + " TLogVAR world.timeout + let c = tlib#char#Get(world.timeout, world.timeout_resolution) + " TLogVAR c, has_key(world.key_map[world.key_mode],c) + let cmod = getcharmod() + endif + " TLogVAR c, cmod " TLogDBG string(sort(keys(world.key_map[world.key_mode]))) - if world.state != '' + + " TLogVAR world.next_agent, world.next_eval + if !empty(world.next_agent) + let nagent = world.next_agent + let world.next_agent = '' + let world = call(nagent, [world, world.GetSelectedItems(world.CurrentItem())]) + call s:CheckAgentReturnValue(nagent, world) + elseif !empty(world.next_eval) + let selected = world.GetSelectedItems(world.CurrentItem()) + let neval = world.next_eval + let world.next_eval = '' + exec neval + call s:CheckAgentReturnValue(neval, world) + elseif world.state != '' " continue elseif has_key(world.key_map[world.key_mode], c) let sr = @/ @@ -382,35 +597,53 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.state = 'exit empty' endif elseif c == "\" - let world.prefidx = world.GetLineIdx(v:mouse_lnum) - " let world.offset = world.prefidx - " TLogVAR v:mouse_lnum, world.prefidx - if empty(world.prefidx) - " call feedkeys(c, 't') - let c = tlib#char#Get(world.timeout) - let world.state = 'help' - continue - endif - throw 'pick' - elseif c == "\" - if g:tlib#input#use_popup && world.has_menu - " if v:mouse_lnum != line('.') - " endif + if v:mouse_win == world.list_wnr let world.prefidx = world.GetLineIdx(v:mouse_lnum) - let world.state = 'redisplay' - call world.DisplayList() - if line('w$') - v:mouse_lnum < 6 - popup ]TLibInputListPopupMenu + " let world.offset = world.prefidx + if empty(world.prefidx) + " call feedkeys(c, 't') + let c = tlib#char#Get(world.timeout) + let world.state = 'help' + continue + endif + throw 'pick' + else + let post_keys = v:mouse_lnum .'gg'. v:mouse_col .'|'. c + if world.allow_suspend + let world = tlib#agent#SuspendToParentWindow(world, world.rv) else - popup! ]TLibInputListPopupMenu + let world.state = 'exit empty' + endif + endif + elseif c == "\" + if v:mouse_win == world.list_wnr + call s:BuildMenu(world) + let world.state = 'redisplay' + if s:PopupmenuExists() == 1 + " if v:mouse_lnum != line('.') + " endif + let world.prefidx = world.GetLineIdx(v:mouse_lnum) + let world.next_state = 'eval[Waiting for popup menu ... Press ESC to continue]' + call world.DisplayList() + if line('w$') - v:mouse_lnum < 6 + popup ]TLibInputListPopupMenu + else + popup! ]TLibInputListPopupMenu + endif endif else - let world.state = 'redisplay' + let post_keys = v:mouse_lnum .'gg'. v:mouse_col .'|'. c + if world.allow_suspend + let world = tlib#agent#SuspendToParentWindow(world, world.rv) + else + let world.state = 'exit empty' + endif endif " TLogVAR world.prefidx, world.state elseif has_key(world.key_map[world.key_mode], 'unknown_key') let agent = world.key_map[world.key_mode].unknown_key.agent let world = call(agent, [world, c]) + call s:CheckAgentReturnValue(agent, world) elseif c >= 32 let world.state = 'display' let numbase = get(world.numeric_chars, c, -99999) @@ -425,7 +658,7 @@ function! tlib#input#ListW(world, ...) "{{{3 else let world.idx = '' " TLogVAR world.filter - if world.llen > g:tlib_inputlist_livesearch_threshold + if world.llen > g:tlib#input#livesearch_threshold let pattern = input('Filter: ', world.CleanFilter(world.filter[0][0]) . nr2char(c)) if empty(pattern) let world.state = 'exit empty' @@ -552,9 +785,8 @@ function! tlib#input#ListW(world, ...) "{{{3 " let &laststatus = laststatus silent! let @/ = lastsearch let &l:scrolloff = scrolloff - if g:tlib#input#use_popup && world.has_menu + if s:PopupmenuExists() == 1 silent! aunmenu ]TLibInputListPopupMenu - let world.has_menu = 0 endif " TLogDBG 'finally 2' @@ -589,6 +821,10 @@ function! tlib#input#ListW(world, ...) "{{{3 " endfor echo redraw! + if !empty(post_keys) + " TLogVAR post_keys + call feedkeys(post_keys) + endif endtry endf @@ -612,7 +848,7 @@ function! s:Init(world, cmd) "{{{3 " TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr let a:world.filetype = &filetype let a:world.fileencoding = &fileencoding - call a:world.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'wb')) + call a:world.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'wb')) call a:world.Initialize() if !has_key(a:world, 'key_mode') let a:world.key_mode = 'default' @@ -623,18 +859,19 @@ function! s:Init(world, cmd) "{{{3 if has_key(a:world.key_map, a:world.key_mode) let a:world.key_map[a:world.key_mode] = extend( \ a:world.key_map[a:world.key_mode], - \ copy(g:tlib_keyagents_InputList_s), + \ copy(g:tlib#input#keyagents_InputList_s), \ 'keep') else - let a:world.key_map[a:world.key_mode] = copy(g:tlib_keyagents_InputList_s) + let a:world.key_map[a:world.key_mode] = copy(g:tlib#input#keyagents_InputList_s) endif else let a:world.key_map = { - \ a:world.key_mode : copy(g:tlib_keyagents_InputList_s) + \ a:world.key_mode : copy(g:tlib#input#keyagents_InputList_s) \ } endif + " TLogVAR a:world.type if stridx(a:world.type, 'm') != -1 - call extend(a:world.key_map[a:world.key_mode], g:tlib_keyagents_InputList_m, 'force') + call extend(a:world.key_map[a:world.key_mode], g:tlib#input#keyagents_InputList_m, 'force') endif for key_mode in keys(a:world.key_map) let a:world.key_map[key_mode] = map(a:world.key_map[key_mode], 'type(v:val) == 4 ? v:val : {"agent": v:val}') @@ -652,7 +889,6 @@ function! s:Init(world, cmd) "{{{3 let a:world.state .= ' '. a:cmd endif endif - call s:BuildMenu(a:world) " TLogVAR a:world.state, a:world.sticky endf @@ -667,40 +903,133 @@ function! s:ExtendKeyMap(world, key_mode, key_handlers) "{{{3 endf +function s:PopupmenuExists() + if !g:tlib#input#use_popup + \ || exists(':popup') != 2 + \ || !(has('gui_win32') || has('gui_gtk') || has('gui_gtk2')) + " \ || !has('gui_win32') + let rv = -1 + else + try + let rv = 1 + silent amenu ]TLibInputListPopupMenu + catch + let rv = 0 + endtry + endif + " TLogVAR rv + return rv +endf + + function! s:BuildMenu(world) "{{{3 - if g:tlib#input#use_popup - if a:world.has_menu - silent! aunmenu ]TLibInputListPopupMenu - endif - amenu ]TLibInputListPopupMenu.Pick\ selected\ item - amenu ]TLibInputListPopupMenu.Select # - amenu ]TLibInputListPopupMenu.Select\ all - amenu ]TLibInputListPopupMenu.Reset\ list - amenu ]TLibInputListPopupMenu.Cancel - amenu ]TLibInputListPopupMenu.-StandardEntries- : - let a:world.has_menu = 1 + if g:tlib#input#use_popup && s:PopupmenuExists() == 0 + call s:BuildItem('Pick\ selected\ item', {'key_name': '', 'eval': 'let world.state = "pick"'}) + call s:BuildItem('Cancel', {'key_name': '', 'agent': 'tlib#agent#Exit'}) + call s:BuildItem('Select', {'key_name': '#', 'agent': 'tlib#agent#Select'}) + call s:BuildItem('Select\ all', {'key_name': '', 'agent': 'tlib#agent#SelectAll'}) + call s:BuildItem('Reset\ list', {'key_name': '', 'agent': 'tlib#agent#Reset'}) + call s:BuildItem('-StandardEntries-', {'key': ":", 'eval': 'let world.state = "redisplay"'}) for [key_mode, key_handlers] in items(a:world.key_map) let keys = sort(keys(key_handlers)) + let mitems = {} for key in keys let handler = key_handlers[key] let k = get(handler, 'key', '') if !empty(k) && has_key(handler, 'help') && !empty(handler.help) if empty(key_mode) || key_mode == 'default' - exec 'amenu ]TLibInputListPopupMenu.'. escape(handler.help, ' .\') - \ .' '. handler.key_name + let mname = '' else - exec 'amenu ]TLibInputListPopupMenu'. - \ '.'. escape(key_mode, ' .\') - \ '.'. escape(handler.help, ' .\') - \ .' '. handler.key_name + let mname = escape(key_mode, ' .\') .'.' endif + if has_key(handler, 'submenu') + let submenu = escape(handler.submenu, ' .\') + else + let submenu = '~' + endif + for mfield in ['menu', 'help', 'key_name', 'agent'] + if has_key(handler, mfield) + let mname .= escape(handler[mfield], ' .\') + break + endif + endfor + if !has_key(mitems, submenu) + let mitems[submenu] = {} + endif + let mitems[submenu][mname] = handler endif endfor + for msubname in sort(keys(mitems)) + let msubitems = mitems[msubname] + if msubname == '~' + let msubmname = '' + else + let msubmname = msubname .'.' + endif + for mname in sort(keys(msubitems)) + let msname = msubmname . mname + let handler = msubitems[mname] + call s:BuildItem(msname, handler) + " if has_key(handler, 'agent') + " call s:BuildItem(msname, {'agent': handler.agent}) + " else + " call s:BuildItem(msname, {'key': handler.key_name}) + " endif + endfor + endfor endfor endif endf +function! s:BuildItem(menu, def) "{{{3 + if has('gui_win32') + let key_mode = 'c' + elseif has('gui_gtk') || has('gui_gtk2') + let key_mode = 'raw' + endif + for k in ['agent', 'eval', 'key_name', 'key'] + if has('gui_win32') + elseif has('gui_gtk') || has('gui_gtk') + if k == 'agent' || k == 'eval' + continue + endif + endif + try + if has_key(a:def, k) + let v = a:def[k] + if k == 'key' + if key_mode == 'c' + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "'. v .'"' + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "'. v .'"' + else + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) v + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) v + endif + elseif k == 'key_name' + if key_mode == 'c' + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "\'. v .'"' + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "\'. v .'"' + else + let key = v + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) key + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) key + endif + elseif k == 'agent' + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_agent ='. string(v) .'' + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_agent ='. string(v) .'' + elseif k == 'eval' + " echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_eval ='. string(v) .'' + exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_eval ='. string(v) .'' + endif + return + endif + catch + endtry + endfor +endf + + function! s:RunStateHandlers(world) "{{{3 " Provide the variable "world" in the environment of an "exec" " handler (ea). @@ -748,7 +1077,7 @@ endf " EXAMPLES: > " echo tlib#input#EditList('Edit:', [100,200,300]) function! tlib#input#EditList(query, list, ...) "{{{3 - let handlers = a:0 >= 1 && !empty(a:1) ? a:1 : g:tlib_handlers_EditList + let handlers = a:0 >= 1 && !empty(a:1) ? a:1 : g:tlib#input#handlers_EditList let default = a:0 >= 2 ? a:2 : [] let timeout = a:0 >= 3 ? a:3 : 0 " TLogVAR handlers @@ -767,7 +1096,7 @@ function! tlib#input#Resume(name, pick, bufnr) "{{{3 " TLogVAR a:name, a:pick echo if bufnr('%') != a:bufnr - if g:tlib_debug + if g:tlib#debug echohl WarningMsg echom "tlib#input#Resume: Internal error: Not in scratch buffer:" bufname('%') echohl NONE @@ -775,7 +1104,7 @@ function! tlib#input#Resume(name, pick, bufnr) "{{{3 let br = tlib#buffer#Set(a:bufnr) endif if !exists('b:tlib_'. a:name) - if g:tlib_debug + if g:tlib#debug echohl WarningMsg echom "tlib#input#Resume: Internal error: b:tlib_". a:name ." does not exist:" bufname('%') echohl NONE diff --git a/sources_non_forked/tlib/autoload/tlib/number.vim b/sources_non_forked/tlib/autoload/tlib/number.vim new file mode 100644 index 00000000..94fde02f --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/number.vim @@ -0,0 +1,30 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Revision: 14 + + +function! tlib#number#ConvertBase(num, base, ...) "{{{3 + let rtype = a:0 >= 1 ? a:1 : 'string' + " TLogVAR a:num, a:base, rtype + let rv = [] + let num = 0.0 + a:num + while floor(num) > 0.0 + let div = floor(num / a:base) + let num1 = float2nr(num - a:base * div) + if a:base <= 10 + call insert(rv, num1) + elseif a:base == 16 + let char = "0123456789ABCDEF"[num1] + call insert(rv, char) + endif + let num = num / a:base + endwh + " TLogVAR rv + if rtype == 'list' + return rv + else + return join(rv, '') + endif +endf + + diff --git a/sources_non_forked/tlib/autoload/tlib/persistent.vim b/sources_non_forked/tlib/autoload/tlib/persistent.vim index a4611a69..b5791744 100644 --- a/sources_non_forked/tlib/autoload/tlib/persistent.vim +++ b/sources_non_forked/tlib/autoload/tlib/persistent.vim @@ -3,7 +3,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-05-11. " @Last Change: 2012-05-11. -" @Revision: 6 +" @Revision: 7 " The directory for persistent data files. If empty, use " |tlib#dir#MyRuntime|.'/share'. @@ -38,6 +38,10 @@ function! tlib#persistent#Get(cfile) "{{{3 endif endf +function! tlib#persistent#Value(...) "{{{3 + return call('tlib#cache#Value', a:000) +endf + function! tlib#persistent#Save(cfile, dictionary) "{{{3 if !empty(a:cfile) " TLogVAR a:dictionary diff --git a/sources_non_forked/tlib/autoload/tlib/scratch.vim b/sources_non_forked/tlib/autoload/tlib/scratch.vim index 41f935d9..bb6e4be2 100644 --- a/sources_non_forked/tlib/autoload/tlib/scratch.vim +++ b/sources_non_forked/tlib/autoload/tlib/scratch.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-07-18. -" @Last Change: 2012-02-08. -" @Revision: 0.0.167 +" @Last Change: 2013-10-16. +" @Revision: 0.0.242 if &cp || exists("loaded_tlib_scratch_autoload") finish @@ -12,6 +12,17 @@ endif let loaded_tlib_scratch_autoload = 1 +" Scratch window position. By default the list window is opened on the +" bottom. Set this variable to 'topleft' or '' to change this behaviour. +" See |tlib#input#List()|. +TLet g:tlib_scratch_pos = 'botright' + +" If you want the scratch buffer to be fully removed, you might want to +" set this variable to 'wipe'. +" See also https://github.com/tomtom/tlib_vim/pull/16 +TLet g:tlib#scratch#hidden = 'hide' + + " :def: function! tlib#scratch#UseScratch(?keyargs={}) " Display a scratch buffer (a buffer with no file). See :TScratch for an " example. @@ -22,23 +33,21 @@ function! tlib#scratch#UseScratch(...) "{{{3 exec tlib#arg#Let([['keyargs', {}]]) " TLogDBG string(keys(keyargs)) let id = get(keyargs, 'scratch', '__Scratch__') - " TLogVAR id - " TLogDBG winnr() - " TLogDBG bufnr(id) - " TLogDBG bufwinnr(id) - " TLogDBG bufnr('%') - if id =~ '^\d\+$' && bufwinnr(id) != -1 - if bufnr('%') != id - exec 'noautocmd buffer! '. id - endif - " let ft = &ft - let ft = '*' + " TLogVAR id, bufwinnr(id) + " TLogVAR bufnr(id), bufname(id) + " TLogVAR 1, winnr(), bufnr('%'), bufname("%") + if bufwinnr(id) != -1 + " echom 'DBG noautocmd keepalt keepj' bufwinnr(id) 'wincmd w' + exec 'noautocmd keepalt keepj' bufwinnr(id) 'wincmd w' + " TLogVAR "reuse", bufnr("%"), bufname("%") else + let winpos = '' let bn = bufnr(id) let wpos = get(keyargs, 'scratch_pos', g:tlib_scratch_pos) " TLogVAR keyargs.scratch_vertical if get(keyargs, 'scratch_vertical') let wpos .= ' vertical' + let winpos = tlib#fixes#Winpos() endif " TLogVAR wpos let scratch_split = get(keyargs, 'scratch_split', 1) @@ -47,7 +56,7 @@ function! tlib#scratch#UseScratch(...) "{{{3 let wn = bufwinnr(bn) if wn != -1 " TLogVAR wn - exec 'noautocmd' (wn .'wincmd w') + exec 'noautocmd keepalt keepj' (wn .'wincmd w') else if scratch_split == 1 let cmd = wpos.' sbuffer!' @@ -57,7 +66,7 @@ function! tlib#scratch#UseScratch(...) "{{{3 let cmd = 'buffer!' endif " TLogVAR cmd - silent exec 'noautocmd' cmd bn + silent exec 'noautocmd keepalt keepj' cmd bn endif else " TLogVAR id @@ -69,24 +78,29 @@ function! tlib#scratch#UseScratch(...) "{{{3 let cmd = 'edit' endif " TLogVAR cmd - silent exec 'noautocmd' cmd escape(id, '%#\ ') + silent exec 'noautocmd keepalt keepj' cmd escape(id, '%#\ ') " silent exec 'split '. id endif let ft = get(keyargs, 'scratch_filetype', '') - " TLogVAR ft - endif - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - setlocal nobuflisted - setlocal foldmethod=manual - setlocal foldcolumn=0 - setlocal modifiable - setlocal nospell - if &ft != '*' - let &ft = ft + " TLogVAR ft, winpos + if !empty(winpos) + exec winpos + endif + setlocal buftype=nofile + let &l:bufhidden = get(keyargs, 'scratch_hidden', g:tlib#scratch#hidden) + setlocal noswapfile + setlocal nobuflisted + setlocal foldmethod=manual + setlocal foldcolumn=0 + setlocal modifiable + setlocal nospell + " TLogVAR &ft, ft + if !empty(ft) + let &l:ft = ft + endif endif let keyargs.scratch = bufnr('%') + " TLogVAR 2, winnr(), bufnr('%'), bufname("%") return keyargs.scratch endf @@ -106,7 +120,11 @@ function! tlib#scratch#CloseScratch(keyargs, ...) "{{{3 if wn != -1 " TLogDBG winnr() let wb = tlib#win#Set(wn) + let winpos = tlib#fixes#Winpos() wincmd c + if get(a:keyargs, 'scratch_vertical') && !empty(winpos) + exec winpos + endif " exec wb " redraw " TLogVAR winnr() diff --git a/sources_non_forked/tlib/autoload/tlib/tag.vim b/sources_non_forked/tlib/autoload/tlib/tag.vim index 64a1715c..5695f0a3 100644 --- a/sources_non_forked/tlib/autoload/tlib/tag.vim +++ b/sources_non_forked/tlib/autoload/tlib/tag.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-11-01. -" @Last Change: 2011-08-11. -" @Revision: 0.0.56 +" @Last Change: 2013-09-25. +" @Revision: 0.0.58 if &cp || exists("loaded_tlib_tag_autoload") finish @@ -12,6 +12,23 @@ endif let loaded_tlib_tag_autoload = 1 +" Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. +TLet g:tlib_tags_extra = '' + +" Filter the tag description through |substitute()| for these filetypes. +" This applies only if the tag cmd field (see |taglist()|) is used. +" :nodefault: +TLet g:tlib_tag_substitute = { + \ 'java': [['\s*{\s*$', '', '']], + \ 'ruby': [['\<\(def\|class\|module\)\>\s\+', '', '']], + \ 'vim': [ + \ ['^\s*com\%[mand]!\?\(\s\+-\S\+\)*\s*\u\w*\zs.*$', '', ''], + \ ['^\s*\(let\|aug\%[roup]\|fu\%[nction]!\?\|com\%[mand]!\?\(\s\+-\S\+\)*\)\s*', '', ''], + \ ['"\?\s*{{{\d.*$', '', ''], + \ ], + \ } + + " :def: function! tlib#tag#Retrieve(rx, ?extra_tags=0) " Get all tags matching rx. Basically, this function simply calls " |taglist()|, but when extra_tags is true, the list of the tag files diff --git a/sources_non_forked/tlib/doc/tlib.txt b/sources_non_forked/tlib/doc/tlib.txt index 6caa99f5..f12563aa 100644 --- a/sources_non_forked/tlib/doc/tlib.txt +++ b/sources_non_forked/tlib/doc/tlib.txt @@ -30,232 +30,264 @@ installed. ======================================================================== Contents~ - :TRequire ............................... |:TRequire| - :TLet ................................... |:TLet| - :TScratch ............................... |:TScratch| - :TVarArg ................................ |:TVarArg| - :TKeyArg ................................ |:TKeyArg| - :TBrowseOutput .......................... |:TBrowseOutput| - :TBrowseScriptnames ..................... |:TBrowseScriptnames| - :TTimeCommand ........................... |:TTimeCommand| - g:tlib_pick_last_item ................... |g:tlib_pick_last_item| - g:tlib_sortprefs_threshold .............. |g:tlib_sortprefs_threshold| - g:tlib_scratch_pos ...................... |g:tlib_scratch_pos| - g:tlib_inputlist_pct .................... |g:tlib_inputlist_pct| - g:tlib_inputlist_width_filename ......... |g:tlib_inputlist_width_filename| - g:tlib_inputlist_higroup ................ |g:tlib_inputlist_higroup| - g:tlib_inputlist_livesearch_threshold ... |g:tlib_inputlist_livesearch_threshold| - g:tlib_inputlist_filename_indicators .... |g:tlib_inputlist_filename_indicators| - g:tlib_inputlist_match .................. |g:tlib_inputlist_match| - g:tlib_inputlist_shortmessage ........... |g:tlib_inputlist_shortmessage| - g:tlib_tags_extra ....................... |g:tlib_tags_extra| - g:tlib_tag_substitute ................... |g:tlib_tag_substitute| - g:tlib_filename_sep ..................... |g:tlib_filename_sep| - g:tlib_cache ............................ |g:tlib_cache| - g:tlib_viewline_position ................ |g:tlib_viewline_position| - g:tlib_inputlist_and .................... |g:tlib_inputlist_and| - g:tlib_inputlist_or ..................... |g:tlib_inputlist_or| - g:tlib_inputlist_not .................... |g:tlib_inputlist_not| - g:tlib_numeric_chars .................... |g:tlib_numeric_chars| - g:tlib_keyagents_InputList_s ............ |g:tlib_keyagents_InputList_s| - g:tlib_scroll_lines ..................... |g:tlib_scroll_lines| - g:tlib_keyagents_InputList_m ............ |g:tlib_keyagents_InputList_m| - g:tlib_handlers_EditList ................ |g:tlib_handlers_EditList| - g:tlib_debug ............................ |g:tlib_debug| - tlib#notify#Echo ........................ |tlib#notify#Echo()| - tlib#notify#TrimMessage ................. |tlib#notify#TrimMessage()| - g:tlib_persistent ....................... |g:tlib_persistent| - tlib#persistent#Dir ..................... |tlib#persistent#Dir()| - tlib#persistent#Filename ................ |tlib#persistent#Filename()| - tlib#persistent#Get ..................... |tlib#persistent#Get()| - tlib#persistent#Save .................... |tlib#persistent#Save()| - g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize| - g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore| - g:tlib#vim#use_vimtweak ................. |g:tlib#vim#use_vimtweak| - tlib#vim#Maximize ....................... |tlib#vim#Maximize()| - tlib#vim#RestoreWindow .................. |tlib#vim#RestoreWindow()| - g:tlib#vim#use_wmctrl ................... |g:tlib#vim#use_wmctrl| - tlib#progressbar#Init ................... |tlib#progressbar#Init()| - tlib#progressbar#Display ................ |tlib#progressbar#Display()| - tlib#progressbar#Restore ................ |tlib#progressbar#Restore()| - tlib#eval#FormatValue ................... |tlib#eval#FormatValue()| - tlib#list#Inject ........................ |tlib#list#Inject()| - tlib#list#Compact ....................... |tlib#list#Compact()| - tlib#list#Flatten ....................... |tlib#list#Flatten()| - tlib#list#FindAll ....................... |tlib#list#FindAll()| - tlib#list#Find .......................... |tlib#list#Find()| - tlib#list#Any ........................... |tlib#list#Any()| - tlib#list#All ........................... |tlib#list#All()| - tlib#list#Remove ........................ |tlib#list#Remove()| - tlib#list#RemoveAll ..................... |tlib#list#RemoveAll()| - tlib#list#Zip ........................... |tlib#list#Zip()| - tlib#list#Uniq .......................... |tlib#list#Uniq()| - tlib#cmd#OutputAsList ................... |tlib#cmd#OutputAsList()| - tlib#cmd#BrowseOutput ................... |tlib#cmd#BrowseOutput()| - tlib#cmd#BrowseOutputWithCallback ....... |tlib#cmd#BrowseOutputWithCallback()| - tlib#cmd#DefaultBrowseOutput ............ |tlib#cmd#DefaultBrowseOutput()| - tlib#cmd#ParseScriptname ................ |tlib#cmd#ParseScriptname()| - tlib#cmd#UseVertical .................... |tlib#cmd#UseVertical()| - tlib#cmd#Time ........................... |tlib#cmd#Time()| - tlib#syntax#Collect ..................... |tlib#syntax#Collect()| - tlib#syntax#Names ....................... |tlib#syntax#Names()| - tlib#balloon#Register ................... |tlib#balloon#Register()| - tlib#balloon#Remove ..................... |tlib#balloon#Remove()| - tlib#balloon#Expr ....................... |tlib#balloon#Expr()| - g:tlib#vcs#def .......................... |g:tlib#vcs#def| - g:tlib#vcs#executables .................. |g:tlib#vcs#executables| - g:tlib#vcs#check ........................ |g:tlib#vcs#check| - tlib#vcs#FindVCS ........................ |tlib#vcs#FindVCS()| - tlib#vcs#Ls ............................. |tlib#vcs#Ls()| - tlib#vcs#Diff ........................... |tlib#vcs#Diff()| - tlib#char#Get ........................... |tlib#char#Get()| - tlib#char#IsAvailable ................... |tlib#char#IsAvailable()| - tlib#char#GetWithTimeout ................ |tlib#char#GetWithTimeout()| - tlib#scratch#UseScratch ................. |tlib#scratch#UseScratch()| - tlib#scratch#CloseScratch ............... |tlib#scratch#CloseScratch()| - tlib#autocmdgroup#Init .................. |tlib#autocmdgroup#Init()| - g:tlib#cache#purge_days ................. |g:tlib#cache#purge_days| - g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days| - g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding| - g:tlib#cache#run_script ................. |g:tlib#cache#run_script| - g:tlib#cache#silent ..................... |g:tlib#cache#silent| - g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge| - tlib#cache#Dir .......................... |tlib#cache#Dir()| - tlib#cache#Filename ..................... |tlib#cache#Filename()| - tlib#cache#Save ......................... |tlib#cache#Save()| - tlib#cache#Get .......................... |tlib#cache#Get()| - tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()| - tlib#cache#Purge ........................ |tlib#cache#Purge()| - tlib#cache#ListFilesInCache ............. |tlib#cache#ListFilesInCache()| - tlib#normal#WithRegister ................ |tlib#normal#WithRegister()| - tlib#time#MSecs ......................... |tlib#time#MSecs()| - tlib#time#Now ........................... |tlib#time#Now()| - tlib#time#Diff .......................... |tlib#time#Diff()| - tlib#time#DiffMSecs ..................... |tlib#time#DiffMSecs()| - tlib#var#Let ............................ |tlib#var#Let()| - tlib#var#EGet ........................... |tlib#var#EGet()| - tlib#var#Get ............................ |tlib#var#Get()| - tlib#var#List ........................... |tlib#var#List()| - tlib#agent#Exit ......................... |tlib#agent#Exit()| - tlib#agent#CopyItems .................... |tlib#agent#CopyItems()| - tlib#agent#PageUp ....................... |tlib#agent#PageUp()| - tlib#agent#PageDown ..................... |tlib#agent#PageDown()| - tlib#agent#Up ........................... |tlib#agent#Up()| - tlib#agent#Down ......................... |tlib#agent#Down()| - tlib#agent#UpN .......................... |tlib#agent#UpN()| - tlib#agent#DownN ........................ |tlib#agent#DownN()| - tlib#agent#ShiftLeft .................... |tlib#agent#ShiftLeft()| - tlib#agent#ShiftRight ................... |tlib#agent#ShiftRight()| - tlib#agent#Reset ........................ |tlib#agent#Reset()| - tlib#agent#Input ........................ |tlib#agent#Input()| - tlib#agent#SuspendToParentWindow ........ |tlib#agent#SuspendToParentWindow()| - tlib#agent#Suspend ...................... |tlib#agent#Suspend()| - tlib#agent#Help ......................... |tlib#agent#Help()| - tlib#agent#OR ........................... |tlib#agent#OR()| - tlib#agent#AND .......................... |tlib#agent#AND()| - tlib#agent#ReduceFilter ................. |tlib#agent#ReduceFilter()| - tlib#agent#PopFilter .................... |tlib#agent#PopFilter()| - tlib#agent#Debug ........................ |tlib#agent#Debug()| - tlib#agent#Select ....................... |tlib#agent#Select()| - tlib#agent#SelectUp ..................... |tlib#agent#SelectUp()| - tlib#agent#SelectDown ................... |tlib#agent#SelectDown()| - tlib#agent#SelectAll .................... |tlib#agent#SelectAll()| - tlib#agent#ToggleStickyList ............. |tlib#agent#ToggleStickyList()| - tlib#agent#EditItem ..................... |tlib#agent#EditItem()| - tlib#agent#NewItem ...................... |tlib#agent#NewItem()| - tlib#agent#DeleteItems .................. |tlib#agent#DeleteItems()| - tlib#agent#Cut .......................... |tlib#agent#Cut()| - tlib#agent#Copy ......................... |tlib#agent#Copy()| - tlib#agent#Paste ........................ |tlib#agent#Paste()| - tlib#agent#EditReturnValue .............. |tlib#agent#EditReturnValue()| - tlib#agent#ViewFile ..................... |tlib#agent#ViewFile()| - tlib#agent#EditFile ..................... |tlib#agent#EditFile()| - tlib#agent#EditFileInSplit .............. |tlib#agent#EditFileInSplit()| - tlib#agent#EditFileInVSplit ............. |tlib#agent#EditFileInVSplit()| - tlib#agent#EditFileInTab ................ |tlib#agent#EditFileInTab()| - tlib#agent#ToggleScrollbind ............. |tlib#agent#ToggleScrollbind()| - tlib#agent#ShowInfo ..................... |tlib#agent#ShowInfo()| - tlib#agent#PreviewLine .................. |tlib#agent#PreviewLine()| - tlib#agent#GotoLine ..................... |tlib#agent#GotoLine()| - tlib#agent#DoAtLine ..................... |tlib#agent#DoAtLine()| - tlib#agent#Wildcard ..................... |tlib#agent#Wildcard()| - tlib#agent#Null ......................... |tlib#agent#Null()| - tlib#agent#ExecAgentByName .............. |tlib#agent#ExecAgentByName()| - tlib#agent#CompleteAgentNames ........... |tlib#agent#CompleteAgentNames()| - g:tlib#Filter_cnfx#expander ............. |g:tlib#Filter_cnfx#expander| - tlib#Filter_cnfx#New .................... |tlib#Filter_cnfx#New()| - tlib#url#Decode ......................... |tlib#url#Decode()| - tlib#url#DecodeChar ..................... |tlib#url#DecodeChar()| - tlib#url#EncodeChar ..................... |tlib#url#EncodeChar()| - tlib#url#Encode ......................... |tlib#url#Encode()| - tlib#signs#ClearAll ..................... |tlib#signs#ClearAll()| - tlib#signs#ClearBuffer .................. |tlib#signs#ClearBuffer()| - tlib#signs#Mark ......................... |tlib#signs#Mark()| - tlib#rx#Escape .......................... |tlib#rx#Escape()| - tlib#rx#EscapeReplace ................... |tlib#rx#EscapeReplace()| - tlib#rx#Suffixes ........................ |tlib#rx#Suffixes()| - tlib#tag#Retrieve ....................... |tlib#tag#Retrieve()| - tlib#tag#Collect ........................ |tlib#tag#Collect()| - tlib#tag#Format ......................... |tlib#tag#Format()| - tlib#map#PumAccept ...................... |tlib#map#PumAccept()| - tlib#Filter_cnfd#New .................... |tlib#Filter_cnfd#New()| - g:tlib#input#use_popup .................. |g:tlib#input#use_popup| - g:tlib#input#format_filename ............ |g:tlib#input#format_filename| - g:tlib#input#filename_padding_r ......... |g:tlib#input#filename_padding_r| - g:tlib#input#filename_max_width ......... |g:tlib#input#filename_max_width| - tlib#input#List ......................... |tlib#input#List()| - tlib#input#ListD ........................ |tlib#input#ListD()| - tlib#input#ListW ........................ |tlib#input#ListW()| - tlib#input#EditList ..................... |tlib#input#EditList()| - tlib#input#Resume ....................... |tlib#input#Resume()| - tlib#input#CommandSelect ................ |tlib#input#CommandSelect()| - tlib#input#Edit ......................... |tlib#input#Edit()| - tlib#input#Dialog ....................... |tlib#input#Dialog()| - tlib#file#Split ......................... |tlib#file#Split()| - tlib#file#Join .......................... |tlib#file#Join()| - tlib#file#Relative ...................... |tlib#file#Relative()| - tlib#file#With .......................... |tlib#file#With()| - tlib#paragraph#GetMetric ................ |tlib#paragraph#GetMetric()| - tlib#paragraph#Move ..................... |tlib#paragraph#Move()| - tlib#World#New .......................... |tlib#World#New()| - tlib#tab#BufMap ......................... |tlib#tab#BufMap()| - tlib#tab#TabWinNr ....................... |tlib#tab#TabWinNr()| - tlib#tab#Set ............................ |tlib#tab#Set()| - tlib#date#DiffInDays .................... |tlib#date#DiffInDays()| - tlib#date#Parse ......................... |tlib#date#Parse()| - tlib#date#SecondsSince1970 .............. |tlib#date#SecondsSince1970()| - tlib#type#IsNumber ...................... |tlib#type#IsNumber()| - tlib#type#IsString ...................... |tlib#type#IsString()| - tlib#type#IsFuncref ..................... |tlib#type#IsFuncref()| - tlib#type#IsList ........................ |tlib#type#IsList()| - tlib#type#IsDictionary .................. |tlib#type#IsDictionary()| - tlib#Filter_fuzzy#New ................... |tlib#Filter_fuzzy#New()| - tlib#textobjects#StandardParagraph ...... |standard-paragraph| - tlib#textobjects#Init ................... |tlib#textobjects#Init()| - v_sp .................................... |v_sp| - o_sp .................................... |o_sp| - tlib#arg#Get ............................ |tlib#arg#Get()| - tlib#arg#Let ............................ |tlib#arg#Let()| - tlib#arg#Key ............................ |tlib#arg#Key()| - tlib#arg#StringAsKeyArgs ................ |tlib#arg#StringAsKeyArgs()| - tlib#arg#Ex ............................. |tlib#arg#Ex()| - tlib#dir#CanonicName .................... |tlib#dir#CanonicName()| - tlib#dir#PlainName ...................... |tlib#dir#PlainName()| - tlib#dir#Ensure ......................... |tlib#dir#Ensure()| - tlib#dir#MyRuntime ...................... |tlib#dir#MyRuntime()| - tlib#dir#CD ............................. |tlib#dir#CD()| - tlib#dir#Push ........................... |tlib#dir#Push()| - tlib#dir#Pop ............................ |tlib#dir#Pop()| - tlib#win#Set ............................ |tlib#win#Set()| - tlib#win#GetLayout ...................... |tlib#win#GetLayout()| - tlib#win#SetLayout ...................... |tlib#win#SetLayout()| - tlib#win#List ........................... |tlib#win#List()| - tlib#win#Width .......................... |tlib#win#Width()| - tlib#win#WinDo .......................... |tlib#win#WinDo()| - tlib#comments#Comments .................. |tlib#comments#Comments()| - tlib#Filter_cnf#New ..................... |tlib#Filter_cnf#New()| + :TRequire .............................. |:TRequire| + :TLet .................................. |:TLet| + :TScratch .............................. |:TScratch| + :TVarArg ............................... |:TVarArg| + :TKeyArg ............................... |:TKeyArg| + :TBrowseOutput ......................... |:TBrowseOutput| + :TBrowseScriptnames .................... |:TBrowseScriptnames| + :TTimeCommand .......................... |:TTimeCommand| + g:tlib#debug ........................... |g:tlib#debug| + tlib#notify#Echo ....................... |tlib#notify#Echo()| + tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()| + g:tlib_persistent ...................... |g:tlib_persistent| + tlib#persistent#Dir .................... |tlib#persistent#Dir()| + tlib#persistent#Filename ............... |tlib#persistent#Filename()| + tlib#persistent#Get .................... |tlib#persistent#Get()| + tlib#persistent#Value .................. |tlib#persistent#Value()| + tlib#persistent#Save ................... |tlib#persistent#Save()| + g:tlib#vim#simalt_maximize ............. |g:tlib#vim#simalt_maximize| + g:tlib#vim#simalt_restore .............. |g:tlib#vim#simalt_restore| + g:tlib#vim#use_vimtweak ................ |g:tlib#vim#use_vimtweak| + tlib#vim#Maximize ...................... |tlib#vim#Maximize()| + tlib#vim#RestoreWindow ................. |tlib#vim#RestoreWindow()| + g:tlib#vim#use_wmctrl .................. |g:tlib#vim#use_wmctrl| + tlib#progressbar#Init .................. |tlib#progressbar#Init()| + tlib#progressbar#Display ............... |tlib#progressbar#Display()| + tlib#progressbar#Restore ............... |tlib#progressbar#Restore()| + tlib#eval#FormatValue .................. |tlib#eval#FormatValue()| + tlib#list#Inject ....................... |tlib#list#Inject()| + tlib#list#Compact ...................... |tlib#list#Compact()| + tlib#list#Flatten ...................... |tlib#list#Flatten()| + tlib#list#FindAll ...................... |tlib#list#FindAll()| + tlib#list#Find ......................... |tlib#list#Find()| + tlib#list#Any .......................... |tlib#list#Any()| + tlib#list#All .......................... |tlib#list#All()| + tlib#list#Remove ....................... |tlib#list#Remove()| + tlib#list#RemoveAll .................... |tlib#list#RemoveAll()| + tlib#list#Zip .......................... |tlib#list#Zip()| + tlib#list#Uniq ......................... |tlib#list#Uniq()| + tlib#cmd#OutputAsList .................. |tlib#cmd#OutputAsList()| + tlib#cmd#BrowseOutput .................. |tlib#cmd#BrowseOutput()| + tlib#cmd#BrowseOutputWithCallback ...... |tlib#cmd#BrowseOutputWithCallback()| + tlib#cmd#DefaultBrowseOutput ........... |tlib#cmd#DefaultBrowseOutput()| + tlib#cmd#ParseScriptname ............... |tlib#cmd#ParseScriptname()| + tlib#cmd#UseVertical ................... |tlib#cmd#UseVertical()| + tlib#cmd#Time .......................... |tlib#cmd#Time()| + tlib#syntax#Collect .................... |tlib#syntax#Collect()| + tlib#syntax#Names ...................... |tlib#syntax#Names()| + tlib#balloon#Register .................. |tlib#balloon#Register()| + tlib#balloon#Remove .................... |tlib#balloon#Remove()| + tlib#balloon#Expr ...................... |tlib#balloon#Expr()| + g:tlib#vcs#def ......................... |g:tlib#vcs#def| + g:tlib#vcs#executables ................. |g:tlib#vcs#executables| + g:tlib#vcs#check ....................... |g:tlib#vcs#check| + tlib#vcs#FindVCS ....................... |tlib#vcs#FindVCS()| + tlib#vcs#Ls ............................ |tlib#vcs#Ls()| + tlib#vcs#Diff .......................... |tlib#vcs#Diff()| + tlib#char#Get .......................... |tlib#char#Get()| + tlib#char#IsAvailable .................. |tlib#char#IsAvailable()| + tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()| + g:tlib_scratch_pos ..................... |g:tlib_scratch_pos| + g:tlib#scratch#hidden .................. |g:tlib#scratch#hidden| + tlib#scratch#UseScratch ................ |tlib#scratch#UseScratch()| + tlib#scratch#CloseScratch .............. |tlib#scratch#CloseScratch()| + tlib#autocmdgroup#Init ................. |tlib#autocmdgroup#Init()| + g:tlib_cache ........................... |g:tlib_cache| + g:tlib#cache#purge_days ................ |g:tlib#cache#purge_days| + g:tlib#cache#purge_every_days .......... |g:tlib#cache#purge_every_days| + g:tlib#cache#script_encoding ........... |g:tlib#cache#script_encoding| + g:tlib#cache#run_script ................ |g:tlib#cache#run_script| + g:tlib#cache#verbosity ................. |g:tlib#cache#verbosity| + g:tlib#cache#dont_purge ................ |g:tlib#cache#dont_purge| + g:tlib#cache#max_filename .............. |g:tlib#cache#max_filename| + tlib#cache#Dir ......................... |tlib#cache#Dir()| + tlib#cache#Filename .................... |tlib#cache#Filename()| + tlib#cache#Save ........................ |tlib#cache#Save()| + tlib#cache#Get ......................... |tlib#cache#Get()| + tlib#cache#Value ....................... |tlib#cache#Value()| + tlib#cache#MaybePurge .................. |tlib#cache#MaybePurge()| + tlib#cache#Purge ....................... |tlib#cache#Purge()| + tlib#cache#ListFilesInCache ............ |tlib#cache#ListFilesInCache()| + tlib#normal#WithRegister ............... |tlib#normal#WithRegister()| + tlib#time#MSecs ........................ |tlib#time#MSecs()| + tlib#time#Now .......................... |tlib#time#Now()| + tlib#time#Diff ......................... |tlib#time#Diff()| + tlib#time#DiffMSecs .................... |tlib#time#DiffMSecs()| + tlib#var#Let ........................... |tlib#var#Let()| + tlib#var#EGet .......................... |tlib#var#EGet()| + tlib#var#Get ........................... |tlib#var#Get()| + tlib#var#List .......................... |tlib#var#List()| + g:tlib_scroll_lines .................... |g:tlib_scroll_lines| + tlib#agent#Exit ........................ |tlib#agent#Exit()| + tlib#agent#CopyItems ................... |tlib#agent#CopyItems()| + tlib#agent#PageUp ...................... |tlib#agent#PageUp()| + tlib#agent#PageDown .................... |tlib#agent#PageDown()| + tlib#agent#Up .......................... |tlib#agent#Up()| + tlib#agent#Down ........................ |tlib#agent#Down()| + tlib#agent#UpN ......................... |tlib#agent#UpN()| + tlib#agent#DownN ....................... |tlib#agent#DownN()| + tlib#agent#ShiftLeft ................... |tlib#agent#ShiftLeft()| + tlib#agent#ShiftRight .................. |tlib#agent#ShiftRight()| + tlib#agent#Reset ....................... |tlib#agent#Reset()| + tlib#agent#ToggleRestrictView .......... |tlib#agent#ToggleRestrictView()| + tlib#agent#RestrictView ................ |tlib#agent#RestrictView()| + tlib#agent#UnrestrictView .............. |tlib#agent#UnrestrictView()| + tlib#agent#Input ....................... |tlib#agent#Input()| + tlib#agent#SuspendToParentWindow ....... |tlib#agent#SuspendToParentWindow()| + tlib#agent#Suspend ..................... |tlib#agent#Suspend()| + tlib#agent#Help ........................ |tlib#agent#Help()| + tlib#agent#OR .......................... |tlib#agent#OR()| + tlib#agent#AND ......................... |tlib#agent#AND()| + tlib#agent#ReduceFilter ................ |tlib#agent#ReduceFilter()| + tlib#agent#PopFilter ................... |tlib#agent#PopFilter()| + tlib#agent#Debug ....................... |tlib#agent#Debug()| + tlib#agent#Select ...................... |tlib#agent#Select()| + tlib#agent#SelectUp .................... |tlib#agent#SelectUp()| + tlib#agent#SelectDown .................. |tlib#agent#SelectDown()| + tlib#agent#SelectAll ................... |tlib#agent#SelectAll()| + tlib#agent#ToggleStickyList ............ |tlib#agent#ToggleStickyList()| + tlib#agent#EditItem .................... |tlib#agent#EditItem()| + tlib#agent#NewItem ..................... |tlib#agent#NewItem()| + tlib#agent#DeleteItems ................. |tlib#agent#DeleteItems()| + tlib#agent#Cut ......................... |tlib#agent#Cut()| + tlib#agent#Copy ........................ |tlib#agent#Copy()| + tlib#agent#Paste ....................... |tlib#agent#Paste()| + tlib#agent#EditReturnValue ............. |tlib#agent#EditReturnValue()| + tlib#agent#ViewFile .................... |tlib#agent#ViewFile()| + tlib#agent#EditFile .................... |tlib#agent#EditFile()| + tlib#agent#EditFileInSplit ............. |tlib#agent#EditFileInSplit()| + tlib#agent#EditFileInVSplit ............ |tlib#agent#EditFileInVSplit()| + tlib#agent#EditFileInTab ............... |tlib#agent#EditFileInTab()| + tlib#agent#ToggleScrollbind ............ |tlib#agent#ToggleScrollbind()| + tlib#agent#ShowInfo .................... |tlib#agent#ShowInfo()| + tlib#agent#PreviewLine ................. |tlib#agent#PreviewLine()| + tlib#agent#GotoLine .................... |tlib#agent#GotoLine()| + tlib#agent#DoAtLine .................... |tlib#agent#DoAtLine()| + tlib#agent#Wildcard .................... |tlib#agent#Wildcard()| + tlib#agent#Null ........................ |tlib#agent#Null()| + tlib#agent#ExecAgentByName ............. |tlib#agent#ExecAgentByName()| + tlib#agent#CompleteAgentNames .......... |tlib#agent#CompleteAgentNames()| + tlib#bitwise#Num2Bits .................. |tlib#bitwise#Num2Bits()| + tlib#bitwise#Bits2Num .................. |tlib#bitwise#Bits2Num()| + tlib#bitwise#AND ....................... |tlib#bitwise#AND()| + tlib#bitwise#OR ........................ |tlib#bitwise#OR()| + tlib#bitwise#XOR ....................... |tlib#bitwise#XOR()| + tlib#bitwise#ShiftRight ................ |tlib#bitwise#ShiftRight()| + tlib#bitwise#ShiftLeft ................. |tlib#bitwise#ShiftLeft()| + tlib#bitwise#Add ....................... |tlib#bitwise#Add()| + tlib#bitwise#Sub ....................... |tlib#bitwise#Sub()| + g:tlib#Filter_cnfx#expander ............ |g:tlib#Filter_cnfx#expander| + tlib#Filter_cnfx#New ................... |tlib#Filter_cnfx#New()| + tlib#url#Decode ........................ |tlib#url#Decode()| + tlib#url#DecodeChar .................... |tlib#url#DecodeChar()| + tlib#url#EncodeChar .................... |tlib#url#EncodeChar()| + tlib#url#Encode ........................ |tlib#url#Encode()| + tlib#signs#ClearAll .................... |tlib#signs#ClearAll()| + tlib#signs#ClearBuffer ................. |tlib#signs#ClearBuffer()| + tlib#signs#Mark ........................ |tlib#signs#Mark()| + tlib#rx#Escape ......................... |tlib#rx#Escape()| + tlib#rx#EscapeReplace .................. |tlib#rx#EscapeReplace()| + tlib#rx#Suffixes ....................... |tlib#rx#Suffixes()| + g:tlib_tags_extra ...................... |g:tlib_tags_extra| + g:tlib_tag_substitute .................. |g:tlib_tag_substitute| + tlib#tag#Retrieve ...................... |tlib#tag#Retrieve()| + tlib#tag#Collect ....................... |tlib#tag#Collect()| + tlib#tag#Format ........................ |tlib#tag#Format()| + tlib#map#PumAccept ..................... |tlib#map#PumAccept()| + tlib#Filter_cnfd#New ................... |tlib#Filter_cnfd#New()| + g:tlib#input#sortprefs_threshold ....... |g:tlib#input#sortprefs_threshold| + g:tlib#input#livesearch_threshold ...... |g:tlib#input#livesearch_threshold| + g:tlib#input#filter_mode ............... |g:tlib#input#filter_mode| + g:tlib#input#higroup ................... |g:tlib#input#higroup| + g:tlib_pick_last_item .................. |g:tlib_pick_last_item| + g:tlib#input#and ....................... |g:tlib#input#and| + g:tlib#input#or ........................ |g:tlib#input#or| + g:tlib#input#not ....................... |g:tlib#input#not| + g:tlib#input#numeric_chars ............. |g:tlib#input#numeric_chars| + g:tlib#input#keyagents_InputList_s ..... |g:tlib#input#keyagents_InputList_s| + g:tlib#input#keyagents_InputList_m ..... |g:tlib#input#keyagents_InputList_m| + g:tlib#input#handlers_EditList ......... |g:tlib#input#handlers_EditList| + g:tlib#input#use_popup ................. |g:tlib#input#use_popup| + g:tlib#input#format_filename ........... |g:tlib#input#format_filename| + g:tlib#input#filename_padding_r ........ |g:tlib#input#filename_padding_r| + g:tlib#input#filename_max_width ........ |g:tlib#input#filename_max_width| + tlib#input#List ........................ |tlib#input#List()| + tlib#input#ListD ....................... |tlib#input#ListD()| + tlib#input#ListW ....................... |tlib#input#ListW()| + tlib#input#EditList .................... |tlib#input#EditList()| + tlib#input#Resume ...................... |tlib#input#Resume()| + tlib#input#CommandSelect ............... |tlib#input#CommandSelect()| + tlib#input#Edit ........................ |tlib#input#Edit()| + tlib#input#Dialog ...................... |tlib#input#Dialog()| + tlib#number#ConvertBase ................ |tlib#number#ConvertBase()| + tlib#file#Split ........................ |tlib#file#Split()| + tlib#file#Join ......................... |tlib#file#Join()| + tlib#file#Relative ..................... |tlib#file#Relative()| + tlib#file#Absolute ..................... |tlib#file#Absolute()| + tlib#file#With ......................... |tlib#file#With()| + tlib#paragraph#GetMetric ............... |tlib#paragraph#GetMetric()| + tlib#paragraph#Move .................... |tlib#paragraph#Move()| + g:tlib_inputlist_pct ................... |g:tlib_inputlist_pct| + g:tlib_inputlist_width_filename ........ |g:tlib_inputlist_width_filename| + g:tlib_inputlist_filename_indicators ... |g:tlib_inputlist_filename_indicators| + g:tlib_inputlist_shortmessage .......... |g:tlib_inputlist_shortmessage| + tlib#World#New ......................... |tlib#World#New()| + prototype.PrintLines + tlib#tab#BufMap ........................ |tlib#tab#BufMap()| + tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()| + tlib#tab#Set ........................... |tlib#tab#Set()| + tlib#date#DiffInDays ................... |tlib#date#DiffInDays()| + tlib#date#Parse ........................ |tlib#date#Parse()| + tlib#date#SecondsSince1970 ............. |tlib#date#SecondsSince1970()| + tlib#type#IsNumber ..................... |tlib#type#IsNumber()| + tlib#type#IsString ..................... |tlib#type#IsString()| + tlib#type#IsFuncref .................... |tlib#type#IsFuncref()| + tlib#type#IsList ....................... |tlib#type#IsList()| + tlib#type#IsDictionary ................. |tlib#type#IsDictionary()| + tlib#Filter_fuzzy#New .................. |tlib#Filter_fuzzy#New()| + tlib#textobjects#StandardParagraph ..... |standard-paragraph| + tlib#textobjects#Init .................. |tlib#textobjects#Init()| + v_sp ................................... |v_sp| + o_sp ................................... |o_sp| + tlib#arg#Get ........................... |tlib#arg#Get()| + tlib#arg#Let ........................... |tlib#arg#Let()| + tlib#arg#Key ........................... |tlib#arg#Key()| + tlib#arg#StringAsKeyArgs ............... |tlib#arg#StringAsKeyArgs()| + tlib#arg#Ex ............................ |tlib#arg#Ex()| + tlib#fixes#Winpos ...................... |tlib#fixes#Winpos()| + g:tlib#dir#sep ......................... |g:tlib#dir#sep| + tlib#dir#CanonicName ................... |tlib#dir#CanonicName()| + tlib#dir#NativeName .................... |tlib#dir#NativeName()| + tlib#dir#PlainName ..................... |tlib#dir#PlainName()| + tlib#dir#Ensure ........................ |tlib#dir#Ensure()| + tlib#dir#MyRuntime ..................... |tlib#dir#MyRuntime()| + tlib#dir#CD ............................ |tlib#dir#CD()| + tlib#dir#Push .......................... |tlib#dir#Push()| + tlib#dir#Pop ........................... |tlib#dir#Pop()| + g:tlib#hash#use_crc32 .................. |g:tlib#hash#use_crc32| + g:tlib#hash#use_adler32 ................ |g:tlib#hash#use_adler32| + tlib#hash#CRC32B ....................... |tlib#hash#CRC32B()| + tlib#hash#CRC32B_ruby .................. |tlib#hash#CRC32B_ruby()| + tlib#hash#CRC32B_vim ................... |tlib#hash#CRC32B_vim()| + tlib#hash#Adler32 ...................... |tlib#hash#Adler32()| + tlib#hash#Adler32_vim .................. |tlib#hash#Adler32_vim()| + tlib#hash#Adler32_tlib ................. |tlib#hash#Adler32_tlib()| + tlib#win#Set ........................... |tlib#win#Set()| + tlib#win#GetLayout ..................... |tlib#win#GetLayout()| + tlib#win#SetLayout ..................... |tlib#win#SetLayout()| + tlib#win#List .......................... |tlib#win#List()| + tlib#win#Width ......................... |tlib#win#Width()| + tlib#win#WinDo ......................... |tlib#win#WinDo()| + tlib#comments#Comments ................. |tlib#comments#Comments()| + tlib#grep#Do ........................... |tlib#grep#Do()| + tlib#grep#LocList ...................... |tlib#grep#LocList()| + tlib#grep#QuickFixList ................. |tlib#grep#QuickFixList()| + tlib#grep#List ......................... |tlib#grep#List()| + tlib#Filter_cnf#New .................... |tlib#Filter_cnf#New()| prototype.Pretty - tlib#Object#New ......................... |tlib#Object#New()| + tlib#Object#New ........................ |tlib#Object#New()| prototype.New prototype.Inherit prototype.Extend @@ -263,32 +295,33 @@ Contents~ prototype.IsRelated prototype.RespondTo prototype.Super - tlib#Object#Methods ..................... |tlib#Object#Methods()| - tlib#buffer#EnableMRU ................... |tlib#buffer#EnableMRU()| - tlib#buffer#DisableMRU .................. |tlib#buffer#DisableMRU()| - tlib#buffer#Set ......................... |tlib#buffer#Set()| - tlib#buffer#Eval ........................ |tlib#buffer#Eval()| - tlib#buffer#GetList ..................... |tlib#buffer#GetList()| - tlib#buffer#ViewLine .................... |tlib#buffer#ViewLine()| - tlib#buffer#HighlightLine ............... |tlib#buffer#HighlightLine()| - tlib#buffer#DeleteRange ................. |tlib#buffer#DeleteRange()| - tlib#buffer#ReplaceRange ................ |tlib#buffer#ReplaceRange()| - tlib#buffer#ScratchStart ................ |tlib#buffer#ScratchStart()| - tlib#buffer#ScratchEnd .................. |tlib#buffer#ScratchEnd()| - tlib#buffer#BufDo ....................... |tlib#buffer#BufDo()| - tlib#buffer#InsertText .................. |tlib#buffer#InsertText()| - tlib#buffer#InsertText0 ................. |tlib#buffer#InsertText0()| - tlib#buffer#CurrentByte ................. |tlib#buffer#CurrentByte()| - tlib#buffer#KeepCursorPosition .......... |tlib#buffer#KeepCursorPosition()| - tlib#hook#Run ........................... |tlib#hook#Run()| - tlib#string#RemoveBackslashes ........... |tlib#string#RemoveBackslashes()| - tlib#string#Chomp ....................... |tlib#string#Chomp()| - tlib#string#Format ...................... |tlib#string#Format()| - tlib#string#Printf1 ..................... |tlib#string#Printf1()| - tlib#string#TrimLeft .................... |tlib#string#TrimLeft()| - tlib#string#TrimRight ................... |tlib#string#TrimRight()| - tlib#string#Strip ....................... |tlib#string#Strip()| - tlib#string#Count ....................... |tlib#string#Count()| + tlib#Object#Methods .................... |tlib#Object#Methods()| + g:tlib_viewline_position ............... |g:tlib_viewline_position| + tlib#buffer#EnableMRU .................. |tlib#buffer#EnableMRU()| + tlib#buffer#DisableMRU ................. |tlib#buffer#DisableMRU()| + tlib#buffer#Set ........................ |tlib#buffer#Set()| + tlib#buffer#Eval ....................... |tlib#buffer#Eval()| + tlib#buffer#GetList .................... |tlib#buffer#GetList()| + tlib#buffer#ViewLine ................... |tlib#buffer#ViewLine()| + tlib#buffer#HighlightLine .............. |tlib#buffer#HighlightLine()| + tlib#buffer#DeleteRange ................ |tlib#buffer#DeleteRange()| + tlib#buffer#ReplaceRange ............... |tlib#buffer#ReplaceRange()| + tlib#buffer#ScratchStart ............... |tlib#buffer#ScratchStart()| + tlib#buffer#ScratchEnd ................. |tlib#buffer#ScratchEnd()| + tlib#buffer#BufDo ...................... |tlib#buffer#BufDo()| + tlib#buffer#InsertText ................. |tlib#buffer#InsertText()| + tlib#buffer#InsertText0 ................ |tlib#buffer#InsertText0()| + tlib#buffer#CurrentByte ................ |tlib#buffer#CurrentByte()| + tlib#buffer#KeepCursorPosition ......... |tlib#buffer#KeepCursorPosition()| + tlib#hook#Run .......................... |tlib#hook#Run()| + tlib#string#RemoveBackslashes .......... |tlib#string#RemoveBackslashes()| + tlib#string#Chomp ...................... |tlib#string#Chomp()| + tlib#string#Format ..................... |tlib#string#Format()| + tlib#string#Printf1 .................... |tlib#string#Printf1()| + tlib#string#TrimLeft ................... |tlib#string#TrimLeft()| + tlib#string#TrimRight .................. |tlib#string#TrimRight()| + tlib#string#Strip ...................... |tlib#string#Strip()| + tlib#string#Count ...................... |tlib#string#Count()| ======================================================================== @@ -376,172 +409,11 @@ plugin/02tlib.vim~ Time the execution time of CMD. -Variables~ +======================================================================== +autoload/tlib.vim~ - *g:tlib_pick_last_item* -g:tlib_pick_last_item (default: 1) - When 1, automatically select the last remaining item only if the list - had only one item to begin with. - When 2, automatically select a last remaining item after applying - any filters. - See |tlib#input#List()|. - - *g:tlib_sortprefs_threshold* -g:tlib_sortprefs_threshold (default: 200) - If a list is bigger than this value, don't try to be smart when - selecting an item. Be slightly faster instead. - See |tlib#input#List()|. - - *g:tlib_scratch_pos* -g:tlib_scratch_pos (default: 'botright') - Scratch window position. By default the list window is opened on the - bottom. Set this variable to 'topleft' or '' to change this behaviour. - See |tlib#input#List()|. - - *g:tlib_inputlist_pct* -g:tlib_inputlist_pct (default: 50) - Size of the input list window (in percent) from the main size (of &lines). - See |tlib#input#List()|. - - *g:tlib_inputlist_width_filename* -g:tlib_inputlist_width_filename (default: '&co / 3') - Size of filename columns when listing filenames. - See |tlib#input#List()|. - - *g:tlib_inputlist_higroup* -g:tlib_inputlist_higroup (default: 'IncSearch') - The highlight group to use for showing matches in the input list - window. - See |tlib#input#List()|. - - *g:tlib_inputlist_livesearch_threshold* -g:tlib_inputlist_livesearch_threshold (default: 1000) - If a list contains more items, |tlib#input#List()| does not perform an - incremental "live search" but uses |input()| to query the user for a - filter. This is useful on slower machines or with very long lists. - - *g:tlib_inputlist_filename_indicators* -g:tlib_inputlist_filename_indicators (default: 0) - If true, |tlib#input#List()| will show some indicators about the - status of a filename (e.g. buflisted(), bufloaded() etc.). - This is disabled by default because vim checks also for the file on - disk when doing this. - - *g:tlib_inputlist_match* -g:tlib_inputlist_match (default: 'cnfx') - Determine how |tlib#input#List()| and related functions work. - Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: - cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted - as a wildcard (this is the default method) - - A plus character ("+") acts as a wildcard as if ".\{-}" (see - |/\{-|) were entered. - - Examples: - - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match - "far". - - Otherwise it is a derivate of the cnf method (see below). - - See also |tlib#Filter_cnfx#New()|. - cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is - expanded to "\.\{-}" - - A period character (".") acts as a wildcard as if ".\{-}" (see - |/\{-|) were entered. - - Examples: - - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match - "far". - - Otherwise it is a derivate of the cnf method (see below). - - See also |tlib#Filter_cnfd#New()|. - cnf .... Match substrings - - A blank creates an AND conjunction, i.e. the next pattern has to - match too. - - A pipe character ("|") creates an OR conjunction, either this or - the next next pattern has to match. - - Patterns are very 'nomagic' |regexp| with a |\V| prefix. - - A pattern starting with "-" makes the filter exclude items - matching that pattern. - - Examples: - - "foo bar" matches items that contain the strings "foo" AND - "bar". - - "foo|bar boo|far" matches items that contain either ("foo" OR - "bar") AND ("boo" OR "far"). - - See also |tlib#Filter_cnf#New()|. - seq .... Match sequences of characters - - |tlib#Filter_seq#New()| - fuzzy .. Match fuzzy character sequences - - |tlib#Filter_fuzzy#New()| - - *g:tlib_inputlist_shortmessage* -g:tlib_inputlist_shortmessage (default: 0) - If not null, display only a short info about the filter. - - *g:tlib_tags_extra* -g:tlib_tags_extra (default: '') - Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. - - *g:tlib_tag_substitute* -g:tlib_tag_substitute - Filter the tag description through |substitute()| for these filetypes. - This applies only if the tag cmd field (see |taglist()|) is used. - - *g:tlib_filename_sep* -g:tlib_filename_sep (default: '/') - - *g:tlib_cache* -g:tlib_cache (default: '') - The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. - You might want to delete old files from this directory from time to - time with a command like: > - find ~/vimfiles/cache/ -atime +31 -type f -print -delete -< - - *g:tlib_viewline_position* -g:tlib_viewline_position (default: 'zz') - Where to display the line when using |tlib#buffer#ViewLine|. - For possible values for position see |scroll-cursor|. - - -Keys for |tlib#input#List|~ - - *g:tlib_inputlist_and* -g:tlib_inputlist_and (default: ' ') - - *g:tlib_inputlist_or* -g:tlib_inputlist_or (default: '|') - - *g:tlib_inputlist_not* -g:tlib_inputlist_not (default: '-') - - *g:tlib_numeric_chars* -g:tlib_numeric_chars - When editing a list with |tlib#input#List|, typing these numeric chars - (as returned by getchar()) will select an item based on its index, not - based on its name. I.e. in the default setting, typing a "4" will - select the fourth item, not the item called "4". - In order to make keys 0-9 filter the items in the list and make - select an item by its index, remove the keys 48 to 57 from - this dictionary. - Format: [KEY] = BASE ... the number is calculated as KEY - BASE. - - *g:tlib_keyagents_InputList_s* -g:tlib_keyagents_InputList_s - The default key bindings for single-item-select list views. If you - want to use , to move the cursor up and down, add these two - lines to after/plugin/02tlib.vim: > - - let g:tlib_keyagents_InputList_s[10] = 'tlib#agent#Down' " - let g:tlib_keyagents_InputList_s[11] = 'tlib#agent#Up' " -< - - *g:tlib_scroll_lines* -g:tlib_scroll_lines (default: 10) - Number of items to move when pressing in the input list window. - - *g:tlib_keyagents_InputList_m* -g:tlib_keyagents_InputList_m - - *g:tlib_handlers_EditList* -g:tlib_handlers_EditList - - *g:tlib_debug* -g:tlib_debug + *g:tlib#debug* +g:tlib#debug ======================================================================== @@ -581,6 +453,9 @@ tlib#persistent#Filename(type, ?file=%, ?mkdir=0) *tlib#persistent#Get()* tlib#persistent#Get(cfile) + *tlib#persistent#Value()* +tlib#persistent#Value(...) + *tlib#persistent#Save()* tlib#persistent#Save(cfile, dictionary) @@ -859,6 +734,18 @@ tlib#char#GetWithTimeout(timeout, ...) ======================================================================== autoload/tlib/scratch.vim~ + *g:tlib_scratch_pos* +g:tlib_scratch_pos (default: 'botright') + Scratch window position. By default the list window is opened on the + bottom. Set this variable to 'topleft' or '' to change this behaviour. + See |tlib#input#List()|. + + *g:tlib#scratch#hidden* +g:tlib#scratch#hidden (default: 'hide') + If you want the scratch buffer to be fully removed, you might want to + set this variable to 'wipe'. + See also https://github.com/tomtom/tlib_vim/pull/16 + *tlib#scratch#UseScratch()* tlib#scratch#UseScratch(?keyargs={}) Display a scratch buffer (a buffer with no file). See :TScratch for an @@ -884,6 +771,14 @@ tlib#autocmdgroup#Init() ======================================================================== autoload/tlib/cache.vim~ + *g:tlib_cache* +g:tlib_cache (default: '') + The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. + You might want to delete old files from this directory from time to + time with a command like: > + find ~/vimfiles/cache/ -atime +31 -type f -print -delete +< + *g:tlib#cache#purge_days* g:tlib#cache#purge_days (default: 31) |tlib#cache#Purge()|: Remove cache files older than N days. @@ -905,10 +800,12 @@ g:tlib#cache#run_script (default: 1) 1 ... Query user 2 ... Yes - *g:tlib#cache#silent* -g:tlib#cache#silent (default: 0) - If non-nil, don't display a message that files were deleted from the - cache. + *g:tlib#cache#verbosity* +g:tlib#cache#verbosity (default: 1) + Verbosity level: + 0 ... Be quiet + 1 ... Display informative message + 2 ... Display detailed messages *g:tlib#cache#dont_purge* g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$']) @@ -916,6 +813,11 @@ g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$']) cached files. If a regexp matches, the file won't be removed by |tlib#cache#Purge()|. + *g:tlib#cache#max_filename* +g:tlib#cache#max_filename (default: 200) + If the cache filename is longer than N characters, use + |pathshorten()|. + *tlib#cache#Dir()* tlib#cache#Dir(?mode = 'bg') The default cache directory. @@ -929,6 +831,11 @@ tlib#cache#Save(cfile, dictionary) *tlib#cache#Get()* tlib#cache#Get(cfile) + *tlib#cache#Value()* +tlib#cache#Value(cfile, generator, ftime, ...) + Get a cached value from cfile. If it is outdated (compared to ftime) + or does not exist, create it calling a generator function. + *tlib#cache#MaybePurge()* tlib#cache#MaybePurge() Call |tlib#cache#Purge()| if the last purge was done before @@ -1016,6 +923,10 @@ tlib#var#List(rx, ?prefix='') autoload/tlib/agent.vim~ Various agents for use as key handlers in tlib#input#List() + *g:tlib_scroll_lines* +g:tlib_scroll_lines (default: 10) + Number of items to move when pressing in the input list window. + *tlib#agent#Exit()* tlib#agent#Exit(world, selected) @@ -1049,6 +960,15 @@ tlib#agent#ShiftRight(world, selected) *tlib#agent#Reset()* tlib#agent#Reset(world, selected) + *tlib#agent#ToggleRestrictView()* +tlib#agent#ToggleRestrictView(world, selected) + + *tlib#agent#RestrictView()* +tlib#agent#RestrictView(world, selected) + + *tlib#agent#UnrestrictView()* +tlib#agent#UnrestrictView(world, selected) + *tlib#agent#Input()* tlib#agent#Input(world, selected) @@ -1165,6 +1085,37 @@ tlib#agent#ExecAgentByName(world, selected) tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) +======================================================================== +autoload/tlib/bitwise.vim~ + + *tlib#bitwise#Num2Bits()* +tlib#bitwise#Num2Bits(num) + + *tlib#bitwise#Bits2Num()* +tlib#bitwise#Bits2Num(bits, ...) + + *tlib#bitwise#AND()* +tlib#bitwise#AND(num1, num2, ...) + + *tlib#bitwise#OR()* +tlib#bitwise#OR(num1, num2, ...) + + *tlib#bitwise#XOR()* +tlib#bitwise#XOR(num1, num2, ...) + + *tlib#bitwise#ShiftRight()* +tlib#bitwise#ShiftRight(bits, n) + + *tlib#bitwise#ShiftLeft()* +tlib#bitwise#ShiftLeft(bits, n) + + *tlib#bitwise#Add()* +tlib#bitwise#Add(num1, num2, ...) + + *tlib#bitwise#Sub()* +tlib#bitwise#Sub(num1, num2, ...) + + ======================================================================== autoload/tlib/Filter_cnfx.vim~ @@ -1239,6 +1190,15 @@ tlib#rx#Suffixes(...) ======================================================================== autoload/tlib/tag.vim~ + *g:tlib_tags_extra* +g:tlib_tags_extra (default: '') + Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. + + *g:tlib_tag_substitute* +g:tlib_tag_substitute + Filter the tag description through |substitute()| for these filetypes. + This applies only if the tag cmd field (see |taglist()|) is used. + *tlib#tag#Retrieve()* tlib#tag#Retrieve(rx, ?extra_tags=0) Get all tags matching rx. Basically, this function simply calls @@ -1301,6 +1261,112 @@ tlib#Filter_cnfd#New(...) autoload/tlib/input.vim~ Input-related, select from a list etc. + *g:tlib#input#sortprefs_threshold* +g:tlib#input#sortprefs_threshold (default: 200) + If a list is bigger than this value, don't try to be smart when + selecting an item. Be slightly faster instead. + See |tlib#input#List()|. + + *g:tlib#input#livesearch_threshold* +g:tlib#input#livesearch_threshold (default: 1000) + If a list contains more items, |tlib#input#List()| does not perform an + incremental "live search" but uses |input()| to query the user for a + filter. This is useful on slower machines or with very long lists. + + *g:tlib#input#filter_mode* +g:tlib#input#filter_mode (default: 'cnfx') + Determine how |tlib#input#List()| and related functions work. + Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: + cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted + as a wildcard (this is the default method) + - A plus character ("+") acts as a wildcard as if ".\{-}" (see + |/\{-|) were entered. + - Examples: + - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match + "far". + - Otherwise it is a derivate of the cnf method (see below). + - See also |tlib#Filter_cnfx#New()|. + cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is + expanded to "\.\{-}" + - A period character (".") acts as a wildcard as if ".\{-}" (see + |/\{-|) were entered. + - Examples: + - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match + "far". + - Otherwise it is a derivate of the cnf method (see below). + - See also |tlib#Filter_cnfd#New()|. + cnf .... Match substrings + - A blank creates an AND conjunction, i.e. the next pattern has to + match too. + - A pipe character ("|") creates an OR conjunction, either this or + the next next pattern has to match. + - Patterns are very 'nomagic' |regexp| with a |\V| prefix. + - A pattern starting with "-" makes the filter exclude items + matching that pattern. + - Examples: + - "foo bar" matches items that contain the strings "foo" AND + "bar". + - "foo|bar boo|far" matches items that contain either ("foo" OR + "bar") AND ("boo" OR "far"). + - See also |tlib#Filter_cnf#New()|. + seq .... Match sequences of characters + - |tlib#Filter_seq#New()| + fuzzy .. Match fuzzy character sequences + - |tlib#Filter_fuzzy#New()| + + *g:tlib#input#higroup* +g:tlib#input#higroup (default: 'IncSearch') + The highlight group to use for showing matches in the input list + window. + See |tlib#input#List()|. + + *g:tlib_pick_last_item* +g:tlib_pick_last_item (default: 1) + When 1, automatically select the last remaining item only if the list + had only one item to begin with. + When 2, automatically select a last remaining item after applying + any filters. + See |tlib#input#List()|. + + +Keys for |tlib#input#List|~ + + *g:tlib#input#and* +g:tlib#input#and (default: ' ') + + *g:tlib#input#or* +g:tlib#input#or (default: '|') + + *g:tlib#input#not* +g:tlib#input#not (default: '-') + + *g:tlib#input#numeric_chars* +g:tlib#input#numeric_chars + When editing a list with |tlib#input#List|, typing these numeric chars + (as returned by getchar()) will select an item based on its index, not + based on its name. I.e. in the default setting, typing a "4" will + select the fourth item, not the item called "4". + In order to make keys 0-9 filter the items in the list and make + select an item by its index, remove the keys 48 to 57 from + this dictionary. + Format: [KEY] = BASE ... the number is calculated as KEY - BASE. + + *g:tlib#input#keyagents_InputList_s* +g:tlib#input#keyagents_InputList_s + The default key bindings for single-item-select list views. If you + want to use , to move the cursor up and down, add these two + lines to after/plugin/02tlib.vim: > + + let g:tlib#input#keyagents_InputList_s[10] = 'tlib#agent#Down' " + let g:tlib#input#keyagents_InputList_s[11] = 'tlib#agent#Up' " +< + + *g:tlib#input#keyagents_InputList_m* +g:tlib#input#keyagents_InputList_m + + *g:tlib#input#handlers_EditList* +g:tlib#input#handlers_EditList + *g:tlib#input#use_popup* g:tlib#input#use_popup (default: has('menu') && (has('gui_gtk') || has('gui_gtk2') || has('gui_win32'))) If true, define a popup menu for |tlib#input#List()| and related @@ -1329,7 +1395,7 @@ tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0 of selected elements or its indexes. By default, typing numbers will select an item by its index. See - |g:tlib_numeric_chars| to find out how to change this. + |g:tlib#input#numeric_chars| to find out how to change this. The item is automatically selected if the numbers typed equals the number of digits of the list length. I.e. if a list contains 20 items, @@ -1347,7 +1413,7 @@ tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0 mi ... Return a list of indexes Several pattern matching styles are supported. See - |g:tlib_inputlist_match|. + |g:tlib#input#filter_mode|. EXAMPLES: > echo tlib#input#List('s', 'Select one item', [100,200,300]) @@ -1411,6 +1477,13 @@ tlib#input#Edit(name, value, callback, ?cb_args=[]) tlib#input#Dialog(text, options, default) +======================================================================== +autoload/tlib/number.vim~ + + *tlib#number#ConvertBase()* +tlib#number#ConvertBase(num, base, ...) + + ======================================================================== autoload/tlib/file.vim~ @@ -1435,6 +1508,9 @@ tlib#file#Relative(filename, basedir) => 'bar/filename.txt' < + *tlib#file#Absolute()* +tlib#file#Absolute(filename, ...) + *tlib#file#With()* tlib#file#With(fcmd, bcmd, files, ?world={}) @@ -1466,9 +1542,32 @@ autoload/tlib/World.vim~ A prototype used by |tlib#input#List|. Inherits from |tlib#Object#New|. + *g:tlib_inputlist_pct* +g:tlib_inputlist_pct (default: 50) + Size of the input list window (in percent) from the main size (of &lines). + See |tlib#input#List()|. + + *g:tlib_inputlist_width_filename* +g:tlib_inputlist_width_filename (default: '&co / 3') + Size of filename columns when listing filenames. + See |tlib#input#List()|. + + *g:tlib_inputlist_filename_indicators* +g:tlib_inputlist_filename_indicators (default: 0) + If true, |tlib#input#List()| will show some indicators about the + status of a filename (e.g. buflisted(), bufloaded() etc.). + This is disabled by default because vim checks also for the file on + disk when doing this. + + *g:tlib_inputlist_shortmessage* +g:tlib_inputlist_shortmessage (default: 0) + If not null, display only a short info about the filter. + *tlib#World#New()* tlib#World#New(...) +prototype.PrintLines + ======================================================================== autoload/tlib/tab.vim~ @@ -1586,9 +1685,20 @@ tlib#arg#Ex(arg, ?chars='%#! ') < +======================================================================== +autoload/tlib/fixes.vim~ + + *tlib#fixes#Winpos()* +tlib#fixes#Winpos() + + ======================================================================== autoload/tlib/dir.vim~ + *g:tlib#dir#sep* +g:tlib#dir#sep (default: exists('+shellslash') && !&shellslash ? '\' : '/') + TLet g:tlib#dir#sep = '/' + *tlib#dir#CanonicName()* tlib#dir#CanonicName(dirname) EXAMPLES: > @@ -1596,6 +1706,16 @@ tlib#dir#CanonicName(dirname) => 'foo/bar/' < + *tlib#dir#NativeName()* +tlib#dir#NativeName(dirname) + EXAMPLES: > + tlib#dir#NativeName('foo/bar/') + On Windows: + => 'foo\bar\' + On Linux: + => 'foo/bar/' +< + *tlib#dir#PlainName()* tlib#dir#PlainName(dirname) EXAMPLES: > @@ -1621,6 +1741,34 @@ tlib#dir#Push(dir, ?locally=0) tlib#dir#Pop() +======================================================================== +autoload/tlib/hash.vim~ + + *g:tlib#hash#use_crc32* +g:tlib#hash#use_crc32 (default: '') + + *g:tlib#hash#use_adler32* +g:tlib#hash#use_adler32 (default: '') + + *tlib#hash#CRC32B()* +tlib#hash#CRC32B(chars) + + *tlib#hash#CRC32B_ruby()* +tlib#hash#CRC32B_ruby(chars) + + *tlib#hash#CRC32B_vim()* +tlib#hash#CRC32B_vim(chars) + + *tlib#hash#Adler32()* +tlib#hash#Adler32(chars) + + *tlib#hash#Adler32_vim()* +tlib#hash#Adler32_vim(chars) + + *tlib#hash#Adler32_tlib()* +tlib#hash#Adler32_tlib(chars) + + ======================================================================== autoload/tlib/win.vim~ @@ -1652,6 +1800,22 @@ tlib#comments#Comments(...) function! tlib#comments#Comments(?rx='') +======================================================================== +autoload/tlib/grep.vim~ + + *tlib#grep#Do()* +tlib#grep#Do(cmd, rx, files) + + *tlib#grep#LocList()* +tlib#grep#LocList(rx, files) + + *tlib#grep#QuickFixList()* +tlib#grep#QuickFixList(rx, files) + + *tlib#grep#List()* +tlib#grep#List(rx, files) + + ======================================================================== autoload/tlib/Filter_cnf.vim~ @@ -1739,6 +1903,11 @@ tlib#Object#Methods(object, ...) ======================================================================== autoload/tlib/buffer.vim~ + *g:tlib_viewline_position* +g:tlib_viewline_position (default: 'zz') + Where to display the line when using |tlib#buffer#ViewLine|. + For possible values for position see |scroll-cursor|. + *tlib#buffer#EnableMRU()* tlib#buffer#EnableMRU() diff --git a/sources_non_forked/tlib/plugin/02tlib.vim b/sources_non_forked/tlib/plugin/02tlib.vim index 126db40a..2cfe155a 100644 --- a/sources_non_forked/tlib/plugin/02tlib.vim +++ b/sources_non_forked/tlib/plugin/02tlib.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-04-10. -" @Last Change: 2012-10-03. -" @Revision: 725 +" @Last Change: 2013-09-25. +" @Revision: 746 " GetLatestVimScripts: 1863 1 tlib.vim if &cp || exists("loaded_tlib") @@ -14,7 +14,7 @@ if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let loaded_tlib = 102 +let loaded_tlib = 106 let s:save_cpo = &cpo set cpo&vim @@ -114,240 +114,5 @@ command! -nargs=0 -complete=command TBrowseScriptnames call command! -nargs=1 -complete=command TTimeCommand call tlib#cmd#Time() - -" :doc: -" Variables~ {{{1 - -" When 1, automatically select the last remaining item only if the list -" had only one item to begin with. -" When 2, automatically select a last remaining item after applying -" any filters. -" See |tlib#input#List()|. -TLet g:tlib_pick_last_item = 1 - -" If a list is bigger than this value, don't try to be smart when -" selecting an item. Be slightly faster instead. -" See |tlib#input#List()|. -TLet g:tlib_sortprefs_threshold = 200 - -" Scratch window position. By default the list window is opened on the -" bottom. Set this variable to 'topleft' or '' to change this behaviour. -" See |tlib#input#List()|. -TLet g:tlib_scratch_pos = 'botright' - -" Size of the input list window (in percent) from the main size (of &lines). -" See |tlib#input#List()|. -TLet g:tlib_inputlist_pct = 50 - -" Size of filename columns when listing filenames. -" See |tlib#input#List()|. -TLet g:tlib_inputlist_width_filename = '&co / 3' -" TLet g:tlib_inputlist_width_filename = 25 - -" The highlight group to use for showing matches in the input list -" window. -" See |tlib#input#List()|. -TLet g:tlib_inputlist_higroup = 'IncSearch' - -" If a list contains more items, |tlib#input#List()| does not perform an -" incremental "live search" but uses |input()| to query the user for a -" filter. This is useful on slower machines or with very long lists. -TLet g:tlib_inputlist_livesearch_threshold = 1000 - -" If true, |tlib#input#List()| will show some indicators about the -" status of a filename (e.g. buflisted(), bufloaded() etc.). -" This is disabled by default because vim checks also for the file on -" disk when doing this. -TLet g:tlib_inputlist_filename_indicators = 0 - -" Determine how |tlib#input#List()| and related functions work. -" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: -" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted -" as a wildcard (this is the default method) -" - A plus character ("+") acts as a wildcard as if ".\{-}" (see -" |/\{-|) were entered. -" - Examples: -" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match -" "far". -" - Otherwise it is a derivate of the cnf method (see below). -" - See also |tlib#Filter_cnfx#New()|. -" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is -" expanded to "\.\{-}" -" - A period character (".") acts as a wildcard as if ".\{-}" (see -" |/\{-|) were entered. -" - Examples: -" - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match -" "far". -" - Otherwise it is a derivate of the cnf method (see below). -" - See also |tlib#Filter_cnfd#New()|. -" cnf .... Match substrings -" - A blank creates an AND conjunction, i.e. the next pattern has to -" match too. -" - A pipe character ("|") creates an OR conjunction, either this or -" the next next pattern has to match. -" - Patterns are very 'nomagic' |regexp| with a |\V| prefix. -" - A pattern starting with "-" makes the filter exclude items -" matching that pattern. -" - Examples: -" - "foo bar" matches items that contain the strings "foo" AND -" "bar". -" - "foo|bar boo|far" matches items that contain either ("foo" OR -" "bar") AND ("boo" OR "far"). -" - See also |tlib#Filter_cnf#New()|. -" seq .... Match sequences of characters -" - |tlib#Filter_seq#New()| -" fuzzy .. Match fuzzy character sequences -" - |tlib#Filter_fuzzy#New()| -TLet g:tlib_inputlist_match = 'cnfx' - -" If not null, display only a short info about the filter. -TLet g:tlib_inputlist_shortmessage = 0 - -" Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. -TLet g:tlib_tags_extra = '' - -" Filter the tag description through |substitute()| for these filetypes. -" This applies only if the tag cmd field (see |taglist()|) is used. -" :nodefault: -TLet g:tlib_tag_substitute = { - \ 'java': [['\s*{\s*$', '', '']], - \ 'ruby': [['\<\(def\|class\|module\)\>\s\+', '', '']], - \ 'vim': [ - \ ['^\s*com\%[mand]!\?\(\s\+-\S\+\)*\s*\u\w*\zs.*$', '', ''], - \ ['^\s*\(let\|aug\%[roup]\|fu\%[nction]!\?\|com\%[mand]!\?\(\s\+-\S\+\)*\)\s*', '', ''], - \ ['"\?\s*{{{\d.*$', '', ''], - \ ], - \ } - -" " Alternative rx for keywords, in case 'iskeyword' is inadequate for -" " the purposes of tlib but you don't want to change it's value. -" TLet g:tlib_keyword_rx = { -" \ 'vim': '\(\w\|#\)', -" \ } - -TLet g:tlib_filename_sep = '/' -" TLet g:tlib_filename_sep = exists('+shellslash') && !&shellslash ? '\' : '/' " {{{2 - -" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. -" You might want to delete old files from this directory from time to -" time with a command like: > -" find ~/vimfiles/cache/ -atime +31 -type f -print -delete -TLet g:tlib_cache = '' - -" Where to display the line when using |tlib#buffer#ViewLine|. -" For possible values for position see |scroll-cursor|. -TLet g:tlib_viewline_position = 'zz' - -" :doc: -" Keys for |tlib#input#List|~ - -TLet g:tlib_inputlist_and = ' ' -TLet g:tlib_inputlist_or = '|' -TLet g:tlib_inputlist_not = '-' - -" When editing a list with |tlib#input#List|, typing these numeric chars -" (as returned by getchar()) will select an item based on its index, not -" based on its name. I.e. in the default setting, typing a "4" will -" select the fourth item, not the item called "4". -" In order to make keys 0-9 filter the items in the list and make -" select an item by its index, remove the keys 48 to 57 from -" this dictionary. -" Format: [KEY] = BASE ... the number is calculated as KEY - BASE. -" :nodefault: -TLet g:tlib_numeric_chars = { - \ 176: 176, - \ 177: 176, - \ 178: 176, - \ 179: 176, - \ 180: 176, - \ 181: 176, - \ 182: 176, - \ 183: 176, - \ 184: 176, - \ 185: 176, - \} - " \ 48: 48, - " \ 49: 48, - " \ 50: 48, - " \ 51: 48, - " \ 52: 48, - " \ 53: 48, - " \ 54: 48, - " \ 55: 48, - " \ 56: 48, - " \ 57: 48, - -" :nodefault: -" The default key bindings for single-item-select list views. If you -" want to use , to move the cursor up and down, add these two -" lines to after/plugin/02tlib.vim: > -" -" let g:tlib_keyagents_InputList_s[10] = 'tlib#agent#Down' " -" let g:tlib_keyagents_InputList_s[11] = 'tlib#agent#Up' " -TLet g:tlib_keyagents_InputList_s = { - \ "\": 'tlib#agent#PageUp', - \ "\": 'tlib#agent#PageDown', - \ "\": 'tlib#agent#Up', - \ "\": 'tlib#agent#Down', - \ "\": 'tlib#agent#UpN', - \ "\": 'tlib#agent#DownN', - \ "\": 'tlib#agent#ShiftLeft', - \ "\": 'tlib#agent#ShiftRight', - \ 18: 'tlib#agent#Reset', - \ 242: 'tlib#agent#Reset', - \ 17: 'tlib#agent#Input', - \ 241: 'tlib#agent#Input', - \ 27: 'tlib#agent#Exit', - \ 26: 'tlib#agent#Suspend', - \ 250: 'tlib#agent#Suspend', - \ 15: 'tlib#agent#SuspendToParentWindow', - \ 63: 'tlib#agent#Help', - \ "\": 'tlib#agent#Help', - \ "\": 'tlib#agent#ExecAgentByName', - \ "\": 'tlib#agent#ExecAgentByName', - \ "\": 'tlib#agent#ReduceFilter', - \ "\": 'tlib#agent#ReduceFilter', - \ "\": 'tlib#agent#PopFilter', - \ "\": 'tlib#agent#PopFilter', - \ "\": 'tlib#agent#PopFilter', - \ "\": 'tlib#agent#PopFilter', - \ "\": 'tlib#agent#Wildcard', - \ 191: 'tlib#agent#Debug', - \ char2nr(g:tlib_inputlist_or): 'tlib#agent#OR', - \ char2nr(g:tlib_inputlist_and): 'tlib#agent#AND', - \ } - -" Number of items to move when pressing in the input list window. -TLet g:tlib_scroll_lines = 10 - -" :nodefault: -TLet g:tlib_keyagents_InputList_m = { - \ 35: 'tlib#agent#Select', - \ "\": 'tlib#agent#SelectUp', - \ "\": 'tlib#agent#SelectDown', - \ 1: 'tlib#agent#SelectAll', - \ 225: 'tlib#agent#SelectAll', - \ } -" "\": 'tlib#agent#Select' - -" :nodefault: -TLet g:tlib_handlers_EditList = [ - \ {'key': 5, 'agent': 'tlib#agent#EditItem', 'key_name': '', 'help': 'Edit item'}, - \ {'key': 4, 'agent': 'tlib#agent#DeleteItems', 'key_name': '', 'help': 'Delete item(s)'}, - \ {'key': 14, 'agent': 'tlib#agent#NewItem', 'key_name': '', 'help': 'New item'}, - \ {'key': 24, 'agent': 'tlib#agent#Cut', 'key_name': '', 'help': 'Cut item(s)'}, - \ {'key': 3, 'agent': 'tlib#agent#Copy', 'key_name': '', 'help': 'Copy item(s)'}, - \ {'key': 22, 'agent': 'tlib#agent#Paste', 'key_name': '', 'help': 'Paste item(s)'}, - \ {'pick_last_item': 0}, - \ {'return_agent': 'tlib#agent#EditReturnValue'}, - \ {'help_extra': [ - \ 'Submit changes by pressing ENTER or or ', - \ 'Cancel editing by pressing c' - \ ]}, - \ ] - -" :nodefault: -TLet g:tlib_debug = 0 - let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/vim-airline/.gitignore b/sources_non_forked/vim-airline/.gitignore new file mode 100644 index 00000000..296f094e --- /dev/null +++ b/sources_non_forked/vim-airline/.gitignore @@ -0,0 +1,3 @@ +doc/tags +*.lock +.vim-flavor diff --git a/sources_non_forked/vim-airline/.travis.yml b/sources_non_forked/vim-airline/.travis.yml new file mode 100644 index 00000000..9ed483e7 --- /dev/null +++ b/sources_non_forked/vim-airline/.travis.yml @@ -0,0 +1,4 @@ +language: ruby +rvm: + - 1.9.3 +script: rake ci diff --git a/sources_non_forked/vim-airline/Gemfile b/sources_non_forked/vim-airline/Gemfile new file mode 100644 index 00000000..088f22e3 --- /dev/null +++ b/sources_non_forked/vim-airline/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'vim-flavor', '~> 1.1' diff --git a/sources_non_forked/vim-airline/LICENSE b/sources_non_forked/vim-airline/LICENSE new file mode 100644 index 00000000..46977354 --- /dev/null +++ b/sources_non_forked/vim-airline/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2013 Bailey Ling + +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/sources_non_forked/vim-airline/README.md b/sources_non_forked/vim-airline/README.md new file mode 100644 index 00000000..dd59b889 --- /dev/null +++ b/sources_non_forked/vim-airline/README.md @@ -0,0 +1,199 @@ +# vim-airline [![Build Status](https://travis-ci.org/bling/vim-airline.png)](https://travis-ci.org/bling/vim-airline) + +Lean & mean status/tabline for vim that's light as air. + +![img](https://github.com/bling/vim-airline/wiki/screenshots/demo.gif) + +# Features + +* Tiny core written with extensibility in mind ([open/closed principle][8]). +* Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [eclim][34], [lawrencium][21] and [virtualenv][31]. +* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. +* Optimized for speed; it loads in under a millisecond. +* Extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki. +* Supports 7.2 as the minimum Vim version. +* The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33]. +* Unit testing suite. + +## Straightforward customization + +If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift. + +![image](https://f.cloud.github.com/assets/306502/1009429/d69306da-0b38-11e3-94bf-7c6e3eef41e9.png) + +## Automatic truncation + +Sections and parts within sections can be configured to automatically hide when the window size shrinks. + +![image](https://f.cloud.github.com/assets/306502/1060831/05c08aac-11bc-11e3-8470-a506a3037f45.png) + +## Smarter tab line + +Automatically displays all buffers when there's only one tab open. + +![tabline](https://f.cloud.github.com/assets/306502/1072623/44c292a0-1495-11e3-9ce6-dcada3f1c536.gif) + +This is disabled by default; add the following to your vimrc to enable the extension: + + let g:airline#extensions#tabline#enabled = 1 + +Separators can be configured independently for the tabline, so here is how you can define "straight" tabs: + + let g:airline#extensions#tabline#left_sep = ' ' + let g:airline#extensions#tabline#left_alt_sep = '|' + +## Seamless integration + +vim-airline integrates with a variety of plugins out of the box. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off). + +#### [ctrlp.vim][10] +![image](https://f.cloud.github.com/assets/306502/962258/7345a224-04ec-11e3-8b5a-f11724a47437.png) + +#### [unite.vim][9] +![image](https://f.cloud.github.com/assets/306502/962319/4d7d3a7e-04ed-11e3-9d59-ab29cb310ff8.png) + +#### [tagbar][19] +![image](https://f.cloud.github.com/assets/306502/962150/7e7bfae6-04ea-11e3-9e28-32af206aed80.png) + +#### [csv.vim][28] +![image](https://f.cloud.github.com/assets/306502/962204/cfc1210a-04eb-11e3-8a93-42e6bcd21efa.png) + +#### [syntastic][5] +![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png) + +#### hunks ([vim-gitgutter][29] & [vim-signify][30]) +![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png) + +#### [virtualenv][31] +![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) + +## Extras + +vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also: + +#### whitespace +![image](https://f.cloud.github.com/assets/306502/962401/2a75385e-04ef-11e3-935c-e3b9f0e954cc.png) + +## Configurable and extensible + +#### Fine-tuned configuration + +Every section is composed of parts, and you can reorder and reconfigure them at will. + +![image](https://f.cloud.github.com/assets/306502/1073278/f291dd4c-14a3-11e3-8a83-268e2753f97d.png) + +Sections can contain accents, which allows for very granular control of visuals (see configuration [here](https://github.com/bling/vim-airline/issues/299#issuecomment-25772886)). + +![image](https://f.cloud.github.com/assets/306502/1195815/4bfa38d0-249d-11e3-823e-773cfc2ca894.png) + +#### Extensible pipeline + +Completely transform the statusline to your liking. Build out the statusline as you see fit by extracting colors from the current colorscheme's highlight groups. + +![allyourbase](https://f.cloud.github.com/assets/306502/1022714/e150034a-0da7-11e3-94a5-ca9d58a297e8.png) + +# Rationale + +There's already [powerline][2], why yet another statusline? + +* 100% vimscript; no python needed. + +What about [vim-powerline][1]? + +* vim-powerline has been deprecated in favor of the newer, unifying powerline, which is under active development; the new version is written in python at the core and exposes various bindings such that it can style statuslines not only in vim, but also tmux, bash, zsh, and others. + +# Where did the name come from? + +I wrote the initial version on an airplane, and since it's light as air it turned out to be a good name. Thanks for flying vim! + +# Installation + +This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers: + +* [Pathogen][11] + * `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline` +* [NeoBundle][12] + * `NeoBundle 'bling/vim-airline'` +* [Vundle][13] + * `Bundle 'bling/vim-airline'` +* [VAM][22] + * `call vam#ActivateAddons([ 'vim-airline' ])` +* manual + * copy all of the files into your `~/.vim` directory + +# Configuration + +`:help airline` + +# Integrating with powerline fonts + +For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository. + +Finally, you can add the convenience variable `let g:airline_powerline_fonts = 1` to your vimrc which will automatically populate the `g:airline_symbols` dictionary with the powerline symbols. + +# FAQ + +Solutions to common problems can be found in the [Wiki][27]. + +# Screenshots + +A full list of screenshots for various themes can be found in the [Wiki][14]. + +# Bugs + +Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following: + +* Reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts. +* A link to your vimrc or a gist which shows how you configured the plugin(s). +* And so I can reproduce; your `:version` of vim, and the commit of vim-airline you're using. + +# Contributions + +Contributions and pull requests are welcome. Please take note of the following guidelines: + +* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords. +* Keep the history clean! squash your branches before you submit a pull request. `pull --rebase` is your friend. +* Any changes to the core should be tested against Vim 7.2. +* If you submit a theme, please create a screenshot so it can be added to the [Wiki][14]. + +# License + +MIT License. Copyright (c) 2013 Bailey Ling. + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bling/vim-airline/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + +[1]: https://github.com/Lokaltog/vim-powerline +[2]: https://github.com/Lokaltog/powerline +[3]: https://github.com/Lokaltog/powerline-fonts +[4]: https://github.com/tpope/vim-fugitive +[5]: https://github.com/scrooloose/syntastic +[6]: https://github.com/bling/vim-bufferline +[7]: https://github.com/bling/minivimrc +[8]: http://en.wikipedia.org/wiki/Open/closed_principle +[9]: https://github.com/Shougo/unite.vim +[10]: https://github.com/kien/ctrlp.vim +[11]: https://github.com/tpope/vim-pathogen +[12]: https://github.com/Shougo/neobundle.vim +[13]: https://github.com/gmarik/vundle +[14]: https://github.com/bling/vim-airline/wiki/Screenshots +[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl +[16]: https://github.com/sjl/gundo.vim +[17]: https://github.com/mbbill/undotree +[18]: https://github.com/scrooloose/nerdtree +[19]: https://github.com/majutsushi/tagbar +[20]: https://powerline.readthedocs.org/en/latest/fontpatching.html +[21]: https://bitbucket.org/ludovicchabant/vim-lawrencium +[22]: https://github.com/MarcWeber/vim-addon-manager +[23]: https://github.com/altercation/solarized +[24]: https://github.com/chriskempson/tomorrow-theme +[25]: https://github.com/tomasr/molokai +[26]: https://github.com/nanotech/jellybeans.vim +[27]: https://github.com/bling/vim-airline/wiki/FAQ +[28]: https://github.com/chrisbra/csv.vim +[29]: https://github.com/airblade/vim-gitgutter +[30]: https://github.com/mhinz/vim-signify +[31]: https://github.com/jmcantrell/vim-virtualenv +[32]: https://github.com/chriskempson/base16-vim +[33]: https://github.com/bling/vim-airline/wiki/Test-Plan +[34]: http://eclim.org diff --git a/sources_non_forked/vim-airline/Rakefile b/sources_non_forked/vim-airline/Rakefile new file mode 100644 index 00000000..741cfc25 --- /dev/null +++ b/sources_non_forked/vim-airline/Rakefile @@ -0,0 +1,14 @@ +#!/usr/bin/env rake + +task :default => [:test] + +task :ci => [:dump, :test] + +task :dump do + sh 'vim --version' +end + +task :test do + sh 'bundle exec vim-flavor test' +end + diff --git a/sources_non_forked/vim-airline/autoload/airline.vim b/sources_non_forked/vim-airline/autoload/airline.vim new file mode 100644 index 00000000..664c78e6 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline.vim @@ -0,0 +1,170 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', []) + +let s:sections = ['a','b','c','gutter','x','y','z','warning'] +let s:inactive_funcrefs = [] + +function! airline#add_statusline_func(name) + call airline#add_statusline_funcref(function(a:name)) +endfunction + +function! airline#add_statusline_funcref(function) + if index(g:airline_statusline_funcrefs, a:function) >= 0 + echohl WarningMsg + echo 'The airline statusline funcref '.string(a:function).' has already been added.' + echohl NONE + return + endif + call add(g:airline_statusline_funcrefs, a:function) +endfunction + +function! airline#remove_statusline_func(name) + let i = index(g:airline_statusline_funcrefs, function(a:name)) + if i > -1 + call remove(g:airline_statusline_funcrefs, i) + endif +endfunction + +function! airline#add_inactive_statusline_func(name) + call add(s:inactive_funcrefs, function(a:name)) +endfunction + +function! airline#load_theme() + if exists('*airline#themes#{g:airline_theme}#refresh') + call airline#themes#{g:airline_theme}#refresh() + endif + + let palette = g:airline#themes#{g:airline_theme}#palette + call airline#themes#patch(palette) + + if exists('g:airline_theme_patch_func') + let Fn = function(g:airline_theme_patch_func) + call Fn(palette) + endif + + call airline#highlighter#load_theme() + call airline#extensions#load_theme() +endfunction + +function! airline#switch_theme(name) + try + let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme + let g:airline_theme = a:name + catch + echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE + if exists('g:airline_theme') + return + else + let g:airline_theme = 'dark' + endif + endtry + + let w:airline_lastmode = '' + call airline#update_statusline() + call airline#load_theme() + + " this is required to prevent clobbering the startup info message, i don't know why... + call airline#check_mode(winnr()) +endfunction + +function! airline#switch_matching_theme() + if exists('g:colors_name') + try + let palette = g:airline#themes#{g:colors_name}#palette + call airline#switch_theme(g:colors_name) + return 1 + catch + for map in items(g:airline_theme_map) + if match(g:colors_name, map[0]) > -1 + call airline#switch_theme(map[1]) + return 1 + endif + endfor + endtry + endif + return 0 +endfunction + +function! airline#update_statusline() + for nr in filter(range(1, winnr('$')), 'v:val != winnr()') + call setwinvar(nr, 'airline_active', 0) + let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) } + call s:invoke_funcrefs(context, s:inactive_funcrefs) + endfor + + unlet! w:airline_render_left + unlet! w:airline_render_right + for section in s:sections + unlet! w:airline_section_{section} + endfor + + let w:airline_active = 1 + let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) } + call s:invoke_funcrefs(context, g:airline_statusline_funcrefs) +endfunction + +let s:contexts = {} +let s:core_funcrefs = [ + \ function('airline#extensions#apply'), + \ function('airline#extensions#default#apply') ] +function! s:invoke_funcrefs(context, funcrefs) + let builder = airline#builder#new(a:context) + let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context) + if err == 1 + let a:context.line = builder.build() + let s:contexts[a:context.winnr] = a:context + call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')') + endif +endfunction + +function! airline#statusline(winnr) + if has_key(s:contexts, a:winnr) + return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line + endif + + " in rare circumstances this happens...see #276 + return '' +endfunction + +function! airline#check_mode(winnr) + let context = s:contexts[a:winnr] + + if get(w:, 'airline_active', 1) + let l:m = mode() + if l:m ==# "i" + let l:mode = ['insert'] + elseif l:m ==# "R" + let l:mode = ['replace'] + elseif l:m =~# '\v(v|V||s|S|)' + let l:mode = ['visual'] + else + let l:mode = ['normal'] + endif + let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) + else + let l:mode = ['inactive'] + let w:airline_current_mode = get(g:airline_mode_map, '__') + endif + + if g:airline_detect_modified + if &modified + call add(l:mode, 'modified') + endif + endif + + if g:airline_detect_paste && &paste + call add(l:mode, 'paste') + endif + + let mode_string = join(l:mode) + if get(w:, 'airline_lastmode', '') != mode_string + call airline#highlighter#highlight_modified_inactive(context.bufnr) + call airline#highlighter#highlight(l:mode) + let w:airline_lastmode = mode_string + endif + + return '' +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/builder.vim b/sources_non_forked/vim-airline/autoload/airline/builder.vim new file mode 100644 index 00000000..c1658974 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/builder.vim @@ -0,0 +1,74 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:prototype = {} + +function! s:prototype.split(...) + let self._side = 0 + let self._line .= '%#'.self._curgroup.'#'.(a:0 ? a:1 : '%=') +endfunction + +function! s:prototype.add_section_spaced(group, contents) + call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space)) +endfunction + +function! s:prototype.add_section(group, contents) + if self._curgroup != '' + if self._curgroup == a:group + let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep + else + call airline#highlighter#add_separator(self._curgroup, a:group, self._side) + let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#' + let self._line .= self._side ? self._context.left_sep : self._context.right_sep + endif + endif + + if self._curgroup != a:group + let self._line .= '%#'.a:group.'#' + endif + + if self._context.active + let contents = [] + let content_parts = split(a:contents, '__accent') + for cpart in content_parts + let accent = matchstr(cpart, '_\zs[^#]*\ze') + call add(contents, cpart) + endfor + let line = join(contents, a:group) + let line = substitute(line, '__restore__', a:group, 'g') + else + let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') + let line = substitute(line, '%#__restore__#', '', 'g') + endif + + let self._line .= line + let self._curgroup = a:group +endfunction + +function! s:prototype.add_raw(text) + let self._line .= a:text +endfunction + +function! s:prototype.build() + if !self._context.active + let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g') + endif + return self._line +endfunction + +function! airline#builder#new(context) + let builder = copy(s:prototype) + let builder._context = a:context + let builder._side = 1 + let builder._curgroup = '' + let builder._line = '' + + call extend(builder._context, { + \ 'left_sep': g:airline_left_sep, + \ 'left_alt_sep': g:airline_left_alt_sep, + \ 'right_sep': g:airline_right_sep, + \ 'right_alt_sep': g:airline_right_alt_sep, + \ }, 'keep') + return builder +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/debug.vim b/sources_non_forked/vim-airline/autoload/airline/debug.vim new file mode 100644 index 00000000..04d7e59c --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/debug.vim @@ -0,0 +1,50 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +function! airline#debug#profile1() + profile start airline-profile-switch.log + profile func * + profile file * + split + for i in range(1, 1000) + wincmd w + redrawstatus + endfor + profile pause + noautocmd qall! +endfunction + +function! airline#debug#profile2() + profile start airline-profile-cursor.log + profile func * + profile file * + edit blank + call setline(1, 'all your base are belong to us') + call setline(2, 'all your base are belong to us') + let positions = [[1,2], [2,2], [1,2], [1,1]] + for i in range(1, 1000) + for pos in positions + call cursor(pos[0], pos[1]) + redrawstatus + endfor + endfor + profile pause + noautocmd qall! +endfunction + +function! airline#debug#profile3() + profile start airline-profile-mode.log + profile func * + profile file * + + for i in range(1000) + startinsert + redrawstatus + stopinsert + redrawstatus + endfor + + profile pause + noautocmd qall! +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/deprecation.vim b/sources_non_forked/vim-airline/autoload/airline/deprecation.vim new file mode 100644 index 00000000..dd0567fc --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/deprecation.vim @@ -0,0 +1,32 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +function! airline#deprecation#check() + if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix') + echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables are obsolete. Please read the documentation about the branch extension.' + endif + + let tests = [ + \ [ 'g:airline_paste_symbol', 'g:airline_symbols.paste' ], + \ [ 'g:airline_readonly_symbol', 'g:airline_symbols.readonly' ], + \ [ 'g:airline_linecolumn_prefix', 'g:airline_symbols.linenr' ], + \ [ 'g:airline_branch_prefix', 'g:airline_symbols.branch' ], + \ [ 'g:airline_branch_empty_message', 'g:airline#extensions#branch#empty_message' ], + \ [ 'g:airline_detect_whitespace', 'g:airline#extensions#whitespace#enabled|show_message' ], + \ [ 'g:airline_enable_hunks', 'g:airline#extensions#hunks#enabled' ], + \ [ 'g:airline_enable_tagbar', 'g:airline#extensions#tagbar#enabled' ], + \ [ 'g:airline_enable_csv', 'g:airline#extensions#csv#enabled' ], + \ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], + \ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], + \ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], + \ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ], + \ ] + for test in tests + if exists(test[0]) + let max = winwidth(0) - 16 + let msg = printf('The variable %s is deprecated and may not work in the future. It has been replaced with %s. Please read the documentation.', test[0], test[1]) + echom msg[:max].'...' + endif + endfor +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions.vim b/sources_non_forked/vim-airline/autoload/airline/extensions.vim new file mode 100644 index 00000000..8707dbd7 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions.vim @@ -0,0 +1,215 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:ext = {} +let s:ext._theme_funcrefs = [] + +function! s:ext.add_statusline_func(name) dict + call airline#add_statusline_func(a:name) +endfunction +function! s:ext.add_statusline_funcref(function) dict + call airline#add_statusline_funcref(a:function) +endfunction +function! s:ext.add_inactive_statusline_func(name) dict + call airline#add_inactive_statusline_func(a:name) +endfunction +function! s:ext.add_theme_func(name) dict + call add(self._theme_funcrefs, function(a:name)) +endfunction + +let s:script_path = tolower(resolve(expand(':p:h'))) + +let s:filetype_overrides = { + \ 'netrw': [ 'netrw', '%f' ], + \ 'nerdtree': [ 'NERD', '' ], + \ 'gundo': [ 'Gundo', '' ], + \ 'diff': [ 'diff', '' ], + \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], + \ 'minibufexpl': [ 'MiniBufExplorer', '' ], + \ 'startify': [ 'startify', '' ], + \ } + +let s:filetype_regex_overrides = {} + +function! s:check_defined_section(name) + if !exists('w:airline_section_{a:name}') + let w:airline_section_{a:name} = g:airline_section_{a:name} + endif +endfunction + +function! airline#extensions#append_to_section(name, value) + call check_defined_section(a:name) + let w:airline_section_{a:name} .= a:value +endfunction + +function! airline#extensions#prepend_to_section(name, value) + call check_defined_section(a:name) + let w:airline_section_{a:name} = a:value . w:airline_section_{a:name} +endfunction + +function! airline#extensions#apply_left_override(section1, section2) + let w:airline_section_a = a:section1 + let w:airline_section_b = a:section2 + let w:airline_section_c = airline#section#create(['readonly']) + let w:airline_render_left = 1 + let w:airline_render_right = 0 +endfunction + +let s:active_winnr = -1 +function! airline#extensions#apply(...) + let s:active_winnr = winnr() + + if s:is_excluded_window() + return -1 + endif + + if &buftype == 'help' + call airline#extensions#apply_left_override('Help', '%f') + let w:airline_section_x = '' + let w:airline_section_y = '' + let w:airline_render_right = 1 + endif + + if &previewwindow + let w:airline_section_a = 'Preview' + let w:airline_section_b = '' + let w:airline_section_c = bufname(winbufnr(winnr())) + endif + + if has_key(s:filetype_overrides, &ft) + let args = s:filetype_overrides[&ft] + call airline#extensions#apply_left_override(args[0], args[1]) + endif + + for item in items(s:filetype_regex_overrides) + if match(&ft, item[0]) >= 0 + call airline#extensions#apply_left_override(item[1][0], item[1][1]) + endif + endfor +endfunction + +function! s:is_excluded_window() + for matchft in g:airline_exclude_filetypes + if matchft ==# &ft + return 1 + endif + endfor + + for matchw in g:airline_exclude_filenames + if matchstr(expand('%'), matchw) ==# matchw + return 1 + endif + endfor + + if g:airline_exclude_preview && &previewwindow + return 1 + endif + + return 0 +endfunction + +function! airline#extensions#load_theme() + call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette) +endfunction + +function! s:sync_active_winnr() + if exists('#airline') && winnr() != s:active_winnr + call airline#update_statusline() + endif +endfunction + +function! airline#extensions#load() + " non-trivial number of external plugins use eventignore=all, so we need to account for that + autocmd CursorMoved * call sync_active_winnr() + + call airline#extensions#quickfix#init(s:ext) + + if get(g:, 'loaded_unite', 0) + call airline#extensions#unite#init(s:ext) + endif + + if get(g:, 'loaded_vimfiler', 0) + let g:vimfiler_force_overwrite_statusline = 0 + endif + + if get(g:, 'loaded_ctrlp', 0) + call airline#extensions#ctrlp#init(s:ext) + endif + + if get(g:, 'command_t_loaded', 0) + call airline#extensions#commandt#init(s:ext) + endif + + if exists(':UndotreeToggle') + call airline#extensions#undotree#init(s:ext) + endif + + if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1)) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter')) + call airline#extensions#hunks#init(s:ext) + endif + + if (get(g:, 'airline#extensions#tagbar#enabled', 1) && get(g:, 'airline_enable_tagbar', 1)) + \ && exists(':TagbarToggle') + call airline#extensions#tagbar#init(s:ext) + endif + + if (get(g:, 'airline#extensions#csv#enabled', 1) && get(g:, 'airline_enable_csv', 1)) + \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) + call airline#extensions#csv#init(s:ext) + endif + + if exists(':VimShell') + let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}'] + let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}'] + endif + + if (get(g:, 'airline#extensions#branch#enabled', 1) && get(g:, 'airline_enable_branch', 1)) + \ && (exists('*fugitive#head') || exists('*lawrencium#statusline')) + call airline#extensions#branch#init(s:ext) + endif + + if (get(g:, 'airline#extensions#bufferline#enabled', 1) && get(g:, 'airline_enable_bufferline', 1)) + \ && exists('*bufferline#get_status_string') + call airline#extensions#bufferline#init(s:ext) + endif + + if get(g:, 'virtualenv_loaded', 0) && get(g:, 'airline#extensions#virtualenv#enabled', 1) + call airline#extensions#virtualenv#init(s:ext) + endif + + if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) + call airline#extensions#eclim#init(s:ext) + endif + + if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) + \ && exists(':SyntasticCheck') + call airline#extensions#syntastic#init(s:ext) + endif + + if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1)) + call airline#extensions#whitespace#init(s:ext) + endif + + if get(g:, 'airline#extensions#tabline#enabled', 0) + call airline#extensions#tabline#init(s:ext) + endif + + " load all other extensions not part of the default distribution + for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") + " we have to check both resolved and unresolved paths, since it's possible + " that they might not get resolved properly (see #187) + if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 + \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 + let name = fnamemodify(file, ':t:r') + if !get(g:, 'airline#extensions#'.name.'#enabled', 1) + continue + endif + try + call airline#extensions#{name}#init(s:ext) + catch + endtry + endif + endfor +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim new file mode 100644 index 00000000..87a70693 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim @@ -0,0 +1,76 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:has_fugitive = exists('*fugitive#head') +let s:has_fugitive_detect = exists('*fugitive#detect') +let s:has_lawrencium = exists('*lawrencium#statusline') +let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') + +if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand + finish +endif + +let s:empty_message = get(g:, 'airline#extensions#branch#empty_message', + \ get(g:, 'airline_branch_empty_message', '')) +let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) + +function! airline#extensions#branch#get_head() + let head = '' + + if s:has_fugitive && !exists('b:mercurial_dir') + let head = fugitive#head() + + if empty(head) && s:has_fugitive_detect && !exists('b:git_dir') + call fugitive#detect(getcwd()) + let head = fugitive#head() + endif + endif + + if empty(head) + if s:has_lawrencium + let head = lawrencium#statusline() + endif + endif + + if empty(head) + if s:has_vcscommand + call VCSCommandEnableBufferSetup() + if exists('b:VCSCommandBufferInfo') + let head = get(b:VCSCommandBufferInfo, 0, '') + endif + endif + endif + + return empty(head) || !s:check_in_path() + \ ? s:empty_message + \ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head) +endfunction + +function! s:check_in_path() + if !exists('b:airline_branch_path') + let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) + let bufferpath = resolve(fnamemodify(expand('%'), ':p:h')) + + if !filereadable(root) "not a file + " if .git is a directory, it's the old submodule format + if match(root, '\.git$') >= 0 + let root = expand(fnamemodify(root, ':h')) + else + " else it's the newer format, and we need to guesstimate + let pattern = '\.git\(\\\|\/\)modules\(\\\|\/\)' + if match(root, pattern) >= 0 + let root = substitute(root, pattern, '', '') + endif + endif + + let b:airline_file_in_root = stridx(bufferpath, root) > -1 + endif + return b:airline_file_in_root +endfunction + +function! airline#extensions#branch#init(ext) + call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') + + autocmd BufReadPost * unlet! b:airline_file_in_root +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim new file mode 100644 index 00000000..0c6013ce --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim @@ -0,0 +1,23 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists('*bufferline#get_status_string') + finish +endif + +let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1) + +function! airline#extensions#bufferline#init(ext) + if s:overwrite + highlight bufferline_selected gui=bold cterm=bold term=bold + highlight link bufferline_selected_inactive airline_c_inactive + let g:bufferline_inactive_highlight = 'airline_c' + let g:bufferline_active_highlight = 'bufferline_selected' + let g:bufferline_active_buffer_left = '' + let g:bufferline_active_buffer_right = '' + let g:bufferline_separator = g:airline_symbols.space + endif + + call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim new file mode 100644 index 00000000..1353940b --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim @@ -0,0 +1,16 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'command_t_loaded', 0) + finish +endif + +function! airline#extensions#commandt#apply(...) + if bufname('%') ==# 'GoToFile' + call airline#extensions#apply_left_override('CommandT', '') + endif +endfunction + +function! airline#extensions#commandt#init(ext) + call a:ext.add_statusline_func('airline#extensions#commandt#apply') +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim new file mode 100644 index 00000000..d3a8cc84 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim @@ -0,0 +1,31 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_csv', 0) && !exists(':Table') + finish +endif + +let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number') + +function! airline#extensions#csv#get_column() + if exists('*CSV_WCol') + if s:column_display ==# 'Name' + return '['.CSV_WCol('Name').CSV_WCol().']' + else + return '['.CSV_WCol().']' + endif + endif + return '' +endfunction + +function! airline#extensions#csv#apply(...) + if &ft ==# "csv" + call airline#extensions#prepend_to_section('gutter', + \ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}') + endif +endfunction + +function! airline#extensions#csv#init(ext) + call a:ext.add_statusline_func('airline#extensions#csv#apply') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim new file mode 100644 index 00000000..64e28854 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim @@ -0,0 +1,77 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif + +let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert') + +function! airline#extensions#ctrlp#generate_color_map(dark, light, white) + return { + \ 'CtrlPdark' : a:dark, + \ 'CtrlPlight' : a:light, + \ 'CtrlPwhite' : a:white, + \ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] , + \ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] , + \ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] , + \ } +endfunction + +function! airline#extensions#ctrlp#load_theme(palette) + if exists('a:palette.ctrlp') + let theme = a:palette.ctrlp + else + let s:color_template = has_key(a:palette, s:color_template) ? s:color_template : 'insert' + let theme = airline#extensions#ctrlp#generate_color_map( + \ a:palette[s:color_template]['airline_c'], + \ a:palette[s:color_template]['airline_b'], + \ a:palette[s:color_template]['airline_a']) + endif + for key in keys(theme) + call airline#highlighter#exec(key, theme[key]) + endfor +endfunction + +" Arguments: focus, byfname, regexp, prv, item, nxt, marked +function! airline#extensions#ctrlp#ctrlp_airline(...) + let b = airline#builder#new({'active': 1}) + if a:3 + call b.add_section_spaced('CtrlPlight', 'regex') + endif + if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1) + call b.add_section_spaced('CtrlPlight', a:4) + call b.add_section_spaced('CtrlPwhite', a:5) + call b.add_section_spaced('CtrlPlight', a:6) + else + call b.add_section_spaced('CtrlPwhite', a:5) + endif + call b.add_section_spaced('CtrlPdark', a:7) + call b.split() + call b.add_raw('%#CtrlPdark#'.a:1.(g:airline_symbols.space)) + call b.add_section_spaced('CtrlPdark', a:2) + call b.add_section_spaced('CtrlPlight', '%{getcwd()}') + return b.build() +endfunction + +" Argument: len +function! airline#extensions#ctrlp#ctrlp_airline_status(...) + let len = '%#CtrlPdark# '.a:1 + let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*' + return len.dir +endfunction + +function! airline#extensions#ctrlp#apply(...) + " disable statusline overwrite if ctrlp already did it + return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0 +endfunction + +function! airline#extensions#ctrlp#init(ext) + let g:ctrlp_status_func = { + \ 'main': 'airline#extensions#ctrlp#ctrlp_airline', + \ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status', + \ } + call a:ext.add_statusline_func('airline#extensions#ctrlp#apply') + call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim new file mode 100644 index 00000000..5d21996f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim @@ -0,0 +1,77 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { + \ 'b': 79, + \ 'x': 60, + \ 'y': 88, + \ 'z': 45, + \ }) +let s:layout = get(g:, 'airline#extensions#default#layout', [ + \ [ 'a', 'b', 'c' ], + \ [ 'x', 'y', 'z', 'warning' ] + \ ]) + +function! s:get_section(winnr, key, ...) + if has_key(s:section_truncate_width, a:key) + if winwidth(a:winnr) < s:section_truncate_width[a:key] + return '' + endif + endif + let spc = g:airline_symbols.space + let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) + let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] + return empty(text) ? '' : prefix.text.suffix +endfunction + +function! s:build_sections(builder, context, keys) + for key in a:keys + if key == 'warning' && !a:context.active + continue + endif + call s:add_section(a:builder, a:context, key) + endfor +endfunction + +if v:version >= 704 || (v:version >= 703 && has('patch81')) + function s:add_section(builder, context, key) + " i have no idea why the warning section needs special treatment, but it's + " needed to prevent separators from showing up + if a:key == 'warning' + call a:builder.add_raw('%(') + endif + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + if a:key == 'warning' + call a:builder.add_raw('%)') + endif + endfunction +else + " older version don't like the use of %(%) + function s:add_section(builder, context, key) + if a:key == 'warning' + call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) + else + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + endif + endfunction +endif + +function! airline#extensions#default#apply(builder, context) + let winnr = a:context.winnr + let active = a:context.active + + if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) + call build_sections(a:builder, a:context, s:layout[0]) + else + call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ') + endif + + call a:builder.split(s:get_section(winnr, 'gutter', '', '')) + + if airline#util#getwinvar(winnr, 'airline_render_right', 1) + call build_sections(a:builder, a:context, s:layout[1]) + endif + + return 1 +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim new file mode 100644 index 00000000..ff6a84fe --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim @@ -0,0 +1,35 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':ProjectCreate') + finish +endif + +function! airline#extensions#eclim#creat_line(...) + if &filetype == "tree" + let builder = a:1 + call builder.add_section('airline_a', ' Project ') + call builder.add_section('airline_b', ' %f ') + call builder.add_section('airline_c', '') + return 1 + endif +endfunction + +function! airline#extensions#eclim#get_warnings() + let eclimList = eclim#display#signs#GetExisting() + if !empty(eclimList) + let errorsLine = eclimList[0]['line'] + let errorsNumber = len(eclimList) + let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" + if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' + return errors.(g:airline_symbols.space) + endif + endif + return '' +endfunction + +function! airline#extensions#eclim#init(ext) + call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') + call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim new file mode 100644 index 00000000..0c64f2c8 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim @@ -0,0 +1,54 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" we don't actually want this loaded :P +finish + +" Due to some potential rendering issues, the use of the `space` variable is +" recommended. +let s:spc = g:airline_symbols.space + +" Extension specific variables can be defined the usual fashion. +if !exists('g:airline#extensions#example#number_of_cats') + let g:airline#extensions#example#number_of_cats = 42 +endif + +" First we define an init function that will be invoked from extensions.vim +function! airline#extensions#example#init(ext) + + " Here we define a new part for the plugin. This allows users to place this + " extension in arbitrary locations. + call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}') + + " Next up we add a funcref so that we can run some code prior to the + " statusline getting modifed. + call a:ext.add_statusline_func('airline#extensions#example#apply') + + " You can also add a funcref for inactive statuslines. + " call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply') +endfunction + +" This function will be invoked just prior to the statusline getting modified. +function! airline#extensions#example#apply(...) + " First we check for the filetype. + if &filetype == "nyancat" + + " Let's say we want to append to section_c, first we check if there's + " already a window-local override, and if not, create it off of the global + " section_c. + let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c) + + " Then we just append this extenion to it, optionally using separators. + let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}' + endif +endfunction + +" Finally, this function will be invoked from the statusline. +function! airline#extensions#example#get_cats() + let cats = '' + for i in range(1, g:airline#extensions#example#number_of_cats) + let cats .= ' (,,,)=(^.^)=(,,,) ' + endfor + return cats +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim new file mode 100644 index 00000000..73c0e2ea --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim @@ -0,0 +1,63 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) + finish +endif + +let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0) +let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-']) + +function! s:get_hunks_signify() + let hunks = sy#repo#get_stats() + if hunks[0] >= 0 + return hunks + endif + return [] +endfunction + +function! s:get_hunks_gitgutter() + if !get(g:, 'gitgutter_enabled', 0) + return '' + endif + return GitGutterGetHunkSummary() +endfunction + +function! s:get_hunks_empty() + return '' +endfunction + +let s:source_func = '' +function! s:get_hunks() + if empty(s:source_func) + if get(g:, 'loaded_signify', 0) + let s:source_func = 's:get_hunks_signify' + elseif exists('*GitGutterGetHunkSummary') + let s:source_func = 's:get_hunks_gitgutter' + else + let s:source_func = 's:get_hunks_empty' + endif + endif + return {s:source_func}() +endfunction + +function! airline#extensions#hunks#get_hunks() + if !get(w:, 'airline_active', 0) + return '' + endif + let hunks = s:get_hunks() + let string = '' + if !empty(hunks) + for i in [0, 1, 2] + if s:non_zero_only == 0 || hunks[i] > 0 + let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) + endif + endfor + endif + return string +endfunction + +function! airline#extensions#hunks#init(ext) + call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim new file mode 100644 index 00000000..7afad864 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim @@ -0,0 +1,37 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' +let g:airline#extensions#quickfix#location_text = 'Location' + +function! airline#extensions#quickfix#apply(...) + if &buftype == 'quickfix' + let w:airline_section_a = s:get_text() + let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' + let w:airline_section_c = '' + let w:airline_section_x = '' + endif +endfunction + +function! airline#extensions#quickfix#init(ext) + call a:ext.add_statusline_func('airline#extensions#quickfix#apply') +endfunction + +function! s:get_text() + redir => buffers + silent ls + redir END + + let nr = bufnr('%') + for buf in split(buffers, '\n') + if match(buf, '\v^\s+'.nr) > -1 + if match(buf, '\[Quickfix List\]') > -1 + return g:airline#extensions#quickfix#quickfix_text + else + return g:airline#extensions#quickfix#location_text + endif + endif + endfor + return '' +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim new file mode 100644 index 00000000..3ecc1eb1 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim @@ -0,0 +1,19 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':SyntasticCheck') + finish +endif + +function! airline#extensions#syntastic#get_warnings() + let errors = SyntasticStatuslineFlag() + if strlen(errors) > 0 + return errors.(g:airline_symbols.space) + endif + return '' +endfunction + +function! airline#extensions#syntastic#init(ext) + call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim new file mode 100644 index 00000000..b80d16e6 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim @@ -0,0 +1,243 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') +let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) +let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) + +let s:builder_context = { + \ 'active' : 1, + \ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), + \ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), + \ } +if get(g:, 'airline_powerline_fonts', 0) + let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , "\ue0b0") + let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , "\ue0b1") +else + let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') + let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') +endif + +let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) +let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) +let s:spc = g:airline_symbols.space + +function! airline#extensions#tabline#init(ext) + if has('gui_running') + set guioptions-=e + endif + + autocmd User AirlineToggledOn call s:toggle_on() + autocmd User AirlineToggledOff call s:toggle_off() + + call s:toggle_on() + call a:ext.add_theme_func('airline#extensions#tabline#load_theme') +endfunction + +function! s:toggle_off() + if exists('s:original_tabline') + let &tabline = s:original_tabline + let &showtabline = s:original_showtabline + endif +endfunction + +function! s:toggle_on() + let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] + + set tabline=%!airline#extensions#tabline#get() + if s:buf_min_count <= 0 && s:tab_min_count <= 1 + set showtabline=2 + else + augroup airline_tabline + autocmd! + if s:show_buffers == 1 + autocmd CursorMoved * call on_cursormove(s:buf_min_count, len(s:get_buffer_list())) + else + autocmd TabEnter * call on_cursormove(s:tab_min_count, tabpagenr('$')) + endif + augroup END + endif +endfunction + +function! airline#extensions#tabline#load_theme(palette) + let colors = get(a:palette, 'tabline', {}) + let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b) + let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) + let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) + let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) + let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) + let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) + call airline#highlighter#exec('airline_tab', l:tab) + call airline#highlighter#exec('airline_tabsel', l:tabsel) + call airline#highlighter#exec('airline_tabtype', l:tabtype) + call airline#highlighter#exec('airline_tabfill', l:tabfill) + call airline#highlighter#exec('airline_tabmod', l:tabmod) + call airline#highlighter#exec('airline_tabhid', l:tabhid) +endfunction + +function! s:on_cursormove(min_count, total_count) + if a:total_count >= a:min_count + if &showtabline != 2 + set showtabline=2 + endif + else + if &showtabline != 0 + set showtabline=0 + endif + endif +endfunction + +function! airline#extensions#tabline#get() + if s:show_buffers && tabpagenr('$') == 1 + return s:get_buffers() + else + return s:get_tabs() + endif +endfunction + +function! airline#extensions#tabline#title(n) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1]) +endfunction + +function! airline#extensions#tabline#get_buffer_name(nr) + return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', [])) +endfunction + +function! s:get_buffer_list() + let buffers = [] + let cur = bufnr('%') + for nr in range(1, bufnr('$')) + if buflisted(nr) && bufexists(nr) + for ex in s:excludes + if match(bufname(nr), ex) + continue + endif + endfor + if getbufvar(nr, 'current_syntax') == 'qf' + continue + endif + call add(buffers, nr) + endif + endfor + + let s:current_buffer_list = buffers + return buffers +endfunction + +function! s:get_visible_buffers() + let buffers = s:get_buffer_list() + let cur = bufnr('%') + + let total_width = 0 + let max_width = 0 + + for nr in buffers + let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 + let total_width += width + let max_width = max([max_width, width]) + endfor + + " only show current and surrounding buffers if there are too many buffers + let position = index(buffers, cur) + let vimwidth = &columns + if total_width > vimwidth && position > -1 + let buf_count = len(buffers) + + " determine how many buffers to show based on the longest buffer width, + " use one on the right side and put the rest on the left + let buf_max = vimwidth / max_width + let buf_right = 1 + let buf_left = max([0, buf_max - buf_right]) + + let start = max([0, position - buf_left]) + let end = min([buf_count, position + buf_right]) + + " fill up available space on the right + if position < buf_left + let end += (buf_left - position) + endif + + " fill up available space on the left + if end > buf_count - 1 - buf_right + let start -= max([0, buf_right - (buf_count - 1 - position)]) + endif + + let buffers = eval('buffers[' . start . ':' . end . ']') + + if start > 0 + call insert(buffers, -1, 0) + endif + + if end < buf_count - 1 + call add(buffers, -1) + endif + endif + + return buffers +endfunction + +function! s:get_buffers() + let b = airline#builder#new(s:builder_context) + let cur = bufnr('%') + let tab_bufs = tabpagebuflist(tabpagenr()) + for nr in s:get_visible_buffers() + if nr < 0 + call b.add_raw('%#airline_tabhid#...') + continue + endif + if cur == nr + if g:airline_detect_modified && getbufvar(nr, '&modified') + let group = 'airline_tabmod' + else + let group = 'airline_tabsel' + endif + else + if index(tab_bufs, nr) > -1 + let group = 'airline_tab' + else + let group = 'airline_tabhid' + endif + endif + call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) + endfor + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabtype', ' buffers ') + return b.build() +endfunction + +function! s:get_tabs() + let b = airline#builder#new(s:builder_context) + for i in range(1, tabpagenr('$')) + if i == tabpagenr() + let group = 'airline_tabsel' + if g:airline_detect_modified + for bi in tabpagebuflist(i) + if getbufvar(bi, '&modified') + let group = 'airline_tabmod' + endif + endfor + endif + else + let group = 'airline_tab' + endif + let val = '%(' + if s:tab_nr_type == 0 + let val .= ' %{len(tabpagebuflist('.i.'))}' + else + let val .= (g:airline_symbols.space).i + endif + call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') + endfor + call b.add_raw('%T') + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tab', ' %999XX ') + call b.add_section('airline_tabtype', ' tabs ') + return b.build() +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim new file mode 100644 index 00000000..656ba225 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim @@ -0,0 +1,60 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') +let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) +let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') +let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) +let s:buf_modified_symbol = g:airline_symbols.modified + +function! airline#extensions#tabline#formatters#default(bufnr, buffers) + let _ = '' + + let name = bufname(a:bufnr) + if empty(name) + let _ .= '[No Name]' + else + if s:fnamecollapse + let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') + else + let _ .= fnamemodify(name, s:fmod) + endif + endif + + return s:wrap_name(a:bufnr, _) +endfunction + +function! airline#extensions#tabline#formatters#unique_tail(bufnr, buffers) + let duplicates = {} + let tails = {} + let map = {} + for nr in a:buffers + let name = bufname(nr) + if empty(name) + let map[nr] = '[No Name]' + else + let tail = fnamemodify(name, ':t') + if has_key(tails, tail) + let duplicates[nr] = nr + endif + let tails[tail] = 1 + let map[nr] = s:wrap_name(nr, tail) + endif + endfor + + for nr in values(duplicates) + let map[nr] = s:wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) + endfor + + return map[a:bufnr] +endfunction + +function! s:wrap_name(bufnr, buffer_name) + let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' + let _ .= a:buffer_name + if getbufvar(a:bufnr, '&modified') == 1 + let _ .= s:buf_modified_symbol + endif + return _ +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim new file mode 100644 index 00000000..061a47f2 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,39 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':TagbarToggle') + finish +endif + +let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') +let s:spc = g:airline_symbols.space + +" Arguments: current, sort, fname +function! airline#extensions#tagbar#get_status(...) + let builder = airline#builder#new({ 'active': a:1 }) + call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) + call builder.add_section('airline_b', s:spc.a:2.s:spc) + call builder.add_section('airline_c', s:spc.a:3.s:spc) + return builder.build() +endfunction + +function! airline#extensions#tagbar#inactive_apply(...) + if getwinvar(a:2.winnr, '&filetype') == 'tagbar' + return -1 + endif +endfunction + +function! airline#extensions#tagbar#currenttag() + if get(w:, 'airline_active', 0) + return tagbar#currenttag('%s', '', s:flags) + endif + return '' +endfunction + +function! airline#extensions#tagbar#init(ext) + call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') + let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' + + call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim new file mode 100644 index 00000000..d897f041 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim @@ -0,0 +1,27 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':UndotreeToggle') + finish +endif + +function! airline#extensions#undotree#apply(...) + if exists('t:undotree') + if &ft == 'undotree' + if exists('*t:undotree.GetStatusLine') + call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}') + else + call airline#extensions#apply_left_override('undotree', '%f') + endif + endif + + if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine') + call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}') + endif + endif +endfunction + +function! airline#extensions#undotree#init(ext) + call a:ext.add_statusline_func('airline#extensions#undotree#apply') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim new file mode 100644 index 00000000..4db38584 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim @@ -0,0 +1,23 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_unite', 0) + finish +endif + +function! airline#extensions#unite#apply(...) + if &ft == 'unite' + call a:1.add_section('airline_a', ' Unite ') + call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') + call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') + call a:1.split() + call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') + return 1 + endif +endfunction + +function! airline#extensions#unite#init(ext) + let g:unite_force_overwrite_statusline = 0 + call a:ext.add_statusline_func('airline#extensions#unite#apply') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim new file mode 100644 index 00000000..c052282c --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim @@ -0,0 +1,20 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'virtualenv_loaded', 0) + finish +endif + +let s:spc = g:airline_symbols.space + +function! airline#extensions#virtualenv#init(ext) + call a:ext.add_statusline_func('airline#extensions#virtualenv#apply') +endfunction + +function! airline#extensions#virtualenv#apply(...) + if &filetype =~ "python" + call airline#extensions#append_to_section('x', + \ s:spc.g:airline_right_alt_sep.s:spc.'%{virtualenv#statusline()}') + endif +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim new file mode 100644 index 00000000..c8910af6 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim @@ -0,0 +1,78 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html + +" for backwards compatibility +if exists('g:airline_detect_whitespace') + let s:show_message = g:airline_detect_whitespace == 1 +else + let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) +endif + +let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) +let s:default_checks = ['indent', 'trailing'] + +let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') +let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') + +let s:enabled = 1 + +function! airline#extensions#whitespace#check() + if &readonly || !&modifiable || !s:enabled + return '' + endif + + if !exists('b:airline_whitespace_check') + let b:airline_whitespace_check = '' + let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks) + + let trailing = 0 + if index(checks, 'trailing') > -1 + let trailing = search(' $', 'nw') + endif + + let mixed = 0 + if index(checks, 'indent') > -1 + let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')] + let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0 + endif + + if trailing != 0 || mixed + let b:airline_whitespace_check = s:symbol + if s:show_message + if trailing != 0 + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) + endif + if mixed + let mixnr = indents[0] == indents[1] ? indents[0] : indents[2] + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr) + endif + endif + endif + endif + return b:airline_whitespace_check +endfunction! + +function! airline#extensions#whitespace#toggle() + if s:enabled + autocmd! airline_whitespace CursorHold,BufWritePost + augroup! airline_whitespace + let s:enabled = 0 + else + call airline#extensions#whitespace#init() + let s:enabled = 1 + endif + echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') +endfunction + +function! airline#extensions#whitespace#init(...) + call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') + + unlet! b:airline_whitespace_check + augroup airline_whitespace + autocmd! + autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check + augroup END +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/highlighter.vim b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim new file mode 100644 index 00000000..f5e68465 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim @@ -0,0 +1,156 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') +let s:separators = {} +let s:accents = {} + +function! s:gui2cui(rgb, fallback) + if a:rgb == '' + return a:fallback + endif + let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)') + 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 + +function! s:get_syn(group, what) + " need to pass in mode, known to break on 7.3.547 + let mode = has('gui_running') ? 'gui' : 'cterm' + let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode) + if empty(color) || color == -1 + let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode) + endif + if empty(color) || color == -1 + if has('gui_running') + let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF' + else + let color = a:what ==# 'fg' ? 0 : 1 + endif + endif + return color +endfunction + +function! s:get_array(fg, bg, opts) + let fg = a:fg + let bg = a:bg + return has('gui_running') + \ ? [ fg, bg, '', '', join(a:opts, ',') ] + \ : [ '', '', fg, bg, join(a:opts, ',') ] +endfunction + +function! airline#highlighter#get_highlight(group, ...) + let fg = s:get_syn(a:group, 'fg') + let bg = s:get_syn(a:group, 'bg') + let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term') + return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) +endfunction + +function! airline#highlighter#get_highlight2(fg, bg, ...) + let fg = s:get_syn(a:fg[0], a:fg[1]) + let bg = s:get_syn(a:bg[0], a:bg[1]) + return s:get_array(fg, bg, a:000) +endfunction + +function! airline#highlighter#exec(group, colors) + let colors = a:colors + if s:is_win32term + let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) + let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) + endif + exec printf('hi %s %s %s %s %s %s %s %s', + \ a:group, + \ get(colors, 0, '') != '' ? 'guifg='.colors[0] : '', + \ get(colors, 1, '') != '' ? 'guibg='.colors[1] : '', + \ get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '', + \ get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '', + \ get(colors, 4, '') != '' ? 'gui='.colors[4] : '', + \ get(colors, 4, '') != '' ? 'cterm='.colors[4] : '', + \ get(colors, 4, '') != '' ? 'term='.colors[4] : '') +endfunction + +function! s:exec_separator(dict, from, to, inverse, suffix) + let l:from = airline#themes#get_highlight(a:from.a:suffix) + let l:to = airline#themes#get_highlight(a:to.a:suffix) + let group = a:from.'_to_'.a:to.a:suffix + if a:inverse + let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] + else + let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] + endif + let a:dict[group] = colors + call airline#highlighter#exec(group, colors) +endfunction + +function! airline#highlighter#load_theme() + for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') + call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) + endfor + call airline#highlighter#highlight(['inactive']) + call airline#highlighter#highlight(['normal']) +endfunction + +function! airline#highlighter#add_separator(from, to, inverse) + let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] + call exec_separator({}, a:from, a:to, a:inverse, '') +endfunction + +function! airline#highlighter#add_accent(accent) + let s:accents[a:accent] = 1 +endfunction + +function! airline#highlighter#highlight_modified_inactive(bufnr) + if getbufvar(a:bufnr, '&modified') + let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') + \ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] + else + let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') + \ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] + endif + + if !empty(colors) + call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) + endif +endfunction + +function! airline#highlighter#highlight(modes) + let p = g:airline#themes#{g:airline_theme}#palette + + " draw the base mode, followed by any overrides + let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') + let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' + for mode in mapped + if exists('g:airline#themes#{g:airline_theme}#palette[mode]') + let dict = g:airline#themes#{g:airline_theme}#palette[mode] + for kvp in items(dict) + let mode_colors = kvp[1] + call airline#highlighter#exec(kvp[0].suffix, mode_colors) + + for accent in keys(s:accents) + if !has_key(p.accents, accent) + continue + endif + let colors = copy(mode_colors) + if p.accents[accent][0] != '' + let colors[0] = p.accents[accent][0] + endif + if p.accents[accent][2] != '' + let colors[2] = p.accents[accent][2] + endif + if len(colors) >= 5 + let colors[4] = get(p.accents[accent], 4, '') + else + call add(colors, get(p.accents[accent], 4, '')) + endif + call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors) + endfor + endfor + + " TODO: optimize this + for sep in items(s:separators) + call exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) + endfor + endif + endfor +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/init.vim b/sources_non_forked/vim-airline/autoload/airline/init.vim new file mode 100644 index 00000000..558b3f23 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/init.vim @@ -0,0 +1,113 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +function! s:check_defined(variable, default) + if !exists(a:variable) + let {a:variable} = a:default + endif +endfunction + +let s:loaded = 0 +function! airline#init#bootstrap() + if s:loaded + return + endif + let s:loaded = 1 + + let g:airline#init#bootstrapping = 1 + + call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b0":">") + call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b1":">") + call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b2":"<") + call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b3":"<") + call s:check_defined('g:airline_detect_modified', 1) + call s:check_defined('g:airline_detect_paste', 1) + call s:check_defined('g:airline_detect_iminsert', 0) + call s:check_defined('g:airline_inactive_collapse', 1) + call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) + call s:check_defined('g:airline_exclude_filetypes', []) + call s:check_defined('g:airline_exclude_preview', 0) + + call s:check_defined('g:airline_mode_map', {}) + call extend(g:airline_mode_map, { + \ '__' : '------', + \ 'n' : 'NORMAL', + \ 'i' : 'INSERT', + \ 'R' : 'REPLACE', + \ 'v' : 'VISUAL', + \ 'V' : 'V-LINE', + \ 'c' : 'COMMAND', + \ '' : 'V-BLOCK', + \ 's' : 'SELECT', + \ 'S' : 'S-LINE', + \ '' : 'S-BLOCK', + \ }, 'keep') + + call s:check_defined('g:airline_theme_map', {}) + call extend(g:airline_theme_map, { + \ 'Tomorrow.*': 'tomorrow', + \ 'base16.*': 'base16', + \ 'mo[l|n]okai': 'molokai', + \ 'wombat.*': 'wombat', + \ '.*zenburn.*': 'zenburn', + \ '.*solarized.*': 'solarized', + \ }, 'keep') + + call s:check_defined('g:airline_symbols', {}) + call extend(g:airline_symbols, { + \ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'), + \ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO'), + \ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!', + \ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':' ), + \ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : ''), + \ 'modified': '+', + \ 'space': ' ', + \ }, 'keep') + + call airline#parts#define('mode', { + \ 'function': 'airline#parts#mode', + \ 'accent': 'bold', + \ }) + call airline#parts#define_function('iminsert', 'airline#parts#iminsert') + call airline#parts#define_function('paste', 'airline#parts#paste') + call airline#parts#define_function('filetype', 'airline#parts#filetype') + call airline#parts#define('readonly', { + \ 'function': 'airline#parts#readonly', + \ 'accent': 'red', + \ }) + call airline#parts#define_raw('file', '%f%m') + call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#') + call airline#parts#define_function('ffenc', 'airline#parts#ffenc') + call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace']) + + unlet g:airline#init#bootstrapping +endfunction + +function! airline#init#sections() + let spc = g:airline_symbols.space + if !exists('g:airline_section_a') + let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert']) + endif + if !exists('g:airline_section_b') + let g:airline_section_b = airline#section#create(['hunks', 'branch']) + endif + if !exists('g:airline_section_c') + let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) + endif + if !exists('g:airline_section_gutter') + let g:airline_section_gutter = airline#section#create(['%=']) + endif + if !exists('g:airline_section_x') + let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype']) + endif + if !exists('g:airline_section_y') + let g:airline_section_y = airline#section#create_right(['ffenc']) + endif + if !exists('g:airline_section_z') + let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) + endif + if !exists('g:airline_section_warning') + let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace']) + endif +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/parts.vim b/sources_non_forked/vim-airline/autoload/airline/parts.vim new file mode 100644 index 00000000..bec4504f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/parts.vim @@ -0,0 +1,79 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:parts = {} + +" PUBLIC API {{{ + +function! airline#parts#define(key, config) + let s:parts[a:key] = get(s:parts, a:key, {}) + if exists('g:airline#init#bootstrapping') + call extend(s:parts[a:key], a:config, 'keep') + else + call extend(s:parts[a:key], a:config, 'force') + endif +endfunction + +function! airline#parts#define_function(key, name) + call airline#parts#define(a:key, { 'function': a:name }) +endfunction + +function! airline#parts#define_text(key, text) + call airline#parts#define(a:key, { 'text': a:text }) +endfunction + +function! airline#parts#define_raw(key, raw) + call airline#parts#define(a:key, { 'raw': a:raw }) +endfunction + +function! airline#parts#define_minwidth(key, width) + call airline#parts#define(a:key, { 'minwidth': a:width }) +endfunction + +function! airline#parts#define_condition(key, predicate) + call airline#parts#define(a:key, { 'condition': a:predicate }) +endfunction + +function! airline#parts#define_accent(key, accent) + call airline#parts#define(a:key, { 'accent': a:accent }) +endfunction + +function! airline#parts#define_empty(keys) + for key in a:keys + call airline#parts#define_raw(key, '') + endfor +endfunction + +function! airline#parts#get(key) + return get(s:parts, a:key, {}) +endfunction + +" }}} + +function! airline#parts#mode() + return get(w:, 'airline_current_mode', '') +endfunction + +function! airline#parts#paste() + return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' +endfunction + +function! airline#parts#iminsert() + if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') + return toupper(b:keymap_name) + endif + return '' +endfunction + +function! airline#parts#readonly() + return &readonly ? g:airline_symbols.readonly : '' +endfunction + +function! airline#parts#filetype() + return &filetype +endfunction + +function! airline#parts#ffenc() + return printf('%s%s', &fenc, strlen(&ff) > 0 ? '['.&ff.']' : '') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/section.vim b/sources_non_forked/vim-airline/autoload/airline/section.vim new file mode 100644 index 00000000..4562bacd --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/section.vim @@ -0,0 +1,73 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +call airline#init#bootstrap() +let s:spc = g:airline_symbols.space + +function! s:wrap_accent(part, value) + if exists('a:part.accent') + call airline#highlighter#add_accent(a:part.accent) + return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#' + endif + return a:value +endfunction + +function! s:create(parts, append) + let _ = '' + for idx in range(len(a:parts)) + let part = airline#parts#get(a:parts[idx]) + let val = '' + + if exists('part.function') + let func = (part.function).'()' + elseif exists('part.text') + let func = '"'.(part.text).'"' + else + if a:append > 0 && idx != 0 + let val .= s:spc.g:airline_left_alt_sep.s:spc + endif + if a:append < 0 && idx != 0 + let val = s:spc.g:airline_right_alt_sep.s:spc.val + endif + if exists('part.raw') + let _ .= s:wrap_accent(part, val.(part.raw)) + continue + else + let _ .= s:wrap_accent(part, val.a:parts[idx]) + continue + endif + endif + + let minwidth = get(part, 'minwidth', 0) + + if a:append > 0 && idx != 0 + let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth) + elseif a:append < 0 && idx != len(a:parts) - 1 + let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) + else + let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) + endif + + if exists('part.condition') + let partval = substitute(partval, '{', '{'.(part.condition).' ? ', '') + let partval = substitute(partval, '}', ' : ""}', '') + endif + + let val .= s:wrap_accent(part, partval) + let _ .= val + endfor + return _ +endfunction + +function! airline#section#create(parts) + return s:create(a:parts, 0) +endfunction + +function! airline#section#create_left(parts) + return s:create(a:parts, 1) +endfunction + +function! airline#section#create_right(parts) + return s:create(a:parts, -1) +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes.vim b/sources_non_forked/vim-airline/autoload/airline/themes.vim new file mode 100644 index 00000000..110a9dc3 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes.vim @@ -0,0 +1,67 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" generates a dictionary which defines the colors for each highlight group +function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) + let palette = { + \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , + \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , + \ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] , + \ } + + if a:0 > 0 + call extend(palette, { + \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , + \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , + \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , + \ }) + else + call extend(palette, { + \ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] , + \ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] , + \ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] , + \ }) + endif + + return palette +endfunction + +function! airline#themes#get_highlight(group, ...) + return call('airline#highlighter#get_highlight', [a:group] + a:000) +endfunction + +function! airline#themes#get_highlight2(fg, bg, ...) + return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) +endfunction + +function! airline#themes#patch(palette) + for mode in keys(a:palette) + if !has_key(a:palette[mode], 'airline_warning') + let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] + endif + endfor + + let a:palette.accents = get(a:palette, 'accents', {}) + let a:palette.accents.bold = [ '', '', '', '', 'bold' ] + let a:palette.accents.italic = [ '', '', '', '', 'italic' ] + + if !has_key(a:palette.accents, 'red') + let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] + endif + if !has_key(a:palette.accents, 'green') + let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] + endif + if !has_key(a:palette.accents, 'blue') + let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] + endif + if !has_key(a:palette.accents, 'yellow') + let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] + endif + if !has_key(a:palette.accents, 'orange') + let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] + endif + if !has_key(a:palette.accents, 'purple') + let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] + endif +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/badwolf.vim b/sources_non_forked/vim-airline/autoload/airline/themes/badwolf.vim new file mode 100644 index 00000000..41a25d1f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/badwolf.vim @@ -0,0 +1,52 @@ +let s:N1 = [ '#141413' , '#aeee00' , 232 , 154 ] " blackestgravel & lime +let s:N2 = [ '#f4cf86' , '#45413b' , 222 , 238 ] " dirtyblonde & deepgravel +let s:N3 = [ '#8cffba' , '#242321' , 121 , 235 ] " saltwatertaffy & darkgravel +let s:N4 = [ '#666462' , 241 ] " mediumgravel + +let s:I1 = [ '#141413' , '#0a9dff' , 232 , 39 ] " blackestgravel & tardis +let s:I2 = [ '#f4cf86' , '#005fff' , 222 , 27 ] " dirtyblonde & facebook +let s:I3 = [ '#0a9dff' , '#242321' , 39 , 235 ] " tardis & darkgravel + +let s:V1 = [ '#141413' , '#ffa724' , 232 , 214 ] " blackestgravel & orange +let s:V2 = [ '#000000' , '#fade3e' , 16 , 221 ] " coal & dalespale +let s:V3 = [ '#000000' , '#b88853' , 16 , 137 ] " coal & toffee +let s:V4 = [ '#c7915b' , 173 ] " coffee + +let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde +let s:RE = [ '#ff9eb8' , 211 ] " dress + +let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] + +let g:airline#themes#badwolf#palette = {} + +let g:airline#themes#badwolf#palette.accents = { + \ 'red': [ '#ff2c4b' , '' , 196 , '' , '' ] + \ } + +let g:airline#themes#badwolf#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#badwolf#palette.normal_modified = { + \ 'airline_b': [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , + \ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } + + +let g:airline#themes#badwolf#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#badwolf#palette.insert_modified = { + \ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } +let g:airline#themes#badwolf#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] } + + +let g:airline#themes#badwolf#palette.replace = copy(airline#themes#badwolf#palette.insert) +let g:airline#themes#badwolf#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ] +let g:airline#themes#badwolf#palette.replace_modified = g:airline#themes#badwolf#palette.insert_modified + + +let g:airline#themes#badwolf#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#badwolf#palette.visual_modified = { + \ 'airline_c': [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } + + +let g:airline#themes#badwolf#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#badwolf#palette.inactive_modified = { + \ 'airline_c': [ s:V1[1] , '' , s:V1[3] , '' , '' ] } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/base16.vim b/sources_non_forked/vim-airline/autoload/airline/themes/base16.vim new file mode 100644 index 00000000..469435e9 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/base16.vim @@ -0,0 +1,107 @@ +if get(g:, 'airline#themes#base16#constant', 0) + let g:airline#themes#base16#palette = {} + + " Color palette + let s:gui_dark_gray = '#202020' + let s:cterm_dark_gray = 234 + let s:gui_med_gray_hi = '#303030' + let s:cterm_med_gray_hi = 236 + let s:gui_med_gray_lo = '#3a3a3a' + let s:cterm_med_gray_lo = 237 + let s:gui_light_gray = '#505050' + let s:cterm_light_gray = 239 + let s:gui_green = '#99cc99' + let s:cterm_green = 151 + let s:gui_blue = '#6a9fb5' + let s:cterm_blue = 67 + let s:gui_purple = '#aa759f' + let s:cterm_purple = 139 + let s:gui_orange = '#d28445' + let s:cterm_orange = 173 + let s:gui_red = '#ac4142' + let s:cterm_red = 131 + let s:gui_pink = '#d7afd7' + let s:cterm_pink = 182 + + " Normal mode + let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] + let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] + let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#base16#palette.normal_modified = { + \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], + \ } + + " Insert mode + let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] + let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) + let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified) + let g:airline#themes#base16#palette.insert_paste = { + \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], + \ } + + " Replace mode + let g:airline#themes#base16#palette.replace = { + \ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], + \ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], + \ } + let g:airline#themes#base16#palette.replace_modified = copy(g:airline#themes#base16#palette.insert_modified) + + " Visual mode + let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] + let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) + let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified) + + " Inactive window + let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] + let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#base16#palette.inactive_modified = { + \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], + \ } +else + function! airline#themes#base16#refresh() + let g:airline#themes#base16#palette = {} + + let g:airline#themes#base16#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold') + let s:N2 = airline#themes#get_highlight('Visual') + let s:N3 = airline#themes#get_highlight('CursorLine') + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + + let group = airline#themes#get_highlight('vimCommand') + let g:airline#themes#base16#palette.normal_modified = { + \ 'statusline': [ group[0], '', group[2], '', '' ] + \ } + + let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold') + let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg']) + let s:I3 = s:N3 + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified + + let s:R1 = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified + + let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') + let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) + let s:V3 = s:N3 + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified + + let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) + let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#base16#palette.inactive_modified = { + \ 'airline_c': [ group[0], '', group[2], '', '' ] + \ } + endfunction + call airline#themes#base16#refresh() +endif + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim new file mode 100644 index 00000000..d18e0324 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim @@ -0,0 +1,62 @@ +" Color palette +let s:gui_dark_gray = '#303030' +let s:cterm_dark_gray = 236 +let s:gui_med_gray_hi = '#444444' +let s:cterm_med_gray_hi = 238 +let s:gui_med_gray_lo = '#3a3a3a' +let s:cterm_med_gray_lo = 237 +let s:gui_light_gray = '#b2b2b2' +let s:cterm_light_gray = 249 +let s:gui_green = '#afd787' +let s:cterm_green = 150 +let s:gui_blue = '#87afd7' +let s:cterm_blue = 110 +let s:gui_purple = '#afafd7' +let s:cterm_purple = 146 +let s:gui_orange = '#d7af5f' +let s:cterm_orange = 179 +let s:gui_red = '#d78787' +let s:cterm_red = 174 +let s:gui_pink = '#d7afd7' +let s:cterm_pink = 182 + +let g:airline#themes#bubblegum#palette = {} + +" Normal mode +let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] +let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] +let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#bubblegum#palette.normal_modified = { + \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], + \ } + +" Insert mode +let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] +let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) +let g:airline#themes#bubblegum#palette.insert_modified = copy(g:airline#themes#bubblegum#palette.normal_modified) +let g:airline#themes#bubblegum#palette.insert_paste = { + \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], + \ } + +" Replace mode +let g:airline#themes#bubblegum#palette.replace = { + \ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], + \ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], + \ } +let g:airline#themes#bubblegum#palette.replace_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) + +" Visual mode +let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] +let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) +let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) + +" Inactive window +let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] +let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#bubblegum#palette.inactive_modified = { + \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], + \ } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/dark.vim b/sources_non_forked/vim-airline/autoload/airline/themes/dark.vim new file mode 100644 index 00000000..217b2f1f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/dark.vim @@ -0,0 +1,102 @@ +" Each theme is contained in its own file and declares variables scoped to the +" file. These variables represent the possible "modes" that airline can +" detect. The mode is the return value of mode(), which gets converted to a +" readable string. The following is a list currently supported modes: normal, +" insert, replace, visual, and inactive. +" +" Each mode can also have overrides. These are small changes to the mode that +" don't require a completely different look. "modified" and "paste" are two +" such supported overrides. These are simply suffixed to the major mode, +" separated by an underscore. For example, "normal_modified" would be normal +" mode where the current buffer is modified. +" +" The theming algorithm is a 2-pass system where the mode will draw over all +" parts of the statusline, and then the override is applied after. This means +" it is possible to specify a subset of the theme in overrides, as it will +" simply overwrite the previous colors. If you want simultaneous overrides, +" then they will need to change different parts of the statusline so they do +" not conflict with each other. +" +" First, let's define an empty dictionary and assign it to the "palette" +" variable. The # is a separator that maps with the directory structure. If +" you get this wrong, Vim will complain loudly. +let g:airline#themes#dark#palette = {} + +" First let's define some arrays. The s: is just a VimL thing for scoping the +" variables to the current script. Without this, these variables would be +" declared globally. Now let's declare some colors for normal mode and add it +" to the dictionary. The array is in the format: +" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid +" values for the "opt" value. +let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ] +let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ] +let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ] +let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + +" Here we define overrides for when the buffer is modified. This will be +" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are +" declared. +let g:airline#themes#dark#palette.normal_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } + + +let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ] +let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ] +let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ] +let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#dark#palette.insert_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } +let g:airline#themes#dark#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , + \ } + + +let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert) +let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] +let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified + + +let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ] +let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ] +let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ] +let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#dark#palette.visual_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } + + +let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] +let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] +let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] +let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) +let g:airline#themes#dark#palette.inactive_modified = { + \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , + \ } + + +" Accents are used to give parts within a section a slightly different look or +" color. Here we are defining a "red" accent, which is used by the 'readonly' +" part by default. Only the foreground colors are specified, so the background +" colors are automatically extracted from the underlying section colors. What +" this means is that regardless of which section the part is defined in, it +" will be red instead of the section's foreground color. You can also have +" multiple parts with accents within a section. +let g:airline#themes#dark#palette.accents = { + \ 'red': [ '#ff0000' , '' , 160 , '' ] + \ } + + +" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp +" variable so that related functionality is loaded iff the user is using +" ctrlp. Note that this is optional, and if you do not define ctrlp colors +" they will be chosen automatically from the existing palette. +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ], + \ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], + \ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ]) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/jellybeans.vim b/sources_non_forked/vim-airline/autoload/airline/themes/jellybeans.vim new file mode 100644 index 00000000..201068c6 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/jellybeans.vim @@ -0,0 +1,52 @@ +let g:airline#themes#jellybeans#palette = {} + +" The name of the function must be 'refresh'. +function! airline#themes#jellybeans#refresh() + " This theme is an example of how to use helper functions to extract highlight + " values from the corresponding colorscheme. It was written in a hurry, so it + " is very minimalistic. If you are a jellybeans user and want to make updates, + " please send pull requests. + + " Here are examples where the entire highlight group is copied and an airline + " compatible color array is generated. + let s:N1 = airline#themes#get_highlight('DbgCurrent', 'bold') + let s:N2 = airline#themes#get_highlight('Folded') + let s:N3 = airline#themes#get_highlight('NonText') + + let g:airline#themes#jellybeans#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#jellybeans#palette.normal_modified = { + \ 'airline_c': [ '#ffb964', '', 215, '', '' ] + \ } + + let s:I1 = airline#themes#get_highlight('DiffAdd', 'bold') + let s:I2 = s:N2 + let s:I3 = s:N3 + let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#jellybeans#palette.insert_modified = g:airline#themes#jellybeans#palette.normal_modified + + let s:R1 = airline#themes#get_highlight('WildMenu', 'bold') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#jellybeans#palette.replace_modified = g:airline#themes#jellybeans#palette.normal_modified + + " Sometimes you want to mix and match colors from different groups, you can do + " that with this method. + let s:V1 = airline#themes#get_highlight2(['TabLineSel', 'bg'], ['DiffDelete', 'bg'], 'bold') + let s:V2 = s:N2 + let s:V3 = s:N3 + let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#jellybeans#palette.visual_modified = g:airline#themes#jellybeans#palette.normal_modified + + " And of course, you can always do it manually as well. + let s:IA = [ '#444444', '#1c1c1c', 237, 234 ] + let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#jellybeans#palette.inactive_modified = g:airline#themes#jellybeans#palette.normal_modified +endfunction + +call airline#themes#jellybeans#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/laederon.vim b/sources_non_forked/vim-airline/autoload/airline/themes/laederon.vim new file mode 100644 index 00000000..115c1079 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/laederon.vim @@ -0,0 +1,62 @@ +" vim-airline companion theme of Laederon +" (https://github.com/Donearm/Laederon) + +" Normal mode +let s:N1 = [ '#1a1a18' , '#ffffff' , 232 , 255 ] " blackestgravel & snow +let s:N2 = [ '#ffffff' , '#44403a' , 255, 238 ] " snow & deepgravel +let s:N3 = [ '#90a680' , '#2e2d2a' , 64, 235 ] " dilutedpaint & darkgravel +let s:N4 = [ '#777470' , 240 ] " gravel + +" Insert mode +let s:I1 = [ '#1a1a18' , '#1693a5' , 232 , 62 ] " blackestgravel & crystallake +let s:I2 = [ '#515744' , '#44403a' , 101 , 238 ] " lichen & deepgravel +let s:I3 = [ '#1693a5' , '#2e2d2a' , 39 , 235 ] " crystallake & darkgravel + +" Visual mode +let s:V1 = [ '#1a1a18' , '#ab3e5d' , 232 , 161 ] " blackestgravel & raspberry +let s:V2 = [ '#000000' , '#908571' , 16 , 252 ] " coal & winterterrain +let s:V3 = [ '#ab3e5d' , '#8c7f77' , 161 , 245 ] " raspberry & wetcoldterrain +let s:V4 = [ '#515744' , 101 ] " lichen + +" Replace mode +let s:RE = [ '#233e09' , 22 ] " oakleaf + +" Paste mode +let s:PA = [ '#ab3e5d' , 161 ] " raspberry + +let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ] + + +let g:airline#themes#laederon#palette = {} + +let g:airline#themes#laederon#palette.accents = { + \ 'red': [ '#ef393d' , '' , 196 , '' , '' ] + \ } + +let g:airline#themes#laederon#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#laederon#palette.normal_modified = { + \ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , + \ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } + + +let g:airline#themes#laederon#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#laederon#palette.insert_modified = { + \ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] } +let g:airline#themes#laederon#palette.insert_paste = { + \ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] } + + +let g:airline#themes#laederon#palette.replace = copy(airline#themes#laederon#palette.insert) +let g:airline#themes#laederon#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ] +let g:airline#themes#laederon#palette.replace_modified = g:airline#themes#laederon#palette.insert_modified + + +let g:airline#themes#laederon#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#laederon#palette.visual_modified = { + \ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } + + +let g:airline#themes#laederon#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#laederon#palette.inactive_modified = { + \ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/light.vim b/sources_non_forked/vim-airline/autoload/airline/themes/light.vim new file mode 100644 index 00000000..d9fe8441 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/light.vim @@ -0,0 +1,45 @@ +let g:airline#themes#light#palette = {} + +let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ] +let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ] +let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ] +let g:airline#themes#light#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#light#palette.normal_modified = { + \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , + \ } + + +let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ] +let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ] +let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ] +let g:airline#themes#light#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#light#palette.insert_modified = { + \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , + \ } +let g:airline#themes#light#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , + \ } + + +let g:airline#themes#light#palette.replace = copy(g:airline#themes#light#palette.insert) +let g:airline#themes#light#palette.replace.airline_a = [ s:I2[0] , '#ff0000' , s:I1[2] , 196 , '' ] +let g:airline#themes#light#palette.replace_modified = g:airline#themes#light#palette.insert_modified + + +let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ] +let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ] +let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ] +let g:airline#themes#light#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#light#palette.visual_modified = { + \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , + \ } + + +let s:IA1 = [ '#666666' , '#b2b2b2' , 242 , 249 , '' ] +let s:IA2 = [ '#8a8a8a' , '#d0d0d0' , 245 , 252 , '' ] +let s:IA3 = [ '#a8a8a8' , '#ffffff' , 248 , 255 , '' ] +let g:airline#themes#light#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) +let g:airline#themes#light#palette.inactive_modified = { + \ 'airline_c': [ '#df0000' , '' , 160 , '' , '' ] , + \ } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/lucius.vim b/sources_non_forked/vim-airline/autoload/airline/themes/lucius.vim new file mode 100644 index 00000000..e3869007 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/lucius.vim @@ -0,0 +1,56 @@ +let g:airline#themes#lucius#palette = {} + +function! airline#themes#lucius#refresh() + + let s:N1 = airline#themes#get_highlight('StatusLine') + let s:N2 = airline#themes#get_highlight('Folded') + let s:N3 = airline#themes#get_highlight('CursorLine') + let g:airline#themes#lucius#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + + let modified_group = airline#themes#get_highlight('Statement') + let g:airline#themes#lucius#palette.normal_modified = { + \ 'airline_c': [modified_group[0], '', modified_group[2], '', ''] + \ } + + let warning_group = airline#themes#get_highlight('DiffDelete') + let g:airline#themes#lucius#palette.normal.airline_warning = warning_group + let g:airline#themes#lucius#palette.normal_modified.airline_warning = warning_group + + let s:I1 = airline#themes#get_highlight('DiffAdd') + let s:I2 = s:N2 + let s:I3 = s:N3 + let g:airline#themes#lucius#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#lucius#palette.insert_modified = g:airline#themes#lucius#palette.normal_modified + let g:airline#themes#lucius#palette.insert.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning + let g:airline#themes#lucius#palette.insert_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning + + let s:R1 = airline#themes#get_highlight('DiffChange') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#lucius#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#lucius#palette.replace_modified = g:airline#themes#lucius#palette.normal_modified + let g:airline#themes#lucius#palette.replace.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning + let g:airline#themes#lucius#palette.replace_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning + + let s:V1 = airline#themes#get_highlight('Cursor') + let s:V2 = s:N2 + let s:V3 = s:N3 + let g:airline#themes#lucius#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#lucius#palette.visual_modified = g:airline#themes#lucius#palette.normal_modified + let g:airline#themes#lucius#palette.visual.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning + let g:airline#themes#lucius#palette.visual_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning + + let s:IA = airline#themes#get_highlight('StatusLineNC') + let g:airline#themes#lucius#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#lucius#palette.inactive_modified = { + \ 'airline_c': [ modified_group[0], '', modified_group[2], '', '' ] + \ } + + let g:airline#themes#lucius#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + +endfunction + +call airline#themes#lucius#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim b/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim new file mode 100644 index 00000000..0024188f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim @@ -0,0 +1,92 @@ +" vim-airline companion theme of Luna +" (https://github.com/Pychimp/vim-luna) + +let g:airline#themes#luna#palette = {} + +let g:airline#themes#luna#palette.accents = { + \ 'red': [ '#ffffff' , '' , 231 , '' , '' ], + \ } + + +let s:N1 = [ '#ffffff' , '#005252' , 231 , 36 ] +let s:N2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] +let s:N3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] +let g:airline#themes#luna#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#luna#palette.normal_modified = { + \ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , + \ } + + +let s:I1 = [ '#ffffff' , '#789f00' , 231 , 106 ] +let s:I2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] +let s:I3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] +let g:airline#themes#luna#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#luna#palette.insert_modified = { + \ 'airline_c': [ '#ffffff' , '#005e5e' , 255 , 52 , '' ] , + \ } +let g:airline#themes#luna#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#789f00' , s:I1[2] , 106 , '' ] , + \ } + + +let g:airline#themes#luna#palette.replace = copy(g:airline#themes#luna#palette.insert) +let g:airline#themes#luna#palette.replace.airline_a = [ s:I2[0] , '#920000' , s:I2[2] , 88 , '' ] +let g:airline#themes#luna#palette.replace_modified = g:airline#themes#luna#palette.insert_modified + +let s:V1 = [ '#ffff9a' , '#ff8036' , 222 , 208 ] +let s:V2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] +let s:V3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] +let g:airline#themes#luna#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#luna#palette.visual_modified = { + \ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , + \ } + +let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ] +let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#luna#palette.inactive_modified = { + \ 'airline_c': [ '#450000' , '' , 52 , '' , '' ] , + \ } + +let g:airline#themes#luna#palette.tabline = { + \ 'airline_tab': ['#2aa198', '#003f3f', 231, 29, ''], + \ 'airline_tabsel': ['#ffffff', '#2e8b57', 231, 36, ''], + \ 'airline_tabtype': ['#ffffff', '#005252', 231, 36, ''], + \ 'airline_tabfill': ['#ffffff', '#002b2b', 231, 23, ''], + \ 'airline_tabmod': ['#ffffff', '#780000', 231, 88, ''], + \ } + +let s:WI = [ '#ffffff', '#5f0000', 231, 88 ] +let g:airline#themes#luna#palette.normal.airline_warning = [ + \ s:WI[0], s:WI[1], s:WI[2], s:WI[3] + \ ] + +let g:airline#themes#luna#palette.normal_modified.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.insert.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.insert_modified.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.visual.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.visual_modified.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.replace.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + +let g:airline#themes#luna#palette.replace_modified.airline_warning = + \ g:airline#themes#luna#palette.normal.airline_warning + + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#luna#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] , + \ [ '#ffffff' , '#005252' , 231 , 36 , '' ] , + \ [ '#ffffff' , '#973d45' , 231 , 95 , '' ] ) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/molokai.vim b/sources_non_forked/vim-airline/autoload/airline/themes/molokai.vim new file mode 100644 index 00000000..1998f002 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/molokai.vim @@ -0,0 +1,65 @@ +let g:airline#themes#molokai#palette = {} + +let g:airline#themes#molokai#palette.accents = { + \ 'red': [ '#66d9ef' , '' , 81 , '' , '' ], + \ } + + +" Normal mode +let s:N1 = [ '#080808' , '#e6db74' , 232 , 144 ] " mode +let s:N2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] " info +let s:N3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] " statusline + +let g:airline#themes#molokai#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#molokai#palette.normal_modified = { + \ 'airline_c': [ '#080808' , '#e6db74' , 232 , 144 , '' ] , + \ } + + +" Insert mode +let s:I1 = [ '#080808' , '#66d9ef' , 232 , 81 ] +let s:I2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] +let s:I3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] + +let g:airline#themes#molokai#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#molokai#palette.insert_modified = { + \ 'airline_c': [ '#080808' , '#66d9ef' , 232 , 81 , '' ] , + \ } + + +" Replace mode +let g:airline#themes#molokai#palette.replace = copy(g:airline#themes#molokai#palette.insert) +let g:airline#themes#molokai#palette.replace.airline_a = [ s:I1[0] , '#ef5939' , s:I1[2] , 166 , '' ] +let g:airline#themes#molokai#palette.replace_modified = { + \ 'airline_c': [ '#080808' , '#ef5939' , 232 , 166 , '' ] , + \ } + + +" Visual mode +let s:V1 = [ '#080808' , '#fd971f' , 232 , 208 ] +let s:V2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] +let s:V3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] + +let g:airline#themes#molokai#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#molokai#palette.visual_modified = { + \ 'airline_c': [ '#080808' , '#fd971f' , 232 , 208 , '' ] , + \ } + + +" Inactive +let s:IA = [ '#1b1d1e' , '#465457' , 233 , 67 , '' ] +let g:airline#themes#molokai#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#molokai#palette.inactive_modified = { + \ 'airline_c': [ '#f8f8f0' , '' , 253 , '' , '' ] , + \ } + + +" CtrlP +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#molokai#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#f8f8f0' , '#465457' , 253 , 67 , '' ] , + \ [ '#f8f8f0' , '#232526' , 253 , 16 , '' ] , + \ [ '#080808' , '#e6db74' , 232 , 144 , 'bold' ] ) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/monochrome.vim b/sources_non_forked/vim-airline/autoload/airline/themes/monochrome.vim new file mode 100644 index 00000000..7dd1a173 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/monochrome.vim @@ -0,0 +1,15 @@ +let g:airline#themes#monochrome#palette = {} + +function! airline#themes#monochrome#refresh() + let s:SL = airline#themes#get_highlight('StatusLine') + let g:airline#themes#monochrome#palette.normal = airline#themes#generate_color_map(s:SL, s:SL, s:SL) + let g:airline#themes#monochrome#palette.insert = g:airline#themes#monochrome#palette.normal + let g:airline#themes#monochrome#palette.replace = g:airline#themes#monochrome#palette.normal + let g:airline#themes#monochrome#palette.visual = g:airline#themes#monochrome#palette.normal + + let s:SLNC = airline#themes#get_highlight('StatusLineNC') + let g:airline#themes#monochrome#palette.inactive = airline#themes#generate_color_map(s:SLNC, s:SLNC, s:SLNC) +endfunction + +call airline#themes#monochrome#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/murmur.vim b/sources_non_forked/vim-airline/autoload/airline/themes/murmur.vim new file mode 100644 index 00000000..adebf3bd --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/murmur.vim @@ -0,0 +1,46 @@ +let g:airline#themes#murmur#palette = {} + +let s:termbg = 237 " Background for branch and file format blocks +let s:termbg2= 234 " Background for middle block +let s:normalbg= 27 " Background for normal mode and file position blocks +let s:insertbg= 70 " Background for insert mode and file position blocks +let s:visualbg= 166 " Background for visual mode and file position blocks +let s:replacebg=88 " Background for replace mode and file position blocks +let s:alert= 88 " Modefied file alert color + +let s:BB = ['#AFAF87', '#5F5F5F', 144, s:termbg] " Branch and file format blocks + +let s:N1 = ['#FFFFFF', '#5F87FF', 15, s:normalbg] " Outside blocks in normal mode +let s:N2 = ['#AFAF87', '#5F5F5F', 39, s:termbg2] " Middle block +let g:airline#themes#murmur#palette.normal = airline#themes#generate_color_map(s:N1, s:BB, s:N2) +let g:airline#themes#murmur#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', s:alert, s:termbg2, 'bold'] ,} + +let s:I1 = ['#FFFFFF', '#87AF5F', 15, s:insertbg] " Outside blocks in insert mode +let s:I2 = ['#AFAF87', '#5F5F5F', s:insertbg, s:termbg2] " Middle block +let g:airline#themes#murmur#palette.insert = airline#themes#generate_color_map(s:I1, s:BB, s:I2) +let g:airline#themes#murmur#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', s:alert, s:termbg2, 'bold'] ,} + +let s:R1 = ['#FFFFFF', '#870000', 15, s:replacebg] " Outside blocks in replace mode +let s:R2 = ['#AFAF87', '#5F5F5F', 255, s:termbg2] " Middle block +let g:airline#themes#murmur#palette.replace = airline#themes#generate_color_map(s:R1, s:BB, s:R2) +let g:airline#themes#murmur#palette.replace_modified = {'airline_c': ['#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,} + +let s:V1 = ['#FFFFFF', '#AF5F00', 15, s:visualbg] " Outside blocks in visual mode +let s:V2 = ['#AFAF87', '#5F5F5F', s:visualbg, s:termbg2] " Middle block +let g:airline#themes#murmur#palette.visual = airline#themes#generate_color_map(s:V1, s:BB, s:V2) +let g:airline#themes#murmur#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,} + +" Inactive mode +let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let g:airline#themes#murmur#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) + +" CtrlP plugin colors +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#murmur#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ ['#FFFFFF', '#5F87FF', 15, s:normalbg, ''], + \ ['#AFAF87', '#5F5F5F', 144, s:termbg, ''], + \ ['#AFAF87', '#5F5F5F', 39, s:termbg2, 'bold']) diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/powerlineish.vim b/sources_non_forked/vim-airline/autoload/airline/themes/powerlineish.vim new file mode 100644 index 00000000..d550e110 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/powerlineish.vim @@ -0,0 +1,46 @@ +" Theme to mimic the default colorscheme of powerline +" Not 100% the same so it's powerline... ish. +" +" Differences from default powerline: +" * Paste indicator isn't colored different +" * Far right hand section matches the color of the mode indicator +" +" Differences from other airline themes: +" * No color differences when you're in a modified buffer +" * Visual mode only changes the mode section. Otherwise +" it appears the same as normal mode + +" Normal mode " fg & bg +let s:N1 = [ '#005f00' , '#afd700' , 22 , 148 ] " darkestgreen & brightgreen +let s:N2 = [ '#9e9e9e' , '#303030' , 247 , 236 ] " gray8 & gray2 +let s:N3 = [ '#ffffff' , '#121212' , 231 , 233 ] " white & gray4 + +" Insert mode " fg & bg +let s:I1 = [ '#005f5f' , '#ffffff' , 23 , 231 ] " darkestcyan & white +let s:I2 = [ '#5fafd7' , '#0087af' , 74 , 31 ] " darkcyan & darkblue +let s:I3 = [ '#87d7ff' , '#005f87' , 117 , 24 ] " mediumcyan & darkestblue + +" Visual mode " fg & bg +let s:V1 = [ '#080808' , '#ffaf00' , 232 , 214 ] " gray3 & brightestorange + +" Replace mode " fg & bg +let s:RE = [ '#ffffff' , '#d70000' , 231 , 160 ] " white & brightred + +let g:airline#themes#powerlineish#palette = {} + +let g:airline#themes#powerlineish#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + +let g:airline#themes#powerlineish#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#powerlineish#palette.insert_replace = { + \ 'airline_a': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ] } + +let g:airline#themes#powerlineish#palette.visual = { + \ 'airline_a': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ] } + +let g:airline#themes#powerlineish#palette.replace = copy(airline#themes#powerlineish#palette.normal) +let g:airline#themes#powerlineish#palette.replace.airline_a = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ] + + +let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] +let g:airline#themes#powerlineish#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/serene.vim b/sources_non_forked/vim-airline/autoload/airline/themes/serene.vim new file mode 100644 index 00000000..9191c077 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/serene.vim @@ -0,0 +1,41 @@ +let g:airline#themes#serene#palette = {} + +let s:guibg = '#080808' +let s:termbg = 232 +let s:termsep = 236 +let s:guisep = '#303030' + +let s:N1 = [ '#00dfff' , s:guibg , 45 , s:termbg ] +let s:N2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] +let s:N3 = [ '#767676' , s:guibg , 7 , s:termbg ] + +let g:airline#themes#serene#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#serene#palette.normal_modified = { + \ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] , + \ } + +let s:I1 = [ '#5fff00' , s:guibg , 82 , s:termbg ] +let s:I2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] +let s:I3 = [ '#767676' , s:guibg , 7 , s:termbg ] +let g:airline#themes#serene#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#serene#palette.insert_modified = copy(g:airline#themes#serene#palette.normal_modified) +let g:airline#themes#serene#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , + \ } + +let g:airline#themes#serene#palette.replace = { + \ 'airline_a': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] , + \ } +let g:airline#themes#serene#palette.replace_modified = copy(g:airline#themes#serene#palette.normal_modified) + +let s:V1 = [ '#dfdf00' , s:guibg , 184 , s:termbg ] +let s:V2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] +let s:V3 = [ '#767676' , s:guibg , 7 , s:termbg ] +let g:airline#themes#serene#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#serene#palette.visual_modified = copy(g:airline#themes#serene#palette.normal_modified) + +let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] +let s:IA2 = [ '#4e4e4e' , s:guisep , 239 , s:termsep , '' ] +let g:airline#themes#serene#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2) +let g:airline#themes#serene#palette.inactive_modified = copy(g:airline#themes#serene#palette.normal_modified) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/simple.vim b/sources_non_forked/vim-airline/autoload/airline/themes/simple.vim new file mode 100644 index 00000000..a111a1cb --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/simple.vim @@ -0,0 +1,46 @@ +let g:airline#themes#simple#palette = {} + +let s:guibg = '#080808' +let s:guibg2 = '#1c1c1c' +let s:termbg = 232 +let s:termbg2= 234 + +let s:N1 = [ s:guibg , '#00dfff' , s:termbg , 45 ] +let s:N2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] +let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg] +let g:airline#themes#simple#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#simple#palette.normal_modified = { + \ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] , + \ } + + +let s:I1 = [ s:guibg, '#5fff00' , s:termbg , 82 ] +let s:I2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] +let s:I3 = [ '#767676' , s:guibg, 243 , s:termbg ] +let g:airline#themes#simple#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#simple#palette.insert_modified = copy(g:airline#themes#simple#palette.normal_modified) +let g:airline#themes#simple#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , + \ } + + +let g:airline#themes#simple#palette.replace = { + \ 'airline_a': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] , + \ } +let g:airline#themes#simple#palette.replace_modified = copy(g:airline#themes#simple#palette.normal_modified) + + +let s:V1 = [ s:guibg, '#dfdf00' , s:termbg , 184 ] +let s:V2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] +let s:V3 = [ '#767676' , s:guibg, 243 , s:termbg ] +let g:airline#themes#simple#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#simple#palette.visual_modified = copy(g:airline#themes#simple#palette.normal_modified) + + +let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] +let s:IA2 = [ '#4e4e4e' , s:guibg2 , 239 , s:termbg2 , '' ] +let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2) +let g:airline#themes#simple#palette.inactive_modified = { + \ 'airline_c': [ '#df0000', '', 160, '', '' ] , + \ } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim b/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim new file mode 100644 index 00000000..31aa34fc --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim @@ -0,0 +1,90 @@ +" vim-airline companion theme of Sol +" (https://github.com/Pychimp/vim-sol) + +let g:airline#themes#sol#palette = {} + +let g:airline#themes#sol#palette.accents = { + \ 'red': [ '#ffffff' , '' , 231 , '' , '' ], + \ } + +let s:N1 = [ '#343434' , '#a0a0a0' , 237 , 248 ] +let s:N2 = [ '#343434' , '#b3b3b3' , 237 , 250 ] +let s:N3 = [ '#343434' , '#c7c7c7' , 237 , 252 ] +let g:airline#themes#sol#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#sol#palette.normal_modified = { + \ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , + \ } + + +let s:I1 = [ '#eeeeee' , '#09643f' , 255 , 30 ] +let s:I2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] +let s:I3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] +let g:airline#themes#sol#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#sol#palette.insert_modified = { + \ 'airline_c': [ '#ffffff' , '#ff6868' , 225 , 167 , '' ] , + \ } +let g:airline#themes#sol#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#09643f' , s:I1[2] , 30 , '' ] , + \ } + + +let g:airline#themes#sol#palette.replace = copy(g:airline#themes#sol#palette.insert) +let g:airline#themes#sol#palette.replace.airline_a = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ] +let g:airline#themes#sol#palette.replace.airline_z = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ] +let g:airline#themes#sol#palette.replace_modified = g:airline#themes#sol#palette.insert_modified + +let s:V1 = [ '#ffff9a' , '#ff6003' , 222 , 202 ] +let s:V2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] +let s:V3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] +let g:airline#themes#sol#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#sol#palette.visual_modified = { + \ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , + \ } + +let s:IA = [ '#777777' , '#c7c7c7' , 244 , 251 , '' ] +let g:airline#themes#sol#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#sol#palette.inactive_modified = { + \ 'airline_c': [ '#ff3535' , '' , 203 , '' , '' ] , + \ } + +let g:airline#themes#sol#palette.tabline = { + \ 'airline_tab': ['#343434', '#b3b3b3', 237, 250, ''], + \ 'airline_tabsel': ['#ffffff', '#004b9a', 231, 31 , ''], + \ 'airline_tabtype': ['#343434', '#a0a0a0', 237, 248, ''], + \ 'airline_tabfill': ['#343434', '#c7c7c7', 237, 251, ''], + \ 'airline_tabmod': ['#ffffff', '#ff6868', 231, 167, ''], + \ } + +let s:WI = [ '#eeeeee', '#ff0f38', 255, 201 ] +let g:airline#themes#sol#palette.normal.airline_warning = [ + \ s:WI[0], s:WI[1], s:WI[2], s:WI[3] + \ ] + +let g:airline#themes#sol#palette.normal_modified.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.insert.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.insert_modified.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.visual.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.visual_modified.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.replace.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +let g:airline#themes#sol#palette.replace_modified.airline_warning = + \ g:airline#themes#sol#palette.normal.airline_warning + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#sol#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#343434' , '#c7c7c7' , 237 , 251 , '' ] , + \ [ '#343434' , '#b3b3b3' , 237 , 250 , '' ] , + \ [ '#eeeeee' , '#007fff' , 255 , 27 , '' ] ) diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim b/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim new file mode 100644 index 00000000..db52bcf8 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim @@ -0,0 +1,173 @@ +let g:airline#themes#solarized#palette = {} + +function! airline#themes#solarized#refresh() + """""""""""""""""""""""""""""""""""""""""""""""" + " Options + """""""""""""""""""""""""""""""""""""""""""""""" + let s:background = get(g:, 'airline_solarized_bg', &background) + let s:ansi_colors = get(g:, 'solarized_termcolors', 16) != 256 && &t_Co >= 16 ? 1 : 0 + let s:tty = &t_Co == 8 + + """""""""""""""""""""""""""""""""""""""""""""""" + " Colors + """""""""""""""""""""""""""""""""""""""""""""""" + " Base colors + let s:base03 = {'t': s:ansi_colors ? 8 : (s:tty ? '0' : 234), 'g': '#002b36'} + let s:base02 = {'t': s:ansi_colors ? '0' : (s:tty ? '0' : 235), 'g': '#073642'} + let s:base01 = {'t': s:ansi_colors ? 10 : (s:tty ? '0' : 240), 'g': '#586e75'} + let s:base00 = {'t': s:ansi_colors ? 11 : (s:tty ? '7' : 241), 'g': '#657b83'} + let s:base0 = {'t': s:ansi_colors ? 12 : (s:tty ? '7' : 244), 'g': '#839496'} + let s:base1 = {'t': s:ansi_colors ? 14 : (s:tty ? '7' : 245), 'g': '#93a1a1'} + let s:base2 = {'t': s:ansi_colors ? 7 : (s:tty ? '7' : 254), 'g': '#eee8d5'} + let s:base3 = {'t': s:ansi_colors ? 15 : (s:tty ? '7' : 230), 'g': '#fdf6e3'} + let s:yellow = {'t': s:ansi_colors ? 3 : (s:tty ? '3' : 136), 'g': '#b58900'} + let s:orange = {'t': s:ansi_colors ? 9 : (s:tty ? '1' : 166), 'g': '#cb4b16'} + let s:red = {'t': s:ansi_colors ? 1 : (s:tty ? '1' : 160), 'g': '#dc322f'} + let s:magenta = {'t': s:ansi_colors ? 5 : (s:tty ? '5' : 125), 'g': '#d33682'} + let s:violet = {'t': s:ansi_colors ? 13 : (s:tty ? '5' : 61 ), 'g': '#6c71c4'} + let s:blue = {'t': s:ansi_colors ? 4 : (s:tty ? '4' : 33 ), 'g': '#268bd2'} + let s:cyan = {'t': s:ansi_colors ? 6 : (s:tty ? '6' : 37 ), 'g': '#2aa198'} + let s:green = {'t': s:ansi_colors ? 2 : (s:tty ? '2' : 64 ), 'g': '#859900'} + + """""""""""""""""""""""""""""""""""""""""""""""" + " Simple mappings + " NOTE: These are easily tweakable mappings. The actual mappings get + " the specific gui and terminal colors from the base color dicts. + """""""""""""""""""""""""""""""""""""""""""""""" + " Normal mode + if s:background == 'dark' + let s:N1 = [s:base3, s:base1, 'bold'] + let s:N2 = [s:base2, (s:tty ? s:base01 : s:base00), ''] + let s:N3 = [s:base01, s:base02, ''] + else + let s:N1 = [s:base2, s:base00, 'bold'] + let s:N2 = [(s:tty ? s:base01 : s:base2), s:base1, ''] + let s:N3 = [s:base1, s:base2, ''] + endif + let s:NF = [s:orange, s:N3[1], ''] + let s:NW = [s:base3, s:orange, ''] + if s:background == 'dark' + let s:NM = [s:base1, s:N3[1], ''] + else + let s:NM = [s:base01, s:N3[1], ''] + endif + + " Insert mode + let s:I1 = [s:N1[0], s:yellow, 'bold'] + let s:I2 = s:N2 + let s:I3 = s:N3 + let s:IF = s:NF + let s:IM = s:NM + + " Visual mode + let s:V1 = [s:N1[0], s:magenta, 'bold'] + let s:V2 = s:N2 + let s:V3 = s:N3 + let s:VF = s:NF + let s:VM = s:NM + + " Replace mode + let s:R1 = [s:N1[0], s:red, ''] + let s:R2 = s:N2 + let s:R3 = s:N3 + let s:RM = s:NM + let s:RF = s:NF + + " Inactive + if s:background == 'dark' + let s:IA = [s:base00, s:base02, ''] + else + let s:IA = [s:base1, s:base2, ''] + endif + + """""""""""""""""""""""""""""""""""""""""""""""" + " Actual mappings + " WARNING: Don't modify this section unless necessary. + """""""""""""""""""""""""""""""""""""""""""""""" + let s:NFa = [s:NF[0].g, s:NF[1].g, s:NF[0].t, s:NF[1].t, s:NF[2]] + let s:IFa = [s:IF[0].g, s:IF[1].g, s:IF[0].t, s:IF[1].t, s:IF[2]] + let s:VFa = [s:VF[0].g, s:VF[1].g, s:VF[0].t, s:VF[1].t, s:VF[2]] + let s:RFa = [s:RF[0].g, s:RF[1].g, s:RF[0].t, s:RF[1].t, s:RF[2]] + + let g:airline#themes#solarized#palette.accents = { + \ 'red': s:NFa, + \ } + + let g:airline#themes#solarized#palette.inactive = airline#themes#generate_color_map( + \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], + \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], + \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]]) + let g:airline#themes#solarized#palette.inactive_modified = { + \ 'airline_c': [s:NM[0].g, '', s:NM[0].t, '', s:NM[2]]} + + let g:airline#themes#solarized#palette.normal = airline#themes#generate_color_map( + \ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]], + \ [s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]], + \ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]]) + + let g:airline#themes#solarized#palette.normal.airline_warning = [ + \ s:NW[0].g, s:NW[1].g, s:NW[0].t, s:NW[1].t, s:NW[2]] + + let g:airline#themes#solarized#palette.normal_modified = { + \ 'airline_c': [s:NM[0].g, s:NM[1].g, + \ s:NM[0].t, s:NM[1].t, s:NM[2]]} + + let g:airline#themes#solarized#palette.normal_modified.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.insert = airline#themes#generate_color_map( + \ [s:I1[0].g, s:I1[1].g, s:I1[0].t, s:I1[1].t, s:I1[2]], + \ [s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]], + \ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]]) + + let g:airline#themes#solarized#palette.insert.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.insert_modified = { + \ 'airline_c': [s:IM[0].g, s:IM[1].g, + \ s:IM[0].t, s:IM[1].t, s:IM[2]]} + + let g:airline#themes#solarized#palette.insert_modified.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.visual = airline#themes#generate_color_map( + \ [s:V1[0].g, s:V1[1].g, s:V1[0].t, s:V1[1].t, s:V1[2]], + \ [s:V2[0].g, s:V2[1].g, s:V2[0].t, s:V2[1].t, s:V2[2]], + \ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]]) + + let g:airline#themes#solarized#palette.visual.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.visual_modified = { + \ 'airline_c': [s:VM[0].g, s:VM[1].g, + \ s:VM[0].t, s:VM[1].t, s:VM[2]]} + + let g:airline#themes#solarized#palette.visual_modified.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.replace = airline#themes#generate_color_map( + \ [s:R1[0].g, s:R1[1].g, s:R1[0].t, s:R1[1].t, s:R1[2]], + \ [s:R2[0].g, s:R2[1].g, s:R2[0].t, s:R2[1].t, s:R2[2]], + \ [s:R3[0].g, s:R3[1].g, s:R3[0].t, s:R3[1].t, s:R3[2]]) + + let g:airline#themes#solarized#palette.replace.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.replace_modified = { + \ 'airline_c': [s:RM[0].g, s:RM[1].g, + \ s:RM[0].t, s:RM[1].t, s:RM[2]]} + + let g:airline#themes#solarized#palette.replace_modified.airline_warning = + \ g:airline#themes#solarized#palette.normal.airline_warning + + let g:airline#themes#solarized#palette.tabline = {} + + let g:airline#themes#solarized#palette.tabline.airline_tab = [ + \ s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]] + + let g:airline#themes#solarized#palette.tabline.airline_tabtype = [ + \ s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]] +endfunction + +call airline#themes#solarized#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/tomorrow.vim b/sources_non_forked/vim-airline/autoload/airline/themes/tomorrow.vim new file mode 100644 index 00000000..f382fc14 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/tomorrow.vim @@ -0,0 +1,44 @@ +let g:airline#themes#tomorrow#palette = {} + +function! airline#themes#tomorrow#refresh() + let g:airline#themes#tomorrow#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold') + let s:N2 = airline#themes#get_highlight('Pmenu') + let s:N3 = airline#themes#get_highlight('CursorLine') + let g:airline#themes#tomorrow#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + + let group = airline#themes#get_highlight('vimCommand') + let g:airline#themes#tomorrow#palette.normal_modified = { + \ 'airline_c': [ group[0], '', group[2], '', '' ] + \ } + + let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold') + let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg']) + let s:I3 = s:N3 + let g:airline#themes#tomorrow#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#tomorrow#palette.insert_modified = g:airline#themes#tomorrow#palette.normal_modified + + let s:R1 = airline#themes#get_highlight('Error', 'bold') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#tomorrow#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#tomorrow#palette.replace_modified = g:airline#themes#tomorrow#palette.normal_modified + + let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') + let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) + let s:V3 = s:N3 + let g:airline#themes#tomorrow#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#tomorrow#palette.visual_modified = g:airline#themes#tomorrow#palette.normal_modified + + let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) + let g:airline#themes#tomorrow#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#tomorrow#palette.inactive_modified = { + \ 'airline_c': [ group[0], '', group[2], '', '' ] + \ } +endfunction + +call airline#themes#tomorrow#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/ubaryd.vim b/sources_non_forked/vim-airline/autoload/airline/themes/ubaryd.vim new file mode 100644 index 00000000..70232ef8 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/ubaryd.vim @@ -0,0 +1,64 @@ +" vim-airline companion theme of Ubaryd +" (https://github.com/Donearm/Ubaryd) + +" Normal mode +let s:N1 = [ '#141413' , '#c7b386' , 232 , 252 ] " blackestgravel & bleaksand +let s:N2 = [ '#c7b386' , '#45413b' , 252, 238 ] " bleaksand & deepgravel +let s:N3 = [ '#b88853' , '#242321' , 137, 235 ] " toffee & darkgravel +let s:N4 = [ '#857f78' , 243 ] " gravel + +" Insert mode +let s:I1 = [ '#1a1a18' , '#fade3e' , 232 , 221 ] " blackestgravel & warmcorn +let s:I2 = [ '#c7b386' , '#45413b' , 252 , 238 ] " bleaksand & deepgravel +let s:I3 = [ '#f4cf86' , '#242321' , 222 , 235 ] " lighttannedskin & darkgravel + +" Visual mode +let s:V1 = [ '#1c1b1a' , '#9a4820' , 233 , 88 ] " blackgravel & warmadobe +let s:V2 = [ '#000000' , '#88633f' , 16 , 95 ] " coal & cappuccino +let s:V3 = [ '#88633f' , '#c7b386' , 95 , 252 ] " cappuccino & bleaksand +let s:V4 = [ '#c14c3d' , 160 ] " tannedumbrella + +" Replace mode +let s:RE = [ '#c7915b' , 173 ] " nut + +" Paste mode +let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon + +let s:IA = [ s:N2[1], s:N3[1], s:N2[3], s:N3[3], '' ] + +let g:airline#themes#ubaryd#palette = {} + +let g:airline#themes#ubaryd#palette.accents = { + \ 'red': [ '#ff7400' , '' , 196 , '' , '' ], + \ } + +let g:airline#themes#ubaryd#palette.inactive = { + \ 'airline_a' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] } + + +let g:airline#themes#ubaryd#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#ubaryd#palette.normal_modified = { + \ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , + \ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } + + +let g:airline#themes#ubaryd#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#ubaryd#palette.insert_modified = { + \ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] } +let g:airline#themes#ubaryd#palette.insert_paste = { + \ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] } + + +let g:airline#themes#ubaryd#palette.replace = copy(airline#themes#ubaryd#palette.insert) +let g:airline#themes#ubaryd#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ] +let g:airline#themes#ubaryd#palette.replace_modified = g:airline#themes#ubaryd#palette.insert_modified + + +let g:airline#themes#ubaryd#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#ubaryd#palette.visual_modified = { + \ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } + +let g:airline#themes#ubaryd#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#ubaryd#palette.inactive_modified = { + \ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] } + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/understated.vim b/sources_non_forked/vim-airline/autoload/airline/themes/understated.vim new file mode 100644 index 00000000..b3e79179 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/understated.vim @@ -0,0 +1,43 @@ +let g:airline#themes#understated#palette = {} + +let s:N1 = ['#FFFFFF', '#5F87FF', 15, 69] " Outside blocks in normal mode (mode and file position) +let s:N2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format) +let s:N3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block + +let g:airline#themes#understated#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#understated#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', 144, 59, 'bold'] ,} + +let s:I1 = ['#FFFFFF', '#87AF5F', 15, 107] " Outside blocks in normal mode (mode and file position) +let s:I2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format) +let s:I3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block +let g:airline#themes#understated#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#understated#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,} +let g:airline#themes#understated#palette.insert_paste = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, ''] ,} + +let g:airline#themes#understated#palette.replace = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#understated#palette.replace.airline_a = ['#FFFFFF', '#870000', 15, 88, ''] +let g:airline#themes#understated#palette.replace_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,} + +let s:V1 = ['#FFFFFF', '#AF5F00', 15, 130] +let s:V2 = ['#AFAF87', '#5F5F5F', 144, 59] +let s:V3 = ['#AFAF87', '#5F5F5F', 144, 59] +let g:airline#themes#understated#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#understated#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', 144, 59, 'bold'] ,} + +let s:V1 = ['#080808', '#FFAF00', 232, 214] +let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] +let g:airline#themes#understated#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) +let g:airline#themes#understated#palette.inactive_modified = {'airline_c': ['#4E4E4E', '', 239, '', 'bold'] ,} + +let g:airline#themes#understated#palette.accents = {'red': ['#FF0000', '', 88, '']} + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#understated#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ ['#FFFFFF', '#1C1C1C', 15, 234, '' ], + \ ['#FFFFFF', '#262626', 15, 235, '' ], + \ ['#FFFFFF', '#303030', 15, 236, 'bold']) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/wombat.vim b/sources_non_forked/vim-airline/autoload/airline/themes/wombat.vim new file mode 100644 index 00000000..39fdc4c1 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/wombat.vim @@ -0,0 +1,90 @@ +" vim-airline companion theme of Wombat +" looks great with wombat256 vim colorscheme + +" Normal mode +" [ guifg, guibg, ctermfg, ctermbg, opts ] +let s:N1 = [ '#141413' , '#CAE682' , 232 , 192 ] " mode +let s:N2 = [ '#CAE682' , '#32322F' , 192 , 236 ] " info +let s:N3 = [ '#CAE682' , '#242424' , 192 , 234 ] " statusline +let s:N4 = [ '#86CD74' , 113 ] " mode modified + +" Insert mode +let s:I1 = [ '#141413' , '#FDE76E' , 232 , 227 ] +let s:I2 = [ '#FDE76E' , '#32322F' , 227 , 236 ] +let s:I3 = [ '#FDE76E' , '#242424' , 227 , 234 ] +let s:I4 = [ '#FADE3E' , 221 ] + +" Visual mode +let s:V1 = [ '#141413' , '#B5D3F3' , 232 , 153 ] +let s:V2 = [ '#B5D3F3' , '#32322F' , 153 , 236 ] +let s:V3 = [ '#B5D3F3' , '#242424' , 153 , 234 ] +let s:V4 = [ '#7CB0E6' , 111 ] + +" Replace mode +let s:R1 = [ '#141413' , '#E5786D' , 232 , 173 ] +let s:R2 = [ '#E5786D' , '#32322F' , 173 , 236 ] +let s:R3 = [ '#E5786D' , '#242424' , 173 , 234 ] +let s:R4 = [ '#E55345' , 203 ] + +" Paste mode +let s:PA = [ '#94E42C' , 47 ] + +" Info modified +let s:IM = [ '#40403C' , 238 ] + +" Inactive mode +let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ] + +let g:airline#themes#wombat#palette = {} + +let g:airline#themes#wombat#palette.accents = { + \ 'red': [ '#E5786D' , '' , 203 , '' , '' ], + \ } + +let g:airline#themes#wombat#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#wombat#palette.normal_modified = { + \ 'airline_a': [ s:N1[0] , s:N4[0] , s:N1[2] , s:N4[1] , '' ] , + \ 'airline_b': [ s:N4[0] , s:IM[0] , s:N4[1] , s:IM[1] , '' ] , + \ 'airline_c': [ s:N4[0] , s:N3[1] , s:N4[1] , s:N3[3] , '' ] } + + +let g:airline#themes#wombat#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#wombat#palette.insert_modified = { + \ 'airline_a': [ s:I1[0] , s:I4[0] , s:I1[2] , s:I4[1] , '' ] , + \ 'airline_b': [ s:I4[0] , s:IM[0] , s:I4[1] , s:IM[1] , '' ] , + \ 'airline_c': [ s:I4[0] , s:N3[1] , s:I4[1] , s:N3[3] , '' ] } + + +let g:airline#themes#wombat#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#wombat#palette.visual_modified = { + \ 'airline_a': [ s:V1[0] , s:V4[0] , s:V1[2] , s:V4[1] , '' ] , + \ 'airline_b': [ s:V4[0] , s:IM[0] , s:V4[1] , s:IM[1] , '' ] , + \ 'airline_c': [ s:V4[0] , s:N3[1] , s:V4[1] , s:N3[3] , '' ] } + + +let g:airline#themes#wombat#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) +let g:airline#themes#wombat#palette.replace_modified = { + \ 'airline_a': [ s:R1[0] , s:R4[0] , s:R1[2] , s:R4[1] , '' ] , + \ 'airline_b': [ s:R4[0] , s:IM[0] , s:R4[1] , s:IM[1] , '' ] , + \ 'airline_c': [ s:R4[0] , s:N3[1] , s:R4[1] , s:N3[3] , '' ] } + + +let g:airline#themes#wombat#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] , + \ 'airline_b': [ s:PA[0] , s:IM[0] , s:PA[1] , s:IM[1] , '' ] , + \ 'airline_c': [ s:PA[0] , s:N3[1] , s:PA[1] , s:N3[3] , '' ] } + + +let g:airline#themes#wombat#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#wombat#palette.inactive_modified = { + \ 'airline_c': [ s:N4[0] , '' , s:N4[1] , '' , '' ] } + + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#wombat#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#DADADA' , '#242424' , 253 , 234 , '' ] , + \ [ '#DADADA' , '#40403C' , 253 , 238 , '' ] , + \ [ '#141413' , '#DADADA' , 232 , 253 , 'bold' ] ) + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/zenburn.vim b/sources_non_forked/vim-airline/autoload/airline/themes/zenburn.vim new file mode 100644 index 00000000..9883c213 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/zenburn.vim @@ -0,0 +1,44 @@ +let g:airline#themes#zenburn#palette = {} + +function! airline#themes#zenburn#refresh() + let g:airline#themes#zenburn#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let s:N1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Folded', 'fg'], 'bold') + let s:N2 = airline#themes#get_highlight('Folded') + let s:N3 = airline#themes#get_highlight('NonText') + + let g:airline#themes#zenburn#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let s:Nmod = airline#themes#get_highlight('Comment') + let g:airline#themes#zenburn#palette.normal_modified = { + \ 'airline_c': s:Nmod + \ } + + let s:I1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['String', 'fg'], 'bold') + let s:I2 = airline#themes#get_highlight2(['String', 'fg'], ['Folded', 'bg']) + let s:I3 = s:N3 + let g:airline#themes#zenburn#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#zenburn#palette.insert_modified = g:airline#themes#zenburn#palette.normal_modified + + let s:R1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Comment', 'fg'], 'bold') + let s:R2 = airline#themes#get_highlight2(['Comment', 'fg'], ['Folded', 'bg']) + let s:R3 = s:N3 + let g:airline#themes#zenburn#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#zenburn#palette.replace_modified = g:airline#themes#zenburn#palette.normal_modified + + let s:V1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Identifier', 'fg'], 'bold') + let s:V2 = airline#themes#get_highlight2(['Identifier', 'fg'], ['Folded', 'bg']) + let s:V3 = s:N3 + let g:airline#themes#zenburn#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#zenburn#palette.visual_modified = g:airline#themes#zenburn#palette.normal_modified + + let s:IA = airline#themes#get_highlight('NonText') + let g:airline#themes#zenburn#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#zenburn#palette.inactive_modified = { + \ 'airline_c': s:Nmod + \ } +endfunction + +call airline#themes#zenburn#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/util.vim b/sources_non_forked/vim-airline/autoload/airline/util.vim new file mode 100644 index 00000000..b97c0866 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/util.vim @@ -0,0 +1,64 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +call airline#init#bootstrap() +let s:spc = g:airline_symbols.space + +function! airline#util#wrap(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + return a:text +endfunction + +function! airline#util#append(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc + return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text +endfunction + +function! airline#util#prepend(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc +endfunction + +if v:version >= 704 + function! airline#util#getwinvar(winnr, key, def) + return getwinvar(a:winnr, a:key, a:def) + endfunction +else + function! airline#util#getwinvar(winnr, key, def) + let winvals = getwinvar(a:winnr, '') + return get(winvals, a:key, a:def) + endfunction +endif + +if v:version >= 704 + function! airline#util#exec_funcrefs(list, ...) + for Fn in a:list + let code = call(Fn, a:000) + if code != 0 + return code + endif + endfor + return 0 + endfunction +else + function! airline#util#exec_funcrefs(list, ...) + " for 7.2; we cannot iterate the list, hence why we use range() + " for 7.3-[97, 328]; we cannot reuse the variable, hence the {} + for i in range(0, len(a:list) - 1) + let Fn{i} = a:list[i] + let code = call(Fn{i}, a:000) + if code != 0 + return code + endif + endfor + return 0 + endfunction +endif + diff --git a/sources_non_forked/vim-airline/doc/airline.txt b/sources_non_forked/vim-airline/doc/airline.txt new file mode 100644 index 00000000..2816c290 --- /dev/null +++ b/sources_non_forked/vim-airline/doc/airline.txt @@ -0,0 +1,677 @@ +*airline.txt* Lean and mean status/tabline that's light as air +*airline* + _ _ _ _ ~ + __ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~ + \ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~ + \ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~ + \_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~ + ~ +============================================================================== +CONTENTS *airline-contents* + + 01. Intro ............................................... |airline-intro| + 02. Features ......................................... |airline-features| + 03. Name ................................................. |airline-name| + 04. Configuration ............................... |airline-configuration| + 05. Commands ......................................... |airline-commands| + 06. Customization ............................... |airline-customization| + 07. Extensions ..................................... |airline-extensions| + 08. Advanced Customization ............. |airline-advanced-customization| + 09. Funcrefs ......................................... |airline-funcrefs| + 10. Pipeline ......................................... |airline-pipeline| + 11. Writing Extensions ..................... |airline-writing-extensions| + 12. Writing Themes ..................................... |airline-themes| + 13. Troubleshooting ........................... |airline-troubleshooting| + 14. Contributions ............................... |airline-contributions| + 15. License ........................................... |airline-license| + +============================================================================== +INTRODUCTION *airline-intro* + +vim-airline is a fast and lightweight alternative to powerline, written +in 100% vimscript with no outside dependencies. + +============================================================================== +FEATURES *airline-features* + +* tiny core written with extensibility in mind. +* integrates with many popular plugins. +* looks good with regular fonts, and provides configuration points so you + can use unicode or powerline symbols. +* optimized for speed; it loads in under a millisecond. +* fully customizable; if you know a little 'statusline' syntax you can + tweak it to your needs. +* extremely easy to write themes. + +============================================================================== +NAME *airline-name* + +Where did the name come from? + +I wrote this on an airplane, and since it's light as air it turned out to be a +good name :-) + +============================================================================== +CONFIGURATION *airline-configuration* + +There are a couple configuration values available (shown with their default +values): + +* the separator used on the left side > + let g:airline_left_sep='>' +< +* the separator used on the right side > + let g:airline_right_sep='<' +< +* enable modified detection > + let g:airline_detect_modified=1 + +* enable paste detection > + let g:airline_detect_paste=1 +< +* enable iminsert detection > + let g:airline_detect_iminsert=0 +< +* determine whether inactive windows should have the left section collapsed to + only the filename of that buffer. > + let g:airline_inactive_collapse=1 +< +* themes are automatically selected based on the matching colorscheme. this + can be overridden by defining a value. > + let g:airline_theme= +< +* if you want to patch the airline theme before it gets applied, you can + supply the name of a function where you can modify the palette. > + let g:airline_theme_patch_func = 'AirlineThemePatch' + function! AirlineThemePatch(palette) + if g:airline_theme == 'badwolf' + for colors in values(a:palette.inactive) + let colors[3] = 245 + endfor + endif + endfunction +< +* enable/disable automatic population of the `g:airline_symbols` dictionary + with powerline symbols. > + let g:airline_powerline_fonts=0 +< +* define the set of text to display for each mode. > + let g:airline_mode_map = {} " see source for the defaults + + " or copy paste the following into your vimrc for shortform text + let g:airline_mode_map = { + \ '__' : '-', + \ 'n' : 'N', + \ 'i' : 'I', + \ 'R' : 'R', + \ 'c' : 'C', + \ 'v' : 'V', + \ 'V' : 'V', + \ '' : 'V', + \ 's' : 'S', + \ 'S' : 'S', + \ '' : 'S', + \ } +< +* define the set of filename match queries which excludes a window from having + its statusline modified > + let g:airline_exclude_filenames = [] " see source for current list +< +* define the set of filetypes which are excluded from having its window + statusline modified > + let g:airline_exclude_filetypes = [] " see source for current list +< +* defines whether the preview window should be excluded from have its window + statusline modified (may help with plugins which use the preview window + heavily) > + let g:airline_exclude_preview = 0 +< +============================================================================== +COMMANDS *airline-commands* + +:AirlineTheme {theme-name} *:AirlineTheme* + Displays or changes the current theme. + +:AirlineToggleWhitespace *:AirlineToggleWhitespace* + Toggles whitespace detection. + +:AirlineToggle *:AirlineToggle* + Toggles between the standard 'statusline' and airline. + +:AirlineRefresh *:AirlineRefresh* + Refreshes all highlight groups. + +============================================================================== +CUSTOMIZATION *airline-customization* + +The following are some unicode symbols for customizing the left/right +separators, as well as the powerline font glyths. + +Note: You must define the dictionary first before setting values. Also, it's a +good idea to check whether if it exists as to avoid accidentally overwritting +its contents. > + if !exists('g:airline_symbols') + let g:airline_symbols = {} + endif + + " unicode symbols + let g:airline_left_sep = '»' + let g:airline_left_sep = '▶' + let g:airline_right_sep = '«' + let g:airline_right_sep = '◀' + let g:airline_symbols.linenr = '␊' + let g:airline_symbols.linenr = '␤' + let g:airline_symbols.linenr = '¶' + let g:airline_symbols.branch = '⎇' + let g:airline_symbols.paste = 'ρ' + let g:airline_symbols.paste = 'Þ' + let g:airline_symbols.paste = '∥' + let g:airline_symbols.whitespace = 'Ξ' + + " powerline symbols + let g:airline_left_sep = '' + let g:airline_left_alt_sep = '' + let g:airline_right_sep = '' + let g:airline_right_alt_sep = '' + let g:airline_symbols.branch = '' + let g:airline_symbols.readonly = '' + let g:airline_symbols.linenr = '' + + " old vim-powerline symbols + let g:airline_left_sep = '⮀' + let g:airline_left_alt_sep = '⮁' + let g:airline_right_sep = '⮂' + let g:airline_right_alt_sep = '⮃' + let g:airline_symbols.branch = '⭠' + let g:airline_symbols.readonly = '⭤' + let g:airline_symbols.linenr = '⭡' +< + +For more intricate customizations, you can replace the predefined sections +with the usual statusline syntax. + +Note: If you define any section variables it will replace the default values +entirely. If you want to disable only certain parts of a section you can try +using variables defined in the |airline-configuration| or |airline-extensions| +section. +> + variable names default contents + ---------------------------------------------------------------------------- + let g:airline_section_a (mode, paste, iminsert) + let g:airline_section_b (hunks, branch) + let g:airline_section_c (bufferline or filename) + let g:airline_section_gutter (readonly, csv) + let g:airline_section_x (tagbar, filetype, virtualenv) + let g:airline_section_y (fileencoding, fileformat) + let g:airline_section_z (percentage, line number, column number) + let g:airline_section_warning (syntastic, whitespace) + + " here is an example of how you could replace the branch indicator with + " the current working directory, followed by the filename. + let g:airline_section_b = '%{getcwd()}' + let g:airline_section_c = '%t' +< +============================================================================== +EXTENSIONS *airline-extensions* + +Most extensions are enabled by default and lazily loaded when the +corresponding plugin (if any) is detected. + +------------------------------------- *airline-default* +The default extension understands all of the `g:` variables in the +|airline-configuration| section, however it also has some more fine-tuned +configuration values that you can use. + +* control which sections get truncated and at what width. > + let g:airline#extensions#default#section_truncate_width = { + \ 'b': 79, + \ 'x': 60, + \ 'y': 88, + \ 'z': 45, + \ }) + + " Note: set to an empty dictionary to disable truncation. + let g:airline#extensions#default#section_truncate_width = {} +< +* configure the layout of the sections by specificing an array of two arrays + (first array is the left side, second array is the right side). > + let g:airline#extensions#default#layout = [ + \ [ 'a', 'b', 'c' ], + \ [ 'x', 'y', 'z', 'warning' ] + \ ]) +< + +------------------------------------- *airline-quickfix* +The quickfix extension is a simple built-in extension which determines +whether the buffer is a quickfix or location list buffer, and adjusts the +title accordingly. + +* configure the title text for quickfix buffers > + let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' +< +* configure the title text for location list buffers > + let g:airline#extensions#quickfix#location_text = 'Location' +< + +------------------------------------- *airline-bufferline* +vim-bufferline + +* enable/disable bufferline integration > + let g:airline#extensions#bufferline#enabled = 1 +< +* determine whether bufferline will overwrite customization variables > + let g:airline#extensions#bufferline#overwrite_variables = 1 +< +------------------------------------- *airline-branch* +fugitive.vim +lawrencium +vcscommand + +* enable/disable fugitive/lawrencium integration > + let g:airline#extensions#branch#enabled = 1 +< +* change the text for when no branch is detected > + let g:airline#extensions#branch#empty_message = '' + +* use vcscommand.vim if available > + let g:airline#extensions#branch#use_vcscommand = 0 +< +------------------------------------- *airline-syntastic* +syntastic + +* enable/disable syntastic integration > + let g:airline#extensions#syntastic#enabled = 1 +< +------------------------------------- *airline-tagbar* +tagbar + +* enable/disable tagbar integration > + let g:airline#extensions#tagbar#enabled = 1 +< +* change how tags are displayed (:help tagbar-statusline) > + let g:airline#extensions#tagbar#flags = '' "default + let g:airline#extensions#tagbar#flags = 'f' + let g:airline#extensions#tagbar#flags = 's' + let g:airline#extensions#tagbar#flags = 'p' +< +------------------------------------- *airline-csv* +csv.vim + +* enable/disable csv integration for displaying the current column. > + let g:airline#extensions#csv#enabled = 1 +< +* change how columns are displayed. > + let g:airline#extensions#csv#column_display = 'Number' (default) + let g:airline#extensions#csv#column_display = 'Name' +< +------------------------------------- *airline-hunks* +vim-gitgutter +vim-signify + +* enable/disable showing a summary of changed hunks under source control. > + let g:airline#extensions#hunks#enabled = 1 +< +* enable/disable showing only non-zero hunks. > + let g:airline#extensions#hunks#non_zero_only = 0 +< +* set hunk count symbols. > + let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] +< +------------------------------------- *airline-ctrlp* +ctrlp + +* configure which mode colors should ctrlp window use (takes effect + only if the active airline theme doesn't define ctrlp colors) > + let g:airline#extensions#ctrlp#color_template = 'insert' (default) + let g:airline#extensions#ctrlp#color_template = 'normal' + let g:airline#extensions#ctrlp#color_template = 'visual' + let g:airline#extensions#ctrlp#color_template = 'replace' +< + +* configure whether to show the previous and next modes (mru, buffer, etc...) +> + let g:airline#extensions#ctrlp#show_adjacent_modes = 1 +< +------------------------------------- *airline-virtualenv* +virtualenv + +* enable/disable virtualenv integration > + let g:airline#extensions#virtualenv#enabled = 1 +< +------------------------------------- *airline-eclim* +eclim + +* enable/disable eclim integration, which works well with the + |airline-syntastic| extension. > + let g:airline#extensions#eclim#enabled = 1 + +------------------------------------- *airline-whitespace* +* enable/disable detection of whitespace errors. > + let g:airline#extensions#whitespace#enabled = 1 +< +* customize the whitespace symbol. > + let g:airline#extensions#whitespace#symbol = '!' +< +* configure which whitespace checks to enable. > + let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ] +< +* configure whether a message should be displayed. > + let g:airline#extensions#whitespace#show_message = 1 +< +* configure the formatting of the warning messages. > + let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' + let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' +< +------------------------------------- *airline-tabline* +* enable/disable enhanced tabline. > + let g:airline#extensions#tabline#enabled = 0 +< +* enable/disable displaying buffers with a single tab. > + let g:airline#extensions#tabline#show_buffers = 1 +< +* configure filename match rules to exclude from the tabline. > + let g:airline#extensions#tabline#excludes = [] +< +* configure how numbers are calculated in tab mode. > + let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default) + let g:airline#extensions#tabline#tab_nr_type = 1 " tab number +< +* defines the name of a formatter for how buffer names are displayed. > + let g:airline#extensions#tabline#formatter = 'default' + + " here is how you can define a 'foo' formatter: + function! airline#extensions#tabline#formatters#foo(bufnr, buffers) + return fnamemodify(bufname(a:bufnr), ':t') + endfunction + let g:airline#extensions#tabline#formatter = 'foo' +< + Note: the following variables are only used by the 'default' formatter. + + * configure whether buffer numbers should be shown. > + let g:airline#extensions#tabline#buffer_nr_show = 0 +< + * configure how buffer numbers should be formatted with |printf|. > + let g:airline#extensions#tabline#buffer_nr_format = '%s: ' +< + * configure the formatting of filenames (see |filename-modifiers|). > + let g:airline#extensions#tabline#fnamemod = ':p:.' +< + * configure collapsing parent directories in buffer name. > + let g:airline#extensions#tabline#fnamecollapse = 1 + + " The `unique_tail` algorithm will display the tail of the filename, unless + " there is another file of the same name, in which it will display it along + " with the containing parent directory. + let g:airline#extensions#tabline#formatter = 'unique_tail' +< +* configure the minimum number of buffers needed to show the tabline. > + let g:airline#extensions#tabline#buffer_min_count = 0 +< + Note: this setting only applies to a single tab and when `show_buffers` is + true. + +* configure the minimum number of tabs needed to show the tabline. > + let g:airline#extensions#tabline#tab_min_count = 0 +< + Note: this setting only applies when `show_buffers` is false. + +* configure separators for the tabline only. > + let g:airline#extensions#tabline#left_sep = '' + let g:airline#extensions#tabline#left_alt_sep = '' + let g:airline#extensions#tabline#right_sep = '' + let g:airline#extensions#tabline#right_alt_sep = '' +< +Note: Enabling this extension will modify 'showtabline' and 'guioptions'. + +============================================================================== +ADVANCED CUSTOMIZATION *airline-advanced-customization* + +The defaults will accomodate the mass majority of users with minimal +configuration. However, if you want to reposition sections or contents you can +do so with built-in helper functions, which makes it possible to create +sections in a more declarative style. + +------------------------------------- *airline-parts* +A part is something that contains metadata that eventually gets rendered into +the statusline. You can define parts that contain constant strings or +functions. Defining parts is needed if you want to use features like automatic +insertion of separators or hiding based on window width. + +For example, this is how you would define a part function: > + call airline#parts#define_function('foo', 'GetFooText') +< +Here is how you would define a part that is visible only if the window width +greater than a minimum width. > + call airline#parts#define_minwidth('foo', 50) +< +Parts can be configured to be visible conditionally. > + call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"') +< +Note: Part definitions are combinative; e.g. the two examples above modify the +same `foo` part. + +Note: Look at the source code and tests for the full API. + +------------------------------------- *airline-predefined-parts* +Before is a list of parts that are predefined by vim-airline. + +* `mode` displays the current mode +* `iminsert` displays the current insert method +* `paste` displays the paste indicator +* `filetype` displays the file type +* `readonly` displays the read only indicator +* `file` displays the filename and modified indicator +* `ffenc` displays the file format and encoding + +And the following are defined for their respective extensions: + +`hunks`, `branch`, `tagbar`, `syntastic`, `whitespace` + +------------------------------------- *airline-accents* +Accents can be defined on any part, like so: > + call airline#parts#define_accent('foo', 'red') +< +This will override the colors of that part by using what is defined in that +particular accent. In the above example, the `red` accent is used, which means +regardless of which section the part is used in, it will have red foreground +colors instead of the section's default foreground color. + +The following accents are defined by default. Themes can define their variants +of the colors, but defaults will be provided if missing. > + bold, italic, red, green, blue, yellow, orange, purple +< +The defaults configure the mode and line number parts to be bold, and the +readonly part to be red. + +------------------------------------- *airline-sections* +Once a part is defined, you can use helper functions to generate the +statuslines for each section. For example, to use the part above, we could +define a section like this: > + function! AirlineInit() + let g:airline_section_a = airline#section#create(['mode', ' ', 'foo']) + let g:airline_section_b = airline#section#create_left(['ffenc','file']) + let g:airline_section_c = airline#section#create(['%{getcwd()}']) + endfunction + autocmd VimEnter * call AirlineInit() +< +This will create a section with the `mode`, followed by a space, and our `foo` +part in section `a`. Section `b` will have two parts with a left-side +separator. And section `c` will contain the current path. You may notice that +the space and cwd are not defined parts. For convenience, if a part of that +key does not exist, it will be inserted as is. The unit tests will be a good +resource for possibilities. + +Note: The use of |VimEnter| is important, because most extensions are lazily +loaded, so we must give them a chance to define their parts before we can use +them. + +Note: The `airline#section#create` function and friends will do its best to +create a section with the appropriate separators, but it only works for +function and text parts. Special 'statusline' items like %f or raw/undefined +parts will not work as it is not possible to inspect their widths/contents +before rendering to the statusline. + +============================================================================== +FUNCREFS *airline-funcrefs* + +vim-airline internally uses funcrefs to integrate with third party plugins, +and you can tap into this functionality to extend it for you needs. This is +the most powerful way to customize the statusline, and sometimes it may be +easier to go this route than the above methods. + +Every section can have two values. The default value is the global `g:` +variable which is used in the absense of a `w:` value. This makes it very easy +to override only certain parts of the statusline by only defining window-local +variables for a subset of all sections. + +------------------------------------- *add_statusline_func* +The following is an example of how you can extend vim-airline to support a +new plugin. > + function! MyPlugin(...) + if &filetype == 'MyPluginFileType' + let w:airline_section_a = 'MyPlugin' + let w:airline_section_b = '%f' + let w:airline_section_c = '%{MyPlugin#function()}' + let g:airline_variable_referenced_in_statusline = 'foo' + endif + endfunction + call airline#add_statusline_func('MyPlugin') +< +Notice that only the left side of the statusline is overwritten. This means +the right side (the line/column numbers, etc) will be intact. + +------------------------------------- *remove_statusline_func* +You can also remove a function as well, which is useful for when you want a +temporary override. > + call airline#remove_statusline_func('MyPlugin') +< + +============================================================================== +PIPELINE *airline-pipeline* + +Sometimes you want to do more than just use overrides. The statusline funcref +is invoked and passed two arguments. The first of these arguments is the +statusline builder. You can use this to build completely custom statuslines +to your liking. Here is an example: > +> + function! MyPlugin(...) + " first variable is the statusline builder + let builder = a:1 + + " WARNING: the API for the builder is not finalized and may change + call builder.add_section('Normal', '%f') + call builder.add_section('WarningMsg', '%{getcwd()}') + call builder.split() + call builder.add_section('airline_z', '%p%%') + + " tell the core to use the contents of the builder + return 1 + endfunction +< +The above example uses various some example highlight groups to demonstrate +that you can use any combination from the loaded colorscheme. However, if +you want colors to change between modes, you should use one of the section +highlight groups, e.g. `airline_a` and `airline_b`. + +The second variable is the context, which is a dictionary containing various +values such as whether the statusline is active or not, and the window number. +> + context = { + 'winnr': 'the window number for the statusline', + 'active': 'whether the window is active or not', + 'bufnr': 'the current buffer for this window', + } +< +------------------------------------- *airline-pipeline-return-codes* +The pipeline accepts various return codes and can be used to determine the +next action. The following are the supported codes: > + 0 the default, continue on with the next funcref + -1 do not modify the statusline + 1 modify the statusline with the current contents of the builder +< +Note: Any value other than 0 will halt the pipeline and prevent the next +funcref from executing. + +============================================================================== +WRITING EXTENSIONS *airline-writing-extensions* + +For contributions into the plugin, here are the following guidelines: + +1. For simple 'filetype' checks, they can be added directly into the +`extensions.vim` file. + +2. Pretty much everything else should live as a separate file under the +`extensions/` directory. + + a. Inside `extensions.vim`, add a check for some variable or command that + is always available (these must be defined in `plugin/`, and _not_ + `autoload/` of the other plugin). If it exists, then initialize the + extension. This ensures that the extension is loaded if and only if the + user has the other plugin installed. Also, a check to + `airline#extensions#foo_plugin#enabled` should be performed to allow the + user to disable it. + + b. Configuration variables for the extension should reside in the + extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`. + +See the source of |example.vim| for documented code of how to write one. +Looking at the other extensions is also a good resource. + +============================================================================== +WRITING THEMES *airline-themes* + +Themes are written "close to the metal" -- you will need to know some basic +VimL syntax to write a theme, but if you've written in any programming +language before it will be easy to pick up. + +The |dark.vim| theme fully documents this procedure and will guide you through +the process. The |jellybeans.vim| theme is another example of how to write a +theme, but instead of manually declaring colors, it extracts the values from +highlight groups. + +============================================================================== +TROUBLESHOOTING *airline-troubleshooting* + +Q. There are no colors. +A. You need to set up your terminal correctly. For more details, see + . Alternatively, if you want + to bypass the automatic detection of terminal colors, you can force Vim + into 256 color mode with this: > + set t_Co=256 +< +Q. The statusline does not appear until I create a split. +A. This is the default setting of 'laststatus'. If you want it to appear all + the time, add the following to your vimrc: > + set laststatus=2 +< +Q. Powerline symbols are not showing up. +A. First, you must install patched powerline fonts. Second, you must enable + unicode in vim. > + set encoding=utf-8 +< +Q. There is a pause when leaving insert mode. +A. Add the following to your vimrc. > + set ttimeoutlen=50 +< +Q. The colors look a little off for some themes. +A. Certain themes are derived from the active colorscheme by extracting colors + from predefined highlight groups. These airline themes will look good for + their intended matching colorschemes, but will be hit or miss when loaded + with other colorschemes. + + +Solutions to other common problems can be found in the Wiki: + + +============================================================================== +CONTRIBUTIONS *airline-contributions* + +Contributions and pull requests are welcome. + +============================================================================== +LICENSE *airline-license* + +MIT License. Copyright © 2013 Bailey Ling. + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-airline/plugin/airline.vim b/sources_non_forked/vim-airline/plugin/airline.vim new file mode 100644 index 00000000..f1d3d386 --- /dev/null +++ b/sources_non_forked/vim-airline/plugin/airline.vim @@ -0,0 +1,109 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) + finish +endif +let g:loaded_airline = 1 + +" autocmd VimEnter * call airline#deprecation#check() + +let s:airline_initialized = 0 +let s:airline_theme_defined = 0 +function! s:init() + if !s:airline_initialized + let s:airline_initialized = 1 + + call airline#init#bootstrap() + call airline#extensions#load() + call airline#init#sections() + + let s:airline_theme_defined = exists('g:airline_theme') + if s:airline_theme_defined || !airline#switch_matching_theme() + let g:airline_theme = get(g:, 'airline_theme', 'dark') + call airline#switch_theme(g:airline_theme) + endif + endif +endfunction + +function! s:on_window_changed() + if pumvisible() + return + endif + call init() + call airline#update_statusline() +endfunction + +function! s:on_colorscheme_changed() + call init() + if !s:airline_theme_defined + if airline#switch_matching_theme() + return + endif + endif + + " couldn't find a match, or theme was defined, just refresh + call airline#load_theme() +endfunction + +function airline#cmdwinenter(...) + call airline#extensions#apply_left_override('Command Line', '') +endfunction + +function! s:airline_toggle() + if exists("#airline") + augroup airline + au! + augroup END + augroup! airline + + if exists("s:stl") + let &stl = s:stl + endif + + silent doautocmd User AirlineToggledOff + else + let s:stl = &statusline + augroup airline + autocmd! + + autocmd CmdwinEnter * + \ call airline#add_statusline_func('airline#cmdwinenter') + \ | call on_window_changed() + autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') + + autocmd ColorScheme * call on_colorscheme_changed() + autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload,VimResized * + \ call on_window_changed() + + autocmd BufWritePost */autoload/airline/themes/*.vim + \ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0] + \ | call airline#load_theme() + augroup END + + silent doautocmd User AirlineToggledOn + + if s:airline_initialized + call on_window_changed() + endif + endif +endfunction + +function! s:get_airline_themes(a, l, p) + let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n") + return map(files, 'fnamemodify(v:val, ":t:r")') +endfunction +function! s:airline_theme(...) + if a:0 + call airline#switch_theme(a:1) + else + echo g:airline_theme + endif +endfunction +command! -nargs=? -complete=customlist,get_airline_themes AirlineTheme call airline_theme() +command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle() +command! AirlineToggle call airline_toggle() +command! AirlineRefresh call airline#load_theme() + +call airline_toggle() + diff --git a/sources_non_forked/vim-airline/t/airline.vim b/sources_non_forked/vim-airline/t/airline.vim new file mode 100644 index 00000000..78ab6d7c --- /dev/null +++ b/sources_non_forked/vim-airline/t/airline.vim @@ -0,0 +1,87 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() +call airline#init#sections() +source plugin/airline.vim + +function! MyFuncref(...) + call a:1.add_raw('hello world') + return 1 +endfunction + +function! MyIgnoreFuncref(...) + return -1 +endfunction + +function! MyAppend1(...) + call a:1.add_raw('hello') +endfunction + +function! MyAppend2(...) + call a:1.add_raw('world') +endfunction + +describe 'airline' + before + let g:airline_statusline_funcrefs = [] + end + + it 'should run user funcrefs first' + call airline#add_statusline_func('MyFuncref') + let &statusline = '' + call airline#update_statusline() + Expect airline#statusline(1) =~ 'hello world' + end + + it 'should not change the statusline with -1' + call airline#add_statusline_funcref(function('MyIgnoreFuncref')) + let &statusline = 'foo' + call airline#update_statusline() + Expect &statusline == 'foo' + end + + it 'should support multiple chained funcrefs' + call airline#add_statusline_func('MyAppend1') + call airline#add_statusline_func('MyAppend2') + call airline#update_statusline() + Expect airline#statusline(1) =~ 'helloworld' + end + + it 'should allow users to redefine sections' + let g:airline_section_a = airline#section#create(['mode', 'mode']) + call airline#update_statusline() + Expect airline#statusline(1) =~ '%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#%#airline_a_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#' + end + + it 'should remove funcrefs properly' + let c = len(g:airline_statusline_funcrefs) + call airline#add_statusline_func('MyIgnoreFuncref') + call airline#remove_statusline_func('MyIgnoreFuncref') + Expect len(g:airline_statusline_funcrefs) == c + end + + it 'should overwrite the statusline with active and inactive splits' + wincmd s + Expect airline#statusline(1) !~ 'inactive' + Expect airline#statusline(2) =~ 'inactive' + wincmd c + end + + it 'should collapse the inactive split if the variable is set true' + let g:airline_inactive_collapse = 1 + wincmd s + Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode' + wincmd c + end + + it 'should not collapse the inactive split if the variable is set false' + let g:airline_inactive_collapse = 0 + wincmd s + Expect getwinvar(2, '&statusline') != 'airline#parts#mode' + wincmd c + end + + it 'should include check_mode' + Expect airline#statusline(1) =~ 'airline#check_mode' + end +end + diff --git a/sources_non_forked/vim-airline/t/builder.vim b/sources_non_forked/vim-airline/t/builder.vim new file mode 100644 index 00000000..3d1afcda --- /dev/null +++ b/sources_non_forked/vim-airline/t/builder.vim @@ -0,0 +1,80 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() + +describe 'active builder' + before + let s:builder = airline#builder#new({'active': 1}) + end + + it 'should start with an empty statusline' + let stl = s:builder.build() + Expect stl == '' + end + + it 'should transition colors from one to the next' + call s:builder.add_section('Normal', 'hello') + call s:builder.add_section('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal#hello%#Normal_to_NonText#>%#NonText#world' + end + + it 'should split left/right sections' + call s:builder.split() + let stl = s:builder.build() + Expect stl =~ '%=' + end + + it 'after split, sections use the right separator' + call s:builder.split() + call s:builder.add_section('Normal', 'hello') + call s:builder.add_section('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal#hello%#Normal_to_NonText#<%#NonText#world' + end + + it 'should not repeat the same highlight group' + call s:builder.add_section('Normal', 'hello') + call s:builder.add_section('Normal', 'hello') + let stl = s:builder.build() + Expect stl == '%#Normal#hello>hello' + end + + it 'should replace accent groups with the specified group' + call s:builder.add_section('Normal', '%#__accent_foo#hello') + let stl = s:builder.build() + Expect stl == '%#Normal#%#Normal_foo#hello' + end + + it 'should replace two accent groups with correct groups' + call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world') + let stl = s:builder.build() + Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world' + end + + it 'should special restore group should go back to previous group' + call s:builder.add_section('Normal', '%#__restore__#') + let stl = s:builder.build() + Expect stl !~ '%#__restore__#' + Expect stl =~ '%#Normal#' + end +end + +describe 'inactive builder' + before + let s:builder = airline#builder#new({'active': 0}) + end + + it 'should transition colors from one to the next' + call s:builder.add_section('Normal', 'hello') + call s:builder.add_section('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world' + end + + it 'should not render accents' + call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world') + let stl = s:builder.build() + Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld' + end +end + diff --git a/sources_non_forked/vim-airline/t/commands.vim b/sources_non_forked/vim-airline/t/commands.vim new file mode 100644 index 00000000..b56b881d --- /dev/null +++ b/sources_non_forked/vim-airline/t/commands.vim @@ -0,0 +1,33 @@ +call airline#init#bootstrap() +call airline#init#sections() + +source plugin/airline.vim + +describe 'commands' + it 'should toggle off and on' + execute 'AirlineToggle' + Expect exists('#airline') to_be_false + execute 'AirlineToggle' + Expect exists('#airline') to_be_true + end + + it 'should toggle whitespace off and on' + call airline#extensions#load() + execute 'AirlineToggleWhitespace' + Expect exists('#airline_whitespace') to_be_false + execute 'AirlineToggleWhitespace' + Expect exists('#airline_whitespace') to_be_true + end + + it 'should display theme name with no args' + execute 'AirlineTheme simple' + Expect g:airline_theme == 'simple' + execute 'AirlineTheme dark' + Expect g:airline_theme == 'dark' + end + + it 'should have a refresh command' + Expect exists(':AirlineRefresh') to_be_true + end +end + diff --git a/sources_non_forked/vim-airline/t/extensions_default.vim b/sources_non_forked/vim-airline/t/extensions_default.vim new file mode 100644 index 00000000..b98e8166 --- /dev/null +++ b/sources_non_forked/vim-airline/t/extensions_default.vim @@ -0,0 +1,32 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() +call airline#init#sections() +source plugin/airline.vim + +describe 'default' + before + let s:builder = airline#builder#new({'active': 1}) + end + + it 'should use the layout' + let g:airline#extensions#default#layout = [ + \ [ 'c', 'a', 'b', 'warning' ], + \ [ 'x', 'z', 'y' ] + \ ] + call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) + let stl = s:builder.build() + Expect stl =~ 'airline_c_to_airline_a' + Expect stl =~ 'airline_a_to_airline_b' + Expect stl =~ 'airline_b_to_airline_warning' + Expect stl =~ 'airline_x_to_airline_z' + Expect stl =~ 'airline_z_to_airline_y' + end + + it 'should only render warning section in active splits' + wincmd s + Expect airline#statusline(1) =~ 'warning' + Expect airline#statusline(2) !~ 'warning' + wincmd c + end +end + diff --git a/sources_non_forked/vim-airline/t/highlighter.vim b/sources_non_forked/vim-airline/t/highlighter.vim new file mode 100644 index 00000000..a1ed4905 --- /dev/null +++ b/sources_non_forked/vim-airline/t/highlighter.vim @@ -0,0 +1,21 @@ +let g:airline_theme = 'dark' + +describe 'highlighter' + it 'should create separator highlight groups' + hi Foo1 ctermfg=1 ctermbg=2 + hi Foo2 ctermfg=3 ctermbg=4 + call airline#highlighter#add_separator('Foo1', 'Foo2', 0) + let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') + Expect hl == [ '', '', '4', '2', '' ] + end + + it 'should populate accent colors' + Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false + Expect hlID('airline_c_red') == 0 + call airline#themes#patch(g:airline#themes#dark#palette) + call airline#highlighter#add_accent('red') + call airline#highlighter#highlight(['normal']) + Expect hlID('airline_c_red') != 0 + end +end + diff --git a/sources_non_forked/vim-airline/t/init.vim b/sources_non_forked/vim-airline/t/init.vim new file mode 100644 index 00000000..86efe582 --- /dev/null +++ b/sources_non_forked/vim-airline/t/init.vim @@ -0,0 +1,77 @@ +let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning'] + +function! s:clear() + for key in s:sections + unlet! g:airline_section_{key} + endfor +endfunction + +call airline#init#bootstrap() + +describe 'init sections' + before + call s:clear() + call airline#init#sections() + end + + after + call s:clear() + end + + it 'section a should have mode, paste, iminsert' + Expect g:airline_section_a =~ 'mode' + Expect g:airline_section_a =~ 'paste' + Expect g:airline_section_a =~ 'iminsert' + end + + it 'section b should be blank because no extensions are installed' + Expect g:airline_section_b == '' + end + + it 'section c should be file' + Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' + end + + it 'section x should be filetype' + Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}' + end + + it 'section y should be fenc and ff' + Expect g:airline_section_y =~ 'ff' + Expect g:airline_section_y =~ 'fenc' + end + + it 'section z should be line numbers' + Expect g:airline_section_z =~ '%3p%%' + Expect g:airline_section_z =~ '%4l' + Expect g:airline_section_z =~ '%3c' + end + + it 'should not redefine sections already defined' + for s in s:sections + let g:airline_section_{s} = s + endfor + call airline#init#bootstrap() + for s in s:sections + Expect g:airline_section_{s} == s + endfor + end + + it 'all default statusline extensions should be blank' + Expect airline#parts#get('hunks').raw == '' + Expect airline#parts#get('branch').raw == '' + Expect airline#parts#get('tagbar').raw == '' + Expect airline#parts#get('syntastic').raw == '' + Expect airline#parts#get('eclim').raw == '' + Expect airline#parts#get('whitespace').raw == '' + end +end + +describe 'init parts' + it 'should not redefine parts already defined' + call airline#parts#define_raw('linenr', 'bar') + call airline#init#sections() + Expect g:airline_section_z =~ 'bar' + end +end + diff --git a/sources_non_forked/vim-airline/t/parts.vim b/sources_non_forked/vim-airline/t/parts.vim new file mode 100644 index 00000000..ee7c92e3 --- /dev/null +++ b/sources_non_forked/vim-airline/t/parts.vim @@ -0,0 +1,39 @@ +describe 'parts' + it 'overwrites existing values' + call airline#parts#define('foo', { 'test': '123' }) + Expect airline#parts#get('foo').test == '123' + call airline#parts#define('foo', { 'test': '321' }) + Expect airline#parts#get('foo').test == '321' + end + + it 'can define a function part' + call airline#parts#define_function('func', 'bar') + Expect airline#parts#get('func').function == 'bar' + end + + it 'can define a text part' + call airline#parts#define_text('text', 'bar') + Expect airline#parts#get('text').text == 'bar' + end + + it 'can define a raw part' + call airline#parts#define_raw('raw', 'bar') + Expect airline#parts#get('raw').raw == 'bar' + end + + it 'can define a minwidth' + call airline#parts#define_minwidth('mw', 123) + Expect airline#parts#get('mw').minwidth == 123 + end + + it 'can define a condition' + call airline#parts#define_condition('part', '1') + Expect airline#parts#get('part').condition == '1' + end + + it 'can define a accent' + call airline#parts#define_accent('part', 'red') + Expect airline#parts#get('part').accent == 'red' + end +end + diff --git a/sources_non_forked/vim-airline/t/section.vim b/sources_non_forked/vim-airline/t/section.vim new file mode 100644 index 00000000..034440c8 --- /dev/null +++ b/sources_non_forked/vim-airline/t/section.vim @@ -0,0 +1,76 @@ +function! SectionSpec() +endfunction + +describe 'section' + before + call airline#parts#define_text('text', 'text') + call airline#parts#define_raw('raw', 'raw') + call airline#parts#define_function('func', 'SectionSpec') + end + + it 'should be able to reference default parts' + let s = airline#section#create(['paste']) + Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}' + end + + it 'should create sections with no separators' + let s = airline#section#create(['text', 'raw', 'func']) + Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}' + end + + it 'should create left sections with separators' + let s = airline#section#create_left(['text', 'text']) + Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}' + end + + it 'should create right sections with separators' + let s = airline#section#create_right(['text', 'text']) + Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}' + end + + it 'should prefix with accent group if provided and restore afterwards' + call airline#parts#define('hi', { + \ 'raw': 'hello', + \ 'accent': 'red', + \ }) + let s = airline#section#create(['hi']) + Expect s == '%#__accent_red#hello%#__restore__#' + end + + it 'should accent functions' + call airline#parts#define_function('hi', 'Hello') + call airline#parts#define_accent('hi', 'bold') + let s = airline#section#create(['hi']) + Expect s == '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#' + end + + it 'should parse out a section from the distro' + call airline#extensions#load() + let s = airline#section#create(['whitespace']) + Expect s =~ 'airline#extensions#whitespace#check' + end + + it 'should use parts as is if they are not found' + let s = airline#section#create(['asdf', 'func']) + Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}' + end + + it 'should force add separators for raw and missing keys' + let s = airline#section#create_left(['asdf', 'raw']) + Expect s == 'asdf > raw' + let s = airline#section#create_left(['asdf', 'aaaa', 'raw']) + Expect s == 'asdf > aaaa > raw' + let s = airline#section#create_right(['raw', '%f']) + Expect s == 'raw < %f' + let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}']) + Expect s == '%t < asdf < %{getcwd()}' + end + + it 'should empty out parts that do not pass their condition' + call airline#parts#define_text('conditional', 'conditional') + call airline#parts#define_condition('conditional', '0') + let s = airline#section#create(['conditional']) + Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}' + end +end + diff --git a/sources_non_forked/vim-airline/t/themes.vim b/sources_non_forked/vim-airline/t/themes.vim new file mode 100644 index 00000000..d735229e --- /dev/null +++ b/sources_non_forked/vim-airline/t/themes.vim @@ -0,0 +1,68 @@ +describe 'themes' + after + highlight clear Foo + highlight clear Normal + end + + it 'should extract correct colors' + highlight Foo ctermfg=1 ctermbg=2 + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '1' + Expect colors[3] == '2' + end + + it 'should extract from normal if colors unavailable' + highlight Normal ctermfg=100 ctermbg=200 + highlight Foo ctermbg=2 + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '100' + Expect colors[3] == '2' + end + + it 'should flip target group if it is reversed' + highlight Foo ctermbg=222 ctermfg=103 term=reverse + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '222' + Expect colors[3] == '103' + end + + it 'should pass args through correctly' + let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') + Expect hl == ['', '', 0, 1, 'bold,italic'] + + let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') + Expect hl == ['', '', 1, 0, 'italic,bold'] + end + + it 'should generate color map with mirroring' + let map = airline#themes#generate_color_map( + \ [ 1, 1, 1, 1, '1' ], + \ [ 2, 2, 2, 2, '2' ], + \ [ 3, 3, 3, 3, '3' ], + \ ) + Expect map.airline_a[0] == 1 + Expect map.airline_b[0] == 2 + Expect map.airline_c[0] == 3 + Expect map.airline_x[0] == 3 + Expect map.airline_y[0] == 2 + Expect map.airline_z[0] == 1 + end + + it 'should generate color map with full set of colors' + let map = airline#themes#generate_color_map( + \ [ 1, 1, 1, 1, '1' ], + \ [ 2, 2, 2, 2, '2' ], + \ [ 3, 3, 3, 3, '3' ], + \ [ 4, 4, 4, 4, '4' ], + \ [ 5, 5, 5, 5, '5' ], + \ [ 6, 6, 6, 6, '6' ], + \ ) + Expect map.airline_a[0] == 1 + Expect map.airline_b[0] == 2 + Expect map.airline_c[0] == 3 + Expect map.airline_x[0] == 4 + Expect map.airline_y[0] == 5 + Expect map.airline_z[0] == 6 + end +end + diff --git a/sources_non_forked/vim-airline/t/util.vim b/sources_non_forked/vim-airline/t/util.vim new file mode 100644 index 00000000..913de9d8 --- /dev/null +++ b/sources_non_forked/vim-airline/t/util.vim @@ -0,0 +1,54 @@ +call airline#init#bootstrap() + +function! Util1() + let g:count += 1 +endfunction +function! Util2() + let g:count += 2 +endfunction +function! Util3(...) + let g:count = a:0 +endfunction + +describe 'util' + before + let g:count = 0 + end + + it 'has append wrapper function' + Expect airline#util#append('', 0) == '' + Expect airline#util#append('1', 0) == ' > 1' + end + + it 'has prepend wrapper function' + Expect airline#util#prepend('', 0) == '' + Expect airline#util#prepend('1', 0) == '1 < ' + end + + it 'has getwinvar function' + Expect airline#util#getwinvar(1, 'asdf', '123') == '123' + call setwinvar(1, 'vspec', 'is cool') + Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool' + end + + it 'has exec funcrefs helper functions' + call airline#util#exec_funcrefs([function('Util1'), function('Util2')]) + Expect g:count == 3 + + call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4) + Expect g:count == 4 + end + + it 'should ignore minwidth if less than 0' + Expect airline#util#append('foo', -1) == ' > foo' + Expect airline#util#prepend('foo', -1) == 'foo < ' + Expect airline#util#wrap('foo', -1) == 'foo' + end + + it 'should return empty if winwidth() > minwidth' + Expect airline#util#append('foo', 99999) == '' + Expect airline#util#prepend('foo', 99999) == '' + Expect airline#util#wrap('foo', 99999) == '' + end +end + diff --git a/sources_non_forked/vim-coffee-script/Makefile b/sources_non_forked/vim-coffee-script/Makefile index 4c03d835..e6ef4092 100644 --- a/sources_non_forked/vim-coffee-script/Makefile +++ b/sources_non_forked/vim-coffee-script/Makefile @@ -2,7 +2,7 @@ REF = HEAD VERSION = $(shell git describe --always $(REF)) ARCHIVE = vim-coffee-script-$(VERSION).zip -ARCHIVE_DIRS = after compiler doc ftdetect ftplugin indent syntax +ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax # Don't do anything by default. all: diff --git a/sources_non_forked/vim-coffee-script/Readme.md b/sources_non_forked/vim-coffee-script/Readme.md index 664b9835..d557848a 100644 --- a/sources_non_forked/vim-coffee-script/Readme.md +++ b/sources_non_forked/vim-coffee-script/Readme.md @@ -1,226 +1,555 @@ -This project adds [CoffeeScript] support to the vim editor. It handles syntax, -indenting, compiling, and more. Also included is support for CoffeeScript in -Haml and HTML. +This project adds [CoffeeScript] support to vim. It covers syntax, indenting, +compiling, and more. -![Screenshot](http://i.imgur.com/eUBvm.png) +![Screenshot](http://i.imgur.com/j1BhpZQ.png) -[CoffeeScript]: http://jashkenas.github.com/coffee-script/ +[CoffeeScript]: http://coffeescript.org/ -### Install from a Zipball +## Table of Contents -This is the quickest way to get things running. +- Installation + - [Requirements](#requirements) + - [Install using Pathogen](#install-using-pathogen) + - [Install using Vundle](#install-using-vundle) + - [Install from a Zip File](#install-from-a-zip-file) +- Coffee Commands + - [Compile to JavaScript](#compile-to-javascript) + - [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets) + - [Live Preview Compiling](#coffeewatch-live-preview-compiling) + - [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets) + - [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript) +- Extras + - [Literate CoffeeScript](#literate-coffeescript) + - [CoffeeScript in HTML](#coffeescript-in-html) + - [CoffeeScript in Haml](#coffeescript-in-haml) +- Configuration + - [Custom Autocmds](#custom-autocmds) + - [Configuration Variables](#configuration-variables) + - [Configure Syntax Highlighting](#configure-syntax-highlighting) + - [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript) -1. Download the latest zipball from [vim.org][zipball-vim] or - [github][zipball-github]. The latest version on github is under Download - Packages (don't use the Download buttons.) +## Requirements -2. Extract the archive into `~/.vim/`: + - vim 7.4 or later + - coffee 1.2.0 or later - unzip -od ~/.vim vim-coffee-script-HASH.zip +## Install using Pathogen -These steps are also used to update the plugin. +This project uses rolling releases based on git commits, so pathogen is a +natural fit for it. If you're already using pathogen, you can skip to step 4. -[zipball-vim]: http://www.vim.org/scripts/script.php?script_id=3590 -[zipball-github]: https://github.com/kchmck/vim-coffee-script/downloads +1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's + readme][install-pathogen] for more information.) -### Install with Pathogen +[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332 +[install-pathogen]: https://github.com/tpope/vim-pathogen#installation -Since this plugin has rolling versions based on git commits, using pathogen and -git is the preferred way to install. The plugin ends up contained in its own -directory and updates are just a `git pull` away. +2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables + all the features of `vim-coffee-script`: -1. Install tpope's [pathogen] into `~/.vim/autoload/` and add this line to your - `vimrc`: + ```vim + call pathogen#infect() + syntax enable + filetype plugin indent on + ``` - call pathogen#infect() + If you already have a vimrc built up, just make sure it contains these calls, + in this order. - To get the all the features of this plugin, make sure you also have a - `filetype plugin indent on` line in there. +3. Create the directory `~/.vim/bundle/`: -[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332 + mkdir ~/.vim/bundle -2. Create and change into `~/.vim/bundle/`: +4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`: - $ mkdir ~/.vim/bundle - $ cd ~/.vim/bundle + git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/ -3. Make a clone of the `vim-coffee-script` repository: - - $ git clone https://github.com/kchmck/vim-coffee-script.git - -#### Updating +Updating takes two steps: 1. Change into `~/.vim/bundle/vim-coffee-script/`: - $ cd ~/.vim/bundle/vim-coffee-script + cd ~/.vim/bundle/vim-coffee-script 2. Pull in the latest changes: - $ git pull + git pull -### CoffeeMake: Compile the Current File +## Install using Vundle -The `CoffeeMake` command compiles the current file and parses any errors: +1. [Install Vundle] into `~/.vim/bundle/`. - ![CoffeeMake](http://i.imgur.com/cr9xI.png) +[Install Vundle]: https://github.com/gmarik/vundle#quick-start -The full signature of the command is: +2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all + the features of `vim-coffee-script`: - :[silent] CoffeeMake[!] [COFFEE-OPTIONS]... -By default, `CoffeeMake` shows all compiler output and jumps to the first line -reported as an error by `coffee`: + ```vim + set nocompatible + filetype off - :CoffeeMake + set rtp+=~/.vim/bundle/vundle/ + call vundle#rc() -Compiler output can be hidden with `silent`: + Bundle 'kchmck/vim-coffee-script' - :silent CoffeeMake + syntax enable + filetype plugin indent on + ``` -Line-jumping can be turned off by adding a bang: + If you're adding Vundle to a built-up vimrc, just make sure all these calls + are in there and that they occur in this order. - :CoffeeMake! +3. Open vim and run `:BundleInstall`. -Options given to `CoffeeMake` are passed along to `coffee`: +To update, open vim and run `:BundleInstall!` (notice the bang!) - :CoffeeMake --bare +## Install from a Zip File -`CoffeeMake` can be manually loaded for a file with: +1. Download the latest zip file from [vim.org][zip]. + +2. Extract the archive into `~/.vim/`: + + unzip -od ~/.vim/ ARCHIVE.zip + + This should create the files `~/.vim/autoload/coffee.vim`, + `~/.vim/compiler/coffee.vim`, etc. + +You can update the plugin using the same steps. + +[zip]: http://www.vim.org/scripts/script.php?script_id=3590 + +## Compile to JavaScript + +A `coffee` wrapper for use with `:make` is enabled automatically for coffee +files if no other compiler is loaded. To enable it manually, run :compiler coffee -#### Recompile on write +The `:make` command is then configured to use the `coffee` compiler and +recognize its errors. I've included a quick reference here but be sure to check +out [`:help :make`][make] for a full reference of the command. -To recompile a file when it's written, add an `autocmd` like this to your -`vimrc`: + ![make](http://i.imgur.com/scUXmxR.png) - au BufWritePost *.coffee silent CoffeeMake! + ![make Result](http://i.imgur.com/eGIjEdn.png) -All of the customizations above can be used, too. This one compiles silently -and with the `-b` option, but shows any errors: +[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg - au BufWritePost *.coffee silent CoffeeMake! -b | cwindow | redraw! +Consider the full signature of a `:make` call as + + :[silent] make[!] [COFFEE-OPTIONS]... + +By default `:make` shows all compiler output and jumps to the first line +reported as an error. Compiler output can be hidden with a leading `:silent`: + + :silent make + +Line-jumping can be turned off by adding a bang: + + :make! + +`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also +[`coffee_make_options`](#coffee_make_options)): + + :make --bare --output /some/dir + +See the [full table of options](http://coffeescript.org/#usage) for a +list of all the options that `coffee` recognizes. + +*Configuration*: [`coffee_compiler`](#coffee_compiler), +[`coffee_make_options`](#coffee_make_options) + +#### The quickfix window + +Compiler errors are added to the [quickfix] list by `:make`, but the quickfix +window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up +the quickfix window if there are any errors: + + :make + :cwindow + +This is usually the desired behavior, so you may want to add an autocmd to your +vimrc to do this automatically: + + autocmd QuickFixCmdPost * nested cwindow | redraw! The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but can removed for gVim. -#### Default compiler options +[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix +[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow -The `CoffeeMake` command passes any options in the `coffee_make_options` -variable along to the compiler. You can use this to set default options: +#### Recompile on write - let coffee_make_options = '--bare' +To recompile a file when it's written, add a `BufWritePost` autocmd to your +vimrc: -#### Path to compiler + autocmd BufWritePost *.coffee silent make! -To change the compiler used by `CoffeeMake` and `CoffeeCompile`, set -`coffee_compiler` to the full path of an executable or the filename of one -in your `$PATH`: +#### Cake and Cakefiles - let coffee_compiler = '/usr/bin/coffee' +A `cake` compiler is also available with the call -This option is set to `coffee` by default. + :compiler cake -### CoffeeCompile: Compile Snippets of CoffeeScript +You can then use `:make` as above to run your Cakefile and capture any `coffee` +errors: -The `CoffeeCompile` command shows how the current file or a snippet of -CoffeeScript is compiled to JavaScript. The full signature of the command is: + :silent make build - :[RANGE] CoffeeCompile [watch|unwatch] [vert[ical]] [WINDOW-SIZE] +It runs within the current directory, so make sure you're in the directory of +your Cakefile before calling it. -Calling `CoffeeCompile` without a range compiles the whole file: +*Configuration*: [`coffee_cake`](#coffee_cake), +[`coffee_cake_options`](#coffee_cake_options) - ![CoffeeCompile](http://i.imgur.com/KJfSZ.png) +## CoffeeCompile: Compile CoffeeScript Snippets -Calling `CoffeeCompile` with a range, like in visual mode, compiles the selected -snippet of CoffeeScript: +CoffeeCompile shows how the current file or a snippet of CoffeeScript is +compiled to JavaScript. - ![CoffeeCompile Snippet](http://i.imgur.com/mbaUA.png) + :[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE] - ![Compiled Snippet](http://i.imgur.com/Ocjuc.png) +Calling `:CoffeeCompile` without a range compiles the whole file: -This scratch buffer can be quickly closed by hitting the `q` key. + ![CoffeeCompile](http://i.imgur.com/0zFG0l0.png) -Using `vert` splits the CoffeeCompile buffer vertically instead of horizontally: + ![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png) + +Calling it with a range, like in visual mode, compiles only the selected snippet +of CoffeeScript: + + ![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png) + + ![Compiled Snippet](http://i.imgur.com/J02j4T8.png) + +Each file gets its own CoffeeCompile buffer, and the same buffer is used for all +future calls of `:CoffeeCompile` on that file. It can be quickly closed by +hitting `q` in normal mode. + +Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally +(see also [`coffee_compile_vert`](#coffee_compile_vert)): :CoffeeCompile vert -Set the `coffee_compile_vert` variable to split the buffer vertically by -default: - - let coffee_compile_vert = 1 - -The initial size of the CoffeeCompile buffer can be given as a number: +By default the CoffeeCompile buffer splits the source buffer in half, but this +can be overridden by passing in a `WINDOW-SIZE`: :CoffeeCompile 4 -#### Watch (live preview) mode +*Configuration*: [`coffee_compiler`](#coffee_compiler`), +[`coffee_compile_vert`](#coffee_compile_vert) -Watch mode is like the Try CoffeeScript preview box on the CoffeeScript -homepage: +#### Quick syntax checking - ![Watch Mode](http://i.imgur.com/M6l1j.png) +If compiling a snippet results in a compiler error, CoffeeCompile adds that +error to the [quickfix] list. - ![Watch Mode](http://i.imgur.com/qtNmU.png) +[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix -Writing some code and then exiting insert mode automatically updates the -compiled JavaScript buffer. + ![Syntax Checking](http://i.imgur.com/RC8accF.png) -Use `watch` to start watching a buffer (`vert` is also recommended): + ![Syntax Checking Result](http://i.imgur.com/gi1ON75.png) - :CoffeeCompile watch vert +You can use this to quickly check the syntax of a snippet. -After making some changes in insert mode, hit escape and the CoffeeScript will -be recompiled. Changes made outside of insert mode don't trigger this recompile, -but calling `CoffeeCompile` will compile these changes without any bad effects. +## CoffeeWatch: Live Preview Compiling -To get synchronized scrolling of a CoffeeScript and CoffeeCompile buffer, set -`scrollbind` on each: +CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript +homepage][CoffeeScript]. + + ![CoffeeWatch](http://i.imgur.com/TRHdIMG.png) + + ![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png) + +CoffeeWatch takes the same options as CoffeeCompile: + + :CoffeeWatch [vert[ical]] [WINDOW-SIZE] + +After a source buffer is watched, leaving insert mode or saving the file fires +off a recompile of the CoffeeScript: + + ![Insert Mode](http://i.imgur.com/SBVcf4k.png) + + ![Recompile](http://i.imgur.com/pbPMog7.png) + +You can force recompilation by calling `:CoffeeWatch`. + +To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set +[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind') +on each: :setl scrollbind -Use `unwatch` to stop watching a buffer: +*Configuration*: [`coffee_compiler`](#coffee_compiler), +[`coffee_watch_vert`](#coffee_watch_vert) - :CoffeeCompile unwatch +## CoffeeRun: Run CoffeeScript Snippets -### CoffeeLint: Lint your CoffeeScript +CoffeeRun compiles the current file or selected snippet and runs the resulting +JavaScript. -The `CoffeeLint` command runs [coffeelint](http://www.coffeelint.org/) (version -0.4.0 or later required) on the current file and parses any errors: + ![CoffeeRun](http://i.imgur.com/YSkHUuQ.png) - :[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS] + ![CoffeeRun Output](http://i.imgur.com/wZQbggN.png) -Use it like `CoffeeMake`. +The command has two forms: - ![CoffeeLint](http://i.imgur.com/dlxF7.png) + :CoffeeRun [PROGRAM-OPTIONS]... -#### Default coffeelint options +This form applies when no `RANGE` is given or when the given range is `1,$` +(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled +program. The filename is passed directly to `coffee` so you must save the file +for your changes to take effect. -Options in `coffee_lint_options` are passed along to `coffeelint`: + :RANGE CoffeeRun [COFFEE-OPTIONS]... + +This form applies with all other ranges. It compiles and runs the lines within +the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`. + +*Configuration*: [`coffee_compiler`](#coffee_compiler), +[`coffee_run_vert`](#coffee_run_vert) + +## CoffeeLint: Lint your CoffeeScript + +CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 0.5.7 or later +required) on the current file and adds any issues to the [quickfix] list. + + ![CoffeeLint](http://i.imgur.com/UN8Nr5N.png) + + ![CoffeeLint Result](http://i.imgur.com/9hSIj3W.png) + + :[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow] + +If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given +in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also +[`coffee_lint_options`](#coffee_lint_options)): + + :CoffeeLint -f lint.json + +It behaves very similar to `:make`, described [above](#compile-to-javascript). + + :CoffeeLint! | cwindow + +*Configuration*: [`coffee_linter`](#coffee_linter), +[`coffee_lint_options`](#coffee_lint_options) + +## Literate CoffeeScript + +Literate CoffeeScript syntax and indent support is provided by +[vim-literate-coffeescript]. The `Coffee` commands detect when they're running +on a litcoffee file and pass the `--literate` flag to their respective tools, +but at this time the commands are not automatically loaded when a litcoffee file +is opened. + +[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript + +To load them, run + + runtime ftplugin/coffee.vim + +while inside a litcoffee buffer. To do this automatically, add + + autocmd FileType litcoffee runtime ftplugin/coffee.vim + +to your vimrc. + +## CoffeeScript in HTML + +CoffeeScript is highlighted and indented within + +```html + +``` + +blocks in html files. + +## CoffeeScript in Haml + +CoffeeScript is highlighted within the `:coffeescript` filter in haml files: + +```haml +:coffeescript + console.log "hullo" +``` + +At this time, coffee indenting doesn't work in these blocks. + +## Custom Autocmds + +You can [define commands][autocmd-explain] to be ran automatically on these +custom events. + +In all cases, the name of the command running the event (`CoffeeCompile`, +`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument. +You can match all commands with a `*` or only specific commands by separating +them with a comma: `CoffeeCompile,CoffeeWatch`. + +[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3 +[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd + +#### CoffeeBufNew + +CoffeeBufNew is ran when a new scratch buffer is created. It's called from the +new buffer, so it can be used to do additional set up. + +```vim +augroup CoffeeBufNew + autocmd User * set wrap +augroup END +``` + +*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun + +#### CoffeeBufUpdate + +CoffeeBufUpdate is ran when a scratch buffer is updated with output from +`coffee`. It's called from the scratch buffer, so it can be used to alter the +compiled output. + +```vim +" Switch back to the source buffer after updating. +augroup CoffeeBufUpdate + autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w' +augroup END +``` + +For example, to strip off the "Generated by" comment on the first line, put this +in your vimrc: + +```vim +function! s:RemoveGeneratedBy() + " If there was an error compiling, there's no comment to remove. + if v:shell_error + return + endif + + " Save cursor position. + let pos = getpos('.') + + " Remove first line. + set modifiable + 1 delete _ + set nomodifiable + + " Restore cursor position. + call setpos('.', pos) +endfunction + +augroup CoffeeBufUpdate + autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy() +augroup END +``` + +*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun + +## Configuration Variables + +This is the full list of configuration variables available, with example +settings and default values. Use these in your vimrc to control the default +behavior. + +#### coffee\_indent\_keep\_current + +By default, the indent function matches the indent of the previous line if it +doesn't find a reason to indent or outdent. To change this behavior so it +instead keeps the [current indent of the cursor][98], use + + let coffee_indent_keep_current = 1 + +[98]: https://github.com/kchmck/vim-coffee-script/pull/98 + +*Default*: `unlet coffee_indent_keep_current` + +Note that if you change this after a coffee file has been loaded, you'll have to +reload the indent script for the change to take effect: + + unlet b:did_indent | runtime indent/coffee.vim + +#### coffee\_compiler + +Path to the `coffee` executable used by the `Coffee` commands: + + let coffee_compiler = '/usr/bin/coffee' + +*Default*: `'coffee'` (search `$PATH` for executable) + +#### coffee\_make\_options + +Options to pass to `coffee` with `:make`: + + let coffee_make_options = '--bare' + +*Default*: `''` (nothing) + +Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler +coffee` must be ran after changing `coffee_make_options` for the changes to take +effect. + +#### coffee\_cake + +Path to the `cake` executable: + + let coffee_cake = '/opt/bin/cake' + +*Default*: `'cake'` (search `$PATH` for executable) + +#### coffee\_cake\_options + +Options to pass to `cake` with `:make`: + + let coffee_cake_options = 'build' + +*Default*: `''` (nothing) + +#### coffee\_linter + +Path to the `coffeelint` executable: + + let coffee_linter = '/opt/bin/coffeelint' + +*Default*: `'coffeelint'` (search `$PATH` for executable) + +#### coffee\_lint\_options + +Options to pass to `coffeelint`: let coffee_lint_options = '-f lint.json' -#### Path to `coffeelint` +*Default*: `''` (nothing) -Use the `coffee_linter` option to set a different path to the `coffeelint` -executable: +#### coffee\_compile\_vert - let coffee_linter = '/usr/bin/coffeelint' +Open the CoffeeCompile buffer with a vertical split instead of a horizontal +one: -This option is set to `coffeelint` by default. + let coffee_compile_vert = 1 -### CoffeeRun: Run some CoffeeScript +*Default*: `unlet coffee_compile_vert` -The `CoffeeRun` command compiles the current file or selected snippet and runs -the resulting JavaScript. Output is shown at the bottom of the screen: +#### coffee\_watch\_vert - ![CoffeeRun](http://i.imgur.com/7hwSy.png) +Open the CoffeeWatch buffer with a vertical split instead of a horizontal +one: - ![CoffeeRun Output](http://i.imgur.com/WNWvC.png) + let coffee_watch_vert = 1 -### Configure Syntax Highlighting +*Default*: `unlet coffee_watch_vert` -Add these lines to your `vimrc` to disable the relevant syntax group. +#### coffee\_run\_vert + +Open the CoffeeRun buffer with a vertical split instead of a horizontal +one: + + let coffee_run_vert = 1 + +*Default*: `unlet coffee_run_vert` + +## Configure Syntax Highlighting + +Add these lines to your vimrc to disable the relevant syntax group. #### Disable trailing whitespace error @@ -231,7 +560,7 @@ with: #### Disable trailing semicolon error -Trailing semicolons are also considered an error (for help transitioning from +Trailing semicolons are considered an error (for help transitioning from JavaScript.) This can be disabled with: hi link coffeeSemicolonError NONE @@ -243,7 +572,7 @@ they're not allowed in CoffeeScript. This can be disabled with: hi link coffeeReservedError NONE -### Tune Vim for CoffeeScript +## Tune Vim for CoffeeScript Changing these core settings can make vim more CoffeeScript friendly. @@ -251,20 +580,20 @@ Changing these core settings can make vim more CoffeeScript friendly. Folding by indentation works well for CoffeeScript functions and classes: - ![Folding](http://i.imgur.com/Y0rDC.png) + ![Folding](http://i.imgur.com/gDgUBdO.png) -To fold by indentation in CoffeeScript files, add this line to your `vimrc`: +To fold by indentation in CoffeeScript files, add this line to your vimrc: - au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable + autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable With this, folding is disabled by default but can be quickly toggled per-file by hitting `zi`. To enable folding by default, remove `nofoldenable`: - au BufNewFile,BufReadPost *.coffee setl foldmethod=indent + autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent #### Two-space indentation To get standard two-space indentation in CoffeeScript files, add this line to -your `vimrc`: +your vimrc: - au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab + autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab diff --git a/sources_non_forked/vim-coffee-script/after/indent/html.vim b/sources_non_forked/vim-coffee-script/after/indent/html.vim new file mode 100644 index 00000000..e6377087 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/after/indent/html.vim @@ -0,0 +1,33 @@ +" Language: CoffeeScript +" Maintainer: Mick Koch +" URL: http://github.com/kchmck/vim-coffee-script +" License: WTFPL + +" Load the coffee and html indent functions. +silent! unlet b:did_indent +runtime indent/coffee.vim +let s:coffeeIndentExpr = &l:indentexpr + +" Load html last so it can overwrite coffee settings. +silent! unlet b:did_indent +runtime indent/html.vim +let s:htmlIndentExpr = &l:indentexpr + +" Inject our wrapper indent function. +setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum) + +function! GetCoffeeHtmlIndent(curlinenum) + " See if we're inside a coffeescript block. + let scriptlnum = searchpair('', 'bWn') + let prevlnum = prevnonblank(a:curlinenum) + + " If we're in the script block and the previous line isn't the script tag + " itself, use coffee indenting. + if scriptlnum && scriptlnum != prevlnum + exec 'return ' s:coffeeIndentExpr + endif + + " Otherwise use html indenting. + exec 'return ' s:htmlIndentExpr +endfunction diff --git a/sources_non_forked/vim-coffee-script/after/syntax/haml.vim b/sources_non_forked/vim-coffee-script/after/syntax/haml.vim index cddd5612..4c517ebb 100644 --- a/sources_non_forked/vim-coffee-script/after/syntax/haml.vim +++ b/sources_non_forked/vim-coffee-script/after/syntax/haml.vim @@ -6,4 +6,8 @@ " Inherit coffee from html so coffeeComment isn't redefined and given higher " priority than hamlInterpolation. syn cluster hamlCoffeescript contains=@htmlCoffeeScript -syn region hamlCoffeescriptFilter matchgroup=hamlFilter start="^\z(\s*\):coffee\z(script\)*\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlCoffeeScript,hamlInterpolation keepend +syn region hamlCoffeescriptFilter matchgroup=hamlFilter +\ start="^\z(\s*\):coffee\z(script\)\?\s*$" +\ end="^\%(\z1 \| *$\)\@!" +\ contains=@hamlCoffeeScript,hamlInterpolation +\ keepend diff --git a/sources_non_forked/vim-coffee-script/after/syntax/html.vim b/sources_non_forked/vim-coffee-script/after/syntax/html.vim index 0affe373..9e2eb3a1 100644 --- a/sources_non_forked/vim-coffee-script/after/syntax/html.vim +++ b/sources_non_forked/vim-coffee-script/after/syntax/html.vim @@ -5,7 +5,7 @@ " Syntax highlighting for text/coffeescript script tags syn include @htmlCoffeeScript syntax/coffee.vim -syn region coffeeScript start=++me=s-1 keepend +syn region coffeeScript start=##me=s-1 keepend \ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc \ containedin=htmlHead diff --git a/sources_non_forked/vim-coffee-script/autoload/coffee.vim b/sources_non_forked/vim-coffee-script/autoload/coffee.vim new file mode 100644 index 00000000..04d5efba --- /dev/null +++ b/sources_non_forked/vim-coffee-script/autoload/coffee.vim @@ -0,0 +1,54 @@ +" Language: CoffeeScript +" Maintainer: Mick Koch +" URL: http://github.com/kchmck/vim-coffee-script +" License: WTFPL + +" Set up some common global/buffer variables. +function! coffee#CoffeeSetUpVariables() + " Path to coffee executable + if !exists('g:coffee_compiler') + let g:coffee_compiler = 'coffee' + endif + + " Options passed to coffee with make + if !exists('g:coffee_make_options') + let g:coffee_make_options = '' + endif + + " Path to cake executable + if !exists('g:coffee_cake') + let g:coffee_cake = 'cake' + endif + + " Extra options passed to cake + if !exists('g:coffee_cake_options') + let g:coffee_cake_options = '' + endif + + " Path to coffeelint executable + if !exists('g:coffee_linter') + let g:coffee_linter = 'coffeelint' + endif + + " Options passed to CoffeeLint + if !exists('g:coffee_lint_options') + let g:coffee_lint_options = '' + endif + + " Pass the litcoffee flag to tools in this buffer if a litcoffee file is open. + " Let the variable be overwritten so it can be updated if a different filetype + " is set. + if &filetype == 'litcoffee' + let b:coffee_litcoffee = '--literate' + else + let b:coffee_litcoffee = '' + endif +endfunction + +function! coffee#CoffeeSetUpErrorFormat() + CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l, + \Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m, + \SyntaxError:\ In\ %f\\,\ %m, + \%f:%l:%c:\ error:\ %m, + \%-G%.%# +endfunction diff --git a/sources_non_forked/vim-coffee-script/compiler/cake.vim b/sources_non_forked/vim-coffee-script/compiler/cake.vim new file mode 100644 index 00000000..0a3c7037 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/compiler/cake.vim @@ -0,0 +1,15 @@ +" Language: CoffeeScript +" Maintainer: Mick Koch +" URL: http://github.com/kchmck/vim-coffee-script +" License: WTFPL + +if exists('current_compiler') + finish +endif + +let current_compiler = 'cake' +call coffee#CoffeeSetUpVariables() + +exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' . +\ g:coffee_cake_options . ' $*', ' ') +call coffee#CoffeeSetUpErrorFormat() diff --git a/sources_non_forked/vim-coffee-script/compiler/coffee.vim b/sources_non_forked/vim-coffee-script/compiler/coffee.vim index 8def0bfc..a70fa64c 100644 --- a/sources_non_forked/vim-coffee-script/compiler/coffee.vim +++ b/sources_non_forked/vim-coffee-script/compiler/coffee.vim @@ -13,27 +13,22 @@ if exists('current_compiler') finish -else - let current_compiler = 'coffee' endif +let current_compiler = 'coffee' +call coffee#CoffeeSetUpVariables() + " Pattern to check if coffee is the compiler let s:pat = '^' . current_compiler -" Path to CoffeeScript compiler -if !exists('coffee_compiler') - let coffee_compiler = 'coffee' -endif - -" Extra options passed to CoffeeMake -if !exists('coffee_make_options') - let coffee_make_options = '' -endif - " Get a `makeprg` for the current filename. function! s:GetMakePrg() - return g:coffee_compiler . ' -c ' . g:coffee_make_options . ' $* ' - \ . fnameescape(expand('%')) + return g:coffee_compiler . + \ ' -c' . + \ ' ' . b:coffee_litcoffee . + \ ' ' . g:coffee_make_options . + \ ' $*' . + \ ' ' . fnameescape(expand('%')) endfunction " Set `makeprg` and return 1 if coffee is still the compiler, else return 0. @@ -50,16 +45,21 @@ function! s:SetMakePrg() endfunction " Set a dummy compiler so we can check whether to set locally or globally. -CompilerSet makeprg=coffee +exec 'CompilerSet makeprg=' . current_compiler +" Then actually set the compiler. call s:SetMakePrg() +call coffee#CoffeeSetUpErrorFormat() -CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l, - \Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m, - \SyntaxError:\ In\ %f\\,\ %m, - \%-G%.%# +function! s:CoffeeMakeDeprecated(bang, args) + echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' . + \ 'is identical.' + sleep 5 + exec 'make' . a:bang a:args +endfunction " Compile the current file. -command! -bang -bar -nargs=* CoffeeMake make +command! -bang -bar -nargs=* CoffeeMake +\ call s:CoffeeMakeDeprecated(, ) " Set `makeprg` on rename since we embed the filename in the setting. augroup CoffeeUpdateMakePrg diff --git a/sources_non_forked/vim-coffee-script/doc/coffee-script.txt b/sources_non_forked/vim-coffee-script/doc/coffee-script.txt index 88a137db..1b43cf3a 100644 --- a/sources_non_forked/vim-coffee-script/doc/coffee-script.txt +++ b/sources_non_forked/vim-coffee-script/doc/coffee-script.txt @@ -1,143 +1,4 @@ -*coffee-script.txt* For Vim version 7.3 - -============================================================================= -Author: Mick Koch *coffee-script-author* -License: WTFPL (see |coffee-script-license|) -============================================================================= - -CONTENTS *coffee-script-contents* - -|coffee-script-introduction| Introduction and Feature Summary -|coffee-script-commands| Commands -|coffee-script-settings| Settings -|compiler-coffee-script| Compiler - -{Vi does not have any of this} - -============================================================================= - -INTRODUCTION *coffee-script* - *coffee-script-introduction* - -This plugin adds support for CoffeeScript syntax, indenting, and compiling. -Also included is an eco syntax and support for CoffeeScript in Haml and HTML. - -COMMANDS *coffee-script-commands* - - *:CoffeeMake* -:CoffeeMake[!] {opts} Wrapper around |:make| that also passes options in - |g:coffee_make_options| to the compiler. Use |:silent| - to hide compiler output. See |:make| for more - information about [!] and other helpful commands. - - *:CoffeeCompile* -:[range]CoffeeCompile [vertical] [{win-size}] - Shows how the current file or [range] is compiled - to JavaScript. [vertical] (or vert) splits the - compile buffer vertically instead of horizontally, and - {win-size} sets the initial size of the buffer. It can - be closed quickly with the "q" key. - -:CoffeeCompile {watch} [vertical] [{win-size}] - The watch mode of :CoffeeCompile emulates the "Try - CoffeeScript" live preview on the CoffeeScript web - site. After making changes to the source file, - exiting insert mode will cause the preview buffer to - update automatically. {watch} should be given as - "watch" or "unwatch," where the latter will stop the - automatic updating. [vertical] is recommended, and - 'scrollbind' is useful. - - *:CoffeeLint* -:[range]CoffeeLint[!] {opts} - Run {coffeelint} on the current file and add any - errors to the quickfix list. The first error is jumped - to if [!] isn't given. Options in - |g:coffee_lint_options| and {opts} are passed along to - {coffeelint}. Although the whole file is linted, if a - [range] is given, only errors within those lines will - be considered. - - *:CoffeeRun* -:[range]CoffeeRun Compiles the file or [range] and runs the resulting - JavaScript, displaying the output. - -SETTINGS *coffee-script-settings* - -You can configure plugin behavior using global variables and syntax commands -in your |vimrc|. - -Global Settings~ - *g:coffee_compiler* -Set the path to the compiler used by |CoffeeMake| and |CoffeeCompile| (it's -{coffee} by default.) -> - let coffee_compiler = '/usr/bin/coffee' -< - *g:coffee_make_options* -Set default options |CoffeeMake| should pass to the compiler. -> - let coffee_make_options = '--bare' -< - *g:coffee_compile_vert* -Split the CoffeeCompile buffer vertically by default. -> - let coffee_compile_vert = 1 -< - *g:coffee_linter* -Set the path to the {coffeelint} executable (it's {coffeelint} by default.) -> - let coffee_linter = '/usr/bin/coffeelint' -< - *g:coffee_lint_options* -Set default options |CoffeeLint| should pass to {coffeelint}. -> - let coffee_lint_options = '-f lint.json' -< - -Syntax Highlighting~ - *ft-coffee-script-syntax* -Trailing whitespace is highlighted as an error by default. This can be -disabled with: -> - hi link coffeeSpaceError NONE - -Trailing semicolons are also considered an error (for help transitioning from -JavaScript.) This can be disabled with: -> - hi link coffeeSemicolonError NONE - -Reserved words like {function} and {var} are highlighted where they're not -allowed in CoffeeScript. This can be disabled with: -> - hi link coffeeReservedError NONE - -COMPILER *compiler-coffee-script* - -A CoffeeScript compiler is provided as a wrapper around {coffee} and can be -loaded with; -> - compiler coffee - -This is done automatically when a CoffeeScript file is opened if no other -compiler is loaded. - -============================================================================= - -LICENSE *coffee-script-license* - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2010 to 2012 Mick Koch - - 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. +Please see the project readme for up-to-date docs: +https://github.com/kchmck/vim-coffee-script vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-coffee-script/ftdetect/eco.vim b/sources_non_forked/vim-coffee-script/ftdetect/eco.vim deleted file mode 100644 index b420649d..00000000 --- a/sources_non_forked/vim-coffee-script/ftdetect/eco.vim +++ /dev/null @@ -1 +0,0 @@ -autocmd BufNewFile,BufRead *.eco set filetype=eco diff --git a/sources_non_forked/vim-coffee-script/ftplugin/coffee.vim b/sources_non_forked/vim-coffee-script/ftplugin/coffee.vim index 44ed1b3d..c44fe979 100644 --- a/sources_non_forked/vim-coffee-script/ftplugin/coffee.vim +++ b/sources_non_forked/vim-coffee-script/ftplugin/coffee.vim @@ -3,261 +3,402 @@ " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif let b:did_ftplugin = 1 +call coffee#CoffeeSetUpVariables() setlocal formatoptions-=t formatoptions+=croql -setlocal comments=:# -setlocal commentstring=#\ %s +setlocal comments=:# commentstring=#\ %s setlocal omnifunc=javascriptcomplete#CompleteJS -" Enable CoffeeMake if it won't overwrite any settings. +" Create custom augroups. +augroup CoffeeBufUpdate | augroup END +augroup CoffeeBufNew | augroup END + +" Enable coffee compiler if a compiler isn't set already. if !len(&l:makeprg) compiler coffee endif -" Check here too in case the compiler above isn't loaded. -if !exists('coffee_compiler') - let coffee_compiler = 'coffee' -endif - -" Path to coffeelint executable -if !exists('coffee_linter') - let coffee_linter = 'coffeelint' -endif - -" Options passed to CoffeeLint -if !exists('coffee_lint_options') - let coffee_lint_options = '' -endif - -" Reset the CoffeeCompile variables for the current buffer. -function! s:CoffeeCompileResetVars() - " Compiled output buffer - let b:coffee_compile_buf = -1 - let b:coffee_compile_pos = [] - - " If CoffeeCompile is watching a buffer - let b:coffee_compile_watch = 0 +" Switch to the window for buf. +function! s:SwitchWindow(buf) + exec bufwinnr(a:buf) 'wincmd w' endfunction -" Clean things up in the source buffer. +" Create a new scratch buffer and return the bufnr of it. After the function +" returns, vim remains in the scratch buffer so more set up can be done. +function! s:ScratchBufBuild(src, vert, size) + if a:size <= 0 + if a:vert + let size = winwidth(bufwinnr(a:src)) / 2 + else + let size = winheight(bufwinnr(a:src)) / 2 + endif + endif + + if a:vert + vertical belowright new + exec 'vertical resize' size + else + belowright new + exec 'resize' size + endif + + setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable + nnoremap q :hide + + return bufnr('%') +endfunction + +" Replace buffer contents with text and delete the last empty line. +function! s:ScratchBufUpdate(buf, text) + " Move to the scratch buffer. + call s:SwitchWindow(a:buf) + + " Double check we're in the scratch buffer before overwriting. + if bufnr('%') != a:buf + throw 'unable to change to scratch buffer' + endif + + setlocal modifiable + silent exec '% delete _' + silent put! =a:text + silent exec '$ delete _' + setlocal nomodifiable +endfunction + +" Parse the output of coffee into a qflist entry for src buffer. +function! s:ParseCoffeeError(output, src, startline) + " Coffee error is always on first line? + let match = matchlist(a:output, + \ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n") + + if !len(match) + return + endif + + " Consider the line number from coffee as relative and add it to the beginning + " line number of the range the command was called on, then subtract one for + " zero-based relativity. + call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1, + \ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r') +endfunction + +" Reset source buffer variables. +function! s:CoffeeCompileResetVars() + " Variables defined in source buffer: + " b:coffee_compile_buf: bufnr of output buffer + " Variables defined in output buffer: + " b:coffee_src_buf: bufnr of source buffer + " b:coffee_compile_pos: previous cursor position in output buffer + + let b:coffee_compile_buf = -1 +endfunction + +function! s:CoffeeWatchResetVars() + " Variables defined in source buffer: + " b:coffee_watch_buf: bufnr of output buffer + " Variables defined in output buffer: + " b:coffee_src_buf: bufnr of source buffer + " b:coffee_watch_pos: previous cursor position in output buffer + + let b:coffee_watch_buf = -1 +endfunction + +function! s:CoffeeRunResetVars() + " Variables defined in CoffeeRun source buffer: + " b:coffee_run_buf: bufnr of output buffer + " Variables defined in CoffeeRun output buffer: + " b:coffee_src_buf: bufnr of source buffer + " b:coffee_run_pos: previous cursor position in output buffer + + let b:coffee_run_buf = -1 +endfunction + +" Clean things up in the source buffers. function! s:CoffeeCompileClose() - exec bufwinnr(b:coffee_compile_src_buf) 'wincmd w' - silent! autocmd! CoffeeCompileAuWatch * + " Switch to the source buffer if not already in it. + silent! call s:SwitchWindow(b:coffee_src_buf) call s:CoffeeCompileResetVars() endfunction -" Update the CoffeeCompile buffer given some input lines. -function! s:CoffeeCompileUpdate(startline, endline) - let input = join(getline(a:startline, a:endline), "\n") +function! s:CoffeeWatchClose() + silent! call s:SwitchWindow(b:coffee_src_buf) + silent! autocmd! CoffeeAuWatch * + call s:CoffeeWatchResetVars() +endfunction - " Move to the CoffeeCompile buffer. - exec bufwinnr(b:coffee_compile_buf) 'wincmd w' +function! s:CoffeeRunClose() + silent! call s:SwitchWindow(b:coffee_src_buf) + call s:CoffeeRunResetVars() +endfunction + +" Compile the lines between startline and endline and put the result into buf. +function! s:CoffeeCompileToBuf(buf, startline, endline) + let src = bufnr('%') + let input = join(getline(a:startline, a:endline), "\n") " Coffee doesn't like empty input. if !len(input) + " Function should still return within output buffer. + call s:SwitchWindow(a:buf) return endif - " Compile input. - let output = system(g:coffee_compiler . ' -scb 2>&1', input) + " Pipe lines into coffee. + let output = system(g:coffee_compiler . + \ ' -scb' . + \ ' ' . b:coffee_litcoffee . + \ ' 2>&1', input) - " Be sure we're in the CoffeeCompile buffer before overwriting. - if exists('b:coffee_compile_buf') - echoerr 'CoffeeCompile buffers are messed up' - return - endif + " Paste output into output buffer. + call s:ScratchBufUpdate(a:buf, output) - " Replace buffer contents with new output and delete the last empty line. - setlocal modifiable - exec '% delete _' - put! =output - exec '$ delete _' - setlocal nomodifiable - - " Highlight as JavaScript if there is no compile error. + " Highlight as JavaScript if there were no compile errors. if v:shell_error + call s:ParseCoffeeError(output, src, a:startline) setlocal filetype= else + " Clear the quickfix list. + call setqflist([], 'r') setlocal filetype=javascript endif - - call setpos('.', b:coffee_compile_pos) -endfunction - -" Update the CoffeeCompile buffer with the whole source buffer. -function! s:CoffeeCompileWatchUpdate() - call s:CoffeeCompileUpdate(1, '$') - exec bufwinnr(b:coffee_compile_src_buf) 'wincmd w' endfunction " Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this " to prevent the cursor from being moved (and its position saved) before the " function is called. function! s:CoffeeCompile(startline, endline, args) - if !executable(g:coffee_compiler) - echoerr "Can't find CoffeeScript compiler `" . g:coffee_compiler . "`" + if a:args =~ '\' + echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead' + sleep 5 + call s:CoffeeWatch(a:args) return endif - " If in the CoffeeCompile buffer, switch back to the source buffer and - " continue. + " Switch to the source buffer if not already in it. + silent! call s:SwitchWindow(b:coffee_src_buf) + + " Bail if not in source buffer. if !exists('b:coffee_compile_buf') - exec bufwinnr(b:coffee_compile_src_buf) 'wincmd w' - endif - - " Parse arguments. - let watch = a:args =~ '\' - let unwatch = a:args =~ '\' - let size = str2nr(matchstr(a:args, '\<\d\+\>')) - - " Determine default split direction. - if exists('g:coffee_compile_vert') - let vert = 1 - else - let vert = a:args =~ '\' - endif - - " Remove any watch listeners. - silent! autocmd! CoffeeCompileAuWatch * - - " If just unwatching, don't compile. - if unwatch - let b:coffee_compile_watch = 0 return endif - if watch - let b:coffee_compile_watch = 1 - endif - - " Build the CoffeeCompile buffer if it doesn't exist. + " Build the output buffer if it doesn't exist. if bufwinnr(b:coffee_compile_buf) == -1 - let src_buf = bufnr('%') - let src_win = bufwinnr(src_buf) + let src = bufnr('%') - " Create the new window and resize it. - if vert - let width = size ? size : winwidth(src_win) / 2 + let vert = exists('g:coffee_compile_vert') || a:args =~ '\' + let size = str2nr(matchstr(a:args, '\<\d\+\>')) - belowright vertical new - exec 'vertical resize' width - else - " Try to guess the compiled output's height. - let height = size ? size : min([winheight(src_win) / 2, - \ a:endline - a:startline + 2]) + " Build the output buffer and save the source bufnr. + let buf = s:ScratchBufBuild(src, vert, size) + let b:coffee_src_buf = src - belowright new - exec 'resize' height - endif - - " We're now in the scratch buffer, so set it up. - setlocal bufhidden=wipe buftype=nofile - setlocal nobuflisted nomodifiable noswapfile nowrap + " Set the buffer name. + exec 'silent! file [CoffeeCompile ' . src . ']' + " Clean up the source buffer when the output buffer is closed. autocmd BufWipeout call s:CoffeeCompileClose() - " Save the cursor when leaving the CoffeeCompile buffer. + " Save the cursor when leaving the output buffer. autocmd BufLeave let b:coffee_compile_pos = getpos('.') - nnoremap q :hide + " Run user-defined commands on new buffer. + silent doautocmd CoffeeBufNew User CoffeeCompile - let b:coffee_compile_src_buf = src_buf - let buf = bufnr('%') - - " Go back to the source buffer and set it up. - exec bufwinnr(b:coffee_compile_src_buf) 'wincmd w' + " Switch back to the source buffer and save the output bufnr. This also + " triggers BufLeave above. + call s:SwitchWindow(src) let b:coffee_compile_buf = buf endif - if b:coffee_compile_watch - call s:CoffeeCompileWatchUpdate() + " Fill the scratch buffer. + call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline) + " Reset cursor to previous position. + call setpos('.', b:coffee_compile_pos) - augroup CoffeeCompileAuWatch - autocmd InsertLeave call s:CoffeeCompileWatchUpdate() - augroup END + " Run any user-defined commands on the scratch buffer. + silent doautocmd CoffeeBufUpdate User CoffeeCompile +endfunction + +" Update the scratch buffer and switch back to the source buffer. +function! s:CoffeeWatchUpdate() + call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$') + call setpos('.', b:coffee_watch_pos) + silent doautocmd CoffeeBufUpdate User CoffeeWatch + call s:SwitchWindow(b:coffee_src_buf) +endfunction + +" Continually compile a source buffer. +function! s:CoffeeWatch(args) + silent! call s:SwitchWindow(b:coffee_src_buf) + + if !exists('b:coffee_watch_buf') + return + endif + + if bufwinnr(b:coffee_watch_buf) == -1 + let src = bufnr('%') + + let vert = exists('g:coffee_watch_vert') || a:args =~ '\' + let size = str2nr(matchstr(a:args, '\<\d\+\>')) + + let buf = s:ScratchBufBuild(src, vert, size) + let b:coffee_src_buf = src + + exec 'silent! file [CoffeeWatch ' . src . ']' + + autocmd BufWipeout call s:CoffeeWatchClose() + autocmd BufLeave let b:coffee_watch_pos = getpos('.') + + silent doautocmd CoffeeBufNew User CoffeeWatch + + call s:SwitchWindow(src) + let b:coffee_watch_buf = buf + endif + + " Make sure only one watch autocmd is defined on this buffer. + silent! autocmd! CoffeeAuWatch * + + augroup CoffeeAuWatch + autocmd InsertLeave call s:CoffeeWatchUpdate() + autocmd BufWritePost call s:CoffeeWatchUpdate() + augroup END + + call s:CoffeeWatchUpdate() +endfunction + +" Run a snippet of CoffeeScript between startline and endline. +function! s:CoffeeRun(startline, endline, args) + silent! call s:SwitchWindow(b:coffee_src_buf) + + if !exists('b:coffee_run_buf') + return + endif + + if bufwinnr(b:coffee_run_buf) == -1 + let src = bufnr('%') + + let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0) + let b:coffee_src_buf = src + + exec 'silent! file [CoffeeRun ' . src . ']' + + autocmd BufWipeout call s:CoffeeRunClose() + autocmd BufLeave let b:coffee_run_pos = getpos('.') + + silent doautocmd CoffeeBufNew User CoffeeRun + + call s:SwitchWindow(src) + let b:coffee_run_buf = buf + endif + + if a:startline == 1 && a:endline == line('$') + let output = system(g:coffee_compiler . + \ ' ' . b:coffee_litcoffee . + \ ' ' . fnameescape(expand('%')) . + \ ' ' . a:args) else - call s:CoffeeCompileUpdate(a:startline, a:endline) - endif -endfunction + let input = join(getline(a:startline, a:endline), "\n") -" Complete arguments for the CoffeeCompile command. -function! s:CoffeeCompileComplete(arg, cmdline, cursor) - let args = ['unwatch', 'vertical', 'watch'] - - if !len(a:arg) - return args - endif - - let match = '^' . a:arg - - for arg in args - if arg =~ match - return [arg] + if !len(input) + return endif - endfor + + let output = system(g:coffee_compiler . + \ ' -s' . + \ ' ' . b:coffee_litcoffee . + \ ' ' . a:args, input) + endif + + call s:ScratchBufUpdate(b:coffee_run_buf, output) + call setpos('.', b:coffee_run_pos) + + silent doautocmd CoffeeBufUpdate User CoffeeRun endfunction -" Run coffeelint on a file, and add any errors between @startline and @endline +" Run coffeelint on a file, and add any errors between startline and endline " to the quickfix list. function! s:CoffeeLint(startline, endline, bang, args) - if !executable(g:coffee_linter) - echoerr "Can't find CoffeeScript linter `" . g:coffee_linter . "`" + let input = join(getline(a:startline, a:endline), "\n") + + if !len(input) return endif - let filename = expand('%') + let output = system(g:coffee_linter . + \ ' -s --csv' . + \ ' ' . b:coffee_litcoffee . + \ ' ' . g:coffee_lint_options . + \ ' ' . a:args . + \ ' 2>&1', input) - if !len(filename) - echoerr 'CoffeeLint must be ran on a saved file' - return - endif - - let lines = split(system(g:coffee_linter . ' --csv ' . g:coffee_lint_options . - \ ' ' . a:args . ' ' . filename . ' 2>&1'), '\n') + " Convert output into an array and strip off the csv header. + let lines = split(output, "\n")[1:] + let buf = bufnr('%') let qflist = [] for line in lines - let match = matchlist(line, '\f\+,\(\d\+\),error,\(.\+\)') + let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$') - " Ignore invalid lines. + " Ignore unmatched lines. if !len(match) continue endif - let lnum = str2nr(match[1]) - - " Don't add the error if it's not in the range. - if lnum < a:startline || lnum > a:endline - continue - endif - - let text = match[2] - - call add(qflist, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text}) + " The 'type' will result in either 'E' or 'W'. + call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1, + \ 'type': toupper(match[2][0]), 'text': match[3]}) endfor + " Replace the quicklist with our items. call setqflist(qflist, 'r') - " Don't jump if there's a bang. + " If not given a bang, jump to first error. if !len(a:bang) silent! cc 1 endif endfunction -" Don't overwrite the CoffeeCompile variables. +" Complete arguments for Coffee* commands. +function! s:CoffeeComplete(cmd, cmdline, cursor) + let args = ['vertical'] + + " If no partial command, return all possibilities. + if !len(a:cmd) + return args + endif + + let pat = '^' . a:cmd + + for arg in args + if arg =~ pat + return [arg] + endif + endfor +endfunction + +" Set initial state variables if they don't exist if !exists('b:coffee_compile_buf') call s:CoffeeCompileResetVars() endif -" Peek at compiled CoffeeScript. -command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeCompileComplete +if !exists('b:coffee_watch_buf') + call s:CoffeeWatchResetVars() +endif + +if !exists('b:coffee_run_buf') + call s:CoffeeRunResetVars() +endif + +command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete \ CoffeeCompile call s:CoffeeCompile(, , ) -" Run some CoffeeScript. -command! -range=% -bar CoffeeRun ,:w !coffee -s -" Run coffeelint on the file. +command! -bar -nargs=* -complete=customlist,s:CoffeeComplete +\ CoffeeWatch call s:CoffeeWatch() +command! -range=% -bar -nargs=* CoffeeRun +\ call s:CoffeeRun(, , ) command! -range=% -bang -bar -nargs=* CoffeeLint -\ call s:CoffeeLint(, , '', ) +\ call s:CoffeeLint(, , , ) diff --git a/sources_non_forked/vim-coffee-script/indent/coffee.vim b/sources_non_forked/vim-coffee-script/indent/coffee.vim index 6e58d5e7..7bd82e3e 100644 --- a/sources_non_forked/vim-coffee-script/indent/coffee.vim +++ b/sources_non_forked/vim-coffee-script/indent/coffee.vim @@ -3,7 +3,7 @@ " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL -if exists("b:did_indent") +if exists('b:did_indent') finish endif @@ -15,43 +15,76 @@ setlocal indentexpr=GetCoffeeIndent(v:lnum) " indented or outdented. setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally +" If no indenting or outdenting is needed, either keep the indent of the cursor +" (use autoindent) or match the indent of the previous line. +if exists('g:coffee_indent_keep_current') + let s:DEFAULT_LEVEL = '-1' +else + let s:DEFAULT_LEVEL = 'indent(prevnlnum)' +endif + " Only define the function once. -if exists("*GetCoffeeIndent") +if exists('*GetCoffeeIndent') finish endif -" Keywords to indent after -let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|' -\ . 'loop\|switch\|when\|try\|catch\|finally\|' -\ . 'class\)\>' +" Keywords that begin a block +let s:BEGIN_BLOCK_KEYWORD = '\C^\%(if\|unless\|else\|for\|while\|until\|' +\ . 'loop\|switch\|when\|try\|catch\|finally\|' +\ . 'class\)\>\%(\s*:\)\@!' -" Operators to indent after -let s:INDENT_AFTER_OPERATOR = '\%([([{:=]\|[-=]>\)$' +" An expression that uses the result of a statement +let s:COMPOUND_EXPRESSION = '\C\%([^-]-\|[^+]+\|[^/]/\|[:=*%&|^<>]\)\s*' +\ . '\%(if\|unless\|for\|while\|until\|loop\|switch\|' +\ . 'try\|class\)\>' -" Keywords and operators that continue a line -let s:CONTINUATION = '\<\%(is\|isnt\|and\|or\)\>$' -\ . '\|' -\ . '\%(-\@\|\*\|/\@$' + +" Operators that continue a line onto the next line +let s:CONTINUATION_OP = '\C\%(\<\%(is\|isnt\|and\|or\)\>\|' +\ . '[^-]-\|[^+]+\|[^-=]>\|[^.]\.\|[<*/%&|^,]\)$' + +" Ancestor operators that prevent continuation indenting +let s:CONTINUATION = s:CONTINUATION_OP . '\|' . s:BEGIN_BLOCK_OP + +" A closing bracket by itself on a line followed by a continuation +let s:BRACKET_CONTINUATION = '^\s*[}\])]\s*' . s:CONTINUATION_OP " A continuation dot access let s:DOT_ACCESS = '^\.' -" Keywords to outdent after -let s:OUTDENT_AFTER = '^\%(return\|break\|continue\|throw\)\>' +" Keywords that break out of a block +let s:BREAK_BLOCK_OP = '\C^\%(return\|break\|continue\|throw\)\>' -" A compound assignment like `... = if ...` -let s:COMPOUND_ASSIGNMENT = '[:=]\s*\%(if\|unless\|for\|while\|until\|' -\ . 'switch\|try\|class\)\>' +" A condition attached to the end of a statement +let s:POSTFIX_CONDITION = '\C\S\s\+\zs\<\%(if\|unless\|when\|while\|until\)\>' -" A postfix condition like `return ... if ...`. -let s:POSTFIX_CONDITION = '\S\s\+\zs\<\%(if\|unless\)\>' +" A then contained in brackets +let s:CONTAINED_THEN = '\C[(\[].\{-}\.\{-\}[)\]]' -" A single line else statement like `else ...` but not `else if ...` -let s:SINGLE_LINE_ELSE = '^else\s\+\%(\<\%(if\|unless\)\>\)\@!' +" An else with a condition attached +let s:ELSE_COND = '\C^\s*else\s\+\<\%(if\|unless\)\>' + +" A single-line else statement (without a condition attached) +let s:SINGLE_LINE_ELSE = '\C^else\s\+\%(\<\%(if\|unless\)\>\)\@!' + +" Pairs of starting and ending keywords, with an initial pattern to match +let s:KEYWORD_PAIRS = [ +\ ['\C^else\>', '\C\<\%(if\|unless\|when\|else\s\+\%(if\|unless\)\)\>', +\ '\C\'], +\ ['\C^catch\>', '\C\', '\C\'], +\ ['\C^finally\>', '\C\', '\C\'] +\] + +" Pairs of starting and ending brackets +let s:BRACKET_PAIRS = {']': '\[', '}': '{', ')': '('} " Max lines to look back for a match let s:MAX_LOOKBACK = 50 @@ -66,286 +99,330 @@ let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)' " Syntax names for strings and comments let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT +" Compatibility code for shiftwidth() as recommended by the docs, but modified +" so there isn't as much of a penalty if shiftwidth() exists. +if exists('*shiftwidth') + let s:ShiftWidth = function('shiftwidth') +else + function! s:ShiftWidth() + return &shiftwidth + endfunction +endif + " Get the linked syntax name of a character. -function! s:SyntaxName(linenum, col) - return synIDattr(synID(a:linenum, a:col, 1), 'name') +function! s:SyntaxName(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') endfunction " Check if a character is in a comment. -function! s:IsComment(linenum, col) - return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_COMMENT +function! s:IsComment(lnum, col) + return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_COMMENT endfunction " Check if a character is in a string. -function! s:IsString(linenum, col) - return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_STRING +function! s:IsString(lnum, col) + return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING endfunction " Check if a character is in a comment or string. -function! s:IsCommentOrString(linenum, col) - return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_STRING_COMMENT -endfunction - -" Check if a whole line is a comment. -function! s:IsCommentLine(linenum) - " Check the first non-whitespace character. - return s:IsComment(a:linenum, indent(a:linenum) + 1) +function! s:IsCommentOrString(lnum, col) + return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING_COMMENT endfunction " Search a line for a regex until one is found outside a string or comment. -function! s:SmartSearch(linenum, regex) - " Start at the first column. - let col = 0 +function! s:SearchCode(lnum, regex) + " Start at the first column and look for an initial match (including at the + " cursor.) + call cursor(a:lnum, 1) + let pos = search(a:regex, 'c', a:lnum) - " Search until there are no more matches, unless a good match is found. - while 1 - call cursor(a:linenum, col + 1) - let [_, col] = searchpos(a:regex, 'cn', a:linenum) - - " No more matches. - if !col - break - endif - - if !s:IsCommentOrString(a:linenum, col) + while pos + if !s:IsCommentOrString(a:lnum, col('.')) return 1 endif + + " Move to the match and continue searching (don't accept matches at the + " cursor.) + let pos = search(a:regex, '', a:lnum) endwhile - " No good match found. return 0 endfunction -" Check if a match should be skipped. -function! s:ShouldSkip(startlinenum, linenum, col) - " Skip if in a comment or string. - if s:IsCommentOrString(a:linenum, a:col) - return 1 - endif +" Search for the nearest previous line that isn't a comment. +function! s:GetPrevNormalLine(startlnum) + let curlnum = a:startlnum - " Skip if a single line statement that isn't adjacent. - if s:SmartSearch(a:linenum, '\') && a:startlinenum - a:linenum > 1 - return 1 - endif + while curlnum + let curlnum = prevnonblank(curlnum - 1) - " Skip if a postfix condition. - if s:SmartSearch(a:linenum, s:POSTFIX_CONDITION) && - \ !s:SmartSearch(a:linenum, s:COMPOUND_ASSIGNMENT) - return 1 - endif - - return 0 -endfunction - -" Find the farthest line to look back to, capped to line 1 (zero and negative -" numbers cause bad things). -function! s:MaxLookback(startlinenum) - return max([1, a:startlinenum - s:MAX_LOOKBACK]) -endfunction - -" Get the skip expression for searchpair(). -function! s:SkipExpr(startlinenum) - return "s:ShouldSkip(" . a:startlinenum . ", line('.'), col('.'))" -endfunction - -" Search for pairs of text. -function! s:SearchPair(start, end) - " The cursor must be in the first column for regexes to match. - call cursor(0, 1) - - let startlinenum = line('.') - - " Don't need the W flag since MaxLookback caps the search to line 1. - return searchpair(a:start, '', a:end, 'bcn', - \ s:SkipExpr(startlinenum), - \ s:MaxLookback(startlinenum)) -endfunction - -" Try to find a previous matching line. -function! s:GetMatch(curline) - let firstchar = a:curline[0] - - if firstchar == '}' - return s:SearchPair('{', '}') - elseif firstchar == ')' - return s:SearchPair('(', ')') - elseif firstchar == ']' - return s:SearchPair('\[', '\]') - elseif a:curline =~ '^else\>' - return s:SearchPair('\<\%(if\|unless\|when\)\>', '\') - elseif a:curline =~ '^catch\>' - return s:SearchPair('\', '\') - elseif a:curline =~ '^finally\>' - return s:SearchPair('\', '\') - endif - - return 0 -endfunction - -" Get the nearest previous line that isn't a comment. -function! s:GetPrevNormalLine(startlinenum) - let curlinenum = a:startlinenum - - while curlinenum - let curlinenum = prevnonblank(curlinenum - 1) - - if !s:IsCommentLine(curlinenum) - return curlinenum + " Return the line if the first non-whitespace character isn't a comment. + if !s:IsComment(curlnum, indent(curlnum) + 1) + return curlnum endif endwhile return 0 endfunction -" Try to find a comment in a line. -function! s:FindComment(linenum) - call cursor(a:linenum, 0) +function! s:SearchPair(startlnum, lookback, skip, open, close) + " Go to the first column so a:close will be matched even if it's at the + " beginning of the line. + call cursor(a:startlnum, 1) + return searchpair(a:open, '', a:close, 'bnW', a:skip, max([1, a:lookback])) +endfunction - " Current column - let cur = 0 - " Last column in the line - let end = col('$') - 1 +" Skip if a match +" - is in a string or comment +" - is a single-line statement that isn't immediately +" adjacent +" - has a postfix condition and isn't an else statement or compound +" expression +function! s:ShouldSkip(startlnum, lnum, col) + return s:IsCommentOrString(a:lnum, a:col) || + \ s:SearchCode(a:lnum, '\C\') && a:startlnum - a:lnum > 1 || + \ s:SearchCode(a:lnum, s:POSTFIX_CONDITION) && + \ getline(a:lnum) !~ s:ELSE_COND && + \ !s:SearchCode(a:lnum, s:COMPOUND_EXPRESSION) +endfunction - while cur != end - call cursor(0, cur + 1) - let [_, cur] = searchpos('#', 'cn', a:linenum) +" Search for the nearest and farthest match for a keyword pair. +function! s:SearchMatchingKeyword(startlnum, open, close) + let skip = 's:ShouldSkip(' . a:startlnum . ", line('.'), line('.'))" - if !cur + " Search for the nearest match. + let nearestlnum = s:SearchPair(a:startlnum, a:startlnum - s:MAX_LOOKBACK, + \ skip, a:open, a:close) + + if !nearestlnum + return [] + endif + + " Find the nearest previous line with indent less than or equal to startlnum. + let ind = indent(a:startlnum) + let lookback = s:GetPrevNormalLine(a:startlnum) + + while lookback && indent(lookback) > ind + let lookback = s:GetPrevNormalLine(lookback) + endwhile + + " Search for the farthest match. If there are no other matches, then the + " nearest match is also the farthest one. + let matchlnum = nearestlnum + + while matchlnum + let lnum = matchlnum + let matchlnum = s:SearchPair(matchlnum, lookback, skip, a:open, a:close) + endwhile + + return [nearestlnum, lnum] +endfunction + +" Strip a line of a trailing comment and surrounding whitespace. +function! s:GetTrimmedLine(lnum) + " Try to find a comment starting at the first column. + call cursor(a:lnum, 1) + let pos = search('#', 'c', a:lnum) + + " Keep searching until a comment is found or search returns 0. + while pos + if s:IsComment(a:lnum, col('.')) break endif - if s:IsComment(a:linenum, cur) - return cur - endif + let pos = search('#', '', a:lnum) endwhile - return 0 -endfunction - -" Get a line without comments or surrounding whitespace. -function! s:GetTrimmedLine(linenum) - let comment = s:FindComment(a:linenum) - let line = getline(a:linenum) - - if comment + if !pos + " No comment was found so use the whole line. + let line = getline(a:lnum) + else " Subtract 1 to get to the column before the comment and another 1 for - " zero-based indexing. - let line = line[:comment - 2] + " column indexing -> zero-based indexing. + let line = getline(a:lnum)[:col('.') - 2] endif return substitute(substitute(line, '^\s\+', '', ''), \ '\s\+$', '', '') endfunction -function! GetCoffeeIndent(curlinenum) - " Don't do anything if on the first line. - if a:curlinenum == 1 +" Get the indent policy when no special rules are used. +function! s:GetDefaultPolicy(curlnum) + " Check whether equalprg is being ran on existing lines. + if strlen(getline(a:curlnum)) == indent(a:curlnum) + " If not indenting an existing line, use the default policy. + return s:DEFAULT_LEVEL + else + " Otherwise let autoindent determine what to do with an existing line. + return '-1' + endif +endfunction + +function! GetCoffeeIndent(curlnum) + " Get the previous non-blank line (may be a comment.) + let prevlnum = prevnonblank(a:curlnum - 1) + + " Bail if there's no code before. + if !prevlnum return -1 endif - let prevlinenum = a:curlinenum - 1 - - " If continuing a comment, keep the indent level. - if s:IsCommentLine(prevlinenum) - return indent(prevlinenum) + " Bail if inside a multiline string. + if s:IsString(a:curlnum, 1) + let prevnlnum = prevlnum + exec 'return' s:GetDefaultPolicy(a:curlnum) endif - let prevlinenum = s:GetPrevNormalLine(a:curlinenum) + " Get the code part of the current line. + let curline = s:GetTrimmedLine(a:curlnum) + " Get the previous non-comment line. + let prevnlnum = s:GetPrevNormalLine(a:curlnum) - " Don't do anything if there's no code before. - if !prevlinenum - return -1 + " Check if the current line is the closing bracket in a bracket pair. + if has_key(s:BRACKET_PAIRS, curline[0]) + " Search for a matching opening bracket. + let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK, + \ "s:IsCommentOrString(line('.'), col('.'))", + \ s:BRACKET_PAIRS[curline[0]], curline[0]) + + if matchlnum + " Match the indent of the opening bracket. + return indent(matchlnum) + else + " No opening bracket found (bad syntax), so bail. + exec 'return' s:GetDefaultPolicy(a:curlnum) + endif endif - " Indent based on the current line. - let curline = s:GetTrimmedLine(a:curlinenum) + " Check if the current line is the closing keyword in a keyword pair. + for pair in s:KEYWORD_PAIRS + if curline =~ pair[0] + " Find the nearest and farthest matches within the same indent level. + let matches = s:SearchMatchingKeyword(a:curlnum, pair[1], pair[2]) - " Try to find a matching statement. This handles outdenting. - let matchlinenum = s:GetMatch(curline) - - if matchlinenum - return indent(matchlinenum) - endif - - " Try to find a matching when. - if curline =~ '^when\>' && !s:SmartSearch(prevlinenum, '\') - let linenum = a:curlinenum - - while linenum - let linenum = s:GetPrevNormalLine(linenum) - - if getline(linenum) =~ '^\s*when\>' - return indent(linenum) + if len(matches) + " Don't force indenting/outdenting as long as line is already lined up + " with a valid match + return max([min([indent(a:curlnum), indent(matches[0])]), + \ indent(matches[1])]) + else + " No starting keyword found (bad syntax), so bail. + exec 'return' s:GetDefaultPolicy(a:curlnum) endif + endif + endfor + + " Check if the current line is a `when` and not the first in a switch block. + if curline =~ '\C^when\>' && !s:SearchCode(prevnlnum, '\C\') + " Look back for a `when`. + while prevnlnum + if getline(prevnlnum) =~ '\C^\s*when\>' + " Indent to match the found `when`, but don't force indenting (for when + " indenting nested switch blocks.) + return min([indent(a:curlnum), indent(prevnlnum)]) + endif + + let prevnlnum = s:GetPrevNormalLine(prevnlnum) endwhile - return -1 + " No matching `when` found (bad syntax), so bail. + exec 'return' s:GetDefaultPolicy(a:curlnum) endif - " Indent based on the previous line. - let prevline = s:GetTrimmedLine(prevlinenum) - let previndent = indent(prevlinenum) + " If the previous line is a comment, use its indentation, but don't force + " indenting. + if prevlnum != prevnlnum + return min([indent(a:curlnum), indent(prevlnum)]) + endif + + let prevline = s:GetTrimmedLine(prevnlnum) " Always indent after these operators. - if prevline =~ s:INDENT_AFTER_OPERATOR - return previndent + &shiftwidth + if prevline =~ s:BEGIN_BLOCK_OP + return indent(prevnlnum) + s:ShiftWidth() endif - " Indent after a continuation if it's the first. - if prevline =~ s:CONTINUATION - " If the line ends in a slash, make sure it isn't a regex. - if prevline =~ '/$' - " Move to the line so we can get the last column. - call cursor(prevlinenum) - - if s:IsString(prevlinenum, col('$') - 1) - return -1 - endif + " Indent if the previous line starts a function block, but don't force + " indenting if the line is non-blank (for empty function bodies.) + if prevline =~ s:FUNCTION + if strlen(getline(a:curlnum)) > indent(a:curlnum) + return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)]) + else + return indent(prevnlnum) + s:ShiftWidth() endif - - let prevprevlinenum = s:GetPrevNormalLine(prevlinenum) - - " If the continuation is the first in the file, there can't be others before - " it. - if !prevprevlinenum - return previndent + &shiftwidth - endif - - let prevprevline = s:GetTrimmedLine(prevprevlinenum) - - " Only indent after the first continuation. - if prevprevline !~ s:CONTINUATION && prevprevline !~ s:CONTINUATION_BLOCK - return previndent + &shiftwidth - endif - - return -1 endif - " Indent after these keywords and compound assignments if they aren't a - " single line statement. - if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT - if !s:SmartSearch(prevlinenum, '\') && prevline !~ s:SINGLE_LINE_ELSE - return previndent + &shiftwidth + " Check if continuation indenting is needed. If the line ends in a slash, make + " sure it isn't a regex. + if prevline =~ s:CONTINUATION_OP && + \ !(prevline =~ '/$' && s:IsString(prevnlnum, col([prevnlnum, '$']) - 1)) + " Don't indent if the continuation follows a closing bracket. + if prevline =~ s:BRACKET_CONTINUATION + exec 'return' s:GetDefaultPolicy(a:curlnum) endif - return -1 + let prevprevnlnum = s:GetPrevNormalLine(prevnlnum) + + " Don't indent if not the first continuation. + if prevprevnlnum && s:GetTrimmedLine(prevprevnlnum) =~ s:CONTINUATION + exec 'return' s:GetDefaultPolicy(a:curlnum) + endif + + " Continuation indenting seems to vary between programmers, so if the line + " is non-blank, don't override the indentation + if strlen(getline(a:curlnum)) > indent(a:curlnum) + exec 'return' s:GetDefaultPolicy(a:curlnum) + endif + + " Otherwise indent a level. + return indent(prevnlnum) + s:ShiftWidth() + endif + + " Check if the previous line starts with a keyword that begins a block. + if prevline =~ s:BEGIN_BLOCK + " Indent if the current line doesn't start with `then` and the previous line + " isn't a single-line statement. + if curline !~ '\C^\' && !s:SearchCode(prevnlnum, '\C\') && + \ prevline !~ s:SINGLE_LINE_ELSE + return indent(prevnlnum) + s:ShiftWidth() + else + exec 'return' s:GetDefaultPolicy(a:curlnum) + endif endif " Indent a dot access if it's the first. - if curline =~ s:DOT_ACCESS && prevline !~ s:DOT_ACCESS - return previndent + &shiftwidth - endif - - " Outdent after these keywords if they don't have a postfix condition or are - " a single-line statement. - if prevline =~ s:OUTDENT_AFTER - if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) || - \ s:SmartSearch(prevlinenum, '\') - return previndent - &shiftwidth + if curline =~ s:DOT_ACCESS + if prevline !~ s:DOT_ACCESS + return indent(prevnlnum) + s:ShiftWidth() + else + exec 'return' s:GetDefaultPolicy(a:curlnum) endif endif - " If no indent or outdent is needed, keep the indent level of the previous - " line. - return previndent + " Outdent if a keyword breaks out of a block as long as it doesn't have a + " postfix condition (and the postfix condition isn't a single-line statement.) + if prevline =~ s:BREAK_BLOCK_OP + if !s:SearchCode(prevnlnum, s:POSTFIX_CONDITION) || + \ s:SearchCode(prevnlnum, '\C\') && + \ !s:SearchCode(prevnlnum, s:CONTAINED_THEN) + " Don't force indenting. + return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()]) + else + exec 'return' s:GetDefaultPolicy(a:curlnum) + endif + endif + + " Check if inside brackets. + let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK, + \ "s:IsCommentOrString(line('.'), col('.'))", + \ '\[\|(\|{', '\]\|)\|}') + + " If inside brackets, indent relative to the brackets, but don't outdent an + " already indented line. + if matchlnum + return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()]) + endif + + " No special rules applied, so use the default policy. + exec 'return' s:GetDefaultPolicy(a:curlnum) endfunction diff --git a/sources_non_forked/vim-coffee-script/syntax/coffee.vim b/sources_non_forked/vim-coffee-script/syntax/coffee.vim index da39e34a..7f8df73c 100644 --- a/sources_non_forked/vim-coffee-script/syntax/coffee.vim +++ b/sources_non_forked/vim-coffee-script/syntax/coffee.vim @@ -10,12 +10,10 @@ endif " Include JavaScript for coffeeEmbed. syn include @coffeeJS syntax/javascript.vim +silent! unlet b:current_syntax " Highlight long strings. -syn sync minlines=100 - -" CoffeeScript identifiers can have dollar signs. -setlocal isident+=$ +syntax sync fromstart " These are `matches` instead of `keywords` because vim's highlighting " priority for keywords is higher than matches. This causes keywords to be @@ -66,7 +64,7 @@ syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display hi def link coffeeSpecialVar Special " An @-variable -syn match coffeeSpecialIdent /@\%(\I\i*\)\?/ display +syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display hi def link coffeeSpecialIdent Identifier " A class-like name that starts with a capital letter @@ -94,27 +92,27 @@ syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/ hi def link coffeeString String " A integer, including a leading plus or minus -syn match coffeeNumber /\i\@/ display syn match coffeeNumber /\<0[bB][01]\+\>/ display syn match coffeeNumber /\<0[oO][0-7]\+\>/ display +syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display hi def link coffeeNumber Number " A floating-point number, including a leading plus or minus -syn match coffeeFloat /\i\@/ - \ display - hi def link coffeeReservedError Error -endif +" An error for reserved keywords, taken from the RESERVED array: +" http://coffeescript.org/documentation/docs/lexer.html#section-67 +syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|package\|private\|protected\|public\|static\|yield\)\>/ +\ display +hi def link coffeeReservedError Error " A normal object assignment -syn match coffeeObjAssign /@\?\I\i*\s*\ze::\@!/ contains=@coffeeIdentifier display +syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display hi def link coffeeObjAssign Identifier syn keyword coffeeTodo TODO FIXME XXX contained @@ -134,7 +132,7 @@ hi def link coffeeHeregexComment coffeeComment " Embedded JavaScript syn region coffeeEmbed matchgroup=coffeeEmbedDelim -\ start=/`/ skip=/\\\\\|\\`/ end=/`/ +\ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend \ contains=@coffeeJS hi def link coffeeEmbedDelim Delimiter @@ -148,17 +146,23 @@ hi def link coffeeEscape SpecialChar " A regex -- must not follow a parenthesis, number, or identifier, and must not " be followed by a number -syn region coffeeRegex start=/\%(\%()\|\i\@/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend -syn region ecoExpression matchgroup=ecoDelimiter start=/<%[=\-]/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend -syn region ecoComment matchgroup=ecoComment start=/<%#/ end=/%>/ contains=@coffeeTodo,@Spell containedin=ALLBUT,@ecoRegions keepend - -" eco features not in coffeescript proper -syn keyword ecoEnd end containedin=@ecoRegions -syn match ecoIndentColon /\s+\w+:/ containedin=@ecoRegions - -" Define the default highlighting. - -hi def link ecoDelimiter Delimiter -hi def link ecoComment Comment -hi def link ecoEnd coffeeConditional -hi def link ecoIndentColon None - -let b:current_syntax = 'eco' - -" vim: nowrap sw=2 sts=2 ts=8: diff --git a/sources_non_forked/vim-coffee-script/test/test-eco.html.eco b/sources_non_forked/vim-coffee-script/test/test-eco.html.eco deleted file mode 100644 index d8c5ed4d..00000000 --- a/sources_non_forked/vim-coffee-script/test/test-eco.html.eco +++ /dev/null @@ -1,12 +0,0 @@ - - <%# comment %> - - <%# basic %> - <%- foo = "1" %> - - <%# interpolation %> - <%= " == #{ ( -> "LOL" )() } == " %> - - <%# interpolation with nested curlies %> - <%= " == #{ { a: 1, b: { c: 3, d: 4 } } } == " %> - diff --git a/sources_non_forked/vim-coffee-script/test/test.haml b/sources_non_forked/vim-coffee-script/test/test.haml new file mode 100644 index 00000000..ae19fba5 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/test/test.haml @@ -0,0 +1,3 @@ +:coffeescript + class Hello + # test diff --git a/sources_non_forked/vim-expand-region/README.md b/sources_non_forked/vim-expand-region/README.md index 0ba8efac..eb8fcd31 100644 --- a/sources_non_forked/vim-expand-region/README.md +++ b/sources_non_forked/vim-expand-region/README.md @@ -90,3 +90,7 @@ let g:expand_region_use_select_mode = 1 [Pathogen]:http://github.com/tpope/vim-pathogen [Vundle]:http://github.com/gmarik/vundle [Neobundle]:http://github.com/Shougo/neobundle.vim + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-expand-region/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + diff --git a/sources_non_forked/vim-fugitive/.gitignore b/sources_non_forked/vim-fugitive/.gitignore new file mode 100644 index 00000000..0a56e3fc --- /dev/null +++ b/sources_non_forked/vim-fugitive/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown b/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown new file mode 100644 index 00000000..8583e1e4 --- /dev/null +++ b/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown @@ -0,0 +1,18 @@ +Before reporting a bug, you should try stripping down your Vim configuration +and removing other plugins. The sad truth about VimScript is that it is +fraught with incompatibilities waiting to happen. I'm happy to work around +them where I can, but it's up to you to isolate the conflict. + +If your [commit message sucks](http://stopwritingramblingcommitmessages.com/), +I'm not going to accept your pull request. I've explained very politely +dozens of times that +[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) +are absolute rules on my own repositories, so I may lack the energy to explain +it to you yet another time. And please, if I ask you to change something, +`git commit --amend`. + +Beyond that, don't be shy about asking before patching. What takes you hours +might take me minutes simply because I have both domain knowledge and a +perverse knowledge of VimScript so vast that many would consider it a symptom +of mental illness. On the flip side, some ideas I'll reject no matter how +good the implementation is. "Send a patch" is an edge case answer in my book. diff --git a/sources_non_forked/vim-fugitive/README.markdown b/sources_non_forked/vim-fugitive/README.markdown new file mode 100644 index 00000000..68a61e6a --- /dev/null +++ b/sources_non_forked/vim-fugitive/README.markdown @@ -0,0 +1,120 @@ +# fugitive.vim + +I'm not going to lie to you; fugitive.vim may very well be the best +Git wrapper of all time. Check out these features: + +View any blob, tree, commit, or tag in the repository with `:Gedit` (and +`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and +write to it to stage the changes. Use `:Gdiff` to bring up the staged +version of the file side by side with the working tree version and use +Vim's diff handling capabilities to stage a subset of the file's +changes. + +Bring up the output of `git status` with `:Gstatus`. Press `-` to +`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that +mofo. And guess what `:Gcommit` does! + +`:Gblame` brings up an interactive vertical split with `git blame` +output. Press enter on a line to edit the commit where the line +changed, or `o` to open it in a split. When you're done, use `:Gedit` +in the historic buffer to go back to the work tree version. + +`:Gmove` does a `git mv` on a file and simultaneously renames the +buffer. `:Gremove` does a `git rm` on a file and simultaneously deletes +the buffer. + +Use `:Ggrep` to search the work tree (or any arbitrary commit) with +`git grep`, skipping over that which is not tracked in the repository. +`:Glog` loads all previous revisions of a file into the quickfix list so +you can iterate over them and watch the file evolve! + +`:Gread` is a variant of `git checkout -- filename` that operates on the +buffer rather than the filename. This means you can use `u` to undo it +and you never get any warnings about the file changing outside Vim. +`:Gwrite` writes to both the work tree and index versions of a file, +making it like `git add` when called from a work tree file and like +`git checkout` when called from the index or a blob in history. + +Use `:Gbrowse` to open the current file on GitHub, with optional line +range (try it in visual mode!). If your current repository isn't on +GitHub, `git instaweb` will be spun up instead. + +Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator +with the current branch in (surprise!) your statusline. + +Last but not least, there's `:Git` for running any arbitrary command, +and `Git!` to open the output of a command in a temp file. + +## Screencasts + +* [A complement to command line git](http://vimcasts.org/e/31) +* [Working with the git index](http://vimcasts.org/e/32) +* [Resolving merge conflicts with vimdiff](http://vimcasts.org/e/33) +* [Browsing the git object database](http://vimcasts.org/e/34) +* [Exploring the history of a git repository](http://vimcasts.org/e/35) + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-fugitive.git + +Once help tags have been generated, you can view the manual with +`:help fugitive`. + +If your Vim version is below 7.2, I recommend also installing +[vim-git](https://github.com/tpope/vim-git) for syntax highlighting and +other Git niceties. + +## FAQ + +> I installed the plugin and started Vim. Why don't any of the commands +> exist? + +Fugitive cares about the current file, not the current working +directory. Edit a file from the repository. + +> I opened a new tab. Why don't any of the commands exist? + +Fugitive cares about the current file, not the current working +directory. Edit a file from the repository. + +> Why is `:Gbrowse` not using the right browser? + +`:Gbrowse` delegates to `git web--browse`, which is less than perfect +when it comes to finding the right browser. You can tell it the correct +browser to use with `git config --global web.browser ...`. On OS X, for +example, you might want to set this to `open`. See `git web--browse --help` +for details. + +> Here's a patch that automatically opens the quickfix window after +> `:Ggrep`. + +This is a great example of why I recommend asking before patching. +There are valid arguments to be made both for and against automatically +opening the quickfix window. Whenever I have to make an arbitrary +decision like this, I ask what Vim would do. And Vim does not open a +quickfix window after `:grep`. + +Luckily, it's easy to implement the desired behavior without changing +fugitive.vim. The following autocommand will cause the quickfix window +to open after any grep invocation: + + autocmd QuickFixCmdPost *grep* cwindow + +## Self-Promotion + +Like fugitive.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-fugitive) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=2975). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +## License + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt new file mode 100644 index 00000000..f40afcfb --- /dev/null +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -0,0 +1,317 @@ +*fugitive.txt* A Git wrapper so awesome, it should be illegal + +Author: Tim Pope +License: Same terms as Vim itself (see |license|) + +This plugin is only available if 'compatible' is not set. + +INTRODUCTION *fugitive* + +Whenever you edit a file from a Git repository, a set of commands is defined +that serve as a gateway to Git. + +COMMANDS *fugitive-commands* + +These commands are local to the buffers in which they work (generally, buffers +that are part of Git repositories). + + *fugitive-:Git* +:Git [args] Run an arbitrary git command. Similar to :!git [args] + but chdir to the repository tree first. + + *fugitive-:Git!* +:Git! [args] Like |:Git|, but capture the output into a temp file, + and edit that temp file. + + *fugitive-:Gcd* +:Gcd [directory] |:cd| relative to the repository. + + *fugitive-:Glcd* +:Glcd [directory] |:lcd| relative to the repository. + + *fugitive-:Gstatus* +:Gstatus Bring up the output of git-status in the preview + window. The following maps, which work on the cursor + line file where sensible, are provided: + + next file + previous file + |:Gedit| + - |:Git| add + - |:Git| reset (staged files) + cA |:Gcommit| --amend --reuse-message=HEAD + ca |:Gcommit| --amend + cc |:Gcommit| + cva |:Gcommit| --amend --verbose + cvc |:Gcommit| --verbose + D |:Gdiff| + ds |:Gsdiff| + dp |:Git!| diff (p for patch; use :Gw to apply) + dp |:Git| add --intent-to-add (untracked files) + dv |:Gvdiff| + O |:Gtabedit| + o |:Gsplit| + p |:Git| add --patch + p |:Git| reset --patch (staged files) + q close status + R reload status + S |:Gvsplit| + + *fugitive-:Gcommit* +:Gcommit [args] A wrapper around git-commit. If there is nothing + to commit, |:Gstatus| is called instead. Unless the + arguments given would skip the invocation of an editor + (e.g., -m), a split window will be used to obtain a + commit message. Write and close that window (:wq or + |:Gwrite|) to finish the commit. Unlike when running + the actual git-commit command, it is possible (but + unadvisable) to muck with the index with commands like + git-add and git-reset while a commit message is + pending. + + *fugitive-:Ggrep* +:Ggrep [args] |:grep| with git-grep as 'grepprg'. + + *fugitive-:Glgrep* +:Glgrep [args] |:lgrep| with git-grep as 'grepprg'. + + *fugitive-:Glog* +:Glog [args] Load all previous revisions of the current file into + the quickfix list. Additional git-log arguments can + be given (for example, --reverse). If "--" appears as + an argument, no file specific filtering is done, and + previous commits rather than previous file revisions + are loaded. + + *fugitive-:Gllog* +:Gllog [args] Like |:Glog|, but use the location list instead of the + quickfix list. + + *fugitive-:Gedit* *fugitive-:Ge* +:Gedit [revision] |:edit| a |fugitive-revision|. + + *fugitive-:Gsplit* +:Gsplit [revision] |:split| a |fugitive-revision|. + + *fugitive-:Gvsplit* +:Gvsplit [revision] |:vsplit| a |fugitive-revision|. + + *fugitive-:Gtabedit* +:Gtabedit [revision] |:tabedit| a |fugitive-revision|. + + *fugitive-:Gpedit* +:Gpedit [revision] |:pedit| a |fugitive-revision|. + +:Gsplit! [args] *fugitive-:Gsplit!* *fugitive-:Gvsplit!* +:Gvsplit! [args] *fugitive-:Gtabedit!* *fugitive-:Gpedit!* +:Gtabedit! [args] Like |:Git!|, but open the resulting temp file in a +:Gpedit! [args] split, tab, or preview window. + + *fugitive-:Gread* +:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|. + When the argument is omitted, this is similar to + git-checkout on a work tree file or git-add on a stage + file, but without writing anything to disk. + +:{range}Gread [revision] + |:read| in a |fugitive-revision| after {range}. + + *fugitive-:Gread!* +:Gread! [args] Empty the buffer and |:read| the output of a Git + command. For example, :Gread! show HEAD:%. + +:{range}Gread! [args] |:read| the output of a Git command after {range}. + + *fugitive-:Gw* *fugitive-:Gwrite* +:Gwrite Write to the current file's path and stage the results. + When run in a work tree file, it is effectively git + add. Elsewhere, it is effectively git-checkout. A + great deal of effort is expended to behave sensibly + when the work tree or index version of the file is + open in another buffer. + +:Gwrite {path} You can give |:Gwrite| an explicit path of where in + the work tree to write. You can also give a path like + :0:foo.txt or even :0 to write to just that stage in + the index. + + *fugitive-:Gwq* +:Gwq [path] Like |:Gwrite| followed by |:quit| if the write + succeeded. + +:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write + succeeded. + + *fugitive-:Gdiff* +:Gdiff [revision] Perform a |vimdiff| against the current file in the + given revision. With no argument, the version in the + index is used (which means a three-way diff during a + merge conflict, making it a git-mergetool + alternative). The newer of the two files is placed + to the right. Use |do| and |dp| and write to the + index file to simulate "git add --patch". + + *fugitive-:Gsdiff* +:Gsdiff [revision] Like |:Gdiff|, but split horizontally. + + *fugitive-:Gvdiff* +:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|. + + *fugitive-:Gmove* +:Gmove {destination} Wrapper around git-mv that renames the buffer + afterward. The destination is relative to the current + directory except when started with a /, in which case + it is relative to the work tree. Add a ! to pass -f. + + *fugitive-:Gremove* +:Gremove Wrapper around git-rm that deletes the buffer + afterward. When invoked in an index file, --cached is + passed. Add a ! to pass -f and forcefully discard the + buffer. + + *fugitive-:Gblame* +:Gblame [flags] Run git-blame on the file and open the results in a + scroll bound vertical split. Press enter on a line to + reblame the file as it was in that commit. You can + give any of ltfnsewMC as flags and they will be passed + along to git-blame. The following maps, which work on + the cursor line commit where sensible, are provided: + + A resize to end of author column + C resize to end of commit column + D resize to end of date/time column + q close blame and return to blamed window + gq q, then |:Gedit| to return to work tree version + q, then open commit + o open commit in horizontal split + O open commit in new tab + - reblame at commit + ~ reblame at [count]th first grandparent + P reblame at [count]th parent (like HEAD^[count]) + +:[range]Gblame [flags] Run git-blame on the given range. + + *fugitive-:Gbrowse* +:[range]Gbrowse If the remote for the current branch is on GitHub, + open the current file, blob, tree, commit, or tag + (with git-web--browse) on GitHub. Otherwise, open the + current file, blob, tree, commit, or tag in + git-instaweb (if you have issues, verify you can run + "git instaweb" from a terminal). If a range is given, + it is appropriately appended to the URL as an anchor. + + To use with GitHub FI, point g:fugitive_github_domains + at a list of domains: +> + let g:fugitive_github_domains = ['https://example.com'] +~ +:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather + than opening it. + +:[range]Gbrowse {revision} + Like :Gbrowse, but for a given |fugitive-revision|. A + useful value here is -, which ties the URL to the + latest commit rather than a volatile branch. + +:[range]Gbrowse [...]@{remote} + Force using the given remote rather than the remote + for the current branch. The remote is used to + determine which GitHub repository to link to. + +MAPPINGS *fugitive-mappings* + +These maps are available everywhere. + + *fugitive-c_CTRL-R_CTRL-G* + On the command line, recall the path to the current + object (that is, a representation of the object + recognized by |:Gedit|). + + *fugitive-y_CTRL-G* +["x]y Yank the commit SHA and path to the current object. + +These maps are available in Git objects. + + *fugitive-* + Jump to the revision under the cursor. + + *fugitive-o* +o Jump to the revision under the cursor in a new split. + + *fugitive-S* +S Jump to the revision under the cursor in a new + vertical split. + + *fugitive-O* +O Jump to the revision under the cursor in a new tab. + + *fugitive--* +- Go to the tree containing the current tree or blob. + + *fugitive-~* +~ Go to the current file in the [count]th first + ancestor. + + *fugitive-P* +P Go to the current file in the [count]th parent. + + *fugitive-C* +C Go to the commit containing the current file. + + *fugitive-.* +. Start a |:| command line with the current revision + prepopulated at the end of the line. + + *fugitive-a* +a Show the current tag, commit, or tree in an alternate + format. + +SPECIFYING REVISIONS *fugitive-revision* + +Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING +REVISIONS" section in the git-rev-parse man page. For commands that accept an +optional revision, the default is the file in the index for work tree files +and the work tree file for everything else. Example revisions follow. + +Revision Meaning ~ +HEAD .git/HEAD +master .git/refs/heads/master +HEAD^{} The commit referenced by HEAD +HEAD^ The parent of the commit referenced by HEAD +HEAD: The tree referenced by HEAD +/HEAD The file named HEAD in the work tree +Makefile The file named Makefile in the work tree +HEAD^:Makefile The file named Makefile in the parent of HEAD +:Makefile The file named Makefile in the index (writable) +- The current file in HEAD +^ The current file in the previous commit +~3 The current file 3 commits ago +: .git/index (Same as |:Gstatus|) +:0 The current file in the index +:1 The current file's common ancestor during a conflict +:2 The current file in the target branch during a conflict +:3 The current file in the merged branch during a conflict +:/foo The most recent commit with "foo" in the message + +STATUSLINE *fugitive-statusline* + + *fugitive#statusline()* +Add %{fugitive#statusline()} to your statusline to get an indicator including +the current branch and the currently edited file's commit. If you don't have +a statusline, this one matches the default when 'ruler' is set: +> + set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P +< + *fugitive#head(...)* +Use fugitive#head() to return the name of the current branch. If the current +HEAD is detached, fugitive#head() will return the empty string, unless the +optional argument is given, in which case the hash of the current commit will +be truncated to the given number of characters. + +ABOUT *fugitive-about* + +Grab the latest version or report a bug on GitHub: + +http://github.com/tpope/vim-fugitive + + vim:tw=78:et:ft=help:norl: diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim new file mode 100644 index 00000000..51e52d88 --- /dev/null +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -0,0 +1,2587 @@ +" fugitive.vim - A Git wrapper so awesome, it should be illegal +" Maintainer: Tim Pope +" Version: 2.0 +" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim + +if exists('g:loaded_fugitive') || &cp + finish +endif +let g:loaded_fugitive = 1 + +if !exists('g:fugitive_git_executable') + let g:fugitive_git_executable = 'git' +endif + +" Utility {{{1 + +function! s:function(name) abort + return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) +endfunction + +function! s:sub(str,pat,rep) abort + return substitute(a:str,'\v\C'.a:pat,a:rep,'') +endfunction + +function! s:gsub(str,pat,rep) abort + return substitute(a:str,'\v\C'.a:pat,a:rep,'g') +endfunction + +function! s:shellesc(arg) abort + if a:arg =~ '^[A-Za-z0-9_/.-]\+$' + return a:arg + elseif &shell =~# 'cmd' + return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' + else + return shellescape(a:arg) + endif +endfunction + +function! s:fnameescape(file) abort + if exists('*fnameescape') + return fnameescape(a:file) + else + return escape(a:file," \t\n*?[{`$\\%#'\"|!<") + endif +endfunction + +function! s:throw(string) abort + let v:errmsg = 'fugitive: '.a:string + throw v:errmsg +endfunction + +function! s:warn(str) + echohl WarningMsg + echomsg a:str + echohl None + let v:warningmsg = a:str +endfunction + +function! s:shellslash(path) + if exists('+shellslash') && !&shellslash + return s:gsub(a:path,'\\','/') + else + return a:path + endif +endfunction + +let s:git_versions = {} + +function! fugitive#git_version(...) abort + if !has_key(s:git_versions, g:fugitive_git_executable) + let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), "\\S\\+\n") + endif + return s:git_versions[g:fugitive_git_executable] +endfunction + +function! s:recall() + let rev = s:sub(s:buffer().rev(), '^/', '') + if rev ==# ':' + return matchstr(getline('.'),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$\|^\d\{6} \x\{40\} \d\t\zs.*') + elseif s:buffer().type('tree') + let file = matchstr(getline('.'), '\t\zs.*') + if empty(file) && line('.') > 2 + let file = s:sub(getline('.'), '/$', '') + endif + if !empty(file) && rev !~# ':$' + return rev . '/' . file + else + return rev . file + endif + endif + return rev +endfunction + +function! s:add_methods(namespace, method_names) abort + for name in a:method_names + let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name) + endfor +endfunction + +let s:commands = [] +function! s:command(definition) abort + let s:commands += [a:definition] +endfunction + +function! s:define_commands() + for command in s:commands + exe 'command! -buffer '.command + endfor +endfunction + +augroup fugitive_utility + autocmd! + autocmd User Fugitive call s:define_commands() +augroup END + +let s:abstract_prototype = {} + +" }}}1 +" Initialization {{{1 + +function! fugitive#is_git_dir(path) abort + let path = s:sub(a:path, '[\/]$', '') . '/' + return isdirectory(path.'objects') && isdirectory(path.'refs') && getfsize(path.'HEAD') > 10 +endfunction + +function! fugitive#extract_git_dir(path) abort + if s:shellslash(a:path) =~# '^fugitive://.*//' + return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//') + endif + let root = s:shellslash(simplify(fnamemodify(a:path, ':p:s?[\/]$??'))) + let previous = "" + while root !=# previous + let dir = s:sub(root, '[\/]$', '') . '/.git' + let type = getftype(dir) + if type ==# 'dir' && fugitive#is_git_dir(dir) + return dir + elseif type ==# 'link' && fugitive#is_git_dir(dir) + return resolve(dir) + elseif type !=# '' && filereadable(dir) + let line = get(readfile(dir, '', 1), 0, '') + if line =~# '^gitdir: \.' && fugitive#is_git_dir(root.'/'.line[8:-1]) + return simplify(root.'/'.line[8:-1]) + elseif line =~# '^gitdir: ' && fugitive#is_git_dir(line[8:-1]) + return line[8:-1] + endif + elseif fugitive#is_git_dir(root) + return root + endif + let previous = root + let root = fnamemodify(root, ':h') + endwhile + return '' +endfunction + +function! fugitive#detect(path) + if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$') + unlet b:git_dir + endif + if !exists('b:git_dir') + let dir = fugitive#extract_git_dir(a:path) + if dir !=# '' + let b:git_dir = dir + endif + endif + if exists('b:git_dir') + silent doautocmd User Fugitive + cnoremap fnameescape(recall()) + nnoremap y :call setreg(v:register, recall()) + let buffer = fugitive#buffer() + if expand('%:p') =~# '//' + call buffer.setvar('&path', s:sub(buffer.getvar('&path'), '^\.%(,|$)', '')) + endif + if stridx(buffer.getvar('&tags'), escape(b:git_dir.'/tags', ', ')) == -1 + call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags')) + if &filetype !=# '' + call buffer.setvar('&tags', escape(b:git_dir.'/'.&filetype.'.tags', ', ').','.buffer.getvar('&tags')) + endif + endif + endif +endfunction + +augroup fugitive + autocmd! + autocmd BufNewFile,BufReadPost * call fugitive#detect(expand(':p')) + autocmd FileType netrw call fugitive#detect(expand('%:p')) + autocmd User NERDTreeInit,NERDTreeNewRoot call fugitive#detect(b:NERDTreeRoot.path.str()) + autocmd VimEnter * if expand('')==''|call fugitive#detect(getcwd())|endif + autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') +augroup END + +" }}}1 +" Repository {{{1 + +let s:repo_prototype = {} +let s:repos = {} + +function! s:repo(...) abort + let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : fugitive#extract_git_dir(expand('%:p'))) + if dir !=# '' + if has_key(s:repos, dir) + let repo = get(s:repos, dir) + else + let repo = {'git_dir': dir} + let s:repos[dir] = repo + endif + return extend(extend(repo, s:repo_prototype, 'keep'), s:abstract_prototype, 'keep') + endif + call s:throw('not a git repository: '.expand('%:p')) +endfunction + +function! fugitive#repo(...) + return call('s:repo', a:000) +endfunction + +function! s:repo_dir(...) dict abort + return join([self.git_dir]+a:000,'/') +endfunction + +function! s:repo_configured_tree() dict abort + if !has_key(self,'_tree') + let self._tree = '' + if filereadable(self.dir('config')) + let config = readfile(self.dir('config'),'',10) + call filter(config,'v:val =~# "^\\s*worktree *="') + if len(config) == 1 + let self._tree = matchstr(config[0], '= *\zs.*') + endif + endif + endif + if self._tree =~# '^\.' + return simplify(self.dir(self._tree)) + else + return self._tree + endif +endfunction + +function! s:repo_tree(...) dict abort + if self.dir() =~# '/\.git$' + let dir = self.dir()[0:-6] + else + let dir = self.configured_tree() + endif + if dir ==# '' + call s:throw('no work tree') + else + return join([dir]+a:000,'/') + endif +endfunction + +function! s:repo_bare() dict abort + if self.dir() =~# '/\.git$' + return 0 + else + return self.configured_tree() ==# '' + endif +endfunction + +function! s:repo_translate(spec) dict abort + if a:spec ==# '.' || a:spec ==# '/.' + return self.bare() ? self.dir() : self.tree() + elseif a:spec =~# '^/\=\.git$' && self.bare() + return self.dir() + elseif a:spec =~# '^/\=\.git/' + return self.dir(s:sub(a:spec, '^/=\.git/', '')) + elseif a:spec =~# '^/' + return self.tree().a:spec + elseif a:spec =~# '^:[0-3]:' + return 'fugitive://'.self.dir().'//'.a:spec[1].'/'.a:spec[3:-1] + elseif a:spec ==# ':' + if $GIT_INDEX_FILE =~# '/[^/]*index[^/]*\.lock$' && fnamemodify($GIT_INDEX_FILE,':p')[0:strlen(self.dir())] ==# self.dir('') && filereadable($GIT_INDEX_FILE) + return fnamemodify($GIT_INDEX_FILE,':p') + else + return self.dir('index') + endif + elseif a:spec =~# '^:/' + let ref = self.rev_parse(matchstr(a:spec,'.[^:]*')) + return 'fugitive://'.self.dir().'//'.ref + elseif a:spec =~# '^:' + return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1] + elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(self.dir(a:spec)) + return self.dir(a:spec) + elseif filereadable(self.dir('refs/'.a:spec)) + return self.dir('refs/'.a:spec) + elseif filereadable(self.dir('refs/tags/'.a:spec)) + return self.dir('refs/tags/'.a:spec) + elseif filereadable(self.dir('refs/heads/'.a:spec)) + return self.dir('refs/heads/'.a:spec) + elseif filereadable(self.dir('refs/remotes/'.a:spec)) + return self.dir('refs/remotes/'.a:spec) + elseif filereadable(self.dir('refs/remotes/'.a:spec.'/HEAD')) + return self.dir('refs/remotes/'.a:spec,'/HEAD') + else + try + let ref = self.rev_parse(matchstr(a:spec,'[^:]*')) + let path = s:sub(matchstr(a:spec,':.*'),'^:','/') + return 'fugitive://'.self.dir().'//'.ref.path + catch /^fugitive:/ + return self.tree(a:spec) + endtry + endif +endfunction + +function! s:repo_head(...) dict abort + let head = s:repo().head_ref() + + if head =~# '^ref: ' + let branch = s:sub(head,'^ref: %(refs/%(heads/|remotes/|tags/)=)=','') + elseif head =~# '^\x\{40\}$' + " truncate hash to a:1 characters if we're in detached head mode + let len = a:0 ? a:1 : 0 + let branch = len ? head[0:len-1] : '' + endif + + return branch +endfunction + +call s:add_methods('repo',['dir','configured_tree','tree','bare','translate','head']) + +function! s:repo_git_command(...) dict abort + let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) + return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') +endfunction + +function! s:repo_git_chomp(...) dict abort + return s:sub(system(call(self.git_command,a:000,self)),'\n$','') +endfunction + +function! s:repo_git_chomp_in_tree(...) dict abort + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + try + execute cd.'`=s:repo().tree()`' + return call(s:repo().git_chomp, a:000, s:repo()) + finally + execute cd.'`=dir`' + endtry +endfunction + +function! s:repo_rev_parse(rev) dict abort + let hash = self.git_chomp('rev-parse','--verify',a:rev) + if hash =~ '\<\x\{40\}$' + return matchstr(hash,'\<\x\{40\}$') + endif + call s:throw('rev-parse '.a:rev.': '.hash) +endfunction + +call s:add_methods('repo',['git_command','git_chomp','git_chomp_in_tree','rev_parse']) + +function! s:repo_dirglob(base) dict abort + let base = s:sub(a:base,'^/','') + let matches = split(glob(self.tree(s:gsub(base,'/','*&').'*/')),"\n") + call map(matches,'v:val[ strlen(self.tree())+(a:base !~ "^/") : -1 ]') + return matches +endfunction + +function! s:repo_superglob(base) dict abort + if a:base =~# '^/' || a:base !~# ':' + let results = [] + if a:base !~# '^/' + let heads = ["HEAD","ORIG_HEAD","FETCH_HEAD","MERGE_HEAD"] + let heads += sort(split(s:repo().git_chomp("rev-parse","--symbolic","--branches","--tags","--remotes"),"\n")) + call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base') + let results += heads + endif + if !self.bare() + let base = s:sub(a:base,'^/','') + let matches = split(glob(self.tree(s:gsub(base,'/','*&').'*')),"\n") + call map(matches,'s:shellslash(v:val)') + call map(matches,'v:val !~ "/$" && isdirectory(v:val) ? v:val."/" : v:val') + call map(matches,'v:val[ strlen(self.tree())+(a:base !~ "^/") : -1 ]') + let results += matches + endif + return results + + elseif a:base =~# '^:' + let entries = split(self.git_chomp('ls-files','--stage'),"\n") + call map(entries,'s:sub(v:val,".*(\\d)\\t(.*)",":\\1:\\2")') + if a:base !~# '^:[0-3]\%(:\|$\)' + call filter(entries,'v:val[1] == "0"') + call map(entries,'v:val[2:-1]') + endif + call filter(entries,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base') + return entries + + else + let tree = matchstr(a:base,'.*[:/]') + let entries = split(self.git_chomp('ls-tree',tree),"\n") + call map(entries,'s:sub(v:val,"^04.*\\zs$","/")') + call map(entries,'tree.s:sub(v:val,".*\t","")') + return filter(entries,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base') + endif +endfunction + +call s:add_methods('repo',['dirglob','superglob']) + +function! s:repo_config(conf) dict abort + return matchstr(system(s:repo().git_command('config').' '.a:conf),"[^\r\n]*") +endfun + +function! s:repo_user() dict abort + let username = s:repo().config('user.name') + let useremail = s:repo().config('user.email') + return username.' <'.useremail.'>' +endfun + +function! s:repo_aliases() dict abort + if !has_key(self,'_aliases') + let self._aliases = {} + for line in split(self.git_chomp('config','--get-regexp','^alias[.]'),"\n") + let self._aliases[matchstr(line,'\.\zs\S\+')] = matchstr(line,' \zs.*') + endfor + endif + return self._aliases +endfunction + +call s:add_methods('repo',['config', 'user', 'aliases']) + +function! s:repo_keywordprg() dict abort + let args = ' --git-dir='.escape(self.dir(),"\\\"' ") + if has('gui_running') && !has('win32') + return g:fugitive_git_executable . ' --no-pager' . args . ' log -1' + else + return g:fugitive_git_executable . args . ' show' + endif +endfunction + +call s:add_methods('repo',['keywordprg']) + +" }}}1 +" Buffer {{{1 + +let s:buffer_prototype = {} + +function! s:buffer(...) abort + let buffer = {'#': bufnr(a:0 ? a:1 : '%')} + call extend(extend(buffer,s:buffer_prototype,'keep'),s:abstract_prototype,'keep') + if buffer.getvar('git_dir') !=# '' + return buffer + endif + call s:throw('not a git repository: '.expand('%:p')) +endfunction + +function! fugitive#buffer(...) abort + return s:buffer(a:0 ? a:1 : '%') +endfunction + +function! s:buffer_getvar(var) dict abort + return getbufvar(self['#'],a:var) +endfunction + +function! s:buffer_setvar(var,value) dict abort + return setbufvar(self['#'],a:var,a:value) +endfunction + +function! s:buffer_getline(lnum) dict abort + return getbufline(self['#'],a:lnum)[0] +endfunction + +function! s:buffer_repo() dict abort + return s:repo(self.getvar('git_dir')) +endfunction + +function! s:buffer_type(...) dict abort + if self.getvar('fugitive_type') != '' + let type = self.getvar('fugitive_type') + elseif fnamemodify(self.spec(),':p') =~# '.\git/refs/\|\.git/\w*HEAD$' + let type = 'head' + elseif self.getline(1) =~ '^tree \x\{40\}$' && self.getline(2) == '' + let type = 'tree' + elseif self.getline(1) =~ '^\d\{6\} \w\{4\} \x\{40\}\>\t' + let type = 'tree' + elseif self.getline(1) =~ '^\d\{6\} \x\{40\}\> \d\t' + let type = 'index' + elseif isdirectory(self.spec()) + let type = 'directory' + elseif self.spec() == '' + let type = 'null' + else + let type = 'file' + endif + if a:0 + return !empty(filter(copy(a:000),'v:val ==# type')) + else + return type + endif +endfunction + +if has('win32') + + function! s:buffer_spec() dict abort + let bufname = bufname(self['#']) + let retval = '' + for i in split(bufname,'[^:]\zs\\') + let retval = fnamemodify((retval==''?'':retval.'\').i,':.') + endfor + return s:shellslash(fnamemodify(retval,':p')) + endfunction + +else + + function! s:buffer_spec() dict abort + let bufname = bufname(self['#']) + return s:shellslash(bufname == '' ? '' : fnamemodify(bufname,':p')) + endfunction + +endif + +function! s:buffer_name() dict abort + return self.spec() +endfunction + +function! s:buffer_commit() dict abort + return matchstr(self.spec(),'^fugitive://.\{-\}//\zs\w*') +endfunction + +function! s:buffer_path(...) dict abort + let rev = matchstr(self.spec(),'^fugitive://.\{-\}//\zs.*') + if rev != '' + let rev = s:sub(rev,'\w*','') + elseif self.spec()[0 : len(self.repo().dir())] ==# self.repo().dir() . '/' + let rev = '/.git'.self.spec()[strlen(self.repo().dir()) : -1] + elseif !self.repo().bare() && self.spec()[0 : len(self.repo().tree())] ==# self.repo().tree() . '/' + let rev = self.spec()[strlen(self.repo().tree()) : -1] + endif + return s:sub(s:sub(rev,'.\zs/$',''),'^/',a:0 ? a:1 : '') +endfunction + +function! s:buffer_rev() dict abort + let rev = matchstr(self.spec(),'^fugitive://.\{-\}//\zs.*') + if rev =~ '^\x/' + return ':'.rev[0].':'.rev[2:-1] + elseif rev =~ '.' + return s:sub(rev,'/',':') + elseif self.spec() =~ '\.git/index$' + return ':' + elseif self.spec() =~ '\.git/refs/\|\.git/.*HEAD$' + return self.spec()[strlen(self.repo().dir())+1 : -1] + else + return self.path('/') + endif +endfunction + +function! s:buffer_sha1() dict abort + if self.spec() =~ '^fugitive://' || self.spec() =~ '\.git/refs/\|\.git/.*HEAD$' + return self.repo().rev_parse(self.rev()) + else + return '' + endif +endfunction + +function! s:buffer_expand(rev) dict abort + if a:rev =~# '^:[0-3]$' + let file = a:rev.self.path(':') + elseif a:rev =~# '^[-:]/$' + let file = '/'.self.path() + elseif a:rev =~# '^-' + let file = 'HEAD^{}'.a:rev[1:-1].self.path(':') + elseif a:rev =~# '^@{' + let file = 'HEAD'.a:rev.self.path(':') + elseif a:rev =~# '^[~^]' + let commit = s:sub(self.commit(),'^\d=$','HEAD') + let file = commit.a:rev.self.path(':') + else + let file = a:rev + endif + return s:sub(s:sub(file,'\%$',self.path()),'\.\@<=/$','') +endfunction + +function! s:buffer_containing_commit() dict abort + if self.commit() =~# '^\d$' + return ':' + elseif self.commit() =~# '.' + return self.commit() + else + return 'HEAD' + endif +endfunction + +function! s:buffer_up(...) dict abort + let rev = self.rev() + let c = a:0 ? a:1 : 1 + while c + if rev =~# '^[/:]$' + let rev = 'HEAD' + elseif rev =~# '^:' + let rev = ':' + elseif rev =~# '^refs/[^^~:]*$\|^[^^~:]*HEAD$' + let rev .= '^{}' + elseif rev =~# '^/\|:.*/' + let rev = s:sub(rev, '.*\zs/.*', '') + elseif rev =~# ':.' + let rev = matchstr(rev, '^[^:]*:') + elseif rev =~# ':$' + let rev = rev[0:-2] + else + return rev.'~'.c + endif + let c -= 1 + endwhile + return rev +endfunction + +call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit','up']) + +" }}}1 +" Git {{{1 + +call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(0,)") + +function! s:ExecuteInTree(cmd) abort + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + try + execute cd.'`=s:repo().tree()`' + execute a:cmd + finally + execute cd.'`=dir`' + endtry +endfunction + +function! s:Git(bang,cmd) abort + if a:bang + return s:Edit('edit',1,a:cmd) + endif + let git = s:repo().git_command() + if has('gui_running') && !has('win32') + let git .= ' --no-pager' + endif + let cmd = matchstr(a:cmd,'\v\C.{-}%($|\\@ `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") +call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :lcd `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") + +" }}}1 +" Gstatus {{{1 + +call s:command("-bar Gstatus :execute s:Status()") +augroup fugitive_status + autocmd! + if !has('win32') + autocmd FocusGained,ShellCmdPost * call fugitive#reload_status() + endif +augroup END + +function! s:Status() abort + try + Gpedit : + wincmd P + setlocal foldmethod=syntax foldlevel=1 + nnoremap q :bdelete + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + return '' +endfunction + +function! fugitive#reload_status() abort + if exists('s:reloading_status') + return + endif + try + let s:reloading_status = 1 + let mytab = tabpagenr() + for tab in [mytab] + range(1,tabpagenr('$')) + for winnr in range(1,tabpagewinnr(tab,'$')) + if getbufvar(tabpagebuflist(tab)[winnr-1],'fugitive_type') ==# 'index' + execute 'tabnext '.tab + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif + try + if !&modified + call s:BufReadIndex() + endif + finally + if exists('restorewinnr') + wincmd p + endif + execute 'tabnext '.mytab + endtry + endif + endfor + endfor + finally + unlet! s:reloading_status + endtry +endfunction + +function! s:stage_info(lnum) abort + let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') + let lnum = a:lnum + if has('multi_byte_encoding') + let colon = '\%(:\|\%uff1a\)' + else + let colon = ':' + endif + while lnum && getline(lnum) !~# colon.'$' + let lnum -= 1 + endwhile + if !lnum + return ['', ''] + elseif getline(lnum+1) =~# '^# .*\ ' + let [old, new] = split(filename,' -> ') + execute 'Gedit '.s:fnameescape(':0:'.new) + return a:diff.' HEAD:'.s:fnameescape(old) + elseif section ==# 'staged' + execute 'Gedit '.s:fnameescape(':0:'.filename) + return a:diff.' -' + else + execute 'Gedit '.s:fnameescape('/'.filename) + return a:diff + endif +endfunction + +function! s:StageDiffEdit() abort + let [filename, section] = s:stage_info(line('.')) + let arg = (filename ==# '' ? '.' : filename) + if section ==# 'staged' + return 'Git! diff --no-ext-diff --cached '.s:shellesc(arg) + elseif section ==# 'untracked' + let repo = s:repo() + call repo.git_chomp_in_tree('add','--intent-to-add',arg) + if arg ==# '.' + silent! edit! + 1 + if !search('^# .*:\n#.*\n# .*"git checkout \|^# Changes not staged for commit:$','W') + call search('^# .*:$','W') + endif + else + call s:StageReloadSeek(arg,line('.'),line('.')) + endif + return '' + else + return 'Git! diff --no-ext-diff '.s:shellesc(arg) + endif +endfunction + +function! s:StageToggle(lnum1,lnum2) abort + if a:lnum1 == 1 && a:lnum2 == 1 + return 'Gedit /.git|call search("^index$", "wc")' + endif + try + let output = '' + for lnum in range(a:lnum1,a:lnum2) + let [filename, section] = s:stage_info(lnum) + let repo = s:repo() + if getline('.') =~# '^# .*:$' + if section ==# 'staged' + call repo.git_chomp_in_tree('reset','-q') + silent! edit! + 1 + if !search('^# .*:\n# .*"git add .*\n#\n\|^# Untracked files:$','W') + call search('^# .*:$','W') + endif + return '' + elseif section ==# 'unstaged' + call repo.git_chomp_in_tree('add','-u') + silent! edit! + 1 + if !search('^# .*:\n# .*"git add .*\n#\n\|^# Untracked files:$','W') + call search('^# .*:$','W') + endif + return '' + else + call repo.git_chomp_in_tree('add','.') + silent! edit! + 1 + call search('^# .*:$','W') + return '' + endif + endif + if filename ==# '' + continue + endif + if !exists('first_filename') + let first_filename = filename + endif + execute lnum + if filename =~ ' -> ' + let cmd = ['mv','--'] + reverse(split(filename,' -> ')) + let filename = cmd[-1] + elseif section ==# 'staged' + let cmd = ['reset','-q','--',filename] + elseif getline(lnum) =~# '^#\tdeleted:' + let cmd = ['rm','--',filename] + elseif getline(lnum) =~# '^#\tmodified:' + let cmd = ['add','--',filename] + else + let cmd = ['add','-A','--',filename] + endif + let output .= call(repo.git_chomp_in_tree,cmd,s:repo())."\n" + endfor + if exists('first_filename') + call s:StageReloadSeek(first_filename,a:lnum1,a:lnum2) + endif + echo s:sub(s:gsub(output,'\n+','\n'),'\n$','') + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + return 'checktime' +endfunction + +function! s:StagePatch(lnum1,lnum2) abort + let add = [] + let reset = [] + + for lnum in range(a:lnum1,a:lnum2) + let [filename, section] = s:stage_info(lnum) + if getline('.') =~# '^# .*:$' && section ==# 'staged' + return 'Git reset --patch' + elseif getline('.') =~# '^# .*:$' && section ==# 'unstaged' + return 'Git add --patch' + elseif getline('.') =~# '^# .*:$' && section ==# 'untracked' + return 'Git add -N .' + elseif filename ==# '' + continue + endif + if !exists('first_filename') + let first_filename = filename + endif + execute lnum + if filename =~ ' -> ' + let reset += [split(filename,' -> ')[1]] + elseif section ==# 'staged' + let reset += [filename] + elseif getline(lnum) !~# '^#\tdeleted:' + let add += [filename] + endif + endfor + try + if !empty(add) + execute "Git add --patch -- ".join(map(add,'s:shellesc(v:val)')) + endif + if !empty(reset) + execute "Git reset --patch -- ".join(map(add,'s:shellesc(v:val)')) + endif + if exists('first_filename') + silent! edit! + 1 + redraw + call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\%( ([^()[:digit:]]\+)\)\=\$','W') + endif + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + return 'checktime' +endfunction + +" }}}1 +" Gcommit {{{1 + +call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit()") + +function! s:Commit(args) abort + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + let msgfile = s:repo().dir('COMMIT_EDITMSG') + let outfile = tempname() + let errorfile = tempname() + try + try + execute cd.s:fnameescape(s:repo().tree()) + if &shell =~# 'cmd' + let command = '' + let old_editor = $GIT_EDITOR + let $GIT_EDITOR = 'false' + else + let command = 'env GIT_EDITOR=false ' + endif + let command .= s:repo().git_command('commit').' '.a:args + if &shell =~# 'csh' + noautocmd silent execute '!('.command.' > '.outfile.') >& '.errorfile + elseif a:args =~# '\%(^\| \)--interactive\>' + noautocmd execute '!'.command.' 2> '.errorfile + else + noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile + endif + finally + execute cd.'`=dir`' + endtry + if !has('gui_running') + redraw! + endif + if !v:shell_error + if filereadable(outfile) + for line in readfile(outfile) + echo line + endfor + endif + return '' + else + let errors = readfile(errorfile) + let error = get(errors,-2,get(errors,-1,'!')) + if error =~# 'false''\=\.$' + let args = a:args + let args = s:gsub(args,'%(%(^| )-- )@' + let args = '--cleanup=strip '.args + endif + if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod + execute 'keepalt edit '.s:fnameescape(msgfile) + elseif s:buffer().type() ==# 'index' + execute 'keepalt edit '.s:fnameescape(msgfile) + execute (search('^#','n')+1).'wincmd+' + setlocal nopreviewwindow + else + execute 'keepalt split '.s:fnameescape(msgfile) + endif + let b:fugitive_commit_arguments = args + setlocal bufhidden=wipe filetype=gitcommit + return '1' + elseif error ==# '!' + return s:Status() + else + call s:throw(error) + endif + endif + catch /^fugitive:/ + return 'echoerr v:errmsg' + finally + if exists('old_editor') + let $GIT_EDITOR = old_editor + endif + call delete(outfile) + call delete(errorfile) + call fugitive#reload_status() + endtry +endfunction + +function! s:CommitComplete(A,L,P) abort + if a:A =~ '^-' || type(a:A) == type(0) " a:A is 0 on :Gcommit - + let args = ['-C', '-F', '-a', '-c', '-e', '-i', '-m', '-n', '-o', '-q', '-s', '-t', '-u', '-v', '--all', '--allow-empty', '--amend', '--author=', '--cleanup=', '--dry-run', '--edit', '--file=', '--include', '--interactive', '--message=', '--no-verify', '--only', '--quiet', '--reedit-message=', '--reuse-message=', '--signoff', '--template=', '--untracked-files', '--verbose'] + return filter(args,'v:val[0 : strlen(a:A)-1] ==# a:A') + else + return s:repo().superglob(a:A) + endif +endfunction + +function! s:FinishCommit() + let args = getbufvar(+expand(''),'fugitive_commit_arguments') + if !empty(args) + call setbufvar(+expand(''),'fugitive_commit_arguments','') + return s:Commit(args) + endif + return '' +endfunction + +augroup fugitive_commit + autocmd! + autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute s:sub(s:FinishCommit(), '^echoerr (.*)', 'echohl ErrorMsg|echo \1|echohl NONE') +augroup END + +" }}}1 +" Ggrep, Glog {{{1 + +if !exists('g:fugitive_summary_format') + let g:fugitive_summary_format = '%s' +endif + +call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',0,)") +call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Glog :execute s:Log('grep',)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :execute s:Log('lgrep',)") + +function! s:Grep(cmd,bang,arg) abort + let grepprg = &grepprg + let grepformat = &grepformat + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + try + execute cd.'`=s:repo().tree()`' + let &grepprg = s:repo().git_command('--no-pager', 'grep', '-n') + let &grepformat = '%f:%l:%m' + exe a:cmd.'! '.escape(matchstr(a:arg,'\v\C.{-}%($|[''" ]\@=\|)@='),'|') + let list = a:cmd =~# '^l' ? getloclist(0) : getqflist() + for entry in list + if bufname(entry.bufnr) =~ ':' + let entry.filename = s:repo().translate(bufname(entry.bufnr)) + unlet! entry.bufnr + elseif a:arg =~# '\%(^\| \)--cached\>' + let entry.filename = s:repo().translate(':0:'.bufname(entry.bufnr)) + unlet! entry.bufnr + endif + endfor + if a:cmd =~# '^l' + call setloclist(0, list, 'r') + else + call setqflist(list, 'r') + endif + if !a:bang && !empty(list) + return (a:cmd =~# '^l' ? 'l' : 'c').'first'.matchstr(a:arg,'\v\C[''" ]\zs\|.*') + else + return matchstr(a:arg,'\v\C[''" ]\|\zs.*') + endif + finally + let &grepprg = grepprg + let &grepformat = grepformat + execute cd.'`=dir`' + endtry +endfunction + +function! s:Log(cmd,...) + let path = s:buffer().path('/') + if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1 + let path = '' + endif + let cmd = ['--no-pager', 'log', '--no-color'] + let cmd += ['--pretty=format:fugitive://'.s:repo().dir().'//%H'.path.'::'.g:fugitive_summary_format] + if empty(filter(a:000[0 : index(a:000,'--')],'v:val !~# "^-"')) + if s:buffer().commit() =~# '\x\{40\}' + let cmd += [s:buffer().commit()] + elseif s:buffer().path() =~# '^\.git/refs/\|^\.git/.*HEAD$' + let cmd += [s:buffer().path()[5:-1]] + endif + end + let cmd += map(copy(a:000),'s:sub(v:val,"^\\%(%(:\\w)*)","\\=fnamemodify(s:buffer().path(),submatch(1))")') + if path =~# '/.' + let cmd += ['--',path[1:-1]] + endif + let grepformat = &grepformat + let grepprg = &grepprg + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + try + execute cd.'`=s:repo().tree()`' + let &grepprg = escape(call(s:repo().git_command,cmd,s:repo()),'%#') + let &grepformat = '%f::%m' + exe a:cmd + finally + let &grepformat = grepformat + let &grepprg = grepprg + execute cd.'`=dir`' + endtry +endfunction + +" }}}1 +" Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread {{{1 + +function! s:Edit(cmd,bang,...) abort + let buffer = s:buffer() + if a:cmd !~# 'read' + if &previewwindow && getbufvar('','fugitive_type') ==# 'index' + wincmd p + if &diff + let mywinnr = winnr() + for winnr in range(winnr('$'),1,-1) + if winnr != mywinnr && getwinvar(winnr,'&diff') + execute winnr.'wincmd w' + close + wincmd p + endif + endfor + endif + endif + endif + + if a:bang + let args = s:gsub(join(a:000, ' '), '\\@>>>>>> + if getline(1) !~# '^diff ' + setlocal readonly nomodifiable + endif + if a:cmd =~# 'pedit' + wincmd p + endif + return echo + endif + return '' + endif + + if a:0 && a:1 == '' + return '' + elseif a:0 + let file = buffer.expand(join(a:000, ' ')) + elseif expand('%') ==# '' + let file = ':' + elseif buffer.commit() ==# '' && buffer.path('/') !~# '^/.git\>' + let file = buffer.path(':') + else + let file = buffer.path('/') + endif + try + let file = buffer.repo().translate(file) + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + if a:cmd ==# 'read' + return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.') + else + return a:cmd.' '.s:fnameescape(file) + endif +endfunction + +function! s:EditComplete(A,L,P) abort + return map(s:repo().superglob(a:A), 'fnameescape(v:val)') +endfunction + +function! s:EditRunComplete(A,L,P) abort + if a:L =~# '^\w\+!' + return s:GitComplete(a:A,a:L,a:P) + else + return s:repo().superglob(a:A) + endif +endfunction + +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Ge :execute s:Edit('edit',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gedit :execute s:Edit('edit',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gpedit :execute s:Edit('pedit',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gsplit :execute s:Edit('split',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gvsplit :execute s:Edit('vsplit',0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gtabedit :execute s:Edit('tabedit',0,)") +call s:command("-bar -bang -nargs=* -count -complete=customlist,s:EditRunComplete Gread :execute s:Edit((! && ? '' : ).'read',0,)") + +" }}}1 +" Gwrite, Gwq {{{1 + +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gwrite :execute s:Write(0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gw :execute s:Write(0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gwq :execute s:Wq(0,)") + +function! s:Write(force,...) abort + if exists('b:fugitive_commit_arguments') + return 'write|bdelete' + elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != '' + return 'wq' + elseif s:buffer().type() == 'index' + return 'Gcommit' + elseif s:buffer().path() ==# '' && getline(4) =~# '^+++ ' + let filename = getline(4)[6:-1] + setlocal buftype= + silent write + setlocal buftype=nowrite + if matchstr(getline(2),'index [[:xdigit:]]\+\.\.\zs[[:xdigit:]]\{7\}') ==# s:repo().rev_parse(':0:'.filename)[0:6] + let err = s:repo().git_chomp('apply','--cached','--reverse',s:buffer().spec()) + else + let err = s:repo().git_chomp('apply','--cached',s:buffer().spec()) + endif + if err !=# '' + let v:errmsg = split(err,"\n")[0] + return 'echoerr v:errmsg' + elseif a:force + return 'bdelete' + else + return 'Gedit '.fnameescape(filename) + endif + endif + let mytab = tabpagenr() + let mybufnr = bufnr('') + let path = a:0 ? join(a:000, ' ') : s:buffer().path() + if path =~# '^:\d\>' + return 'write'.(a:force ? '! ' : ' ').s:fnameescape(s:repo().translate(s:buffer().expand(path))) + endif + let always_permitted = (s:buffer().path() ==# path && s:buffer().commit() =~# '^0\=$') + if !always_permitted && !a:force && s:repo().git_chomp_in_tree('diff','--name-status','HEAD','--',path) . s:repo().git_chomp_in_tree('ls-files','--others','--',path) !=# '' + let v:errmsg = 'fugitive: file has uncommitted changes (use ! to override)' + return 'echoerr v:errmsg' + endif + let file = s:repo().translate(path) + let treebufnr = 0 + for nr in range(1,bufnr('$')) + if fnamemodify(bufname(nr),':p') ==# file + let treebufnr = nr + endif + endfor + + if treebufnr > 0 && treebufnr != bufnr('') + let temp = tempname() + silent execute '%write '.temp + for tab in [mytab] + range(1,tabpagenr('$')) + for winnr in range(1,tabpagewinnr(tab,'$')) + if tabpagebuflist(tab)[winnr-1] == treebufnr + execute 'tabnext '.tab + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif + try + let lnum = line('.') + let last = line('$') + silent execute '$read '.temp + silent execute '1,'.last.'delete_' + silent write! + silent execute lnum + let did = 1 + finally + if exists('restorewinnr') + wincmd p + endif + execute 'tabnext '.mytab + endtry + endif + endfor + endfor + if !exists('did') + call writefile(readfile(temp,'b'),file,'b') + endif + else + execute 'write! '.s:fnameescape(s:repo().translate(path)) + endif + + if a:force + let error = s:repo().git_chomp_in_tree('add', '--force', file) + else + let error = s:repo().git_chomp_in_tree('add', file) + endif + if v:shell_error + let v:errmsg = 'fugitive: '.error + return 'echoerr v:errmsg' + endif + if s:buffer().path() ==# path && s:buffer().commit() =~# '^\d$' + set nomodified + endif + + let one = s:repo().translate(':1:'.path) + let two = s:repo().translate(':2:'.path) + let three = s:repo().translate(':3:'.path) + for nr in range(1,bufnr('$')) + let name = fnamemodify(bufname(nr), ':p') + if bufloaded(nr) && !getbufvar(nr,'&modified') && (name ==# one || name ==# two || name ==# three) + execute nr.'bdelete' + endif + endfor + + unlet! restorewinnr + let zero = s:repo().translate(':0:'.path) + for tab in range(1,tabpagenr('$')) + for winnr in range(1,tabpagewinnr(tab,'$')) + let bufnr = tabpagebuflist(tab)[winnr-1] + let bufname = fnamemodify(bufname(bufnr), ':p') + if bufname ==# zero && bufnr != mybufnr + execute 'tabnext '.tab + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif + try + let lnum = line('.') + let last = line('$') + silent execute '$read '.s:fnameescape(file) + silent execute '1,'.last.'delete_' + silent execute lnum + set nomodified + diffupdate + finally + if exists('restorewinnr') + wincmd p + endif + execute 'tabnext '.mytab + endtry + break + endif + endfor + endfor + call fugitive#reload_status() + return 'checktime' +endfunction + +function! s:Wq(force,...) abort + let bang = a:force ? '!' : '' + if exists('b:fugitive_commit_arguments') + return 'wq'.bang + endif + let result = call(s:function('s:Write'),[a:force]+a:000) + if result =~# '^\%(write\|wq\|echoerr\)' + return s:sub(result,'^write','wq') + else + return result.'|quit'.bang + endif +endfunction + +" }}}1 +" Gdiff {{{1 + +call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff(0,)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff(0,)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff(1,)") + +augroup fugitive_diff + autocmd! + autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff_all(getbufvar(+expand(''), 'git_dir')) | endif + autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff() | endif +augroup END + +function! s:diff_window_count() + let c = 0 + for nr in range(1,winnr('$')) + let c += getwinvar(nr,'&diff') + endfor + return c +endfunction + +function! s:diff_restore() + let restore = 'setlocal nodiff noscrollbind' + \ . ' scrollopt=' . &l:scrollopt + \ . (&l:wrap ? ' wrap' : ' nowrap') + \ . ' foldmethod=' . &l:foldmethod + \ . ' foldcolumn=' . &l:foldcolumn + \ . ' foldlevel=' . &l:foldlevel + if has('cursorbind') + let restore .= (&l:cursorbind ? ' ' : ' no') . 'cursorbind' + endif + return restore +endfunction + +function! s:diffthis() + if !&diff + let w:fugitive_diff_restore = s:diff_restore() + diffthis + endif +endfunction + +function! s:diffoff() + if exists('w:fugitive_diff_restore') + execute w:fugitive_diff_restore + unlet w:fugitive_diff_restore + else + diffoff + endif +endfunction + +function! s:diffoff_all(dir) + for nr in range(1,winnr('$')) + if getwinvar(nr,'&diff') + if nr != winnr() + execute nr.'wincmd w' + let restorewinnr = 1 + endif + if exists('b:git_dir') && b:git_dir ==# a:dir + call s:diffoff() + endif + endif + endfor +endfunction + +function! s:buffer_compare_age(commit) dict abort + let scores = {':0': 1, ':1': 2, ':2': 3, ':': 4, ':3': 5} + let my_score = get(scores,':'.self.commit(),0) + let their_score = get(scores,':'.a:commit,0) + if my_score || their_score + return my_score < their_score ? -1 : my_score != their_score + elseif self.commit() ==# a:commit + return 0 + endif + let base = self.repo().git_chomp('merge-base',self.commit(),a:commit) + if base ==# self.commit() + return -1 + elseif base ==# a:commit + return 1 + endif + let my_time = +self.repo().git_chomp('log','--max-count=1','--pretty=format:%at',self.commit()) + let their_time = +self.repo().git_chomp('log','--max-count=1','--pretty=format:%at',a:commit) + return my_time < their_time ? -1 : my_time != their_time +endfunction + +call s:add_methods('buffer',['compare_age']) + +function! s:Diff(bang,...) + let vert = a:bang ? '' : 'vertical ' + if exists(':DiffGitCached') + return 'DiffGitCached' + elseif (!a:0 || a:1 == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# '' + let nr = bufnr('') + execute 'leftabove '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':2''))`' + execute 'nnoremap dp :diffput '.nr.'diffupdate' + call s:diffthis() + wincmd p + execute 'rightbelow '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':3''))`' + execute 'nnoremap dp :diffput '.nr.'diffupdate' + call s:diffthis() + wincmd p + call s:diffthis() + return '' + elseif a:0 + let arg = join(a:000, ' ') + if arg ==# '' + return '' + elseif arg ==# '/' + let file = s:buffer().path('/') + elseif arg ==# ':' + let file = s:buffer().path(':0:') + elseif arg =~# '^:/.' + try + let file = s:repo().rev_parse(arg).s:buffer().path(':') + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + else + let file = s:buffer().expand(arg) + endif + if file !~# ':' && file !~# '^/' && s:repo().git_chomp('cat-file','-t',file) =~# '^\%(tag\|commit\)$' + let file = file.s:buffer().path(':') + endif + else + let file = s:buffer().path(s:buffer().commit() == '' ? ':0:' : '/') + endif + try + let spec = s:repo().translate(file) + let commit = matchstr(spec,'\C[^:/]//\zs\x\+') + if s:buffer().compare_age(commit) < 0 + execute 'rightbelow '.vert.'split '.s:fnameescape(spec) + else + execute 'leftabove '.vert.'split '.s:fnameescape(spec) + endif + call s:diffthis() + wincmd p + call s:diffthis() + return '' + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +" }}}1 +" Gmove, Gremove {{{1 + +function! s:Move(force,destination) + if a:destination =~# '^/' + let destination = a:destination[1:-1] + else + let destination = s:shellslash(fnamemodify(s:sub(a:destination,'[%#]%(:\w)*','\=expand(submatch(0))'),':p')) + if destination[0:strlen(s:repo().tree())] ==# s:repo().tree('') + let destination = destination[strlen(s:repo().tree('')):-1] + endif + endif + if isdirectory(s:buffer().spec()) + " Work around Vim parser idiosyncrasy + let discarded = s:buffer().setvar('&swapfile',0) + endif + let message = call(s:repo().git_chomp_in_tree,['mv']+(a:force ? ['-f'] : [])+['--', s:buffer().path(), destination], s:repo()) + if v:shell_error + let v:errmsg = 'fugitive: '.message + return 'echoerr v:errmsg' + endif + let destination = s:repo().tree(destination) + if isdirectory(destination) + let destination = fnamemodify(s:sub(destination,'/$','').'/'.expand('%:t'),':.') + endif + call fugitive#reload_status() + if s:buffer().commit() == '' + if isdirectory(destination) + return 'keepalt edit '.s:fnameescape(destination) + else + return 'keepalt saveas! '.s:fnameescape(destination) + endif + else + return 'file '.s:fnameescape(s:repo().translate(':0:'.destination)) + endif +endfunction + +function! s:MoveComplete(A,L,P) + if a:A =~ '^/' + return s:repo().superglob(a:A) + else + let matches = split(glob(a:A.'*'),"\n") + call map(matches,'v:val !~ "/$" && isdirectory(v:val) ? v:val."/" : v:val') + return matches + endif +endfunction + +function! s:Remove(force) + if s:buffer().commit() ==# '' + let cmd = ['rm'] + elseif s:buffer().commit() ==# '0' + let cmd = ['rm','--cached'] + else + let v:errmsg = 'fugitive: rm not supported here' + return 'echoerr v:errmsg' + endif + if a:force + let cmd += ['--force'] + endif + let message = call(s:repo().git_chomp_in_tree,cmd+['--',s:buffer().path()],s:repo()) + if v:shell_error + let v:errmsg = 'fugitive: '.s:sub(message,'error:.*\zs\n\(.*-f.*',' (add ! to force)') + return 'echoerr '.string(v:errmsg) + else + call fugitive#reload_status() + return 'bdelete'.(a:force ? '!' : '') + endif +endfunction + +augroup fugitive_remove + autocmd! + autocmd User Fugitive if s:buffer().commit() =~# '^0\=$' | + \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,s:MoveComplete Gmove :execute s:Move(0,)" | + \ exe "command! -buffer -bar -bang Gremove :execute s:Remove(0)" | + \ endif +augroup END + +" }}}1 +" Gblame {{{1 + +augroup fugitive_blame + autocmd! + autocmd BufReadPost *.fugitiveblame setfiletype fugitiveblame + autocmd FileType fugitiveblame setlocal nomodeline | if exists('b:git_dir') | let &l:keywordprg = s:repo().keywordprg() | endif + autocmd Syntax fugitiveblame call s:BlameSyntax() + autocmd User Fugitive if s:buffer().type('file', 'blob') | exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:Blame(0,,,,[])" | endif +augroup END + +function! s:linechars(pattern) + let chars = strlen(s:gsub(matchstr(getline('.'), a:pattern), '.', '.')) + if exists('*synconcealed') && &conceallevel > 1 + for col in range(1, chars) + let chars -= synconcealed(line('.'), col)[0] + endfor + endif + return chars +endfunction + +function! s:Blame(bang,line1,line2,count,args) abort + try + if s:buffer().path() == '' + call s:throw('file or blob required') + endif + if filter(copy(a:args),'v:val !~# "^\\%(--root\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] + call s:throw('unsupported option') + endif + call map(a:args,'s:sub(v:val,"^\\ze[^-]","-")') + let cmd = ['--no-pager', 'blame', '--show-number'] + a:args + if s:buffer().commit() =~# '\D\|..' + let cmd += [s:buffer().commit()] + else + let cmd += ['--contents', '-'] + endif + let basecmd = escape(call(s:repo().git_command,cmd+['--',s:buffer().path()],s:repo()),'!') + try + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + if !s:repo().bare() + let dir = getcwd() + execute cd.'`=s:repo().tree()`' + endif + if a:count + execute 'write !'.substitute(basecmd,' blame ',' blame -L '.a:line1.','.a:line2.' ','g') + else + let error = resolve(tempname()) + let temp = error.'.fugitiveblame' + if &shell =~# 'csh' + silent! execute '%write !('.basecmd.' > '.temp.') >& '.error + else + silent! execute '%write !'.basecmd.' > '.temp.' 2> '.error + endif + if exists('l:dir') + execute cd.'`=dir`' + unlet dir + endif + if v:shell_error + call s:throw(join(readfile(error),"\n")) + endif + for winnr in range(winnr('$'),1,-1) + call setwinvar(winnr, '&scrollbind', 0) + if getbufvar(winbufnr(winnr), 'fugitive_blamed_bufnr') + execute winbufnr(winnr).'bdelete' + endif + endfor + let bufnr = bufnr('') + let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)' + if &l:wrap + let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&wrap",1)' + endif + if &l:foldenable + let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&foldenable",1)' + endif + setlocal scrollbind nowrap nofoldenable + let top = line('w0') + &scrolloff + let current = line('.') + let s:temp_files[temp] = s:repo().dir() + exe 'keepalt leftabove vsplit '.temp + let b:fugitive_blamed_bufnr = bufnr + let w:fugitive_leave = restore + let b:fugitive_blame_arguments = join(a:args,' ') + execute top + normal! zt + execute current + setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable filetype=fugitiveblame + if exists('+concealcursor') + setlocal concealcursor=nc conceallevel=2 + endif + if exists('+relativenumber') + setlocal norelativenumber + endif + execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) + nnoremap q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdelete','^-1','','') + nnoremap gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand("%:p") =~# "^fugitive:[\\/][\\/]"Geditendif','^-1','','') + nnoremap :exe BlameCommit("exe 'norm q'edit") + nnoremap - :exe BlameJump('') + nnoremap P :exe BlameJump('^'.v:count1) + nnoremap ~ :exe BlameJump('~'.v:count1) + nnoremap i :exe BlameCommit("exe 'norm q'edit") + nnoremap o :exe BlameCommit((&splitbelow ? "botright" : "topleft")." split") + nnoremap O :exe BlameCommit("tabedit") + nnoremap A :exe "vertical resize ".(linechars('.\{-\}\ze [0-9:/+-][0-9:/+ -]* \d\+)')+1+v:count) + nnoremap C :exe "vertical resize ".(linechars('^\S\+')+1+v:count) + nnoremap D :exe "vertical resize ".(linechars('.\{-\}\ze\d\ze\s\+\d\+)')+1-v:count) + redraw + syncbind + endif + finally + if exists('l:dir') + execute cd.'`=dir`' + endif + endtry + return '' + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +function! s:BlameCommit(cmd) abort + let cmd = s:Edit(a:cmd, 0, matchstr(getline('.'),'\x\+')) + if cmd =~# '^echoerr' + return cmd + endif + let lnum = matchstr(getline('.'),' \zs\d\+\ze\s\+[([:digit:]]') + let path = matchstr(getline('.'),'^\^\=\x\+\s\+\zs.\{-\}\ze\s*\d\+ ') + if path ==# '' + let path = s:buffer(b:fugitive_blamed_bufnr).path() + endif + execute cmd + if search('^diff .* b/\M'.escape(path,'\').'$','W') + call search('^+++') + let head = line('.') + while search('^@@ \|^diff ') && getline('.') =~# '^@@ ' + let top = +matchstr(getline('.'),' +\zs\d\+') + let len = +matchstr(getline('.'),' +\d\+,\zs\d\+') + if lnum >= top && lnum <= top + len + let offset = lnum - top + if &scrolloff + + + normal! zt + else + normal! zt + + + endif + while offset > 0 && line('.') < line('$') + + + if getline('.') =~# '^[ +]' + let offset -= 1 + endif + endwhile + return 'if foldlevel(".")|foldopen!|endif' + endif + endwhile + execute head + normal! zt + endif + return '' +endfunction + +function! s:BlameJump(suffix) abort + let commit = matchstr(getline('.'),'^\^\=\zs\x\+') + if commit =~# '^0\+$' + let commit = ':0' + endif + let lnum = matchstr(getline('.'),' \zs\d\+\ze\s\+[([:digit:]]') + let path = matchstr(getline('.'),'^\^\=\x\+\s\+\zs.\{-\}\ze\s*\d\+ ') + if path ==# '' + let path = s:buffer(b:fugitive_blamed_bufnr).path() + endif + let args = b:fugitive_blame_arguments + let offset = line('.') - line('w0') + let bufnr = bufnr('%') + let winnr = bufwinnr(b:fugitive_blamed_bufnr) + if winnr > 0 + exe winnr.'wincmd w' + endif + execute s:Edit('edit', 0, commit.a:suffix.':'.path) + execute lnum + if winnr > 0 + exe bufnr.'bdelete' + endif + execute 'Gblame '.args + execute lnum + let delta = line('.') - line('w0') - offset + if delta > 0 + execute 'normal! '.delta."\" + elseif delta < 0 + execute 'normal! '.(-delta)."\" + endif + syncbind + return '' +endfunction + +function! s:BlameSyntax() abort + let b:current_syntax = 'fugitiveblame' + let conceal = has('conceal') ? ' conceal' : '' + let arg = exists('b:fugitive_blame_arguments') ? b:fugitive_blame_arguments : '' + syn match FugitiveblameBoundary "^\^" + syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,fugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite + syn match FugitiveblameHash "\%(^\^\=\)\@<=\x\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite + syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=0\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite + syn region FugitiveblameAnnotation matchgroup=FugitiveblameDelimiter start="(" end="\%( \d\+\)\@<=)" contained keepend oneline + syn match FugitiveblameTime "[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%( \+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation + exec 'syn match FugitiveblameLineNumber " *\d\+)\@=" contained containedin=FugitiveblameAnnotation'.conceal + exec 'syn match FugitiveblameOriginalFile " \%(\f\+\D\@<=\|\D\@=\f\+\)\%(\%(\s\+\d\+\)\=\s\%((\|\s*\d\+)\)\)\@=" contained nextgroup=FugitiveblameOriginalLineNumber,FugitiveblameAnnotation skipwhite'.(arg =~# 'f' ? '' : conceal) + exec 'syn match FugitiveblameOriginalLineNumber " *\d\+\%(\s(\)\@=" contained nextgroup=FugitiveblameAnnotation skipwhite'.(arg =~# 'n' ? '' : conceal) + exec 'syn match FugitiveblameOriginalLineNumber " *\d\+\%(\s\+\d\+)\)\@=" contained nextgroup=FugitiveblameShort skipwhite'.(arg =~# 'n' ? '' : conceal) + syn match FugitiveblameShort " \d\+)" contained contains=FugitiveblameLineNumber + syn match FugitiveblameNotCommittedYet "(\@<=Not Committed Yet\>" contained containedin=FugitiveblameAnnotation + hi def link FugitiveblameBoundary Keyword + hi def link FugitiveblameHash Identifier + hi def link FugitiveblameUncommitted Function + hi def link FugitiveblameTime PreProc + hi def link FugitiveblameLineNumber Number + hi def link FugitiveblameOriginalFile String + hi def link FugitiveblameOriginalLineNumber Float + hi def link FugitiveblameShort FugitiveblameDelimiter + hi def link FugitiveblameDelimiter Delimiter + hi def link FugitiveblameNotCommittedYet Comment +endfunction + +" }}}1 +" Gbrowse {{{1 + +call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(0,,,)") + +function! s:Browse(bang,line1,count,...) abort + try + let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]*\%(://.\{-\}\)\=$','','') : '' + if rev ==# '' + let expanded = s:buffer().rev() + elseif rev ==# ':' + let expanded = s:buffer().path('/') + else + let expanded = s:buffer().expand(rev) + endif + let full = s:repo().translate(expanded) + let commit = '' + if full =~# '^fugitive://' + let commit = matchstr(full,'://.*//\zs\w\+') + let path = matchstr(full,'://.*//\w\+\zs/.*') + if commit =~ '..' + let type = s:repo().git_chomp('cat-file','-t',commit.s:sub(path,'^/',':')) + else + let type = 'blob' + endif + let path = path[1:-1] + elseif s:repo().bare() + let path = '.git/' . full[strlen(s:repo().dir())+1:-1] + let type = '' + else + let path = full[strlen(s:repo().tree())+1:-1] + if path =~# '^\.git/' + let type = '' + elseif isdirectory(full) + let type = 'tree' + else + let type = 'blob' + endif + endif + if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1])) + let body = readfile(s:repo().dir(path[5:-1]))[0] + if body =~# '^\x\{40\}$' + let commit = body + let type = 'commit' + let path = '' + elseif body =~# '^ref: refs/' + let path = '.git/' . matchstr(body,'ref: \zs.*') + endif + endif + + if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]*\%(://.\{-\}\)\=$' + let remote = matchstr(join(a:000, ' '),'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$') + elseif path =~# '^\.git/refs/remotes/.' + let remote = matchstr(path,'^\.git/refs/remotes/\zs[^/]\+') + else + let remote = 'origin' + let branch = matchstr(rev,'^[[:alnum:]/._-]\+\ze[:^~@]') + if branch ==# '' && path =~# '^\.git/refs/\w\+/' + let branch = s:sub(path,'^\.git/refs/\w+/','') + endif + if filereadable(s:repo().dir('refs/remotes/'.branch)) + let remote = matchstr(branch,'[^/]\+') + let rev = rev[strlen(remote)+1:-1] + else + if branch ==# '' + let branch = matchstr(s:repo().head_ref(),'\ 0 ? a:line1 : 0) + endif + + if url == '' + call s:throw("Instaweb failed to start and '".remote."' is not a GitHub remote") + endif + + if a:bang + let @* = url + return 'echomsg '.string(url) + else + return 'echomsg '.string(url).'|call fugitive#buffer().repo().git_chomp("web--browse",'.string(url).')' + endif + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort + let path = a:path + let domain_pattern = 'github\.com' + let domains = exists('g:fugitive_github_domains') ? g:fugitive_github_domains : [] + for domain in domains + let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.') + endfor + let repo = matchstr(a:url,'^\%(https\=://\|git://\|git@\)\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$') + if repo ==# '' + return '' + endif + if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0 + let root = 'http://' . s:sub(repo,':','/') + else + let root = 'https://' . s:sub(repo,':','/') + endif + if path =~# '^\.git/refs/heads/' + let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1] + if branch ==# '' + return root . '/commits/' . path[16:-1] + else + return root . '/commits/' . branch + endif + elseif path =~# '^\.git/refs/.' + return root . '/commits/' . matchstr(path,'[^/]\+$') + elseif path =~# '.git/\%(config$\|hooks\>\)' + return root . '/admin' + elseif path =~# '^\.git\>' + return root + endif + if a:rev =~# '^[[:alnum:]._-]\+:' + let commit = matchstr(a:rev,'^[^:]*') + elseif a:commit =~# '^\d\=$' + let local = matchstr(a:repo.head_ref(),'\ 0 && a:line1 == a:line2 + let url .= '#L' . a:line1 + elseif a:line2 > 0 + let url .= '#L' . a:line1 . '-' . a:line2 + endif + elseif a:type == 'tag' + let commit = matchstr(getline(3),'^tag \zs.*') + let url = root . '/tree/' . commit + else + let url = root . '/commit/' . commit + endif + return url +endfunction + +function! s:instaweb_url(repo,rev,commit,path,type,...) abort + let output = a:repo.git_chomp('instaweb','-b','unknown') + if output =~# 'http://' + let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:repo.dir(),':t') + else + return '' + endif + if a:path =~# '^\.git/refs/.' + return root . ';a=shortlog;h=' . matchstr(a:path,'^\.git/\zs.*') + elseif a:path =~# '^\.git\>' + return root + endif + let url = root + if a:commit =~# '^\x\{40\}$' + if a:type ==# 'commit' + let url .= ';a=commit' + endif + let url .= ';h=' . a:repo.rev_parse(a:commit . (a:path == '' ? '' : ':' . a:path)) + else + if a:type ==# 'blob' + let tmp = tempname() + silent execute 'write !'.a:repo.git_command('hash-object','-w','--stdin').' > '.tmp + let url .= ';h=' . readfile(tmp)[0] + else + try + let url .= ';h=' . a:repo.rev_parse((a:commit == '' ? 'HEAD' : ':' . a:commit) . ':' . a:path) + catch /^fugitive:/ + call s:throw('fugitive: cannot browse uncommitted file') + endtry + endif + let root .= ';hb=' . matchstr(a:repo.head_ref(),'[^ ]\+$') + endif + if a:path !=# '' + let url .= ';f=' . a:path + endif + if a:0 && a:1 + let url .= '#l' . a:1 + endif + return url +endfunction + +" }}}1 +" File access {{{1 + +function! s:ReplaceCmd(cmd,...) abort + let fn = expand('%:p') + let tmp = tempname() + let prefix = '' + try + if a:0 && a:1 != '' + if &shell =~# 'cmd' + let old_index = $GIT_INDEX_FILE + let $GIT_INDEX_FILE = a:1 + else + let prefix = 'env GIT_INDEX_FILE='.s:shellesc(a:1).' ' + endif + endif + if &shell =~# 'cmd' + let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' + call system('cmd /c "'.prefix.s:gsub(a:cmd,'[<>]', cmd_escape_char.'&').' > '.tmp.'"') + else + call system(' ('.prefix.a:cmd.' > '.tmp.') ') + endif + finally + if exists('old_index') + let $GIT_INDEX_FILE = old_index + endif + endtry + silent exe 'keepalt file '.tmp + try + silent edit! + finally + silent exe 'keepalt file '.s:fnameescape(fn) + call delete(tmp) + if fnamemodify(bufname('$'), ':p') ==# tmp + silent execute 'bwipeout '.bufnr('$') + endif + silent exe 'doau BufReadPost '.s:fnameescape(fn) + endtry +endfunction + +function! s:BufReadIndex() + if !exists('b:fugitive_display_format') + let b:fugitive_display_format = filereadable(expand('%').'.lock') + endif + let b:fugitive_display_format = b:fugitive_display_format % 2 + let b:fugitive_type = 'index' + try + let b:git_dir = s:repo().dir() + setlocal noro ma nomodeline + if fnamemodify($GIT_INDEX_FILE !=# '' ? $GIT_INDEX_FILE : b:git_dir . '/index', ':p') ==# expand('%:p') + let index = '' + else + let index = expand('%:p') + endif + if b:fugitive_display_format + call s:ReplaceCmd(s:repo().git_command('ls-files','--stage'),index) + set ft=git nospell + else + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + if fugitive#git_version() =~# '^0\|1\.[1-7]\.' + let cmd = s:repo().git_command('status') + else + let cmd = s:repo().git_command( + \ '-c', 'status.displayCommentPrefix=true', + \ '-c', 'color.status=false', + \ 'status') + endif + try + execute cd.'`=s:repo().tree()`' + call s:ReplaceCmd(cmd, index) + finally + execute cd.'`=dir`' + endtry + set ft=gitcommit + set foldtext=fugitive#foldtext() + endif + setlocal ro noma nomod noswapfile + if &bufhidden ==# '' + setlocal bufhidden=delete + endif + call s:JumpInit() + nunmap P + nunmap ~ + nnoremap :execute StageNext(v:count1) + nnoremap :execute StagePrevious(v:count1) + nnoremap - :silent execute StageToggle(line('.'),line('.')+v:count1-1) + xnoremap - :silent execute StageToggle(line("'<"),line("'>")) + nnoremap a :let b:fugitive_display_format += 1exe BufReadIndex() + nnoremap i :let b:fugitive_display_format -= 1exe BufReadIndex() + nnoremap C :Gcommit + nnoremap cA :Gcommit --amend --reuse-message=HEAD + nnoremap ca :Gcommit --amend + nnoremap cc :Gcommit + nnoremap cva :Gcommit --amend --verbose + nnoremap cvc :Gcommit --verbose + nnoremap D :execute StageDiff('Gvdiff') + nnoremap dd :execute StageDiff('Gvdiff') + nnoremap dh :execute StageDiff('Gsdiff') + nnoremap ds :execute StageDiff('Gsdiff') + nnoremap dp :execute StageDiffEdit() + nnoremap dv :execute StageDiff('Gvdiff') + nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) + xnoremap p :execute StagePatch(line("'<"),line("'>")) + nnoremap q :if bufnr('$') == 1quitelsebdeleteendif + nnoremap R :edit + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +function! s:FileRead() + try + let repo = s:repo(fugitive#extract_git_dir(expand(''))) + let path = s:sub(s:sub(matchstr(expand(''),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&') + let hash = repo.rev_parse(path) + if path =~ '^:' + let type = 'blob' + else + let type = repo.git_chomp('cat-file','-t',hash) + endif + " TODO: use count, if possible + return "read !".escape(repo.git_command('cat-file',type,hash),'%#\') + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +function! s:BufReadIndexFile() + try + let b:fugitive_type = 'blob' + let b:git_dir = s:repo().dir() + try + call s:ReplaceCmd(s:repo().git_command('cat-file','blob',s:buffer().sha1())) + finally + if &bufhidden ==# '' + setlocal bufhidden=delete + endif + endtry + return '' + catch /^fugitive: rev-parse/ + silent exe 'doau BufNewFile '.s:fnameescape(expand('%:p')) + return '' + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +function! s:BufWriteIndexFile() + let tmp = tempname() + try + let path = matchstr(expand(''),'//\d/\zs.*') + let stage = matchstr(expand(''),'//\zs\d') + silent execute 'write !'.s:repo().git_command('hash-object','-w','--stdin').' > '.tmp + let sha1 = readfile(tmp)[0] + let old_mode = matchstr(s:repo().git_chomp('ls-files','--stage',path),'^\d\+') + if old_mode == '' + let old_mode = executable(s:repo().tree(path)) ? '100755' : '100644' + endif + let info = old_mode.' '.sha1.' '.stage."\t".path + call writefile([info],tmp) + if &shell =~# 'cmd' + let error = system('type '.s:gsub(tmp,'/','\\').'|'.s:repo().git_command('update-index','--index-info')) + else + let error = system(s:repo().git_command('update-index','--index-info').' < '.tmp) + endif + if v:shell_error == 0 + setlocal nomodified + silent execute 'doautocmd BufWritePost '.s:fnameescape(expand('%:p')) + call fugitive#reload_status() + return '' + else + return 'echoerr '.string('fugitive: '.error) + endif + finally + call delete(tmp) + endtry +endfunction + +function! s:BufReadObject() + try + setlocal noro ma + let b:git_dir = s:repo().dir() + let hash = s:buffer().sha1() + if !exists("b:fugitive_type") + let b:fugitive_type = s:repo().git_chomp('cat-file','-t',hash) + endif + if b:fugitive_type !~# '^\%(tag\|commit\|tree\|blob\)$' + return "echoerr 'fugitive: unrecognized git type'" + endif + let firstline = getline('.') + if !exists('b:fugitive_display_format') && b:fugitive_type != 'blob' + let b:fugitive_display_format = +getbufvar('#','fugitive_display_format') + endif + + if b:fugitive_type !=# 'blob' + setlocal nomodeline + endif + + let pos = getpos('.') + silent %delete + setlocal endofline + + try + if b:fugitive_type ==# 'tree' + let b:fugitive_display_format = b:fugitive_display_format % 2 + if b:fugitive_display_format + call s:ReplaceCmd(s:repo().git_command('ls-tree',hash)) + else + call s:ReplaceCmd(s:repo().git_command('show','--no-color',hash)) + endif + elseif b:fugitive_type ==# 'tag' + let b:fugitive_display_format = b:fugitive_display_format % 2 + if b:fugitive_display_format + call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) + else + call s:ReplaceCmd(s:repo().git_command('cat-file','-p',hash)) + endif + elseif b:fugitive_type ==# 'commit' + let b:fugitive_display_format = b:fugitive_display_format % 2 + if b:fugitive_display_format + call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) + else + call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash)) + call search('^parent ') + if getline('.') ==# 'parent ' + silent delete_ + else + silent s/\%(^parent\)\@\)\=$','W',line('.')+3) + silent delete_ + end + 1 + endif + elseif b:fugitive_type ==# 'blob' + call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) + endif + finally + call setpos('.',pos) + setlocal ro noma nomod + if &bufhidden ==# '' + setlocal bufhidden=delete + endif + if b:fugitive_type !=# 'blob' + set filetype=git + nnoremap a :let b:fugitive_display_format += v:count1exe BufReadObject() + nnoremap i :let b:fugitive_display_format -= v:count1exe BufReadObject() + else + call s:JumpInit() + endif + endtry + + return '' + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +augroup fugitive_files + autocmd! + autocmd BufReadCmd index{,.lock} + \ if fugitive#is_git_dir(expand(':p:h')) | + \ exe s:BufReadIndex() | + \ elseif filereadable(expand('')) | + \ read | + \ 1delete | + \ endif + autocmd FileReadCmd fugitive://**//[0-3]/** exe s:FileRead() + autocmd BufReadCmd fugitive://**//[0-3]/** exe s:BufReadIndexFile() + autocmd BufWriteCmd fugitive://**//[0-3]/** exe s:BufWriteIndexFile() + autocmd BufReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe s:BufReadObject() + autocmd FileReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe s:FileRead() + autocmd FileType git + \ if exists('b:git_dir') | + \ call s:JumpInit() | + \ endif +augroup END + +" }}}1 +" Temp files {{{1 + +if !exists('s:temp_files') + let s:temp_files = {} +endif + +augroup fugitive_temp + autocmd! + autocmd BufNewFile,BufReadPost * + \ if has_key(s:temp_files,expand(':p')) | + \ let b:git_dir = s:temp_files[expand(':p')] | + \ let b:git_type = 'temp' | + \ call fugitive#detect(expand(':p')) | + \ setlocal bufhidden=delete | + \ nnoremap q :bdelete| + \ endif +augroup END + +" }}}1 +" Go to file {{{1 + +function! s:JumpInit() abort + nnoremap :exe GF("edit") + if !&modifiable + if exists(':CtrlP') + nnoremap :exe 'CtrlP '.fnameescape(repo().tree()) + endif + nnoremap o :exe GF("split") + nnoremap S :exe GF("vsplit") + nnoremap O :exe GF("tabedit") + nnoremap - :exe Edit('edit',0,buffer().up(v:count1)) if fugitive#buffer().type('tree')call search('^'.escape(expand('#:t'),'.*[]~\').'/\=$','wc')endif + nnoremap P :exe Edit('edit',0,buffer().commit().'^'.v:count1.buffer().path(':')) + nnoremap ~ :exe Edit('edit',0,buffer().commit().'~'.v:count1.buffer().path(':')) + nnoremap C :exe Edit('edit',0,buffer().containing_commit()) + nnoremap cc :exe Edit('edit',0,buffer().containing_commit()) + nnoremap co :exe Edit('split',0,buffer().containing_commit()) + nnoremap cS :exe Edit('vsplit',0,buffer().containing_commit()) + nnoremap cO :exe Edit('tabedit',0,buffer().containing_commit()) + nnoremap cP :exe Edit('pedit',0,buffer().containing_commit()) + nnoremap . : =fnameescape(recall()) + endif +endfunction + +function! s:GF(mode) abort + try + let buffer = s:buffer() + let myhash = buffer.sha1() + if myhash ==# '' && getline(1) =~# '^\%(commit\|tag\) \w' + let myhash = matchstr(getline(1),'^\w\+ \zs\S\+') + endif + + if buffer.type('tree') + let showtree = (getline(1) =~# '^tree ' && getline(2) == "") + if showtree && line('.') == 1 + return "" + elseif showtree && line('.') > 2 + return s:Edit(a:mode,0,buffer.commit().':'.s:buffer().path().(buffer.path() =~# '^$\|/$' ? '' : '/').s:sub(getline('.'),'/$','')) + elseif getline('.') =~# '^\d\{6\} \l\{3,8\} \x\{40\}\t' + return s:Edit(a:mode,0,buffer.commit().':'.s:buffer().path().(buffer.path() =~# '^$\|/$' ? '' : '/').s:sub(matchstr(getline('.'),'\t\zs.*'),'/$','')) + endif + + elseif buffer.type('blob') + let ref = expand("") + try + let sha1 = buffer.repo().rev_parse(ref) + catch /^fugitive:/ + endtry + if exists('sha1') + return s:Edit(a:mode,0,ref) + endif + + else + + " Index + if getline('.') =~# '^\d\{6\} \x\{40\} \d\t' + let ref = matchstr(getline('.'),'\x\{40\}') + let file = ':'.s:sub(matchstr(getline('.'),'\d\t.*'),'\t',':') + return s:Edit(a:mode,0,file) + + elseif getline('.') =~# '^#\trenamed:.* -> ' + let file = '/'.matchstr(getline('.'),' -> \zs.*') + return s:Edit(a:mode,0,file) + elseif getline('.') =~# '^#\t[[:alpha:] ]\+: *.' + let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') + return s:Edit(a:mode,0,file) + elseif getline('.') =~# '^#\t.' + let file = '/'.matchstr(getline('.'),'#\t\zs.*') + return s:Edit(a:mode,0,file) + elseif getline('.') =~# ': needs merge$' + let file = '/'.matchstr(getline('.'),'.*\ze: needs merge$') + return s:Edit(a:mode,0,file).'|Gdiff' + + elseif getline('.') ==# '# Not currently on any branch.' + return s:Edit(a:mode,0,'HEAD') + elseif getline('.') =~# '^# On branch ' + let file = 'refs/heads/'.getline('.')[12:] + return s:Edit(a:mode,0,file) + elseif getline('.') =~# "^# Your branch .*'" + let file = matchstr(getline('.'),"'\\zs\\S\\+\\ze'") + return s:Edit(a:mode,0,file) + endif + + let showtree = (getline(1) =~# '^tree ' && getline(2) == "") + + if getline('.') =~# '^ref: ' + let ref = strpart(getline('.'),5) + + elseif getline('.') =~# '^commit \x\{40\}\>' + let ref = matchstr(getline('.'),'\x\{40\}') + return s:Edit(a:mode,0,ref) + + elseif getline('.') =~# '^parent \x\{40\}\>' + let ref = matchstr(getline('.'),'\x\{40\}') + let line = line('.') + let parent = 0 + while getline(line) =~# '^parent ' + let parent += 1 + let line -= 1 + endwhile + return s:Edit(a:mode,0,ref) + + elseif getline('.') =~ '^tree \x\{40\}$' + let ref = matchstr(getline('.'),'\x\{40\}') + if s:repo().rev_parse(myhash.':') == ref + let ref = myhash.':' + endif + return s:Edit(a:mode,0,ref) + + elseif getline('.') =~# '^object \x\{40\}$' && getline(line('.')+1) =~ '^type \%(commit\|tree\|blob\)$' + let ref = matchstr(getline('.'),'\x\{40\}') + let type = matchstr(getline(line('.')+1),'type \zs.*') + + elseif getline('.') =~# '^\l\{3,8\} '.myhash.'$' + return '' + + elseif getline('.') =~# '^\l\{3,8\} \x\{40\}\>' + let ref = matchstr(getline('.'),'\x\{40\}') + echoerr "warning: unknown context ".matchstr(getline('.'),'^\l*') + + elseif getline('.') =~# '^[+-]\{3\} [ab/]' + let ref = getline('.')[4:] + + elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW') + let type = getline('.')[0] + let lnum = line('.') - 1 + let offset = -1 + while getline(lnum) !~# '^@@ -\d\+,\d\+ +\d\+,' + if getline(lnum) =~# '^[ '.type.']' + let offset += 1 + endif + let lnum -= 1 + endwhile + let offset += matchstr(getline(lnum), type.'\zs\d\+') + let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1] + let dcmd = '+'.offset.'|if foldlevel(".")|foldopen!|endif' + let dref = '' + + elseif getline('.') =~# '^rename from ' + let ref = 'a/'.getline('.')[12:] + elseif getline('.') =~# '^rename to ' + let ref = 'b/'.getline('.')[10:] + + elseif getline('.') =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)' + let dref = matchstr(getline('.'),'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)') + let ref = matchstr(getline('.'),'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)') + let dcmd = 'Gdiff' + + elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)' + let line = getline(line('.')-1) + let dref = matchstr(line,'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)') + let ref = matchstr(line,'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)') + let dcmd = 'Gdiff!' + + elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$' + let ref = getline('.') + else + let ref = '' + endif + + if myhash ==# '' + let ref = s:sub(ref,'^a/','HEAD:') + let ref = s:sub(ref,'^b/',':0:') + if exists('dref') + let dref = s:sub(dref,'^a/','HEAD:') + endif + else + let ref = s:sub(ref,'^a/',myhash.'^:') + let ref = s:sub(ref,'^b/',myhash.':') + if exists('dref') + let dref = s:sub(dref,'^a/',myhash.'^:') + endif + endif + + if ref ==# '/dev/null' + " Empty blob + let ref = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391' + endif + + if exists('dref') + return s:Edit(a:mode,0,ref) . '|'.dcmd.' '.s:fnameescape(dref) + elseif ref != "" + return s:Edit(a:mode,0,ref) + endif + + endif + return '' + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry +endfunction + +" }}}1 +" Statusline {{{1 + +function! s:repo_head_ref() dict abort + return readfile(self.dir('HEAD'))[0] +endfunction + +call s:add_methods('repo',['head_ref']) + +function! fugitive#statusline(...) + if !exists('b:git_dir') + return '' + endif + let status = '' + if s:buffer().commit() != '' + let status .= ':' . s:buffer().commit()[0:7] + endif + let status .= '('.fugitive#head(7).')' + if &statusline =~# '%[MRHWY]' && &statusline !~# '%[mrhwy]' + return ',GIT'.status + else + return '[Git'.status.']' + endif +endfunction + +function! fugitive#head(...) + if !exists('b:git_dir') + return '' + endif + + return s:repo().head(a:0 ? a:1 : 0) +endfunction + +" }}}1 +" Folding {{{1 + +function! fugitive#foldtext() abort + if &foldmethod !=# 'syntax' + return foldtext() + elseif getline(v:foldstart) =~# '^diff ' + let [add, remove] = [-1, -1] + let filename = '' + for lnum in range(v:foldstart, v:foldend) + if filename ==# '' && getline(lnum) =~# '^[+-]\{3\} [abciow12]/' + let filename = getline(lnum)[6:-1] + endif + if getline(lnum) =~# '^+' + let add += 1 + elseif getline(lnum) =~# '^-' + let remove += 1 + elseif getline(lnum) =~# '^Binary ' + let binary = 1 + endif + endfor + if filename ==# '' + let filename = matchstr(getline(v:foldstart), '^diff .\{-\} a/\zs.*\ze b/') + endif + if filename ==# '' + let filename = getline(v:foldstart)[5:-1] + endif + if exists('binary') + return 'Binary: '.filename + else + return (add<10&&remove<100?' ':'') . add . '+ ' . (remove<10&&add<100?' ':'') . remove . '- ' . filename + endif + elseif getline(v:foldstart) =~# '^# .*:$' + let lines = getline(v:foldstart, v:foldend) + call filter(lines, 'v:val =~# "^#\t"') + cal map(lines,'s:sub(v:val, "^#\t%(modified: +|renamed: +)=", "")') + cal map(lines,'s:sub(v:val, "^([[:alpha:] ]+): +(.*)", "\\2 (\\1)")') + return getline(v:foldstart).' '.join(lines, ', ') + endif + return foldtext() +endfunction + +augroup fugitive_foldtext + autocmd! + autocmd User Fugitive + \ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' | + \ set foldtext=fugitive#foldtext() | + \ endif +augroup END + +" }}}1 + +" vim:set et sw=2: diff --git a/sources_non_forked/vim-less/README.md b/sources_non_forked/vim-less/README.md index 6d15adf9..697ad124 100644 --- a/sources_non_forked/vim-less/README.md +++ b/sources_non_forked/vim-less/README.md @@ -1,4 +1,4 @@ -# VIM-LESS # +# VIM-LESS This vim bundle adds syntax highlighting, indenting and autocompletion for the dynamic stylesheet language [LESS](http://lesscss.org). @@ -8,7 +8,8 @@ in `after/syntax/css.vim` or `after/syntax/css/*.vim`. ![vim-less with vim-css-color and vim-css3-syntax (colorscheme solarized)](https://github.com/lenniboy/vim-less/raw/master/screenshot.png) -## Installing and Using ## + +## Installing and Using - Install [pathogen](http://www.vim.org/scripts/script.php?script_id=2332) into `~/.vim/autoload/` and add the following line to your `~/.vimrc`: @@ -23,19 +24,21 @@ in `after/syntax/css.vim` or `after/syntax/css/*.vim`. - OR use [vundle](https://github.com/gmarik/vundle), adding this line to your `~/.vimrc`: - Bundle 'lunaru/vim-less' + Bundle 'groenewege/vim-less' - OR use git submodules: $ git submodule add https://github.com/groenewege/vim-less.git bundle/vim-less $ git submodule init + ### Map .less to .css , lessc is required. nnoremap ,m :w !lessc % > %:t:r.css -## Credits ## + +## Credits Inspiration from [vim-haml](https://github.com/tpope/vim-haml), [scss-syntax.vim](https://github.com/cakebaker/scss-syntax.vim) and diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 2b565b4d..3024f2f7 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -76,8 +76,8 @@ syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+ syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart -syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart -syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart +syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic +syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart @@ -86,7 +86,7 @@ syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end= if main_syntax ==# 'markdown' for s:type in g:markdown_fenced_languages - exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') endfor unlet! s:type endif diff --git a/sources_non_forked/vim-multiple-cursors/CHANGELOG.md b/sources_non_forked/vim-multiple-cursors/CHANGELOG.md index d08bd09e..265b39f8 100644 --- a/sources_non_forked/vim-multiple-cursors/CHANGELOG.md +++ b/sources_non_forked/vim-multiple-cursors/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2 (06/10/2013) +Bugfixes: + - Fix plugin break in PASTE mode. This fixes #44. + ## 2.1 (04/26/2013) Bugfixes: diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index a94de146..04da4c6b 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -69,7 +69,7 @@ let g:multi_cursor_start_key='' ## Setting Currently there're two additional global settings one can tweak: -### ```g:multi_cursor_exit_from_visual_mode``` (Defaut: 1) +### ```g:multi_cursor_exit_from_visual_mode``` (Default: 1) If set to 0, then pressing `g:multi_cursor_quit_key` in _Visual_ mode will not quit and delete all existing cursors. This is useful if you want to press Escape and go back to Normal mode, and still be able to operate on all the cursors. @@ -87,7 +87,6 @@ highlight link multiple_cursors_visual Visual ## Issues - Multi key commands like `ciw` do not work at the moment -- Insert mode can be slow. If you are using Neobundle and have many plugins, try switching to Vundle to see if it helps. See https://github.com/Shougo/neobundle.vim/issues/84 for additional info. - All user input typed before Vim is able to fan out the last operation to all cursors is lost. This is a implementation decision to keep the input perfectly synced in all locations, at the cost of potentially losing user input. - Select mode is not implemented @@ -107,3 +106,7 @@ Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selec [Neobundle]:http://github.com/Shougo/neobundle.vim [emacs-multiple-cursors]:https://github.com/magnars/multiple-cursors.el + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-multiple-cursors/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + diff --git a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim index 227e150d..7cdae119 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -50,9 +50,9 @@ endif " Internal Mappings "=============================================================================== -inoremap (i) :call process_user_inut() -nnoremap (i) :call process_user_inut() -xnoremap (i) :call process_user_inut() +inoremap (i) :call process_user_input() +nnoremap (i) :call process_user_input() +xnoremap (i) :call process_user_input() inoremap (a) :call apply_user_input_next('i') nnoremap (a) :call apply_user_input_next('n') @@ -97,8 +97,8 @@ endfunction " attempted to be created at the next occurrence of the visual selection function! multiple_cursors#new(mode) if a:mode ==# 'n' - " Reset all existing cursors, don't restore view - call s:cm.reset(0) + " Reset all existing cursors, don't restore view and setting + call s:cm.reset(0, 0) " Select the word under cursor to set the '< and '> marks exec "normal! viw" @@ -113,7 +113,7 @@ function! multiple_cursors#new(mode) let start = line("'<") let finish = line("'>") if start != finish - call s:cm.reset(0) + call s:cm.reset(0, 0) let col = col("'<") for line in range(line("'<"), line("'>")) let pos = [line, col] @@ -124,7 +124,7 @@ function! multiple_cursors#new(mode) else " Came directly from visual mode if s:cm.is_empty() - call s:cm.reset(0) + call s:cm.reset(0, 0) if visualmode() ==# 'V' let left = [line('.'), 1] @@ -133,7 +133,7 @@ function! multiple_cursors#new(mode) return endif call s:cm.add(right, [left, right]) - else + else call s:cm.add(s:pos("'>"), s:region("'<", "'>")) endif endif @@ -219,7 +219,7 @@ function! multiple_cursors#find(start, end, pattern) call winrestview(s:cm.saved_winview) echohl ErrorMsg | echo 'No match found' | echohl None return - else + else echohl Normal | echo 'Added '.s:cm.size().' cursor'.(s:cm.size()>1?'s':'') | echohl None call s:wait_for_user_input('v') endif @@ -318,6 +318,7 @@ function! s:CursorManager.new() \ 'virtualedit': &virtualedit, \ 'cursorline': &cursorline, \ 'lazyredraw': &lazyredraw, + \ 'paste': &paste, \ } " We save the window view when multicursor mode is entered let obj.saved_winview = [] @@ -327,7 +328,7 @@ function! s:CursorManager.new() endfunction " Clear all cursors and their highlights -function! s:CursorManager.reset(restore_view) dict +function! s:CursorManager.reset(restore_view, restore_setting) dict if a:restore_view " Return the view back to the beginning if !empty(self.saved_winview) @@ -357,7 +358,9 @@ function! s:CursorManager.reset(restore_view) dict let self.saved_winview = [] let self.start_from_find = 0 let s:char = '' - call self.restore_user_settings() + if a:restore_setting + call self.restore_user_settings() + endif endfunction " Returns 0 if it's not managing any cursors at the moment @@ -513,10 +516,17 @@ endfunction " where the real vim cursor is " lazyredraw needs to be turned on to prevent jerky screen behavior with many " cursors on screen +" paste mode needs to be switched off since it turns off a bunch of features +" that's critical for the plugin to function function! s:CursorManager.initialize() dict + let self.saved_settings['virtualedit'] = &virtualedit + let self.saved_settings['cursorline'] = &cursorline + let self.saved_settings['lazyredraw'] = &lazyredraw + let self.saved_settings['paste'] = &paste let &virtualedit = "onemore" let &cursorline = 0 let &lazyredraw = 1 + let &paste = 0 " We could have already saved the view from multiple_cursors#find if !self.start_from_find let self.saved_winview = winsaveview() @@ -529,6 +539,7 @@ function! s:CursorManager.restore_user_settings() dict let &virtualedit = self.saved_settings['virtualedit'] let &cursorline = self.saved_settings['cursorline'] let &lazyredraw = self.saved_settings['lazyredraw'] + let &paste = self.saved_settings['paste'] endif endfunction @@ -742,7 +753,7 @@ function! s:feedkeys(keys) endfunction " Take the user input and apply it at every cursor -function! s:process_user_inut() +function! s:process_user_input() " Grr this is frustrating. In Insert mode, between the feedkey call and here, " the current position could actually CHANGE for some odd reason. Forcing a " position reset here @@ -876,7 +887,7 @@ function! s:exit() let exit = 1 endif if exit - call s:cm.reset(1) + call s:cm.reset(1, 1) return 1 endif return 0 @@ -923,7 +934,7 @@ function! s:revert_highlight_fix() if type(s:saved_line) == 1 if s:from_mode ==# 'i' silent! undojoin | call setline('.', s:saved_line) - else + else call setline('.', s:saved_line) endif endif @@ -961,7 +972,7 @@ function! s:end_latency_measure() silent! echom "Starting latency debug at ".reltimestr(reltime()) redir END endif - + if !s:skip_latency_measure exec 'redir >> '.s:latency_debug_file silent! echom "Processing '".s:char."' took ".string(str2float(reltimestr(reltime(s:start_time)))*1000).' ms in '.s:cm.size().' cursors. mode = '.s:from_mode @@ -1000,7 +1011,7 @@ function! s:wait_for_user_input(mode) if s:exit() return endif - + " If the key is a special key and we're in the right mode, handle it if index(get(s:special_keys, s:from_mode, []), s:char) != -1 call s:handle_special_key(s:char, s:from_mode) diff --git a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt index dc6550bf..a1de56e5 100644 --- a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt +++ b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt @@ -160,7 +160,6 @@ like the following in your vimrc: > cursors is lost. This is a implementation decision to keep the input perfectly synced in all locations, at the cost of potentially losing user input. -- Performance in terminal vim degrades significantly with more cursors - Select mode is not implemented ============================================================================== diff --git a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb index 590222eb..1e8fc89c 100644 --- a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb +++ b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb @@ -270,4 +270,19 @@ describe "Multiple Cursors" do hello world EOF end + + specify "#set paste mode" do + before <<-EOF + hello + hello + EOF + + type ':set pastecworld:set nopaste' + + after <<-EOF + world + world + EOF + end + end diff --git a/sources_non_forked/vim-snipmate/Contributors.md b/sources_non_forked/vim-snipmate/Contributors.md index 7d9488f5..33380c1d 100644 --- a/sources_non_forked/vim-snipmate/Contributors.md +++ b/sources_non_forked/vim-snipmate/Contributors.md @@ -10,6 +10,8 @@ additional contributions from: * [alderz](https://github.com/alderz) * [asymmetric](https://github.com/asymmetric) +* [bpugh](https://github.com/bpugh) +* [bruno-](https://github.com/bruno-) * [darkwise](https://github.com/darkwise) * [henrik](https://github.com/henrik) * [holizz](https://github.com/holizz) @@ -30,8 +32,10 @@ additional contributions from: * [radicalbit](https://github.com/radicalbit) * [redpill](https://github.com/redpill) * [robhudson](https://github.com/robhudson) +* [Shraymonks](https://github.com/shraymonks) * [sickill](https://github.com/sickill) * [statik](https://github.com/statik) * [steveno](https://github.com/steveno) * [taq](https://github.com/taq) * [thisgeek](https://github.com/thisgeek) +* [Xandaros](https://github.com/Xandaros) diff --git a/sources_non_forked/vim-snipmate/README.md b/sources_non_forked/vim-snipmate/README.md index eb7fae64..02718478 100644 --- a/sources_non_forked/vim-snipmate/README.md +++ b/sources_non_forked/vim-snipmate/README.md @@ -17,8 +17,10 @@ Garbas][garbas], [Marc Weber][marcweber], and [Adnan Zafar][ajzafar]. ## Installing SnipMate ## -SnipMate depends on [vim-addon-mw-utils][mw-utils] and [tlib][tlib]. We -recommend one of the following ways of installing all three. +We recommend one of the following methods for installing SnipMate and its +dependencies. SnipMate depends on [vim-addon-mw-utils][mw-utils] and +[tlib][tlib]. Since SnipMate does not ship with any snippets, we suggest +looking at the [vim-snippets][vim-snippets] repository. * Using [Pathogen][pathogen], run the following commands: @@ -27,6 +29,9 @@ recommend one of the following ways of installing all three. % git clone https://github.com/MarcWeber/vim-addon-mw-utils.git % git clone https://github.com/garbas/vim-snipmate.git + # Optional: + % git clone https://github.com/honza/vim-snippets.git + * Using [VAM][vam], add `vim-snippets` to the list of packages to be installed. * Using [Vundle][vundle], add the following to your `vimrc` then run @@ -36,8 +41,8 @@ recommend one of the following ways of installing all three. Bundle "tomtom/tlib_vim" Bundle "garbas/vim-snipmate" -Lastly, since SnipMate does not ship with any snippets, we suggest looking at -the [vim-snippets][vim-snippets] repository. + " Optional: + Bundle "honza/vim-snippets" [ultisnips]: https://github.com/sirver/ultisnips diff --git a/sources_non_forked/vim-snipmate/addon-info.json b/sources_non_forked/vim-snipmate/addon-info.json index 94903731..8d9930ff 100644 --- a/sources_non_forked/vim-snipmate/addon-info.json +++ b/sources_non_forked/vim-snipmate/addon-info.json @@ -8,5 +8,5 @@ "vim-addon-mw-utils": {}, "tlib": {} }, - "description" : "snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim. See README.markdown to learn about the features this fork adds" + "description" : "snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim. See README.md to learn about the features this fork adds" } diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 0b830e03..bb3ecdfd 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -7,7 +7,7 @@ let s:c = g:snipMate try call tlib#input#List('mi', '', []) catch /.*/ - echoe "you're missing tlib. See install instructions at ".expand(':h:h').'/README.rst' + echoe "you're missing tlib. See install instructions at ".expand(':h:h').'/README.md' endtry " match $ which doesn't follow a \ @@ -22,17 +22,18 @@ let s:c.read_snippets_cached = get(s:c, 'read_snippets_cached', {'func' : functi " if filetype is objc, cpp, cs or cu also append snippets from scope 'c' " you can add multiple by separating scopes by ',', see s:AddScopeAliases -" TODO add documentation to doc/* let s:c.scope_aliases = get(s:c, 'scope_aliases', {}) -let s:c.scope_aliases.objc = get(s:c.scope_aliases, 'objc', 'c') -let s:c.scope_aliases.cpp = get(s:c.scope_aliases, 'cpp', 'c') -let s:c.scope_aliases.cu = get(s:c.scope_aliases, 'cu', 'c') -let s:c.scope_aliases.xhtml = get(s:c.scope_aliases, 'xhtml', 'html') -let s:c.scope_aliases.html = get(s:c.scope_aliases, 'html', 'javascript') -let s:c.scope_aliases.php = get(s:c.scope_aliases, 'php', 'php,html,javascript') -let s:c.scope_aliases.ur = get(s:c.scope_aliases, 'ur', 'html,javascript') -let s:c.scope_aliases.mxml = get(s:c.scope_aliases, 'mxml', 'actionscript') -let s:c.scope_aliases.eruby = get(s:c.scope_aliases, 'eruby', 'eruby-rails,html') +if !exists('g:snipMate_no_default_aliases') || !g:snipMate_no_default_aliases + let s:c.scope_aliases.objc = get(s:c.scope_aliases, 'objc', 'c') + let s:c.scope_aliases.cpp = get(s:c.scope_aliases, 'cpp', 'c') + let s:c.scope_aliases.cu = get(s:c.scope_aliases, 'cu', 'c') + let s:c.scope_aliases.xhtml = get(s:c.scope_aliases, 'xhtml', 'html') + let s:c.scope_aliases.html = get(s:c.scope_aliases, 'html', 'javascript') + let s:c.scope_aliases.php = get(s:c.scope_aliases, 'php', 'php,html,javascript') + let s:c.scope_aliases.ur = get(s:c.scope_aliases, 'ur', 'html,javascript') + let s:c.scope_aliases.mxml = get(s:c.scope_aliases, 'mxml', 'actionscript') + let s:c.scope_aliases.eruby = get(s:c.scope_aliases, 'eruby', 'eruby-rails,html') +endif " set this to "\" to make snipmate not swallow tab (make sure to not have " expandtab set). Remember that you can always enter tabs by then @@ -77,11 +78,10 @@ fun! snipMate#expandSnip(snip, col) endif endif - call setline(lnum, line.snipLines[0]) - - " Autoindent snippet according to previous indentation - let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1 - call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val")) + " Insert snippet with proper indentation + let indent = indent(lnum) + 1 + call setline(lnum, line . snipLines[0]) + call append(lnum, map(snipLines[1:], "empty(v:val) ? v:val : '" . strpart(line, 0, indent - 1) . "' . v:val")) " Open any folds snippet expands into if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif @@ -122,8 +122,9 @@ endfunction fun! s:ProcessSnippet(snip) let snippet = a:snip - if exists('g:snipmate_content_visual') - let visual = g:snipmate_content_visual | unlet g:snipmate_content_visual + if exists('b:snipmate_content_visual') + let visual = b:snipmate_content_visual + unlet b:snipmate_content_visual else let visual = '' endif @@ -168,8 +169,20 @@ fun! s:ProcessSnippet(snip) let i += 1 endw + " Add ${0} tab stop if found + if snippet =~ s:d . '{0' + let snippet = substitute(snippet, s:d.'{0', '${'.i, '') + let s = matchstr(snippet, s:d.'{'.i.':\zs.\{-}\ze}') + if s != '' + let snippet = substitute(snippet, s:d.'0', '$'.i, 'g') + let snippet = substitute(snippet, s:d.i, s.'&', 'g') + endif + else + let snippet .= '${'.i.'}' + endif + if &et " Expand tabs to spaces if 'expandtab' is set. - return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g') + return substitute(snippet, '\t', repeat(' ', (&sts > 0) ? &sts : &sw), 'g') endif return snippet endf @@ -391,7 +404,8 @@ endf " if triggername is not set 'default' is assumed fun! snipMate#ReadSnippetsFile(file) let result = [] - if !filereadable(a:file) | return result | endif + let new_scopes = [] + if !filereadable(a:file) | return [result, new_scopes] | endif let r_guard = '^guard\s\+\zs.*' let inSnip = 0 let guard = 1 @@ -421,9 +435,12 @@ fun! snipMate#ReadSnippetsFile(file) let trigger = strpart(trigger, 0, space - 1) endif let content = '' + elseif line[:6] == 'extends' + call extend(new_scopes, map(split(strpart(line, 8)), + \ "substitute(v:val, ',*$', '', '')")) endif endfor - return result + return [result, new_scopes] endf " adds scope aliases to list. @@ -448,7 +465,14 @@ fun! s:AddScopeAliases(list) endf function! s:Glob(path, expr) - return filter(split(globpath(a:path, a:expr), "\n"), 'filereadable(v:val)') + let res = [] + for p in split(a:path, ',') + let h = fnamemodify(a:expr, ':h') + if isdirectory(p . '/' . h) + call extend(res, split(glob(p . '/' . a:expr), "\n")) + endif + endfor + return filter(res, 'filereadable(v:val)') endfunction " returns dict of @@ -467,7 +491,7 @@ function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) let paths = join(funcref#Call(s:c.snippet_dirs), ',') let result = {} let scopes = s:AddScopeAliases(a:scopes) - let trigger = escape(a:trigger, '{}*[]`') + let trigger = escape(a:trigger, "*[]?{}`'$") " collect existing files for scope in scopes @@ -490,7 +514,7 @@ function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) if !a:mustExist for p in split(paths, ',') - let p .= '/' . scope . '.snippets' + let p .= '/snippets/' . scope . '.snippets' let result[p] = get(result, p, {'exists': 0, 'type': 'snippets'}) endfor endif @@ -514,21 +538,27 @@ endf " default triggers based on paths fun! snipMate#DefaultPool(scopes, trigger, result) let triggerR = substitute(a:trigger,'*','.*','g') + let extra_scopes = [] for [f,opts] in items(snipMate#GetSnippetFiles(1, a:scopes, a:trigger)) let opts.name_prefix = matchstr(f, '\v[^/]+\ze/snippets') . ' ' . opts.name_prefix if opts.type == 'snippets' - for [trigger, name, contents, guard] in cached_file_contents#CachedFileContents(f, s:c.read_snippets_cached, 0) + let [snippets, extension] = cached_file_contents#CachedFileContents(f, s:c.read_snippets_cached, 0) + for [trigger, name, contents, guard] in snippets if trigger !~ escape(triggerR,'~') | continue | endif if snipMate#EvalGuard(guard) call snipMate#SetByPath(a:result, [trigger, opts.name_prefix.' '.name], contents) endif endfor + call extend(extra_scopes, extension) elseif opts.type == 'snippet' call snipMate#SetByPath(a:result, [opts.trigger, opts.name_prefix.' '.opts.name], funcref#Function('return readfile('.string(f).')')) else throw "unexpected" endif endfor + if !empty(extra_scopes) + call snipMate#DefaultPool(extra_scopes, a:trigger, a:result) + endif endf " return a dict of snippets found in runtimepath matching trigger @@ -693,10 +723,8 @@ fun! snipMate#ShowAvailableSnips() return '' endf - -" user interface implementation {{{1 - -fun! snipMate#TriggerSnippet() +" Pass an argument to force snippet expansion instead of triggering or jumping +function! snipMate#TriggerSnippet(...) if exists('g:SuperTabMappingForward') if g:SuperTabMappingForward == "" let SuperTabPlug = maparg('SuperTabForward', 'i') @@ -723,7 +751,7 @@ fun! snipMate#TriggerSnippet() call feedkeys("\") | return '' endif - if exists('b:snip_state') + if exists('b:snip_state') && a:0 == 0 " Jump only if no arguments let jump = b:snip_state.jump_stop(0) if type(jump) == 1 " returned a string return jump @@ -759,8 +787,7 @@ fun! snipMate#TriggerSnippet() return word == '' \ ? "\" \ : "\=snipMate#ShowAvailableSnips()\" -endf - +endfunction fun! snipMate#BackwardsSnippet() if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif @@ -790,5 +817,4 @@ fun! snipMate#BackwardsSnippet() return "\" endf - " vim:noet:sw=4:ts=4:ft=vim diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index 4043191a..a0f052d3 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -1,280 +1,274 @@ -*snipMate.txt* Plugin for using TextMate-style snippets in Vim. +*SnipMate.txt* Plugin for using TextMate-style snippets in Vim. -snipMate *snippet* *snippets* *snipMate* +SnipMate *snippet* *snippets* *SnipMate* Last Change: December 27, 2009 -|snipMate-installation| Installation -|snipMate-description| Description -|snipMate-related-work| Related work -|snipMate-usage| Usage (GETTING STARTED QUICKLY) -|snipMate-snippet-sources| snippet sources -|snipMate-syntax| Snippet syntax -|snipMate-settings| Settings -|snipMate-features| Features -|snipMate-disadvantages| Disadvantages to TextMate -|snipMate-contact| Contact -|snipMate-license| License -|snipMate-bugs| BUGS +1. Description |SnipMate-description| +2. Usage |SnipMate-usage| +3. Interface and Settings |SnipMate-interface| |SnipMate-settings| +4. Snippet syntax |SnipMate-syntax| +5. Snippet sources |SnipMate-snippet-sources| +6. Disadvantages to TextMate |SnipMate-disadvantages| +7. Contact |SnipMate-contact| +8. License |SnipMate-license| For Vim version 7.0 or later. This plugin only works if 'compatible' is not set. {Vi does not have any of these features.} +SnipMate depends on vim-addon-mw-utils and tlib. ============================================================================== -INSTALLATION *snipMate-installation* +DESCRIPTION *SnipMate-description* -Of course you can use whatever tool you want. -However some features of snipMate depend on external VimL code: -tlib: tlib#input#List (providing a nice selection list) -vim-addon-mw-utils: (providing all the caching implementation) -Thus i recommend vim-addon-manager to install snipMate because this will also -fetch the dependencies for you. +SnipMate implements snippet features in Vim. A snippet is like a template, +reducing repetitive insertion of pieces of text. Snippets can contain +placeholders for modifying the text if necessary or interpolated code for +evaluation. For example, in C, typing "for" then pushing could expand +to: > -The complete set of dependencies can be found in snipMate-addon-info.txt -The current VAM-plugin name for this enhanced version of snipMate is "snipMate". + for (i = 0; i < count; i++) { + /* code */ + } + +SnipMate is inspired by TextMate's snippet features. ============================================================================== -DESCRIPTION *snipMate-description* +USAGE *SnipMate-usage* -snipMate is an extension to Vim which allows you to store and retrieve text -snippets with placeholders in a very convenient way. +Every snippet consists of an expansion and a trigger. Typing a trigger into +your buffer and then hitting your trigger key ( by default, see +|SnipMate-mappings|) will replace the trigger with the expansion text. -snipMate is inspired by TextMate's snippet features. +The expansion text can optionally include tab stops. When it does, upon +expansion of the snippet, the cursor is placed at the first one, and the user +can jump between each tab stop. Each of these tab stops can be represented by +default placeholder text. If such a placeholder is provided, then the text of +the placeholder can be repeated in the snippet at specified mirrors. Any edits +to the placeholder are instantly updated at every mirror. + +SnipMate allows multiple snippets to use the same trigger. When triggered, +a list of all snippets with that trigger is provided and prompts for which +snippet to use. + + *SnipMate-scopes* +SnipMate searches for snippets inside a directory named "snippets" inside each +entry in 'runtimepath'. Which files are loaded depends on 'filetype' and +'syntax'; see |SnipMate-syntax| for more information. Snippets are loaded and +refreshed automatically on demand. + +Note: SnipMate does not ship with any snippets. In order to use it, the user +must either write their own snippets or obtain some from a repository like +https://github.com/honza/vim-snippets ============================================================================== -RELATED WORK *snipMate-related-work* +INTERFACE AND SETTINGS *SnipMate-interface* *SnipMate-settings* -There are some alternatives: -- ultisnips (python based) -- xptemplate which is probably a much more powerful - but also more complex -- neosnippets - which seems to be able to read snippet -files when swiching on compatible mode -- (..?) + *SnipMate-commands* +Commands~ -snipmate is not perfect - however it gets its job done perfectly and gets out -of your way. So if you want to get started fast without reading too much -documentation probably snipmate is for you. + *:SnipMateOpenSnippetFiles* +:SnipMateOpenSnippetFiles Opens a list of all valid snippet locations + based on the current scope |SnipMate-scopes|. + Only existing files and non-existing .snippets + files will be shown, with the existing files + shown first. + + *SnipMate-options* +Options~ + +g:snips_author A variable used in some snippets in place of + the author's (your) name. Similar to + $TM_FULLNAME in TextMate. For example, > + snippet name + `g:snips_author` +< creates a snippet "name" that expands to your + name. + +g:snipMate This |Dictionary| contains other SnipMate + options. In short add > + let g:snipMate = {} +< to your .vimrc before setting other SnipMate + options. + +g:snipMate.scope_aliases A |Dictionary| associating certain filetypes + with other scopes |SnipMate-scopes|. The + entries consist of a filetype as the key and + a comma-separated list of aliases as the + value. For example, > + let g:snipMate.scope_aliases = {} + let g:snipMate.scope_aliases['ruby'] + \ = 'ruby,ruby-rails' +< tells SnipMate that "ruby-rails" snippets in + addition to "ruby" snippets should be loaded + when editing files with 'filetype' set to + "ruby" or contains "ruby" as an entry in the + case of dotted filetypes. + +g:snipMate_no_default_aliases + When set to 1, prevents SnipMate from loading + default scope aliases. The defaults are: + Filetype Alias ~ + cpp c + cu c + eruby eruby-rails,html + html javascript + mxml actionscript + objc c + php php,html,javascript + ur html,javascript + xhtml html + Note: Setting this option does not disable + scope aliases entirely, only those made by + SnipMate itself. Any scope aliases created by + the user or someone else will still be in + effect. + +g:snipMate['no_match_completion_feedkeys_chars'] + A string inserted when no match for a trigger + is found. By default a tab is inserted + according to 'expandtab', 'tabstop', and + 'softtabstop'. Set it to the empty string to + prevent anything from being inserted. + + *SnipMate-mappings* +Mappings~ + +The mappings SnipMate uses can be customized with the |:map| commands. For +example, to change the key that triggers snippets and moves to the next +tabstop, > + + :imap snipMateNextOrTrigger + :smap snipMateNextOrTrigger + +The list of possible mappings is as follows: + +snipMateNextOrTrigger Default: Mode: Insert, Select + Jumps to the next tab stop or, if none exists, + try to expand a snippet. Use in both insert + and select modes. + +snipMateTrigger Default: unmapped Mode: Insert + Try to expand a snippet regardless of any + existing snippet expansion. If done within an + expanded snippet, the outer snippet's tab + stops are lost, unless expansion failed. + +snipMateBack Default: Mode: Insert, Select + Jump to the previous tab stop, if it exists. + Use in both insert and select modes. + +snipMateShow Default: Mode: Insert + Show all available snippets (that start with + the previous text, if it exists). Use in + insert mode. + +snipMateVisual Default: Mode: Visual + See |SnipMate-visual|. + +Additionally, is mapped in visual mode in .snippets files for retabbing +snippets. ============================================================================== -USAGE (GETTING STARTED QUICKLY) *snipMate-usage* +SYNTAX *snippet-syntax* *SnipMate-syntax* -Adding snippets: > - :SnipMateOpenSnippetFiles -< all valid snippet locations will be shown in a list. Existing files are - shown first. The list depends on Vim's |runtimepath|. Thus snipMate - perfectly integrates with the recommended way of installing each plugin into - its own directory which all newer plugin management solutions (VAM, - Pathogen, Vundle, ..) propagate. +SnipMate looks inside of each entry of 'rtp' (or |SnipMate-snippet-sources|) +for a directory named /snippets/. Based on the 'filetype' and 'syntax' +settings (taking into account the dotted syntax), the following files are read +for snippets: > - The command will only show non existing .snippets files. See |snipMate-syntax| - to learn about all supported files snipMate can read. + .../snippets/.snippets + .../snippets//.snippets + .../snippets//.snippet + .../snippets///.snippet - In .snippets files you should use \t as indentation character which will - be replaced by spaces/tabs depending on your Vim indentation settings. +where is an entry in 'filetype' or 'syntax', is an arbitrary +name, is the trigger for a snippet, and is +a description used for |SnipMate-multisnip|. - You can retab your snippet text by visually selecting it and pressing . +A .snippet file defines a single snippet with the trigger (and description) +determined by the filename. The entire contents of the file are used as the +snippet expansion text. -Using snippets: ~ +Multiple snippets can be defined in *.snippets files. Each snippet definition +looks something like: > - : shows a list of available snippets - XX : will either show a list of all snippets starting with the - characters XX or expand the snippet if it matches a snippet name. + snippet trigger optional description + guard left_from_cursor='^\s*' + expanded text + more expanded text -associating snippets and filetypes: ~ +< *SnipMate-multisnip* +The description is optional. If it is left out and a second snippet inside the +same .snippets file uses the same trigger, the second one will overwrite the +first. Otherwise multisnip is used. -1) > - g:snipMate.scope_aliases -< defines which snippets types are available when you edit a buffer. - You can override the default in autoload/snipMate.vim in your .vimrc. For - example, to add both ruby.snippets and ruby-rails.snippets for files of - filetype='ruby', add the following to your vimrc: > - let g:snipMate = {} - let g:snipMate.scope_aliases = {} - let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails' +The guard condition line is also optional. It can be used to make a snippet +available only in some cases. The value should be a VimL expression. -< SnipMate scopes are akin to filetypes. Setting a scope alias as shown above - allows multiple snippets files to be used for one filetype without actually - changing the filetype. +Note: Hard tabs in the expansion text are required. When the snippet is +expanded in the text and 'expandtab' is set, each tab will be replaced with +spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise. -2) - set filetype to a list such as 'html.javascript' or such. +Comments can be made in .snippets files by starting a line with a # character. +However these can't be used inside of snippet definitions: > - Add this to your .vimrc to not add tabs if there is no match: > - let g:snipMate['no_match_completion_feedkeys_chars'] = "" -< + # this is a correct comment + snippet trigger + expanded text + snippet another_trigger + # this isn't a comment! + expanded text - *snipMate-disambiguation* -What happens if multiple files or filetypes define the same snippet name or if -|multi_snip| is being used? This results in name collisions! -You'll get list of matching snippets and can choose one. +This should hopefully be clear with the included syntax highlighting. -Snippets are loaded and refreshed automatically on demand. -The parsed .snippets files are cached. + *snipMate-extends* +Borrowing from UltiSnips, .snippets files can also contain an extends +directive, for example: > -in the current buffer to show a list via. + extends html, javascript, css -============================================================================== -SNIPPET SOURCES *snipMate-snippet-sources* +will tell SnipMate to also read html, javascript, and css snippets. -snipMate is configurable. + *SnipMate-tabstops* +Tab stops~ -plugin/snipMate.vim assigns three important keys: -> - " default implementation collecting snippets by handlers - let g:snipMate['get_snippets'] = snipMate#GetSnippets - " default handler: - let g:snipMateSources['default'] = snipMate#DefaultPool - " default directories containing snippets: - let g:snipMate['snippet_dirs'] = funcref#Function('return split(&runtimepath,",")') -< -You can override all of those settings. +A tab stop, specified by ${#} where # is a number, tells SnipMate where to +position the cursor next. The special tab stop ${0} denotes the last cursor +position; in its absence, the cursor is placed at the end of the snippet. -You can see that the default set of snippets is determined by Vim's |rtp|. +For example, to place the cursor first on the id of a
tag, allow +the user to press to go to the middle of it, and finally end after +
: > -Example 1: ~ -autoload/snipMate_python_demo.vim shows how you can register additional -sources such as creating snippets on the fly representing python function -definitions found in the current file. + snippet div +
+ ${2} +
-Example 2: ~ -Add to your ~/.vimrc: For each know snippet add a second version ending in _ -adding folding markers -> - let g:commentChar = { - \ 'vim': '"', - \ 'c': '//', - \ 'cpp': '//', - \ 'sh': '#', - \ 'python': '#' - \} - " url https://github.com/garbas/vim-snipmate/issues/49 - fun! AddFolding(text) - return substitute(a:text,'\n'," ".g:commentChar[&ft]." {{{\n",1)."\n".g:commentChar[&ft]." }}}" - endf - - fun! SnippetsWithFolding(scopes, trigger, result) - " hacky: temporarely remove this function to prevent infinite recursion: - call remove(g:snipMateSources, 'with_folding') - " get list of snippets: - let result = snipMate#GetSnippets(a:scopes, substitute(a:trigger,'_\(\*\)\?$','\1','')) - let g:snipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding') - - " add folding: - for k in keys(result) - let a:result[k.'_'] = map(result[k],'AddFolding(v:val)') - endfor - endf - - " force setting default: - runtime plugin/snipMate.vim - " add our own source - let g:snipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding') -< - -More details about all possible relative locations to |rtp| can be found in -|snipMate-syntax| - -============================================================================== -SYNTAX *snippet-syntax* *snipMate-syntax* - -Default snippet sources [1], you can add your own as illustrated in -|snipMate-snippet-sources|. - -trigger: the snippet's name. -|rtp| : Vim's |runtimepath| path list - -one snippet per file: - |rtp|/snippets//.snippet - -many snippets per file, triggers are specified in file, see below: - |rtp|/snippets/.snippets (RECOMMENDED) - |rtp|/snippets//*.snippets - - -See |snipMate-disambiguation| to learn about how name collisions are handled. - -Note that dotted -'filetype' syntax is supported -- e.g., you can use > - - :set ft=html.eruby syntax=sql - -to activate snippets for both HTML, eRuby and sql for the current file. -See g:snipMate['get_scopes'] in plugin/snipMate.vim. However, this is not -recommended, as it can have unwanted side effects (appears to break some forms -of syntax highlighting). Instead, set g:snipMate.scope_aliases. -See|snipMate-usage|. - -The syntax for snippets in *.snippets files is the following: > - - snippet trigger - guard left_from_cursor='^\s*' - expanded text - more expanded text - -Note: the guard condition line is optional. It can be used to make a snippet available -only in some cases. the value should be a viml expression. -(This implementation may change). Only supported in *.snippets files by now. - -Multiple snippets having the same name but different triggers exist? - - -Note that the first hard tab after the snippet trigger is required, and not -expanded in the actual snippet. The syntax for *.snippet files is the same, -only without the trigger declaration and starting indentation. - -Also note that indentation within snippets must be defined using hard tabs. -They can be expanded to spaces later if desired (see |snipMate-indenting|). -You can retab a snippet by visually selecting the lines, then press . - -"#" is used as a line-comment character in *.snippets files; however, they can -only be used outside of a snippet declaration. E.g.: > - - # this is a correct comment - snippet trigger - expanded text - snippet another_trigger - # this isn't a comment! - expanded text -< -This should hopefully be obvious with the included syntax highlighting. - - *snipMate-${#}* -Tab stops ~ - -By default, the cursor is placed at the end of a snippet. To specify where the -cursor is to be placed next, use "${#}", where the # is the number of the tab -stop. E.g., to place the cursor first on the id of a
tag, and then allow -the user to press to go to the middle of it: - > - snippet div -
- ${2} -
-< - *snipMate-placeholders* *snipMate-${#:}* *snipMate-$#* -Placeholders ~ +< *SnipMate-placeholders* *SnipMate-mirrors* +Placeholders and Mirrors~ Placeholder text can be supplied using "${#:text}", where # is the number of the tab stop. This text then can be copied throughout the snippet using "$#", given # is the same number as used before. So, to make a C for loop: > - snippet for - for (${2:i}; $2 < ${1:count}; $1++) { - ${4} - } + snippet for + for (${2:i}; $2 < ${1:count}; $1++) { + ${4} + } This will cause "count" to first be selected and change if the user starts typing. When is pressed, the "i" in ${2}'s position will be selected; all $2 variables will default to "i" and automatically be updated if the user starts typing. -NOTE: "$#" syntax is used only for variables, not for tab stops as in TextMate. -Variables within variables are also possible. For instance: > +NOTE: "$#" syntax is used only for mirrors, not for tab stops as in TextMate. + +Mirrors can also be used inside of placeholders. For instance: > snippet opt - + Will, as usual, cause "option" to first be selected and update all the $1 variables if the user starts typing. Since one of these variables is inside of @@ -282,34 +276,33 @@ ${2}, this text will then be used as a placeholder for the next tab stop, allowing the user to change it if he wishes. To copy a value throughout a snippet without supplying default text, simply -use the "${#:}" construct without the text; e.g.: > +use the "${#:}" construct without the text, e.g.: > snippet foo - ${1:}bar$1 -< *snipMate-commands* + ${1:}bar$1 - - *snipMate-visual-selection-support* +< *SnipMate-visual* There is a special placeholder called {VISUAL}. If you visually select text, -then press Vim switches to insert mode. The next snippet you'll expand -will replace {VISUAL} by the text which was selected previously +then press Vim switches to insert mode. The next snippet you'll expand +will replace {VISUAL} by the text which was selected previously. -Interpolated Vim Script ~ + *SnipMate-eval* +Interpolated Vim Script~ Snippets can also contain Vim script commands that are executed (via |eval()|) when the snippet is inserted. Commands are given inside backticks (`...`); for TextMates's functionality, use the |system()| function. E.g.: > snippet date - `system("date +%Y-%m-%d")` + `system("date +%Y-%m-%d")` will insert the current date, assuming you are on a Unix system. Note that you can also (and should) use |strftime()| for this example. -Filename([{expr}] [, {defaultText}]) *snipMate-filename* *Filename()* +Filename([{expr}] [, {defaultText}]) *SnipMate-Filename()* Since the current filename is used often in snippets, a default function -has been defined for it in snipMate.vim, appropriately called Filename(). +has been defined for it in SnipMate.vim, appropriately called Filename(). With no arguments, the default filename without an extension is returned; the first argument specifies what to place before or after the filename, @@ -319,97 +312,88 @@ if you only want the filename to be returned, the first argument can be left blank. Examples: > snippet filename - `Filename()` + `Filename()` snippet filename_with_default - `Filename('', 'name')` + `Filename('', 'name')` snippet filename_foo - `filename('$1_foo')` + `Filename('$1_foo')` The first example returns the filename if it the file has been named, and an empty string if it hasn't. The second returns the filename if it's been named, and "name" if it hasn't. The third returns the filename followed by "_foo" if it has been named, and an empty string if it hasn't. - *multi_snip* -To specify that a snippet can have multiple matches in a *.snippets file, use -this syntax: > +============================================================================== +SNIPPET SOURCES *SnipMate-snippet-sources* - snippet trigger A description of snippet #1 - expand this text - snippet trigger A description of snippet #2 - expand THIS text! +SnipMate is configurable. -See |snipMate-disambiguation| +plugin/SnipMate.vim assigns three important keys: > + + " default implementation collecting snippets by handlers + let g:SnipMate['get_snippets'] = SnipMate#GetSnippets + " default handler: + let g:SnipMateSources['default'] = SnipMate#DefaultPool + " default directories containing snippets: + let g:SnipMate['snippet_dirs'] + \ = funcref#Function('return split(&runtimepath,",")') + +You can override all of those settings. + +You can see that the default set of snippets is determined by Vim's 'rtp'. + +Example 1:~ +autoload/SnipMate_python_demo.vim shows how you can register additional +sources such as creating snippets on the fly representing python function +definitions found in the current file. + +Example 2:~ +Add to your ~/.vimrc: For each know snippet add a second version ending in _ +adding folding markers > + + let g:commentChar = { + \ 'vim': '"', + \ 'c': '//', + \ 'cpp': '//', + \ 'sh': '#', + \ 'python': '#' + \ } + " url https://github.com/garbas/vim-snipmate/issues/49 + fun! AddFolding(text) + return substitute(a:text,'\n'," ".g:commentChar[&ft]." {{{\n",1)."\n".g:commentChar[&ft]." }}}" + endf + + fun! SnippetsWithFolding(scopes, trigger, result) + " hacky: temporarely remove this function to prevent infinite recursion: + call remove(g:SnipMateSources, 'with_folding') + " get list of snippets: + let result = SnipMate#GetSnippets(a:scopes, substitute(a:trigger,'_\(\*\)\?$','\1','')) + let g:SnipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding') + + " add folding: + for k in keys(result) + let a:result[k.'_'] = map(result[k],'AddFolding(v:val)') + endfor + endf + + " force setting default: + runtime plugin/SnipMate.vim + " add our own source + let g:SnipMateSources['with_folding'] = funcref#Function('SnippetsWithFolding') + +See |SnipMate-syntax| for more details about all possible relative locations +to 'rtp' can be found in. ============================================================================== -SETTINGS *snipMate-settings* *g:snips_author* +DISADVANTAGES *SnipMate-disadvantages* -The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set -to your name; it can then be used in snippets to automatically add it. E.g.: > - - let g:snips_author = 'Hubert Farnsworth' - snippet name - `g:snips_author` -< - *snipMate-expandtab* *snipMate-indenting* -If you would like your snippets to be expanded using spaces instead of tabs, -just enable 'expandtab' and set 'softtabstop' to your preferred amount of -spaces. If 'softtabstop' is not set, 'shiftwidth' is used instead. - - *snipMate-mappings* -The mappings snipMate uses can be customized with the |:map| commands. For -example, to change the key that triggers snippets and moves to the next -tabstop, > - - :imap snipMateNextOrTrigger - :smap snipMateNextOrTrigger -< -The list of possible mappings is as follows: - -snipMateNextOrTrigger Jumps to the next tab stop or, if none exists, - try to expand a snippet. Use in both insert - and select modes. - -snipMateBack Jump to the previous tab stop, if it exists. - Use in both insert and select modes. - -snipMateShow Show all available snippets (that start with - the previous text, if it exists). Use in - insert mode. - -snipMateVisual |snipMate-visual-selection-support| - -============================================================================== -FEATURES *snipMate-features* - -snipMate.vim has the following features among others: - - The syntax of snippets is very similar to TextMate's, allowing - easy conversion. - - The position of the snippet is kept transparently (i.e. it does not use - markers/placeholders written to the buffer), which allows you to escape - out of an incomplete snippet, something particularly useful in Vim. - - Variables in snippets are updated as-you-type. - - Snippets can have multiple matches. - - Snippets can be out of order. For instance, in a do...while loop, the - condition can be added before the code. - - [New] File-based snippets are supported. - - [New] Triggers after non-word delimiters are expanded, e.g. "foo" - in "bar.foo". - - [New] can now be used to jump tab stops in reverse order. - -============================================================================== -DISADVANTAGES *snipMate-disadvantages* - -snipMate.vim currently has the following disadvantages to TextMate's snippets: - - There is no $0; the order of tab stops must be explicitly stated. - - Placeholders within placeholders are not possible. E.g.: > - - '${3}
' -< - In TextMate this would first highlight ' id="some_id"', and if +SnipMate.vim currently has the following disadvantages to TextMate's snippets: + - Nested placeholders are not currently possible. E.g.: > + '${3}' +< In TextMate this would first highlight ' id="some_id"', and if you hit delete it would automatically skip ${2} and go to ${3} on the next , but if you didn't delete it it would highlight - "some_id" first. You cannot do this in snipMate.vim. + "some_id" first. You cannot do this in SnipMate.vim. - Regex cannot be performed on variables, such as "${1/.*/\U&}" - Placeholders cannot span multiple lines. - Activating snippets in different scopes of the same file is @@ -418,7 +402,7 @@ snipMate.vim currently has the following disadvantages to TextMate's snippets: Perhaps some of these features will be added in a later release. ============================================================================== -CHANGELOG *snipMate-changelog* +CHANGELOG *SnipMate-changelog* 0.85 - 2013-04-03 ----------------- @@ -432,7 +416,7 @@ CHANGELOG *snipMate-changelog* * Enable per-buffer expansion of snippets * Fix 'cpo' compatibility * Update supertab compatibility -* Enable customization of various things through g:snipMate +* Enable customization of various things through g:SnipMate * Disable spelling in snippet files * Highlight trigger names in .snippets files @@ -453,33 +437,24 @@ CHANGELOG *snipMate-changelog* ============================================================================== -CONTACT *snipMate-contact* *snipMate-author* +CONTACT *SnipMate-contact* *SnipMate-author* -current maintainers: - - Adnan Zafar - - garbas +SnipMate is currently maintained by: + - Rok Garbas - Marc Weber (marco-oweber@gmx.de) -You should consider creating a github ticket or contacting us because the -original author Michael Sanders did not act upon change requests for long -time. Anyway - he did most of the hard initial work. + - Adnan Zafar -To contact the author (Michael Sanders), please email: - msanders42+snipmate gmail com +For bug reports, issues, or questions, check out the Issues page on GitHub: +https://github.com/garbas/vim-snipmate/issues + +The original author, Michael Sanders, can be reached at: +msanders42+snipmate gmail com ============================================================================== -BUGS *snipMate-bugs* +LICENSE *SnipMate-license* - does not work: Try gvim. is mapped to ctrl-2 or such in -Vim - this is not a snipmate issue. - -[1]: I think having so many different ways is too complicated - - Marc Weber - -============================================================================== -LICENSE *snipMate-license* - -snipMate is released under the MIT license: +SnipMate is released under the MIT license: Copyright 2009-2010 Michael Sanders. All rights reserved. @@ -502,5 +477,4 @@ out of or in connection with the software or the use or other dealings in the software. ============================================================================== - -vim:tw=78:ts=8:ft=help:norl: + vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-snipmate/ftplugin/snippet.vim b/sources_non_forked/vim-snipmate/ftplugin/snippet.vim index bf09b424..242aa865 100644 --- a/sources_non_forked/vim-snipmate/ftplugin/snippet.vim +++ b/sources_non_forked/vim-snipmate/ftplugin/snippet.vim @@ -1,7 +1,7 @@ command! -buffer -range=% RetabSnip ,call snipMate#RetabSnip() vnoremap :RetabSnip -if !exists('g:nsippet_no_indentation_settings') +if !exists('g:snippet_no_indentation_settings') setlocal sw=4 setlocal tabstop=4 setlocal noexpandtab diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 0ae33584..a4531b02 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -1,6 +1,6 @@ " File: snipMate.vim " Author: Michael Sanders -" Version: 0.85 +" Version: 0.86 " Description: snipMate.vim implements some of TextMate's snippets features in " Vim. A snippet is a piece of often-typed text that you can " insert into your document using a trigger word followed by a "". @@ -21,7 +21,7 @@ set cpo&vim try call funcref#Function('') catch /.*/ - echoe "you're missing vim-addon-mw-utils. See install instructions at ".expand(':h:h').'/README.rst' + echoe "you're missing vim-addon-mw-utils. See install instructions at ".expand(':h:h').'/README.md' endtry if (!exists('g:snipMateSources')) @@ -38,11 +38,11 @@ au FileType snippets setl noet nospell fdm=expr fde=getline(v:lnum)!~'^\\t\\\\|^ inoremap snipMateNextOrTrigger =snipMate#TriggerSnippet() snoremap snipMateNextOrTrigger a=snipMate#TriggerSnippet() +inoremap snipMateTrigger =snipMate#TriggerSnippet(1) inoremap snipMateBack =snipMate#BackwardsSnippet() snoremap snipMateBack a=snipMate#BackwardsSnippet() inoremap snipMateShow =snipMate#ShowAvailableSnips() -" FIXME: snipMateVisual pollutes register(s) -xnoremap snipMateVisual s:let g:snipmate_content_visual=getreg('1') +xnoremap snipMateVisual :call grab_visual()i " config which can be overridden (shared lines) if !exists('g:snipMate') @@ -56,30 +56,15 @@ let s:snipMate['get_snippets'] = get(s:snipMate, 'get_snippets', funcref#Functio " snippets. You can replace it with your own implementation. Defaults to all " directories in &rtp/snippets/* let s:snipMate['snippet_dirs'] = get(s:snipMate, 'snippet_dirs', funcref#Function('return split(&runtimepath,",")')) +if type(s:snipMate['snippet_dirs']) == type([]) + call map(s:snipMate['snippet_dirs'], 'expand(v:val)') +endif " _ is default scope added always " " &ft honors multiple filetypes and syntax such as in set ft=html.javascript syntax=FOO let s:snipMate['get_scopes'] = get(s:snipMate, 'get_scopes', funcref#Function('return split(&ft,"\\.")+[&syntax, "_"]')) -if !exists('snippets_dir') - let snippets_dir = substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g') -endif - -" Processes a single-snippet file; optionally add the name of the parent -" directory for a snippet with multiple matches. -fun! s:ProcessFile(file, ft, ...) - let keyword = fnamemodify(a:file, ':t:r') - if keyword == '' | return | endif - try - let text = join(readfile(a:file), "\n") - catch /E484/ - echom "Error in snipMate.vim: couldn't read file: ".a:file - endtry - return a:0 ? MakeSnip(a:ft, a:1, text, keyword) - \ : MakeSnip(a:ft, keyword, text) -endf - " dummy for compatibility - will be removed " moving to autoload to improve loading speed and debugging fun! TriggerSnippet() @@ -91,6 +76,18 @@ fun! BackwardSnippet() return snipMate#BackwardsSnippet() endf +" Modified from Luc Hermitte's function on StackOverflow +" +function! s:grab_visual() + let a_save = @a + try + normal! gv"ad + let b:snipmate_content_visual = @a + finally + let @a = a_save + endtry +endfunction + " restore 'cpo' let &cpo = s:save_cpo diff --git a/sources_non_forked/vim-snipmate/syntax/snippets.vim b/sources_non_forked/vim-snipmate/syntax/snippets.vim index 169802f0..f9859cf0 100644 --- a/sources_non_forked/vim-snipmate/syntax/snippets.vim +++ b/sources_non_forked/vim-snipmate/syntax/snippets.vim @@ -6,17 +6,17 @@ syn match tabStop '\$\d\+' syn match snipEscape '\\\\\|\\`' syn match snipCommand '\%(\\\@ +${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> ${0:# body...} endsnippet -snippet bfun "Function (bound)" b -${1:(${2:args}) }=> - ${0:# body...} +snippet bfun "Function (bound)" i +`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr} endsnippet -snippet if "If" b +snippet if "If" if ${1:condition} ${0:# body...} endsnippet -snippet ife "If .. Else" b +snippet ife "If .. Else" if ${1:condition} ${2:# body...} else ${3:# body...} endsnippet -snippet elif "Else if" b +snippet eif "Else if" b else if ${1:condition} ${0:# body...} endsnippet -snippet ifte "Ternary if" b +snippet ifte "Ternary if" if ${1:condition} then ${2:value} else ${3:other} endsnippet -snippet unl "Unless" b +snippet unl "Unless" ${1:action} unless ${2:condition} endsnippet -snippet fora "Array Comprehension" b +snippet fora "Array Comprehension" for ${1:name} in ${2:array} ${0:# body...} endsnippet -snippet foro "Object Comprehension" b +snippet foro "Object Comprehension" for ${1:key}, ${2:value} of ${3:Object} ${0:# body...} endsnippet -snippet forr "Range Comprehension (inclusive)" b -for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}} +snippet forr "Range Comprehension (inclusive)" +for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet -snippet forrex "Range Comprehension (exclusive)" b -for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}} +snippet forrex "Range Comprehension (exclusive)" +for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet -snippet swi "Switch" b +snippet swi "Switch" switch ${1:object} when ${2:value} - ${0:# body...} + ${3:# body...} + else + $0 +endsnippet + +snippet swit "Switch when .. then" +switch ${1:object} + when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} + else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} endsnippet snippet cla "Class" b -class ${1:ClassName}${2: extends ${3:Ancestor}} +class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor} - ${4:constructor: (${5:args}) -> - ${6:# body...}} - $7 + ${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` -> + ${5:# body...}} + $0 endsnippet -snippet try "Try .. Catch" b +snippet try "Try .. Catch" try $1 catch ${2:error} @@ -80,7 +88,7 @@ snippet req "Require" b ${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'}) endsnippet -snippet # "Interpolated Code" +snippet # "Interpolated Code" i #{$1}$0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/d.snippets b/sources_non_forked/vim-snippets/UltiSnips/d.snippets index 8ed9b417..7f38c6d8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/d.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/d.snippets @@ -126,7 +126,7 @@ else } endsnippet -snippet elif "else if (elif)" b +snippet eif "else if (elif)" b else if(${1:/*condition*/}) { ${VISUAL}${0:/*code*/} @@ -576,7 +576,7 @@ snippet module "New module (module)" b // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -module ${2}.`!v Filename('$1', 'name')`; +module ${2}.`!v vim_snippets#Filename('$1', 'name')`; ${3} diff --git a/sources_non_forked/vim-snippets/UltiSnips/django.snippets b/sources_non_forked/vim-snippets/UltiSnips/django.snippets index 59b77c57..553babab 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/django.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/django.snippets @@ -76,7 +76,7 @@ snippet if {% endif %} endsnippet -snippet else +snippet el {% else %} ${1} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets b/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets new file mode 100644 index 00000000..ae7ea201 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets @@ -0,0 +1,168 @@ +# Credit: @iurifg + +snippet do +do + ${1} +end +endsnippet + +snippet if "if .. do .. end" +if ${1:condition} do + ${2:expression} +end +endsnippet + +snippet if "if .. do: .." +if ${1:condition}, do: ${2:expression} +endsnippet + +snippet ife "if .. do .. else .. end" +if ${1:condition} do + ${2:expression} +else + ${3:expression} +end +endsnippet + +snippet ife "if .. do: .. else:" +if ${1:condition}, do: ${2}, else: ${3} +endsnippet + +snippet unless "unless .. do .. end" +unless ${1} do + ${2} +end +endsnippet + +snippet unless "unless .. do: .." +unless ${1:condition}, do: ${2} +endsnippet + +snippet unlesse "unless .. do .. else .. end" +unless ${1:condition} do + ${2} +else + ${3} +end +endsnippet + +snippet unlesse "unless .. do: .. else:" +unless ${1:condition}, do: ${2}, else: ${3} +endsnippet + +snippet cond +"cond do" +${1} -> + ${2} +end +endsnippet + +snippet case +case ${1} do +${2} -> + ${3} +end +endsnippet + +snippet def +def ${1:name} do + ${2} +end +endsnippet + +snippet defin "def function(n), do: n" +def ${1:name}, do: ${2} +endsnippet + +snippet defg +def ${1:name} when ${2:guard-condition} do + ${3} +end +endsnippet + +snippet defim +defimpl ${1:protocol_name}, for: ${2:data_type} do + ${3} +end +endsnippet + +snippet defma +defmacro ${1:name} do + ${2} +end +endsnippet + +snippet defmo +defmodule ${1:module_name} do + ${2} +end +endsnippet + +snippet defp +defp ${1:name} do + ${2} +end +endsnippet + +snippet defpr +defprotocol ${1:name}, [${2:function}] +endsnippet + +snippet defr +defrecord ${1:record_name}, ${2:fields} +endsnippet + +snippet doc +@doc """ +${1} +""" +endsnippet + +snippet fn +fn(${1:args}) -> ${2} end +endsnippet + +snippet fun +function do + ${1} +end +endsnippet + +snippet mdoc +@moduledoc """ +${1} +""" +endsnippet + +snippet rec +receive do +${1} -> + ${2} +end +endsnippet + +snippet req +require ${1:module_name} +endsnippet + +snippet imp +import ${1:module_name} +endsnippet + +snippet ali "alias old-module to shorthand" +alias ${1:module_name} +endsnippet + +snippet test +test "${1:test_name}" do + ${2} +end +endsnippet + +snippet try "try .. rescue .. end" +try do + ${1} +rescue + ${2} -> ${3} +end +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets index c6b201ea..88f71791 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets @@ -263,7 +263,7 @@ snippet st "submit_tag" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet -snippet else "else (ERB)" +snippet el "else (ERB)" <% else %> endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets index eb7b2c62..99f947f8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets @@ -1,13 +1,13 @@ -snippet if "if ... then ... else ..." +snippet ife "if ... then ... else ..." if ${1:condition} then ${2:expression} else ${3:expression} endsnippet snippet case "case ... of ..." -case ${1:expression} of - ${2:pattern} -> ${3:expression} - ${4:pattern} -> ${5:expression} +case ${1} of + ${2} -> ${3} + ${4} -> ${5} endsnippet snippet :: "Type signature" diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index bb074789..fd11d70b 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -281,16 +281,16 @@ snippet html5 "HTML5 Template" - ${1} - + ${1} + -
- ${2} -
-
- ${4} -
+
+ ${2} +
+
+ ${4} +
endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets new file mode 100644 index 00000000..1f77ad7b --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets @@ -0,0 +1,31 @@ +# more can be found in snippets/html_minimal.snippets +# these UltiSnips override snippets because nested placeholders are being used + +snippet id +id="${1}"${2} +endsnippet + +snippet idn +id="${1}" name="${2:$1}" +endsnippet + +snippet label_and_input + +${8} +endsnippet + +snippet input +${7} +endsnippet + +snippet textarea + +endsnippet + +snippet img + $3 +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index 6e1b3ffe..617c1616 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -59,7 +59,7 @@ default: $0 endsnippet -snippet elif "else if" b +snippet eif "else if" b else if ($1)`!p nl(snip)`{ $0 } diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index e4e7f7ab..439ec874 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -27,39 +27,46 @@ endsnippet snippet proto "Prototype (proto)" ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{ - ${0:// body...} -}; + ${0} +} endsnippet snippet for "for (...) {...} (faster)" for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){ ${3:$1[$2]}$0 -}; +} endsnippet snippet for "for (...) {...}" for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) { ${3:$1[$2]}$0 -}; +} endsnippet snippet fun "function (fun)" function ${1:function_name} (${2:argument}) { - ${0:// body...} + ${0} } endsnippet +# for one line if .. else you usually use a ? b : c snippet ife "if ___ else" -if (${1:true}) {$0} else{}; +if (${1}) { + ${2} +} else { + ${3} +} endsnippet snippet if "if" -if (${1:true}) {$0}; +if (${1}) { + ${2} +} endsnippet snippet timeout "setTimeout function" -setTimeout(function() {$0}${2:}, ${1:10}); +setTimeout(function() {$0}${2:}, ${1:10}) endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets new file mode 100644 index 00000000..543a26ad --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets @@ -0,0 +1,88 @@ +################################################################### +# Ember snippets # +################################################################### + +# Application +snippet eapp "App.Name = Ember.Application.create({});" +${1:App.Name} = Ember.Application.create({}); +endsnippet + +# Models +snippet emod "App.ModelName = Ember.Model.extend({...});" +${1:model_name} = Ember.Model.extend({ + ${0://Properties here...} +}); +endsnippet + +# View +snippet eview "App.ViewName = Ember.Model.extend({...});" +${1:view_name} = Ember.View.extend({ + ${0://Properties here...} +}); +endsnippet + +# Controller +snippet econtroller "App.ControllerName = Ember.Model.extend({...});" +${1:controller_name} = Ember.ObjectController.extend({ + ${0://Properties here...} +}); +endsnippet + +# Route +snippet eroute "App.RouteName = Ember.Route.extend({...});" +${1:route_name} = Ember.Route.extend({ + ${0://Properties here...} +}); +endsnippet + +snippet eview "App.ViewName = Ember.Model.create({...});" +${1:view_name} = Ember.View.create({ + ${0://Properties here...} +}); +endsnippet + +# Object +snippet eobj "App.ObjectName = Ember.Object.extend({...});" +${1:object_name} = Ember.Object.create({ + ${0://Properties here...} +}); +endsnippet + +# Mixin +snippet emix "App.MixinName = Ember.Model.extend({...});" +${1:view_name} = Ember.Mixin.create({ + ${0://Properties here...} +}); +endsnippet + +# Ember getter and setter +snippet eget "this.get('property');" +${1:this}.get('${2:property}'); +endsnippet + +snippet eset "this.set('property', value);" +${1:this}.set('${2:property}', ${3:value}); +endsnippet + +# Computer properties +snippet cpro "property_name: function() {...}.property()," +${1:property_name}: function() { + ${0://body...} +}.property('${3:argumenet}'), +endsnippet + +snippet cpro ": function() {...}.property('property')," +${1:property_name}: function() { + ${0://body...} +}.property(), +endsnippet + + +# Observes +snippet proo "property_name: function() {...}.property()" +${1:property_name}: function() { + ${0://body...} +}.observes('${3:property}'), +endsnippet + +# vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets index 8aefef3a..157eb91a 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets @@ -4,17 +4,17 @@ endsnippet snippet open "open" let open ${1:module} in -${2:e} +${2} endsnippet snippet try "try" -try ${1:e} +try ${1} with ${2:Not_found} -> ${3:()} endsnippet snippet ref "ref" -let ${1:name} = ref ${2:val} in -${3:e} +let ${1} = ref ${2} in +${3} endsnippet snippet matchl "pattern match on a list" @@ -24,88 +24,83 @@ match ${1:list} with endsnippet snippet matcho "pattern match on an option type" -match ${1:x} with -| Some(${2:y}) -> ${3:()} +match ${1} with +| Some(${2}) -> ${3:()} | None -> ${4:()} endsnippet snippet fun "anonymous function" -(fun ${1:x} -> ${2:x}) +(fun ${1} -> ${2}) endsnippet snippet cc "commment" -(* ${1:comment} *) +(* ${1} *) endsnippet snippet let "let .. in binding" -let ${1:x} = ${2:v} in -${3:e} +let ${1} = ${2} in +${3} endsnippet snippet lr "let rec" -let rec ${1:f} = - ${2:expr} +let rec ${1} = + ${2} endsnippet -snippet if "if" -if ${1:(* condition *)} then - ${2:(* A *)} +snippet ife "if" +if ${1} then + ${2} else - ${3:(* B *)} + ${3} endsnippet -snippet If "If" -if ${1:(* condition *)} then - ${2:(* A *)} +snippet if "If" +if ${1} then + ${2} endsnippet -snippet while "while" -while ${1:(* condition *)} do - ${2:(* A *)} +snippet wh "while" +while ${1} do + ${2} done endsnippet snippet for "for" for ${1:i} = ${2:1} to ${3:10} do - ${4:(* BODY *)} + ${4} done endsnippet snippet match "match" -match ${1:(* e1 *)} with -| ${2:p} -> ${3:e2} -endsnippet - -snippet Match "match" -match ${1:(* e1 *)} with -| ${2:p} -> ${3:e2} +match ${1} with +| ${2} -> ${3} endsnippet snippet class "class" class ${1:name} = object - ${2:methods} + ${2} end endsnippet snippet obj "obj" object - ${2:methods} + ${2} end endsnippet snippet Obj "object" object (self) - ${2:methods} + ${2} end endsnippet snippet {{ "object functional update" -{< ${1:x} = ${2:y} >} +{< ${1} = ${2} >} endsnippet snippet beg "beg" begin - ${1:block} + ${1}${VISUAL} end endsnippet @@ -115,19 +110,19 @@ endsnippet snippet mod "module - no signature" module ${1:(* Name *)} = struct - ${2:(* BODY *)} + ${2} end endsnippet snippet Mod "module with signature" module ${1:(* Name *)} : ${2:(* SIG *)} = struct - ${3:(* BODY *)} + ${3} end endsnippet snippet sig "anonymous signature" sig - ${2:(* BODY *)} + ${2} end endsnippet @@ -137,32 +132,32 @@ endsnippet snippet func "define functor - no signature" module ${1:M} (${2:Arg} : ${3:ARG}) = struct - ${4:(* BODY *)} + ${4} end endsnippet snippet Func "define functor - with signature" module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct - ${5:(* BODY *)} + ${5} end endsnippet snippet mot "Declare module signature" module type ${1:(* Name *)} = sig - ${2:(* BODY *)} + ${2} end endsnippet snippet module "Module with anonymous signature" module ${1:(* Name *)} : sig - ${2:(* SIGNATURE *)} + ${2} end = struct - ${3:(* BODY *)} + ${3} end endsnippet snippet oo "odoc" -(** ${1:odoc} *) +(** ${1} *) endsnippet snippet qt "inline qtest" diff --git a/sources_non_forked/vim-snippets/UltiSnips/perl.snippets b/sources_non_forked/vim-snippets/UltiSnips/perl.snippets index 6a9e8f9d..e183b115 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/perl.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/perl.snippets @@ -117,7 +117,7 @@ unless ($1) { endsnippet -snippet while "while" +snippet wh "while" while ($1) { ${2:# body...} } diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index 40461d29..b7d01670 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -1,258 +1,108 @@ -## Snippets from SnipMate, taken from -## https://github.com/scrooloose/snipmate-snippets.git +snippet ${3});${4} endsnippet -snippet def "def" -define('${1}'${2});${3} +snippet vdd "php var_dump and die" +var_dump(${1}); die(); endsnippet -snippet do "do" -do { - ${2:// code... } -} while (${1:/* condition */});" +snippet ns "php namespace" b +namespace ${1:`!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`}; + endsnippet -snippet doc_f "doc_f" +snippet nc "php namespace and class or interface" b +namespace ${1:`!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`}; + /** - * $2 - * @return ${4:void} - * @author ${5:`!v g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{${6} + * ${3:@author `whoami`}${4} + */ +`!p +m = re.search(r'Abstract', path) +if m: + snip.rv = 'abstract ' +``!p +if re.search(r'Interface', path): + snip.rv = 'interface' +elif re.search(r'Trait', path): + snip.rv = 'trait' +else: + snip.rv = 'class' +` ${2:`!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +`} +{ } endsnippet -snippet doc_i "doc_i" +snippet st "php static function" b +${1:public} static function $2($3) +{ + ${4} +} +endsnippet + +snippet __ "php constructor" b +${1:public} function __construct($2) +{ + ${3} +} +endsnippet + +snippet sg "Setter and Getter" b /** - * $1 - * @package ${2:default} - * @author ${3:`!v g:snips_author`} - **/ -interface ${1:someClass} -{${4} -} // END interface $1" -endsnippet - -snippet else "else" -else { - ${1:// code...} -} -endsnippet - -snippet for "for" -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} -} -endsnippet - -snippet foreachk "foreachk" -foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4:// code...} -} -endsnippet - -snippet get "get" -$_GET['${1}']${2} -endsnippet - -snippet if "if" -if (${1:/* condition */}) { - ${2:// code...} -} -endsnippet - -snippet inc "inc" -include '${1:file}';${2} -endsnippet - -snippet log "log" -error_log(var_export(${1}, true));${2} -endsnippet - -snippet post "post" -$_POST['${1}']${2} -endsnippet - -snippet req1 "req1" -require_once '${1:file}';${2} -endsnippet - -snippet session "session" -$_SESSION['${1}']${2} -endsnippet - -snippet t "t" -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} -endsnippet - -snippet var "var" -var_export(${1});${2} -endsnippet - -snippet getter "PHP Class Getter" !b -/* - * Getter for $1 + * @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`} + * + * ${4} */ -public function get${1/\w+\s*/\u$0/}() +${1:protected} $${2}; + +public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p +if re.match(r'^(\\|[A-Z]).*', t[3]): + snip.rv = t[3] + ' ' +else: + snip.rv = '' +`$$2) { - return $this->$1;$2 -} -$4 -endsnippet + $this->$2 = $$2; -snippet setter "PHP Class Setter" !b -/* - * Setter for $1 - */ -public function set${1/\w+\s*/\u$0/}($$1) + return $this; +} + +public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`() { - $this->$1 = $$1;$3 - ${4:return $this;} + return $this->$2; } -$0 endsnippet -snippet gs "PHP Class Getter Setter" !b -protected $$1 - -/* - * Getter for $1 - */ -public function get${1/\w+\s*/\u$0/}() -{ - return $this->$1;$2 +snippet if "php if" !b +if (${1}) { + ${2} } - -/* - * Setter for $1 - */ -public function set${1/\w+\s*/\u$0/}($$1) -{ - $this->$1 = $$1;$3 - ${4:return $this;} -} -$0 endsnippet -snippet pub "Public function" !b -public function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pro "Protected function" !b -protected function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pri "Private function" !b -private function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pubs "Public static function" !b -public static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pros "Protected static function" !b -protected static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pris "Private static function" !b -private static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet fu "Function snip" !b -function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet -# :vim:ft=snippets - -snippet fore "Foreach loop" -foreach ($${1:variable} as $${3:value}){ - ${VISUAL}${4} -} -$0 -endsnippet - -snippet new "New class instance" !b -$$1 = new $1($2); -$0 -endsnippet - - -snippet ife "if else" -if (${1:/* condition */}) { - ${2:// code...} +snippet ife "php ife" !b +if (${1}) { + ${2} } else { - ${3:// code...} + } -$0 endsnippet - -snippet class "Class declaration template" !b +snippet /** "php comment block" b /** - * Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`} - * @author $2 + * @${1} */ -class $1 -{ - public function ${3:__construct}(${4:$options}) - { - ${4:// code} - } -} -$0 endsnippet - -snippet pr "Dumb debug helper in HTML" -echo '
' . var_export($1, 1) . '
';$0 -endsnippet - -snippet pc "Dumb debug helper in cli" -var_export($1);$0 -endsnippet - -# Symfony 2 based snippets -snippet sfa "Symfony 2 Controller action" -/** -* @Route("/${1:route_name}", name="$1") -* @Template() -*/ -public function $1Action($2) -{ - $3 - return ${4:array();}$0 -} -endsnippet - -# :vim:ft=snippets: - diff --git a/sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets b/sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets new file mode 100644 index 00000000..6609f3fa --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets @@ -0,0 +1,30 @@ +# sugguestion? report bugs? +# please go to https://github.com/chrisyue/vim-snippets/issues +snippet test "phpunit test class" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +/** + * @author `whoami` + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends \PHPUnit_Framework_TestCase +{ + public function test${1}() + { + ${2} + } +} +endsnippet + +snippet exp "phpunit expects" i +expects($this->${1:once}()) + ->method('${2}') + ->with($this->equalTo(${3})${4}) + ->will($this->returnValue(${5})); +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets b/sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets new file mode 100644 index 00000000..b5ff0ee3 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets @@ -0,0 +1,237 @@ +# sugguestion? report bugs? +# go to https://github.com/chrisyue/vim-snippets/issues + +snippet contr "symfony2 controller" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; + +/** + * ${1:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends Controller +{ +} +endsnippet + +snippet act "symfony2 action" b +/** + * @Route("${3}", name="${4}") + * @Method({${5:"POST"}}) + */ +public function ${1}Action(${2}) +{ + ${6} + return $this->redirect($this->generateUrl('home', [], false)); +} +endsnippet + +snippet actt "symfony2 action and template" b +/** + * @Route("${3}", name="${4}") + * @Method({${5:"GET"}}) + * @Template() + */ +public function ${1}Action(${2}) +{ + ${6} + return []; +}`!p +abspath = os.path.abspath(path)` +endsnippet + +snippet comm "symfony2 command" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * ${3:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends ContainerAwareCommand +{ + protected function configure() + { + $this + ->setName('${1}') + ->setDescription('${2}') + ->setDefinition([ + new InputArgument('', InputArgument::REQUIRED, ''), + new InputOption('', null, InputOption::VALUE_NONE, ''), + ]) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + } +} +endsnippet + +snippet subs "symfony2 subscriber" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +/** + * ${1:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` implements EventSubscriberInterface +{ + public function __construct() + { + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return []; + } +} +endsnippet + +snippet transf "symfony2 form data transformer" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * ${3:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` implements DataTransformerInterface +{ + /** + * {@inheritDoc} + */ + public function transform(${1}) + { + } + + /** + * {@inheritDoc} + */ + public function reverseTransform(${2}) + { + } +} +endsnippet + +snippet ent "symfony2 doctrine entity" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Doctrine\ORM\Mapping as ORM; + +/** + * ${3:@author `whoami`} + * + * @ORM\Entity() + * @ORM\Table(name="`!p +tmp = re.match(r'.*(?=\.)', fn).group() +tmp = re.sub(r'\B([A-Z])', r'_\1', tmp) +snip.rv = tmp.lower() +`") + */ +`!p +m = re.search(r'Abstract', path) +if m: + snip.rv = 'abstract ' +`class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` +{ + /** + * @ORM\Column(type="integer") + * @ORM\GeneratedValue + * @ORM\Id + */ + private $id; +} +endsnippet + +snippet form "symfony2 form type" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; + +/** + * ${2:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends AbstractType +{ + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + } + + /** + * {@inheritDoc} + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return '${1}'; + } +} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets index 71745101..88e0caaf 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets @@ -1,61 +1,314 @@ - +# -*- coding: utf-8 -*- ########################################################################### # General Stuff # ########################################################################### +global !p +import vim +from os import path as ospath +from string import Template +import re +from collections import Counter + +#http://docutils.sourceforge.net/docs/ref/rst/roles.html +TEXT_ROLES = ['emphasis','literal','code','math', + 'pep-reference','rfc-reference', + 'strong','subscript','superscript', + 'title-reference','raw'] +TEXT_ROLES_REGEX = r'\.\.\srole::?\s(w+)' + +#http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions +SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", + "error", "hint", "important", "note", + "tip", "warning"] +#http://docutils.sourceforge.net/docs/ref/rst/directives.html +DIRECTIVES = ['topic','sidebar','math','epigraph', + 'parsed-literal','code','highlights', + 'pull-quote','compound','container', + 'list-table','class','sectnum', + 'role','default-role','unicode', + 'raw'] + +NONE_CONTENT_DIRECTIVES = ['rubric', 'contents', 'header', + 'footer', 'date', 'include', 'title'] + +INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include'] +# CJK chars +# http://stackoverflow.com/questions/2718196/find-all-chinese-text-in-a-string-using-python-and-regex +CJK_RE = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE) + + +def has_cjk(char): + """ + Detect char contains CJK character + + :param char: characters needs to be detect + """ + try: + CJK_RE.finditer(char).next() + except StopIteration: + return False + else: + return True + +def real_filename(filename): + """peal extension name off if possible + # i.e. "foo.bar.png will return "foo.bar" + """ + return ospath.splitext(filename)[0] + +def check_file_exist(rst_path, relative_path): + """ + For RST file, it can just include files as relative path. + + :param rst_path: absolute path to rst file + :param relative_path: path related to rst file + :return: relative file's absolute path if file exist + """ + abs_path = ospath.join(ospath.dirname(rst_path), relative_path) + if ospath.isfile(abs_path): + return abs_path + + +def rst_char_len(char): + """ + return len of string which fit in rst + For instance:chinese "我" decode as only one character, + However, the rst interpreter needs 2 "=" instead of 1. + + :param: char needs to be count + """ + return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) + +def make_items(times, leading='+'): + """ + make lines with leading char multitimes + + :param: times, how many times you need + :param: leading, leading character + """ + times = int(times) + if leading == 1: + msg = "" + for x in xrange(1, times+1): + msg += "%s. Item\n" % x + return msg + else: + return ("%s Item\n" % leading) * times + + +def look_up_directives(regex, fpath): + """ + find all directive args in given file + :param: regex, the regex that needs to match + :param: path, to path to rst file + + :return: list, empty list if nothing match + """ + try: + with open(fpath) as source: + match = re.findall(regex, source.read()) + except IOError: + match = [] + return match + + +def get_popular_code_type(): + """ + find most popular code type in the given rst + + :param path: file to detect + + :return: string, most popular code type in file + """ + buf = "".join(vim.current.buffer) + types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf) + try: + popular_type = Counter(types).most_common()[0][0] + except IndexError: + popular_type = "lua" # Don't break default + return popular_type + + +def complete(t, opts): + """ + get options that start with t + + :param t: query string + :param opts: list that needs to be completed + + :return: a string that start with t + """ + msg = "({0})" + if t: + opts = [ m[len(t):] for m in opts if m.startswith(t) ] + if len(opts) == 1: + return opts[0] + + if not len(opts): + msg = "{0}" + return msg.format("|".join(opts)) + +endglobal + snippet part "Part" b -`!p snip.rv = len(t[1])*'#'` +`!p snip.rv = rst_char_len(t[1])*'#'` ${1:Part name} -`!p snip.rv = len(t[1])*'#'` +`!p snip.rv = rst_char_len(t[1])*'#'` $0 endsnippet snippet sec "Section" b ${1:Section name} -`!p snip.rv = len(t[1])*'='` +`!p snip.rv = rst_char_len(t[1])*'='` $0 endsnippet snippet ssec "Subsection" b ${1:Section name} -`!p snip.rv = len(t[1])*'-'` +`!p snip.rv = rst_char_len(t[1])*'-'` $0 endsnippet snippet sssec "Subsubsection" b ${1:Section name} -`!p snip.rv = len(t[1])*'^'` +`!p snip.rv = rst_char_len(t[1])*'^'` $0 endsnippet snippet chap "Chapter" b -`!p snip.rv = len(t[1])*'*'` +`!p snip.rv = rst_char_len(t[1])*'*'` ${1:Chapter name} -`!p snip.rv = len(t[1])*'*'` +`!p snip.rv = rst_char_len(t[1])*'*'` $0 endsnippet snippet para "Paragraph" b ${1:Paragraph name} -`!p snip.rv = len(t[1])*'"'` +`!p snip.rv = rst_char_len(t[1])*'"'` $0 endsnippet +snippet em "Emphasize string" i +`!p +# dirty but works with CJK charactor detection +if has_cjk(vim.current.line): + snip.rv ="\ "`*${1:${VISUAL:Em}}*`!p +if has_cjk(vim.current.line): + snip.rv ="\ " +else: + snip.rv = " " +`$0 +endsnippet + +snippet st "Strong string" i +`!p +if has_cjk(vim.current.line): + snip.rv ="\ "`**${1:${VISUAL:Strong}}**`!p +if has_cjk(vim.current.line): + snip.rv ="\ " +else: + snip.rv = " " +`$0 +endsnippet + +snippet "li(st)? (?P\d+)" "List" br +$0 +`!p +# usage: li 4 +# which will extand into a unordered list contains 4 items +snip.rv = make_items(match.groupdict()['num']) +` +endsnippet + +snippet "ol(st)? (?P\d+)" "Order List" br +$0 +`!p +# usage: ol 4 +# which will extand into a ordered list contains 4 items +snip.rv = make_items(match.groupdict()['num'], 1) +` +endsnippet ########################################################################### # More Specialized Stuff. # ########################################################################### snippet cb "Code Block" b -.. code-block:: ${1:lua} +.. code-block:: ${1:`!p snip.rv = get_popular_code_type()`} ${2:code} $0 endsnippet +# match snippets : +# img, inc, fig +snippet id "Includable Directives" b +`!p +real_name=real_filename(ospath.basename(t[2])) +di=t[1][:2] + +link="" +content="" + +if di == 'im': + link = "|{0}|".format(real_name) + +if di == 'fi': + content=""" + :alt: {0} + {0}""".format(real_name) +` +..`!p snip.rv = " %s" % link if link else ""` $1`!p snip.rv=complete(t[1], INCLUDABLE_DIRECTIVES)`:: ${2:file}`!p if content: + snip.rv +=" "+content` +`!p +# Tip of whether file is exist in comment type +if not check_file_exist(path, t[2]): + snip.rv='.. FILE {0} does not exist'.format(t[2]) +else: + snip.rv="" +`$0 +endsnippet + +snippet di "Directives" b +.. $1`!p snip.rv=complete(t[1], DIRECTIVES)`:: $2 + + ${3:Content} +$0 +endsnippet + +snippet nd "None Content Directives" b +.. $1`!p snip.rv=complete(t[1], NONE_CONTENT_DIRECTIVES)`:: $2 +$0 +endsnippet + +snippet sa "Specific Admonitions" b +.. $1`!p snip.rv =complete(t[1], SPECIFIC_ADMONITIONS)`:: + + ${2:Content} + +$0 +endsnippet + +#it will be trigger at start of line or after a word +snippet ro "Text Roles" w +\ :$1`!p snip.rv=complete(t[1], + TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX, + path))`:\`$2\`\ +endsnippet + +############ +# Sphinx # +############ + +snippet sid "SideBar" b +.. sidebar:: ${1:SideBar Title} + + ${2:SideBar Content} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets index 63365890..90001b1a 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets @@ -25,7 +25,7 @@ endsnippet snippet if "if ... end" if ${1:condition} - ${2:# TODO} + ${2} end endsnippet @@ -33,9 +33,9 @@ endsnippet snippet ife "if ... else ... end" if ${1:condition} - ${2:# TODO} + ${2} else - ${3:# TODO} + ${3} end endsnippet @@ -43,11 +43,11 @@ endsnippet snippet ifee "if ... elseif ... else ... end" if ${1:condition} - ${2:# TODO} + ${2} elsif ${3:condition} - ${4:# TODO} + ${4} else - ${0:# TODO} + ${0} end endsnippet @@ -55,7 +55,7 @@ endsnippet snippet unless "unless ... end" unless ${1:condition} - ${0:# TODO} + ${0} end endsnippet @@ -63,9 +63,9 @@ endsnippet snippet unlesse "unless ... else ... end" unless ${1:condition} - ${2:# TODO} + ${2} else - ${0:# TODO} + ${0} end endsnippet @@ -73,11 +73,11 @@ endsnippet snippet unlesee "unless ... elseif ... else ... end" unless ${1:condition} - ${2:# TODO} + ${2} elsif ${3:condition} - ${4:# TODO} + ${4} else - ${0:# TODO} + ${0} end endsnippet @@ -85,7 +85,7 @@ endsnippet snippet "\b(de)?f" "def ..." r def ${1:function_name}${2: ${3:*args}} - ${0:# TODO} + ${0} end endsnippet @@ -93,7 +93,7 @@ endsnippet snippet defi "def initialize ..." def initialize${1: ${2:*args}} - ${0:# TODO} + ${0} end endsnippet @@ -101,23 +101,23 @@ endsnippet snippet defr "def ... rescue ..." def ${1:function_name}${2: ${3:*args}} - ${4:# TODO} + ${4} rescue - ${0:# TODO} + ${0} end endsnippet snippet For "(..).each { || }" -(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} } +(${1:from}..${2:to}).each { |${3:i}| ${4} } endsnippet snippet for "(..).each do || end" (${1:from}..${2:to}).each do |${3:i}| - ${0:# TODO} + ${0} end endsnippet @@ -138,42 +138,42 @@ endsnippet snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |,| }" r -`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.del(ete)?_?if" ".delete_if do |,| end" r `!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Keep_?if" ".keep_if { |,| }" r -`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.keep_?if" ".keep_if do ,| end" r `!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Reject" ".reject { |,| }" r -`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.reject" ".reject do ,| end" r `!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet @@ -194,56 +194,56 @@ endsnippet snippet "(\S+)\.Sort" ".sort { |,| }" r -`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3} } endsnippet snippet "(\S+)\.sort" ".sort do |,| end" r `!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Each_?k(ey)?" ".each_key { || }" r -`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} } +`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2} } endsnippet snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| end" r `!p snip.rv=match.group(1)`.each_key do |${1:key}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Each_?val(ue)?" ".each_value { || }" r -`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} } +`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2} } endsnippet snippet "(\S+)\.each_?val(ue)?" ".each_value do || end" r `!p snip.rv=match.group(1)`.each_value do |${1:value}| - ${0:# TODO} + ${0} end endsnippet snippet Each ".each { || }" -${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} } +${1:elements}.each { |${2:${1/s$//}}| ${3} } endsnippet snippet each ".each do || end" ${1:elements}.each do |${2:${1/s$//}}| - ${0:# TODO} + ${0} end endsnippet @@ -251,14 +251,14 @@ endsnippet snippet each_?s(lice)? ".each_slice(n) do |slice| end" each_slice(${1:2}) do |${2:slice}| - ${0:# TODO} + ${0} end endsnippet snippet Each_?s(lice)? ".each_slice(n) { |slice| }" -each_slice(${1:2}) { |${2:slice}| ${3:# TODO} } +each_slice(${1:2}) { |${2:slice}| ${3} } endsnippet @@ -273,7 +273,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -288,7 +288,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -303,7 +303,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -318,7 +318,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -333,7 +333,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -348,7 +348,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -364,7 +364,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`},${2:i}| ${3:# TODO} }$0 +`},${2:i}| ${3} }$0 endsnippet @@ -379,7 +379,7 @@ try: except: snip.rv = 'element' `},${2:i}| - ${0:# TODO} + ${0} end endsnippet @@ -387,14 +387,14 @@ endsnippet snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r -`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.each_?p(air)?" ".each_pair do |,| end" r `!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet @@ -424,26 +424,24 @@ snippet "(\S+)\.Index" ".index do |item| ... end" r end endsnippet - - -snippet do "do || ... end" i -do ${1:|${2:key}|} - $0 -end -endsnippet - - - -snippet Do "do ... end" i +# comments about do and dov see snippets/ruby.snippets +snippet do "do ... end" i do $0 end endsnippet +snippet dov "do || ... end" i +do |${1:v}| + $2 +end +endsnippet + + snippet until "until ... end" until ${1:expression} - ${0:# TODO} + ${0} end endsnippet @@ -451,15 +449,15 @@ endsnippet snippet Until "begin ... end until " begin - ${0:# TODO} + ${0} end until ${1:expression} endsnippet -snippet while "while ... end" +snippet wh "while ... end" while ${1:expression} - ${0:# TODO} + ${0} end endsnippet @@ -467,7 +465,7 @@ endsnippet snippet While "begin ... end while " begin - ${0:# TODO} + ${0} end while ${1:expression} endsnippet @@ -493,9 +491,9 @@ endsnippet snippet begin "begin ... rescue ... end" begin - ${1:# TODO} + ${1} rescue - ${0:# TODO} + ${0} end endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets index 915c0df9..cce06ef3 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets @@ -79,7 +79,7 @@ until ${2:[[ ${1:condition} ]]}; do done endsnippet -snippet while "while ... (done)" +snippet wh "while ... (done)" while ${2:[[ ${1:condition} ]]}; do ${0:#statements} done diff --git a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets index 2cb1f347..fd53d265 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets @@ -16,14 +16,14 @@ foreach ${1:var} ${2:\$list} { endsnippet snippet if "if... (if)" b -if {${1:condition}} { +if {${1}} { ${2} } endsnippet snippet proc "proc... (proc)" b -proc ${1:name} {${2:args}} \ +proc ${1} {${2}} \ { ${3} } @@ -40,8 +40,8 @@ switch ${1:-exact} -- ${2:\$var} { endsnippet -snippet while "while... (while)" b -while {${1:condition}} { +snippet wh "while... (while)" b +while {${1}} { ${2} } diff --git a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets index f4c37f07..5655c4b1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets @@ -25,30 +25,30 @@ endsnippet snippet f fun ${1:function_name}(${2}) - ${3:" code} + ${3} endf endsnippet snippet for -for ${1:needle} in ${2:haystack} - ${3:" code} +for ${1} in ${2} + ${3} endfor endsnippet snippet wh -while ${1:condition} - ${2:" code} +while ${1} + ${2} endw endsnippet snippet if -if ${1:condition} - ${2:" code} +if ${1} + ${2} endif endsnippet snippet ife -if ${1:condition} +if ${1} ${2} else ${3} diff --git a/sources_non_forked/vim-snippets/autoload/vim_snippets.vim b/sources_non_forked/vim-snippets/autoload/vim_snippets.vim new file mode 100644 index 00000000..061f171e --- /dev/null +++ b/sources_non_forked/vim-snippets/autoload/vim_snippets.vim @@ -0,0 +1,27 @@ +" this is well known Filename found in snipmate (and the other engines), but +" rewritten and documented :) +" +" optional arg1: string in which to replace '$1' by filename with extension +" and path dropped. Defaults to $1 +" optional arg2: return this value if buffer has no filename +" But why not use the template in this case, too? +" Doesn't make sense to me +fun! vim_snippets#Filename(...) + let template = get(a:000, 0, "$1") + let arg2 = get(a:000, 1, "") + + let basename = expand('%:t:r') + + if basename == '' + return arg2 + else + return substitute(template, '$1', basename, 'g') + endif +endf + +" original code: +" fun! Filename(...) +" let filename = expand('%:t:r') +" if filename == '' | return a:0 == 2 ? a:2 : '' | endif +" return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g') +" endf diff --git a/sources_non_forked/vim-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets index c7297480..6a3d8b28 100644 --- a/sources_non_forked/vim-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -2,7 +2,7 @@ # (c) holds no legal value ;) snippet c) - Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2} + Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved. snippet date `strftime("%Y-%m-%d")` snippet ddate @@ -16,80 +16,80 @@ snippet lorem snippet GPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + 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 2 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 . - ${3} + ${0} snippet LGPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This library 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . - ${3} + ${0} snippet GPL3 ${1:one line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + 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 . - - ${3} + + ${0} snippet LGPL3 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This library 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . - ${3} + ${0} snippet BSD2 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -97,7 +97,7 @@ snippet BSD2 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -108,18 +108,18 @@ snippet BSD2 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The views and conclusions contained in the software and documentation + + + The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressedor implied, of $2. - ${4} + ${0} snippet BSD3 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -130,7 +130,7 @@ snippet BSD3 3. Neither the name of the ${3:organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -142,12 +142,12 @@ snippet BSD3 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${4} + ${0} snippet BSD4 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -161,7 +161,7 @@ snippet BSD4 4. Neither the name of the $3 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -173,21 +173,21 @@ snippet BSD4 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${4} + ${0} snippet MIT ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + 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 + 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. @@ -196,40 +196,40 @@ snippet MIT TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ${3} + ${0} snippet APACHE ${1:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${2:copyright holder} - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - ${3} -snippet BEERWARE + ${0} +snippet BEERWARE ${2:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${3:copyright holder} - + Licensed under the "THE BEER-WARE LICENSE" (Revision 42): ${1:`g:snips_author`} wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think - this stuff is worth it, you can buy me a beer or coffee in return + this stuff is worth it, you can buy me a beer or coffee in return - ${4} + ${0} snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 - Copyright `strftime("%Y")` ${1:copyright holder} + Copyright `strftime("%Y")` ${0:copyright holder} Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long diff --git a/sources_non_forked/vim-snippets/snippets/actionscript.snippets b/sources_non_forked/vim-snippets/snippets/actionscript.snippets index af9611c3..6b1d8ebe 100644 --- a/sources_non_forked/vim-snippets/snippets/actionscript.snippets +++ b/sources_non_forked/vim-snippets/snippets/actionscript.snippets @@ -2,25 +2,25 @@ snippet main package { import flash.display.*; import flash.Events.*; - + public class Main extends Sprite { public function Main ( ) { trace("start"); stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener(Event.RESIZE, resizeListener); } - + private function resizeListener (e:Event):void { trace("The application window changed size!"); trace("New width: " + stage.stageWidth); trace("New height: " + stage.stageHeight); } - + } - + } snippet class - ${1:public|internal} class ${2:name} ${3:extends } { + ${1:public|internal} class ${2:name} ${0:extends } { public function $2 ( ) { ("start"); } @@ -28,7 +28,7 @@ snippet class snippet all package name { - ${1:public|internal|final} class ${2:name} ${3:extends } { + ${1:public|internal|final} class ${2:name} ${0:extends } { private|public| static const FOO = "abc"; private|public| static var BAR = "abc"; @@ -55,48 +55,48 @@ snippet all snippet switch switch(${1}){ case ${2}: - ${3} + ${0} break; default: } snippet case case ${1}: - ${2} + ${0} break; snippet package package ${1:package}{ - ${2} + ${0} } snippet wh while ${1:cond}{ - ${2} + ${0} } snippet do do { - ${2} + ${0} } while (${1:cond}) -snippet while +snippet wh while ${1:cond}{ - ${2} + ${0} } snippet for enumerate names for (${1:var} in ${2:object}){ - ${3} + ${0} } snippet for enumerate values for each (${1:var} in ${2:object}){ - ${3} + ${0} } snippet get_set function get ${1:name} { return ${2} } function set $1 (newValue) { - ${3} + ${0} } snippet interface interface name { - function method(${1}):${2:returntype}; + function method(${1}):${0:returntype}; } snippet try try { @@ -104,34 +104,34 @@ snippet try } catch (error:ErrorType) { ${2} } finally { - ${3} + ${0} } # For Loop (same as c.snippet) snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${0} } # Custom For Loop snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} + ${0} } # If Condition snippet if if (${1:/* condition */}) { - ${2:/* code */} + ${0} } snippet el else { - ${1} + ${0} } # Ternary conditional snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} + ${1:/* condition */} ? ${2:a} : ${0:b} snippet fun function ${1:function_name}(${2})${3} { - ${4:/* code */} + ${0} } # FlxSprite (usefull when using the flixel library) snippet FlxSprite @@ -144,13 +144,13 @@ snippet FlxSprite public function $1(${3: X:Number, Y:Number}):void { super(X,Y); - ${4: //code...} + ${4} } override public function update():void { super.update(); - ${5: //code...} + ${0} } } } diff --git a/sources_non_forked/vim-snippets/snippets/apache.snippets b/sources_non_forked/vim-snippets/snippets/apache.snippets index a9e53e19..db3256e9 100644 --- a/sources_non_forked/vim-snippets/snippets/apache.snippets +++ b/sources_non_forked/vim-snippets/snippets/apache.snippets @@ -2,34 +2,34 @@ # snippet dir - DirectoryIndex ${2:index.html} + DirectoryIndex ${0:index.html} Order Deny,Allow Deny from All -# +# snippet filesmatch - ${2} + ${0} # snippet ifmodule - ${2} + ${0} # snippet limitexcept - ${2} + ${0} # snippet proxy - ${2} + ${0} # snippet virtualhost ServerAdmin ${3:webmaster@example.com} DocumentRoot ${4:/www/example.com} - ServerName ${5:www.example.com} + ServerName ${0:www.example.com} diff --git a/sources_non_forked/vim-snippets/snippets/autoit.snippets b/sources_non_forked/vim-snippets/snippets/autoit.snippets index 690018ce..f973fbc3 100644 --- a/sources_non_forked/vim-snippets/snippets/autoit.snippets +++ b/sources_non_forked/vim-snippets/snippets/autoit.snippets @@ -1,66 +1,66 @@ snippet if If ${1:condition} Then - ${2:; True code} + ${0:; True code} EndIf snippet el Else - ${1} -snippet elif + ${0} +snippet eif ElseIf ${1:condition} Then - ${2:; True code} + ${0:; True code} # If/Else block -snippet ifel +snippet ife If ${1:condition} Then ${2:; True code} Else - ${3:; Else code} + ${0:; Else code} EndIf -# If/ElseIf/Else block +# If/ElseIf/Else block - because there is eif this is not really neccessary snippet ifelif If ${1:condition 1} Then ${2:; True code} ElseIf ${3:condition 2} Then ${4:; True code} Else - ${5:; Else code} + ${0:; Else code} EndIf # Switch block snippet switch Switch (${1:condition}) - Case {$2:case1}: - {$3:; Case 1 code} + Case ${2:case1}: + ${3:; Case 1 code} Case Else: - {$4:; Else code} + ${0:; Else code} EndSwitch # Select block snippet select Select (${1:condition}) - Case {$2:case1}: - {$3:; Case 1 code} + Case ${2:case1}: + ${3:; Case 1 code} Case Else: - {$4:; Else code} + ${0:; Else code} EndSelect # While loop -snippet while +snippet wh While (${1:condition}) - ${2:; code...} + ${0:; code...} WEnd # For loop snippet for For ${1:n} = ${3:1} to ${2:count} - ${4:; code...} + ${0:; code...} Next # New Function snippet func Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${4:Return} + ${0:Return} EndFunc # Message box snippet msg - MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) + MsgBox(${0:MsgType}, ${1:"Title"}, ${2:"Message Text"}) # Debug Message snippet debug - MsgBox(0, "Debug", ${1:"Debug Message"}) + MsgBox(0, "Debug", ${0:"Debug Message"}) # Show Variable Debug Message snippet showvar - MsgBox(0, "${1:VarName}", $1) + MsgBox(0, "${0:VarName}", $1) diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index de6d6a93..96e19a0a 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -3,29 +3,29 @@ snippet main int main(int argc, const char *argv[]) { - ${1} + ${0} return 0; } # main(void) snippet mainn int main(void) { - ${1} + ${0} return 0; } ## -## Preprocessor +## Preprocessor # #include <...> snippet inc - #include <${1:stdio}.h>${2} + #include <${1:stdio}.h> # #include "..." snippet Inc - #include "${1:`Filename("$1.h")`}"${2} + #include "${1:`vim_snippets#Filename("$1.h")`}" # ifndef...define...endif snippet ndef #ifndef $1 #define ${1:SYMBOL} ${2:value} - #endif${3} + #endif # define snippet def #define @@ -33,19 +33,19 @@ snippet def snippet ifdef #ifdef ${1:FOO} ${2:#define } - #endif${3} + #endif # if snippet #if #if ${1:FOO} - ${2} + ${0} #endif # header include guard snippet once - #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} + #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} #define $1 - ${2} + ${0} #endif /* end of include guard: $1 */ ## @@ -53,18 +53,21 @@ snippet once # if snippet if if (${1:/* condition */}) { - ${2:/* code */} - }${3} + ${2} + } # else snippet el else { ${1} - }${2} + } # else if snippet elif else if (${1:/* condition */}) { - ${2:/* code */} - }${3} + ${2} + } +# ifi +snippet ifi + if (${1:/* condition */}) ${2}; # ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} @@ -76,80 +79,80 @@ snippet switch ${4:break;}${5} default: ${6} - }${7} + } # switch without default snippet switchndef switch (${1:/* variable */}) { case ${2:/* variable case */}: ${3} ${4:break;}${5} - }${6} + } # case snippet case case ${1:/* variable case */}: ${2} - ${3:break;}${4} + ${3:break;} ## ## Loops # for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} - }${5} + ${4} + } # for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} - }${6} + ${5} + } # while snippet wh while (${1:/* condition */}) { - ${2:/* code */} - }${3} + ${2} + } # do... while snippet do do { - ${2:/* code */} - } while (${1:/* condition */});${3} + ${2} + } while (${1:/* condition */}); ## ## Functions # function definition snippet fun ${1:void} ${2:function_name}(${3}) { - ${4:/* code */} - }${5} + ${4} + } # function declaration snippet fund - ${1:void} ${2:function_name}(${3});${4} + ${1:void} ${2:function_name}(${3}); ## ## Types # typedef snippet td - typedef ${1:int} ${2:MyCustomType};${3} + typedef ${1:int} ${2:MyCustomType}; # struct snippet st - struct ${1:`Filename('$1_t', 'name')`} { + struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { ${2:/* data */} - }${3: /* optional variable list */};${4} + }${3: /* optional variable list */}; # typedef struct snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} - } ${1:`Filename('$1_t', 'name')`};${4} + } ${1:`vim_snippets#Filename('$1_t', 'name')`}; # typedef enum snippet tde typedef enum { ${1:/* data */} - } ${2:foo};${3} + } ${2:foo}; ## ## Input/Output # printf snippet pr - printf("${1:%s}\n"${2});${3} + printf("${1:%s}\n"${2}); # fprintf (again, this isn't as nice as TextMate's version, but it works) snippet fpr - fprintf(${1:stderr}, "${2:%s}\n"${3});${4} + fprintf(${1:stderr}, "${2:%s}\n"${3}); # getopt snippet getopt int choice; @@ -204,14 +207,14 @@ snippet getopt { while ( optind < argc ) { - ${4} + ${0} } } ## ## Miscellaneous # This is kind of convenient snippet . - [${1}]${2} + [${1}] # GPL snippet gpl /* @@ -230,5 +233,5 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - - ${2} + + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/chef.snippets b/sources_non_forked/vim-snippets/snippets/chef.snippets index 51036135..429146ad 100644 --- a/sources_non_forked/vim-snippets/snippets/chef.snippets +++ b/sources_non_forked/vim-snippets/snippets/chef.snippets @@ -17,7 +17,7 @@ snippet cookbook_file ${14:#}${15: action :create} # Create this file (Default) ${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet - ${18:#}${19: action :delete} # Delete this file + ${18:#}${0: action :delete} # Delete this file end snippet execute @@ -34,7 +34,7 @@ snippet execute ${18:#}umask ${19:nil} # Umask for files created by the command ${20:#}${21:action :run} # Run this command (Default) - ${22:#}${23:action :nothing} # Do not run this command + ${22:#}${0:action :nothing} # Do not run this command end snippet link @@ -46,7 +46,7 @@ snippet link ${8:#}group ${9} # The group of the symlink ${10:#}${11:action :create} # Create a link (Default) - ${12:#}${13:action :delete} # Delete a link + ${12:#}${0:action :delete} # Delete a link end snippet package @@ -61,7 +61,7 @@ snippet package ${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default) ${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version ${16:#}${17:action :remove} # Remove a package - ${18:#}${19:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself) + ${18:#}${0:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself) end snippet service @@ -83,7 +83,7 @@ snippet service ${26:#}${27:action :start} # Start this service ${28:#}${29:action :stop} # Stop this service ${30:#}${31:action :restart} # Restart this service - ${32:#}${33:action :reload} # Reload the configuration for this service + ${32:#}${0:action :reload} # Reload the configuration for this service end snippet file @@ -97,7 +97,7 @@ snippet file ${12:#}${13:action :create} # Create this file (Default) ${14:#}${15:action :delete} # Delete this file - ${16:#}${17:action :touch} # Touch this file (update the mtime/atime) + ${16:#}${0:action :touch} # Touch this file (update the mtime/atime) end snippet directory @@ -109,7 +109,7 @@ snippet directory ${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p) ${12:#}${13:action :create} # Create this directory (Default) - ${14:#}${15:action :delete} # Delete this directory + ${14:#}${0:action :delete} # Delete this directory end snippet template @@ -127,7 +127,7 @@ snippet template ${20:#}${21:action :create} # Create the file (Default) ${22:#}${23:action :delete} # Delete this file - ${24:#}${25:action :touch} # Touch this file (update the mtime/atime) + ${24:#}${0:action :touch} # Touch this file (update the mtime/atime) end snippet svn @@ -141,10 +141,10 @@ snippet svn ${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations ${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations ${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command - + ${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default) ${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available - ${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts + ${22:#}${0:action :export} # Export the source, excluding or removing any version control artifacts end snippet git @@ -159,10 +159,10 @@ snippet git ${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update ${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone ${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this. - + ${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default) ${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available - ${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts + ${24:#}${0:action :export} # Export the source, excluding or removing any version control artifacts end snippet deploy @@ -197,8 +197,8 @@ snippet deploy ${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking ${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting ${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting - + ${60:#}${61::deploy} # Deploy the application (Default) ${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place - ${64:#}${65::rollback} # Rollback the application to the previous release + ${64:#}${0::rollback} # Rollback the application to the previous release end diff --git a/sources_non_forked/vim-snippets/snippets/clojure.snippets b/sources_non_forked/vim-snippets/snippets/clojure.snippets index e247debf..6fd653fc 100644 --- a/sources_non_forked/vim-snippets/snippets/clojure.snippets +++ b/sources_non_forked/vim-snippets/snippets/clojure.snippets @@ -1,90 +1,90 @@ snippet comm (comment - ${1} + ${0} ) snippet condp (condp ${1:pred} ${2:expr} - ${3}) + ${0}) snippet def - (def ${1}) + (def ${0}) snippet defm (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}] - ${5}) + ${0}) snippet defmm - (defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn}) + (defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defma - (defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn}) + (defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defn (defn ${1:name} "${2:doc-string}" [${3:arg-list}] - ${4}) + ${0}) snippet defp (defprotocol ${1:name} - ${2}) + ${0}) snippet defr (defrecord ${1:name} [${2:fields}] ${3:protocol} - ${4}) + ${0}) snippet deft (deftest ${1:name} (is (= ${2:assertion}))) - ${3}) + ${0}) snippet is - (is (= ${1} ${2})) + (is (= ${1} ${0})) snippet defty (deftype ${1:Name} [${2:fields}] ${3:Protocol} - ${4}) + ${0}) snippet doseq (doseq [${1:elem} ${2:coll}] - ${3}) + ${0}) snippet fn - (fn [${1:arg-list}] ${2}) + (fn [${1:arg-list}] ${0}) snippet if (if ${1:test-expr} ${2:then-expr} - ${3:else-expr}) -snippet if-let + ${0:else-expr}) +snippet if-let (if-let [${1:result} ${2:test-expr}] (${3:then-expr} $1) - (${4:else-expr})) + (${0:else-expr})) snippet imp (:import [${1:package}]) - & {:keys [${1:keys}] :or {${2:defaults}}} + & {:keys [${1:keys}] :or {${0:defaults}}} snippet let (let [${1:name} ${2:expr}] - ${3}) + ${0}) snippet letfn (letfn [(${1:name) [${2:args}] - ${3})]) + ${0})]) snippet map - (map ${1:func} ${2:coll}) + (map ${1:func} ${0:coll}) snippet mapl - (map #(${1:lambda}) ${2:coll}) + (map #(${1:lambda}) ${0:coll}) snippet met (${1:name} [${2:this} ${3:args}] - ${4}) + ${0}) snippet ns (ns ${1:name} - ${2}) + ${0}) snippet dotimes (dotimes [_ 10] (time (dotimes [_ ${1:times}] - ${2}))) + ${0}))) snippet pmethod - (${1:name} [${2:this} ${3:args}]) + (${1:name} [${2:this} ${0:args}]) snippet refer - (:refer-clojure :exclude [${1}]) + (:refer-clojure :exclude [${0}]) snippet require - (:require [${1:namespace} :as [${2}]]) + (:require [${1:namespace} :as [${0}]]) snippet use - (:use [${1:namespace} :only [${2}]]) + (:use [${1:namespace} :only [${0}]]) snippet print - (println ${1}) + (println ${0}) snippet reduce (reduce ${1:(fn [p n] ${3})} ${2}) snippet when - (when ${1:test} ${2:body}) + (when ${1:test} ${0:body}) snippet when-let (when-let [${1:result} ${2:test}] - ${3:body}) + ${0:body}) diff --git a/sources_non_forked/vim-snippets/snippets/cmake.snippets b/sources_non_forked/vim-snippets/snippets/cmake.snippets index 26aa9ac9..ef2256a4 100644 --- a/sources_non_forked/vim-snippets/snippets/cmake.snippets +++ b/sources_non_forked/vim-snippets/snippets/cmake.snippets @@ -8,7 +8,7 @@ snippet cmake ${$2_INCLUDE_DIR} ) - ADD_SUBDIRECTORY(${3:src}) + ADD_SUBDIRECTORY(${0:src}) ADD_EXECUTABLE($1) @@ -18,41 +18,41 @@ snippet cmake snippet include INCLUDE_DIRECTORIES( - ${${1:INCLUDE_DIR}} + ${${0:INCLUDE_DIR}} ) snippet find - FIND_PACKAGE(${1:LIBRARY}) + FIND_PACKAGE(${0:LIBRARY}) snippet glob - FILE(GLOB ${1:SRCS} *.${2:cpp}) + FILE(GLOB ${1:SRCS} *.${0:cpp}) snippet subdir - ADD_SUBDIRECTORY(${1:src}) + ADD_SUBDIRECTORY(${0:src}) snippet lib ADD_LIBRARY(${1:lib} ${2:STATIC} - ${${3:SRCS}} + ${${0:SRCS}} ) snippet link TARGET_LINK_LIBRARIES(${1:bin} - ${2:somelib} + ${0:somelib} ) - + snippet bin ADD_EXECUTABLE(${1:bin}) snippet set - SET(${1:var} ${2:val}) + SET(${1:var} ${0:val}) snippet dep ADD_DEPENDENCIES(${1:target} - ${2:dep} + ${0:dep} ) snippet props - SET_TARGET_PROPERTIES(${1:target} - ${2:PROPERTIES} ${3:COMPILE_FLAGS} - ${4:"-O3 -Wall -pedantic"} + SET_TARGET_PROPERTIES(${1:target} + ${2:PROPERTIES} ${3:COMPILE_FLAGS} + ${0:"-O3 -Wall -pedantic"} ) diff --git a/sources_non_forked/vim-snippets/snippets/coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee.snippets index 11c82e7d..aca6e81a 100644 --- a/sources_non_forked/vim-snippets/snippets/coffee.snippets +++ b/sources_non_forked/vim-snippets/snippets/coffee.snippets @@ -2,94 +2,94 @@ snippet forindo for ${1:name} in ${2:array} do ($1) -> - ${3:// body} + ${0:// body} # Array comprehension snippet fora for ${1:name} in ${2:array} - ${3:# body...} + ${0:# body...} # Object comprehension snippet foro for ${1:key}, ${2:value} of ${3:object} - ${4:# body...} + ${0:# body...} # Range comprehension (inclusive) snippet forr for ${1:name} in [${2:start}..${3:finish}] - ${4:# body...} + ${0:# body...} snippet forrb for ${1:name} in [${2:start}..${3:finish}] by ${4:step} - ${5:# body...} + ${0:# body...} # Range comprehension (exclusive) snippet forrex for ${1:name} in [${2:start}...${3:finish}] - ${4:# body...} + ${0:# body...} snippet forrexb for ${1:name} in [${2:start}...${3:finish}] by ${4:step} - ${5:# body...} + ${0:# body...} # Function snippet fun (${1:args}) -> - ${2:# body...} + ${0:# body...} # Function (bound) snippet bfun (${1:args}) => - ${2:# body...} + ${0:# body...} # Class snippet cla class .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - ${2} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + ${0} snippet cla class .. constructor: .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} constructor: (${2:args}) -> ${3} - ${4} + ${0} snippet cla class .. extends .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} - ${3} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + ${0} snippet cla class .. extends .. constructor: .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} constructor: (${3:args}) -> ${4} - ${5} + ${0} # If snippet if if ${1:condition} - ${2:# body...} + ${0:# body...} # If __ Else snippet ife if ${1:condition} ${2:# body...} else - ${3:# body...} + ${0:# body...} # Else if -snippet elif +snippet eif else if ${1:condition} - ${2:# body...} + ${0:# body...} # Ternary If snippet ifte - if ${1:condition} then ${2:value} else ${3:other} + if ${1:condition} then ${2:value} else ${0:other} # Unless snippet unl - ${1:action} unless ${2:condition} + ${1:action} unless ${0:condition} # Switch snippet swi switch ${1:object} when ${2:value} - ${3:# body...} + ${0:# body...} # Log snippet log - console.log ${1} + console.log ${0} # Try __ Catch snippet try try ${1} catch ${2:error} - ${3} + ${0} # Require snippet req - ${2:$1} = require '${1:sys}'${3} + ${2:$1} = require '${1:sys}' # Export snippet exp - ${1:root} = exports ? this + ${0:root} = exports ? this diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index c3e19fe9..cdccf1eb 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -1,52 +1,52 @@ ## STL Collections # std::array snippet array - std::array<${1:T}, ${2:N}> ${3};${4} + std::array<${1:T}, ${2:N}> ${3}; # std::vector snippet vector - std::vector<${1:T}> ${2};${3} + std::vector<${1:T}> ${2}; # std::deque snippet deque - std::deque<${1:T}> ${2};${3} + std::deque<${1:T}> ${2}; # std::forward_list snippet flist - std::forward_list<${1:T}> ${2};${3} + std::forward_list<${1:T}> ${2}; # std::list snippet list - std::list<${1:T}> ${2};${3} + std::list<${1:T}> ${2}; # std::set snippet set - std::set<${1:T}> ${2};${3} + std::set<${1:T}> ${2}; # std::map snippet map - std::map<${1:Key}, ${2:T}> ${3};${4} + std::map<${1:Key}, ${2:T}> ${3}; # std::multiset snippet mset - std::multiset<${1:T}> ${2};${3} + std::multiset<${1:T}> ${2}; # std::multimap snippet mmap - std::multimap<${1:Key}, ${2:T}> ${3};${4} + std::multimap<${1:Key}, ${2:T}> ${3}; # std::unordered_set snippet uset - std::unordered_set<${1:T}> ${2};${3} + std::unordered_set<${1:T}> ${2}; # std::unordered_map snippet umap - std::unordered_map<${1:Key}, ${2:T}> ${3};${4} + std::unordered_map<${1:Key}, ${2:T}> ${3}; # std::unordered_multiset snippet umset - std::unordered_multiset<${1:T}> ${2};${3} + std::unordered_multiset<${1:T}> ${2}; # std::unordered_multimap snippet ummap - std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} + std::unordered_multimap<${1:Key}, ${2:T}> ${3}; # std::stack snippet stack - std::stack<${1:T}> ${2};${3} + std::stack<${1:T}> ${2}; # std::queue snippet queue - std::queue<${1:T}> ${2};${3} + std::queue<${1:T}> ${2}; # std::priority_queue snippet pqueue - std::priority_queue<${1:T}> ${2};${3} + std::priority_queue<${1:T}> ${2}; ## ## Access Modifiers # private @@ -64,68 +64,68 @@ snippet fr # mutable snippet mu mutable -## +## ## Class # class snippet cl - class ${1:`Filename('$1', 'name')`} + class ${1:`vim_snippets#Filename('$1', 'name')`} { public: $1(${2}); ~$1(); private: - ${3:/* data */} + ${0:/* data */} }; # member function implementation snippet mfun - ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:/* code */} + ${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { + ${0} } # namespace snippet ns - namespace ${1:`Filename('', 'my')`} { - ${2} + namespace ${1:`vim_snippets#Filename('', 'my')`} { + ${0} } /* namespace $1 */ ## ## Input/Output # std::cout snippet cout - std::cout << ${1} << std::endl;${2} + std::cout << ${1} << std::endl; # std::cin snippet cin - std::cin >> ${1};${2} + std::cin >> ${1}; ## ## Iteration -# for i +# for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} - }${5} + ${4} + } # foreach snippet fore for (${1:auto} ${2:i} : ${3:container}) { - ${4:/* code */} - }${5} + ${4} + } # iterator snippet iter for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { ${6} - }${7} + } # auto iterator snippet itera - for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { - ${2:std::cout << *$1 << std::endl;} - }${3} + for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) { + ${3:std::cout << *$1 << std::endl;} + } ## ## Lambdas # lamda (one line) snippet ld - [${1}](${2}){${3:/* code */}}${4} + [${1}](${2}){${3}} # lambda (multi-line) snippet lld [${1}](${2}){ - ${3:/* code */} - }${4} + ${3} + } diff --git a/sources_non_forked/vim-snippets/snippets/cs.snippets b/sources_non_forked/vim-snippets/snippets/cs.snippets index 725f8b7d..e537bce4 100644 --- a/sources_non_forked/vim-snippets/snippets/cs.snippets +++ b/sources_non_forked/vim-snippets/snippets/cs.snippets @@ -1,12 +1,12 @@ # cs.snippets # =========== -# +# # Standard C-Sharp snippets for snipmate. # # Largely ported over from Visual Studio 2010 snippets plus # a few snippets from Resharper plus a few widely known snippets. # -# Most snippets on elements (i.e. classes, properties) +# Most snippets on elements (i.e. classes, properties) # follow suffix conventions. The order of suffixes to a snippet # is fixed. # @@ -55,207 +55,207 @@ # * Events # # Feedback is welcome! -# +# # entry point snippet sim public static int Main(string[] args) { - ${1} + ${0} return 0; - } + } snippet simc public class Application { public static int Main(string[] args) { - ${1} + ${0} return 0; } } # if condition snippet if if (${1}) { - ${2} - } + ${0} + } snippet el else { - ${1} - } + ${0} + } snippet ifs - if (${1}) - ${2} + if (${1}) + ${0} # ternary conditional snippet t - ${1} ? ${2} : ${3} + ${1} ? ${2} : ${0} snippet ? - ${1} ? ${2} : ${3} + ${1} ? ${2} : ${0} # do while loop snippet do do { - ${2} + ${0} } while (${1}); # while loop snippet wh while (${1}) { - ${2} + ${0} } # for loop snippet for for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { - ${4} + ${0} } # foreach snippet fore foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } snippet foreach foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } snippet each foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } # interfaces snippet interface - public interface ${1:`Filename()`} { - ${2} + public interface ${1:`vim_snippets#Filename()`} { + ${0} } snippet if+ - public interface ${1:`Filename()`} { - ${2} + public interface ${1:`vim_snippets#Filename()`} { + ${0} } # class bodies snippet class - public class ${1:`Filename()`} { - ${2} + public class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls - ${2:public} class ${1:`Filename()`} { - ${3} + ${2:public} class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls+ - public class ${1:`Filename()`} { - ${2} + public class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls+^ - public static class ${1:`Filename()`} { - ${2} + public static class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls& - internal class ${1:`Filename()`} { - ${2} + internal class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls&^ - internal static class ${1:`Filename()`} { - ${2} + internal static class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls| - protected class ${1:`Filename()`} { - ${2} + protected class ${1:`vim_snippets#Filename()`} { + ${0} } snippet cls|% - protected abstract class ${1:`Filename()`} { - ${2} + protected abstract class ${1:`vim_snippets#Filename()`} { + ${0} } # constructor snippet ctor - public ${1:`Filename()`}() { - ${2} + public ${1:`vim_snippets#Filename()`}() { + ${0} } # properties - auto properties by default. # default type is int with layout get / set. snippet prop - ${1:public} ${2:int} ${3:} { get; set; }${4} + ${1:public} ${2:int} ${3:} { get; set; } snippet p - ${1:public} ${2:int} ${3:} { get; set; }${4} + ${1:public} ${2:int} ${3:} { get; set; } snippet p+ - public ${1:int} ${2:} { get; set; }${3} + public ${1:int} ${2:} { get; set; } snippet p+& - public ${1:int} ${2:} { get; internal set; }${3} + public ${1:int} ${2:} { get; internal set; } snippet p+| - public ${1:int} ${2:} { get; protected set; }${3} + public ${1:int} ${2:} { get; protected set; } snippet p+- - public ${1:int} ${2:} { get; private set; }${3} + public ${1:int} ${2:} { get; private set; } snippet p& - internal ${1:int} ${2:} { get; set; }${3} + internal ${1:int} ${2:} { get; set; } snippet p&| - internal ${1:int} ${2:} { get; protected set; }${3} + internal ${1:int} ${2:} { get; protected set; } snippet p&- - internal ${1:int} ${2:} { get; private set; }${3} + internal ${1:int} ${2:} { get; private set; } snippet p| - protected ${1:int} ${2:} { get; set; }${3} + protected ${1:int} ${2:} { get; set; } snippet p|- - protected ${1:int} ${2:} { get; private set; }${3} + protected ${1:int} ${2:} { get; private set; } snippet p- - private ${1:int} ${2:} { get; set; }${3} + private ${1:int} ${2:} { get; set; } # property - bool snippet pi - ${1:public} int ${2:} { get; set; }${3} + ${1:public} int ${2:} { get; set; } snippet pi+ - public int ${1} { get; set; }${2} + public int ${1} { get; set; } snippet pi+& - public int ${1} { get; internal set; }${2} + public int ${1} { get; internal set; } snippet pi+| - public int ${1} { get; protected set; }${2} + public int ${1} { get; protected set; } snippet pi+- - public int ${1} { get; private set; }${2} + public int ${1} { get; private set; } snippet pi& - internal int ${1} { get; set; }${2} + internal int ${1} { get; set; } snippet pi&| - internal int ${1} { get; protected set; }${2} + internal int ${1} { get; protected set; } snippet pi&- - internal int ${1} { get; private set; }${2} + internal int ${1} { get; private set; } snippet pi| - protected int ${1} { get; set; }${2} + protected int ${1} { get; set; } snippet pi|- - protected int ${1} { get; private set; }${2} + protected int ${1} { get; private set; } snippet pi- - private int ${1} { get; set; }${2} + private int ${1} { get; set; } # property - bool snippet pb - ${1:public} bool ${2:} { get; set; }${3} + ${1:public} bool ${2:} { get; set; } snippet pb+ - public bool ${1} { get; set; }${2} + public bool ${1} { get; set; } snippet pb+& - public bool ${1} { get; internal set; }${2} + public bool ${1} { get; internal set; } snippet pb+| - public bool ${1} { get; protected set; }${2} + public bool ${1} { get; protected set; } snippet pb+- - public bool ${1} { get; private set; }${2} + public bool ${1} { get; private set; } snippet pb& - internal bool ${1} { get; set; }${2} + internal bool ${1} { get; set; } snippet pb&| - internal bool ${1} { get; protected set; }${2} + internal bool ${1} { get; protected set; } snippet pb&- - internal bool ${1} { get; private set; }${2} + internal bool ${1} { get; private set; } snippet pb| - protected bool ${1} { get; set; }${2} + protected bool ${1} { get; set; } snippet pb|- - protected bool ${1} { get; private set; }${2} + protected bool ${1} { get; private set; } snippet pb- - private bool ${1} { get; set; }${2} + private bool ${1} { get; set; } # property - string snippet ps - ${1:public} string ${2:} { get; set; }${3} + ${1:public} string ${2:} { get; set; } snippet ps+ - public string ${1} { get; set; }${2} + public string ${1} { get; set; } snippet ps+& - public string ${1} { get; internal set; }${2} + public string ${1} { get; internal set; } snippet ps+| - public string ${1} { get; protected set; }${2} + public string ${1} { get; protected set; } snippet ps+- - public string ${1} { get; private set; }${2} + public string ${1} { get; private set; } snippet ps& - internal string ${1} { get; set; }${2} + internal string ${1} { get; set; } snippet ps&| - internal string ${1} { get; protected set; }${2} + internal string ${1} { get; protected set; } snippet ps&- - internal string ${1} { get; private set; }${2} + internal string ${1} { get; private set; } snippet ps| - protected string ${1} { get; set; }${2} + protected string ${1} { get; set; } snippet ps|- - protected string ${1} { get; private set; }${2} + protected string ${1} { get; private set; } snippet ps- - private string ${1} { get; set; }${2} + private string ${1} { get; set; } # members - void snippet m ${1:public} ${2:void} ${3:}(${4:}) { @@ -342,33 +342,33 @@ snippet ms- } # structure snippet struct - public struct ${1:`Filename()`} { - ${2} + public struct ${1:`vim_snippets#Filename()`} { + ${0} } # enumeration snippet enum public enum ${1} { - ${2} + ${0} } # preprocessor directives snippet #if #if - ${1} + ${0} #endif # inline xml documentation snippet /// /// - /// ${1} + /// ${0} /// snippet
- ${1} + ${0}
snippet area - ${4} + ${0} snippet area+ ${4} - area+${5} + area+ snippet area:c - ${3} + ${0} snippet area:d - ${3} + ${0} snippet area:p - ${3} + ${0} snippet area:r - ${3} + ${0} snippet article
- ${1} + ${0}
snippet article.
- ${2} + ${0}
snippet article#
- ${2} + ${0}
snippet aside snippet aside. snippet aside# snippet audio - snippet b - ${1} + ${0} snippet base - + snippet bdi - ${1} + ${0} snippet bdo - ${2} + ${0} snippet bdo:l - ${1} + ${0} snippet bdo:r - ${1} + ${0} snippet blockquote
- ${1} + ${0}
snippet body - ${1} + ${0} snippet br -
${1} +
snippet button - + snippet button. - + snippet button# - + snippet button:s - + snippet button:r - + snippet canvas - ${1} + ${0} snippet caption - ${1} + ${0} snippet cite - ${1} + ${0} snippet code - ${1} + ${0} snippet col - ${1} + snippet col+ - col+${1} + col+ snippet colgroup - ${1} + ${0} snippet colgroup+ - col+${1} + col+${0} snippet command - + snippet command:c - + snippet command:r - + snippet datagrid - ${1} + ${0} snippet datalist - ${1} + ${0} snippet datatemplate - ${1} + ${0} snippet dd -
${1}
+
${0}
snippet dd. -
${2}
+
${0}
snippet dd# -
${2}
+
${0}
snippet del - ${1} + ${0} snippet details -
${1}
+
${0}
snippet dfn - ${1} + ${0} snippet dialog - ${1} + ${0} snippet div
- ${1} + ${0}
snippet div.
- ${2} + ${0}
snippet div#
- ${2} + ${0}
snippet dl
- ${1} + ${0}
snippet dl.
- ${2} + ${0}
snippet dl#
- ${2} + ${0}
snippet dl+
${1}
${2}
- dt+${3} + dt+${0}
snippet dt -
${1}
+
${0}
snippet dt. -
${2}
+
${0}
snippet dt# -
${2}
+
${0}
snippet dt+
${1}
${2}
- dt+${3} + dt+${0} snippet em - ${1} + ${0} snippet embed - snippet fieldset
- ${1} + ${0}
snippet fieldset.
- ${2} + ${0}
snippet fieldset#
- ${2} + ${0}
snippet fieldset+
${1} ${2}
- fieldset+${3} + fieldset+${0} snippet figcaption -
${1}
+
${0}
snippet figure -
${1}
+
${0}
snippet footer
- ${1} + ${0}
snippet footer.
- ${2} + ${0}
snippet footer#
- ${2} + ${0}
snippet form
- ${3} + ${0}
snippet form.
- ${4} + ${0}
snippet form#
- ${4} + ${0}
snippet h1 -

${1}

+

${0}

snippet h1. -

${2}

+

${0}

snippet h1# -

${2}

+

${0}

snippet h2 -

${1}

+

${0}

snippet h2. -

${2}

+

${0}

snippet h2# -

${2}

+

${0}

snippet h3 -

${1}

+

${0}

snippet h3. -

${2}

+

${0}

snippet h3# -

${2}

+

${0}

snippet h4 -

${1}

+

${0}

snippet h4. -

${2}

+

${0}

snippet h4# -

${2}

+

${0}

snippet h5 -
${1}
+
${0}
snippet h5. -
${2}
+
${0}
snippet h5# -
${2}
+
${0}
snippet h6 -
${1}
+
${0}
snippet h6. -
${2}
+
${0}
snippet h6# -
${2}
+
${0}
snippet head - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} - ${2} + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} + ${0} snippet header
- ${1} + ${0}
snippet header.
- ${2} + ${0}
snippet header#
- ${2} + ${0}
snippet hgroup
- ${1} + ${0}
snippet hgroup.
- ${1} + ${0} snippet html5 - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:meta} - ${3:body} + ${0:body} snippet i - ${1} + ${0} snippet iframe - ${2} + snippet iframe. - ${3} + snippet iframe# - ${3} + snippet img - ${2}${3} + ${2} snippet img. - ${3}${4} + ${3} snippet img# - ${3}${4} + ${3} snippet input - ${5} + snippet input. - ${6} + snippet input:text - ${4} + snippet input:submit - ${4} + snippet input:hidden - ${4} + snippet input:button - ${4} + snippet input:image - ${5} + snippet input:checkbox - ${3} + snippet input:radio - ${3} + snippet input:color - ${4} + snippet input:date - ${4} + snippet input:datetime - ${4} + snippet input:datetime-local - ${4} + snippet input:email - ${4} + snippet input:file - ${4} + snippet input:month - ${4} + snippet input:number - ${4} + snippet input:password - ${4} + snippet input:range - ${4} + snippet input:reset - ${4} + snippet input:search - ${4} + snippet input:time - ${4} + snippet input:url - ${4} + snippet input:week - ${4} + snippet ins - ${1} + ${0} snippet kbd - ${1} + ${0} snippet keygen - ${1} + ${0} snippet label - + snippet label:i - ${7} + snippet label:s snippet legend - ${1} + ${0} snippet legend+ - ${1} + ${0} snippet li -
  • ${1}
  • +
  • ${0}
  • snippet li. -
  • ${2}
  • +
  • ${0}
  • snippet li+
  • ${1}
  • - li+${2} + li+ snippet lia -
  • ${1}
  • +
  • ${1}
  • snippet lia+
  • ${1}
  • - lia+${3} + lia+ snippet link - ${5} + snippet link:atom - ${2} + snippet link:css - ${3} + snippet link:favicon - ${2} + snippet link:rss - ${2} + snippet link:touch - ${2} + snippet map - ${2} + ${0} snippet map. - ${3} + ${0} snippet map# ${5}${6} - ${7} + snippet mark - ${1} + ${0} snippet menu - ${1} + ${0} snippet menu:c - ${1} + ${0} snippet menu:t - ${1} + ${0} snippet meta - ${3} + snippet meta:compat - ${3} + snippet meta:refresh - ${3} + snippet meta:utf - ${3} + snippet meter - ${1} + ${0} snippet nav snippet nav. snippet nav# snippet noscript snippet object ${3} - ${4} + # Embed QT Movie snippet movie - ${6} + snippet ol
      - ${1} + ${0}
    snippet ol.
      - ${2} + ${0}
    snippet ol+
    1. ${1}
    2. - li+${2} + li+${0}
    snippet opt - + snippet opt+ - opt+${3} + opt+${0} snippet optt - + snippet optgroup - opt+${3} + opt+${0} snippet output - ${1} + ${0} snippet p -

    ${1}

    +

    ${0}

    snippet param - ${3} + snippet pre
    -		${1}
    +		${0}
     	
    snippet progress - ${1} + ${0} snippet q - ${1} + ${0} snippet rp - ${1} + ${0} snippet rt - ${1} + ${0} snippet ruby - ${1} + ${0} snippet s - ${1} + ${0} snippet samp - ${1} + ${0} snippet script snippet scriptsrc - + snippet section
    - ${1} + ${0}
    snippet section.
    - ${2} + ${0}
    snippet section#
    - ${2} + ${0}
    snippet select snippet select. snippet small - ${1} + ${0} snippet source - + snippet span - ${1} + ${0} +snippet span. + ${0} +snippet span# + ${0} snippet strong - ${1} + ${0} snippet style snippet sub - ${1} + ${0} snippet summary - ${1} + ${0} snippet sup - ${1} + ${0} snippet table - ${2} + ${0}
    snippet table. - ${3} + ${0}
    snippet table# - ${3} + ${0}
    snippet tbody - ${1} + ${0} snippet td - ${1} + ${0} snippet td. - ${2} + ${0} snippet td# - ${2} + ${0} snippet td+ ${1} - td+${2} + td+${0} snippet textarea - ${6} + snippet tfoot - ${1} + ${0} snippet th - ${1} + ${0} snippet th. - ${2} + ${0} snippet th# - ${2} + ${0} snippet th+ ${1} - th+${2} + th+${0} snippet thead - ${1} + ${0} snippet time - + snippet title - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${0:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr - ${1} + ${0} snippet tr+ ${1} - td+${2} + td+${0} snippet track - - ${2} + ${0} snippet ul#
      - ${2} + ${0}
    snippet ul+
    • ${1}
    • - li+${2} + li+${0}
    snippet var - ${1} + ${0} snippet video -

    ${2:$1}${3} + ${2:$1} snippet ${2}${3} + ${2} snippet ${1}{${2} + ${1}{ snippet ${2} + snippet ${1}${2} + ${1} snippet ${1}${2} + ${1} diff --git a/sources_non_forked/vim-snippets/snippets/css.snippets b/sources_non_forked/vim-snippets/snippets/css.snippets index 72212d2d..8886643a 100644 --- a/sources_non_forked/vim-snippets/snippets/css.snippets +++ b/sources_non_forked/vim-snippets/snippets/css.snippets @@ -1,50 +1,50 @@ snippet . ${1} { - ${2} + ${0} } snippet ! !important snippet bdi:m+ - -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:m - -moz-border-image: ${1}; + -moz-border-image: ${0}; snippet bdrz:m - -moz-border-radius: ${1}; + -moz-border-radius: ${0}; snippet bxsh:m+ - -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh:m - -moz-box-shadow: ${1}; + -moz-box-shadow: ${0}; snippet bdi:w+ - -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:w - -webkit-border-image: ${1}; + -webkit-border-image: ${0}; snippet bdrz:w - -webkit-border-radius: ${1}; + -webkit-border-radius: ${0}; snippet bxsh:w+ - -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh:w - -webkit-box-shadow: ${1}; + -webkit-box-shadow: ${0}; snippet @f @font-face { font-family: ${1}; - src: url(${2}); + src: url(${0}); } snippet @i - @import url(${1}); + @import url(${0}); snippet @m @media ${1:print} { - ${2} + ${0} } snippet bg+ - background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat}; + background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat}; snippet bga - background-attachment: ${1}; + background-attachment: ${0}; snippet bga:f background-attachment: fixed; snippet bga:s background-attachment: scroll; snippet bgbk - background-break: ${1}; + background-break: ${0}; snippet bgbk:bb background-break: bounding-box; snippet bgbk:c @@ -52,7 +52,7 @@ snippet bgbk:c snippet bgbk:eb background-break: each-box; snippet bgcp - background-clip: ${1}; + background-clip: ${0}; snippet bgcp:bb background-clip: border-box; snippet bgcp:cb @@ -62,15 +62,15 @@ snippet bgcp:nc snippet bgcp:pb background-clip: padding-box; snippet bgc - background-color: #${1:FFF}; + background-color: #${0:FFF}; snippet bgc:t background-color: transparent; snippet bgi - background-image: url(${1}); + background-image: url(${0}); snippet bgi:n background-image: none; snippet bgo - background-origin: ${1}; + background-origin: ${0}; snippet bgo:bb background-origin: border-box; snippet bgo:cb @@ -78,13 +78,13 @@ snippet bgo:cb snippet bgo:pb background-origin: padding-box; snippet bgpx - background-position-x: ${1}; + background-position-x: ${0}; snippet bgpy - background-position-y: ${1}; + background-position-y: ${0}; snippet bgp - background-position: ${1:0} ${2:0}; + background-position: ${1:0} ${0:0}; snippet bgr - background-repeat: ${1}; + background-repeat: ${0}; snippet bgr:n background-repeat: no-repeat; snippet bgr:x @@ -94,7 +94,7 @@ snippet bgr:y snippet bgr:r background-repeat: repeat; snippet bgz - background-size: ${1}; + background-size: ${0}; snippet bgz:a background-size: auto; snippet bgz:ct @@ -102,67 +102,67 @@ snippet bgz:ct snippet bgz:cv background-size: cover; snippet bg - background: ${1}; + background: ${0}; snippet bg:ie - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}'); + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}'); snippet bg:n background: none; snippet bd+ - border: ${1:1px} ${2:solid} #${3:000}; + border: ${1:1px} ${2:solid} #${0:000}; snippet bdb+ - border-bottom: ${1:1px} ${2:solid} #${3:000}; + border-bottom: ${1:1px} ${2:solid} #${0:000}; snippet bdbc - border-bottom-color: #${1:000}; + border-bottom-color: #${0:000}; snippet bdbi - border-bottom-image: url(${1}); + border-bottom-image: url(${0}); snippet bdbi:n border-bottom-image: none; snippet bdbli - border-bottom-left-image: url(${1}); + border-bottom-left-image: url(${0}); snippet bdbli:c border-bottom-left-image: continue; snippet bdbli:n border-bottom-left-image: none; snippet bdblrz - border-bottom-left-radius: ${1}; + border-bottom-left-radius: ${0}; snippet bdbri - border-bottom-right-image: url(${1}); + border-bottom-right-image: url(${0}); snippet bdbri:c border-bottom-right-image: continue; snippet bdbri:n border-bottom-right-image: none; snippet bdbrrz - border-bottom-right-radius: ${1}; + border-bottom-right-radius: ${0}; snippet bdbs - border-bottom-style: ${1}; + border-bottom-style: ${0}; snippet bdbs:n border-bottom-style: none; snippet bdbw - border-bottom-width: ${1}; + border-bottom-width: ${0}; snippet bdb - border-bottom: ${1}; + border-bottom: ${0}; snippet bdb:n border-bottom: none; snippet bdbk - border-break: ${1}; + border-break: ${0}; snippet bdbk:c border-break: close; snippet bdcl - border-collapse: ${1}; + border-collapse: ${0}; snippet bdcl:c border-collapse: collapse; snippet bdcl:s border-collapse: separate; snippet bdc - border-color: #${1:000}; + border-color: #${0:000}; snippet bdci - border-corner-image: url(${1}); + border-corner-image: url(${0}); snippet bdci:c border-corner-image: continue; snippet bdci:n border-corner-image: none; snippet bdf - border-fit: ${1}; + border-fit: ${0}; snippet bdf:c border-fit: clip; snippet bdf:of @@ -178,55 +178,55 @@ snippet bdf:sp snippet bdf:st border-fit: stretch; snippet bdi - border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:n border-image: none; snippet bdl+ - border-left: ${1:1px} ${2:solid} #${3:000}; + border-left: ${1:1px} ${2:solid} #${0:000}; snippet bdlc - border-left-color: #${1:000}; + border-left-color: #${0:000}; snippet bdli - border-left-image: url(${1}); + border-left-image: url(${0}); snippet bdli:n border-left-image: none; snippet bdls - border-left-style: ${1}; + border-left-style: ${0}; snippet bdls:n border-left-style: none; snippet bdlw - border-left-width: ${1}; + border-left-width: ${0}; snippet bdl - border-left: ${1}; + border-left: ${0}; snippet bdl:n border-left: none; snippet bdlt - border-length: ${1}; + border-length: ${0}; snippet bdlt:a border-length: auto; snippet bdrz - border-radius: ${1}; + border-radius: ${0}; snippet bdr+ - border-right: ${1:1px} ${2:solid} #${3:000}; + border-right: ${1:1px} ${2:solid} #${0:000}; snippet bdrc - border-right-color: #${1:000}; + border-right-color: #${0:000}; snippet bdri - border-right-image: url(${1}); + border-right-image: url(${0}); snippet bdri:n border-right-image: none; snippet bdrs - border-right-style: ${1}; + border-right-style: ${0}; snippet bdrs:n border-right-style: none; snippet bdrw - border-right-width: ${1}; + border-right-width: ${0}; snippet bdr - border-right: ${1}; + border-right: ${0}; snippet bdr:n border-right: none; snippet bdsp - border-spacing: ${1}; + border-spacing: ${0}; snippet bds - border-style: ${1}; + border-style: ${0}; snippet bds:ds border-style: dashed; snippet bds:dtds @@ -254,69 +254,69 @@ snippet bds:s snippet bds:w border-style: wave; snippet bdt+ - border-top: ${1:1px} ${2:solid} #${3:000}; + border-top: ${1:1px} ${2:solid} #${0:000}; snippet bdtc - border-top-color: #${1:000}; + border-top-color: #${0:000}; snippet bdti - border-top-image: url(${1}); + border-top-image: url(${0}); snippet bdti:n border-top-image: none; snippet bdtli - border-top-left-image: url(${1}); + border-top-left-image: url(${0}); snippet bdtli:c border-corner-image: continue; snippet bdtli:n border-corner-image: none; snippet bdtlrz - border-top-left-radius: ${1}; + border-top-left-radius: ${0}; snippet bdtri - border-top-right-image: url(${1}); + border-top-right-image: url(${0}); snippet bdtri:c border-top-right-image: continue; snippet bdtri:n border-top-right-image: none; snippet bdtrrz - border-top-right-radius: ${1}; + border-top-right-radius: ${0}; snippet bdts - border-top-style: ${1}; + border-top-style: ${0}; snippet bdts:n border-top-style: none; snippet bdtw - border-top-width: ${1}; + border-top-width: ${0}; snippet bdt - border-top: ${1}; + border-top: ${0}; snippet bdt:n border-top: none; snippet bdw - border-width: ${1}; + border-width: ${0}; snippet bd - border: ${1}; + border: ${0}; snippet bd:n border: none; snippet b - bottom: ${1}; + bottom: ${0}; snippet b:a bottom: auto; snippet bxsh+ - box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh - box-shadow: ${1}; + box-shadow: ${0}; snippet bxsh:n box-shadow: none; snippet bxz - box-sizing: ${1}; + box-sizing: ${0}; snippet bxz:bb box-sizing: border-box; snippet bxz:cb box-sizing: content-box; snippet cps - caption-side: ${1}; + caption-side: ${0}; snippet cps:b caption-side: bottom; snippet cps:t caption-side: top; snippet cl - clear: ${1}; + clear: ${0}; snippet cl:b clear: both; snippet cl:l @@ -326,23 +326,23 @@ snippet cl:n snippet cl:r clear: right; snippet cp - clip: ${1}; + clip: ${0}; snippet cp:a clip: auto; snippet cp:r - clip: rect(${1:0} ${2:0} ${3:0} ${4:0}); + clip: rect(${1:0} ${2:0} ${3:0} ${0:0}); snippet c - color: #${1:000}; + color: #${0:000}; snippet ct - content: ${1}; + content: ${0}; snippet ct:a - content: attr(${1}); + content: attr(${0}); snippet ct:cq content: close-quote; snippet ct:c - content: counter(${1}); + content: counter(${0}); snippet ct:cs - content: counters(${1}); + content: counters(${0}); snippet ct:ncq content: no-close-quote; snippet ct:noq @@ -352,11 +352,11 @@ snippet ct:n snippet ct:oq content: open-quote; snippet coi - counter-increment: ${1}; + counter-increment: ${0}; snippet cor - counter-reset: ${1}; + counter-reset: ${0}; snippet cur - cursor: ${1}; + cursor: ${0}; snippet cur:a cursor: auto; snippet cur:c @@ -374,7 +374,7 @@ snippet cur:p snippet cur:t cursor: text; snippet d - display: ${1}; + display: ${0}; snippet d:mib display: -moz-inline-box; snippet d:mis @@ -414,7 +414,7 @@ snippet d:tbr snippet d:tb display: table; snippet ec - empty-cells: ${1}; + empty-cells: ${0}; snippet ec:h empty-cells: hide; snippet ec:s @@ -422,7 +422,7 @@ snippet ec:s snippet exp expression() snippet fl - float: ${1}; + float: ${0}; snippet fl:l float: left; snippet fl:n @@ -430,9 +430,9 @@ snippet fl:n snippet fl:r float: right; snippet f+ - font: ${1:1em} ${2:Arial},${3:sans-serif}; + font: ${1:1em} ${2:Arial},${0:sans-serif}; snippet fef - font-effect: ${1}; + font-effect: ${0}; snippet fef:eb font-effect: emboss; snippet fef:eg @@ -442,13 +442,13 @@ snippet fef:n snippet fef:o font-effect: outline; snippet femp - font-emphasize-position: ${1}; + font-emphasize-position: ${0}; snippet femp:a font-emphasize-position: after; snippet femp:b font-emphasize-position: before; snippet fems - font-emphasize-style: ${1}; + font-emphasize-style: ${0}; snippet fems:ac font-emphasize-style: accent; snippet fems:c @@ -460,27 +460,27 @@ snippet fems:dt snippet fems:n font-emphasize-style: none; snippet fem - font-emphasize: ${1}; + font-emphasize: ${0}; snippet ff - font-family: ${1}; + font-family: ${0}; snippet ff:c - font-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive; + font-family: ${0:'Monotype Corsiva','Comic Sans MS'},cursive; snippet ff:f - font-family: ${1:Capitals,Impact},fantasy; + font-family: ${0:Capitals,Impact},fantasy; snippet ff:m - font-family: ${1:Monaco,'Courier New'},monospace; + font-family: ${0:Monaco,'Courier New'},monospace; snippet ff:ss - font-family: ${1:Helvetica,Arial},sans-serif; + font-family: ${0:Helvetica,Arial},sans-serif; snippet ff:s - font-family: ${1:Georgia,'Times New Roman'},serif; + font-family: ${0:Georgia,'Times New Roman'},serif; snippet fza - font-size-adjust: ${1}; + font-size-adjust: ${0}; snippet fza:n font-size-adjust: none; snippet fz - font-size: ${1}; + font-size: ${0}; snippet fsm - font-smooth: ${1}; + font-smooth: ${0}; snippet fsm:aw font-smooth: always; snippet fsm:a @@ -488,7 +488,7 @@ snippet fsm:a snippet fsm:n font-smooth: never; snippet fst - font-stretch: ${1}; + font-stretch: ${0}; snippet fst:c font-stretch: condensed; snippet fst:e @@ -508,7 +508,7 @@ snippet fst:uc snippet fst:ue font-stretch: ultra-expanded; snippet fs - font-style: ${1}; + font-style: ${0}; snippet fs:i font-style: italic; snippet fs:n @@ -516,13 +516,13 @@ snippet fs:n snippet fs:o font-style: oblique; snippet fv - font-variant: ${1}; + font-variant: ${0}; snippet fv:n font-variant: normal; snippet fv:sc font-variant: small-caps; snippet fw - font-weight: ${1}; + font-weight: ${0}; snippet fw:b font-weight: bold; snippet fw:br @@ -532,31 +532,31 @@ snippet fw:lr snippet fw:n font-weight: normal; snippet f - font: ${1}; + font: ${0}; snippet h - height: ${1}; + height: ${0}; snippet h:a height: auto; snippet l - left: ${1}; + left: ${0}; snippet l:a left: auto; snippet lts - letter-spacing: ${1}; + letter-spacing: ${0}; snippet lh - line-height: ${1}; + line-height: ${0}; snippet lisi - list-style-image: url(${1}); + list-style-image: url(${0}); snippet lisi:n list-style-image: none; snippet lisp - list-style-position: ${1}; + list-style-position: ${0}; snippet lisp:i list-style-position: inside; snippet lisp:o list-style-position: outside; snippet list - list-style-type: ${1}; + list-style-type: ${0}; snippet list:c list-style-type: circle; snippet list:dclz @@ -574,75 +574,75 @@ snippet list:s snippet list:ur list-style-type: upper-roman; snippet lis - list-style: ${1}; + list-style: ${0}; snippet lis:n list-style: none; snippet mb - margin-bottom: ${1}; + margin-bottom: ${0}; snippet mb:a margin-bottom: auto; snippet ml - margin-left: ${1}; + margin-left: ${0}; snippet ml:a margin-left: auto; snippet mr - margin-right: ${1}; + margin-right: ${0}; snippet mr:a margin-right: auto; snippet mt - margin-top: ${1}; + margin-top: ${0}; snippet mt:a margin-top: auto; snippet m - margin: ${1}; + margin: ${0}; snippet m:4 - margin: ${1:0} ${2:0} ${3:0} ${4:0}; + margin: ${1:0} ${2:0} ${3:0} ${0:0}; snippet m:3 - margin: ${1:0} ${2:0} ${3:0}; + margin: ${1:0} ${2:0} ${0:0}; snippet m:2 - margin: ${1:0} ${2:0}; + margin: ${1:0} ${0:0}; snippet m:0 margin: 0; snippet m:a margin: auto; snippet mah - max-height: ${1}; + max-height: ${0}; snippet mah:n max-height: none; snippet maw - max-width: ${1}; + max-width: ${0}; snippet maw:n max-width: none; snippet mih - min-height: ${1}; + min-height: ${0}; snippet miw - min-width: ${1}; + min-width: ${0}; snippet op - opacity: ${1}; + opacity: ${0}; snippet op:ie - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100}); + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100}); snippet op:ms - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})'; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})'; snippet orp - orphans: ${1}; + orphans: ${0}; snippet o+ - outline: ${1:1px} ${2:solid} #${3:000}; + outline: ${1:1px} ${2:solid} #${0:000}; snippet oc - outline-color: ${1:#000}; + outline-color: ${0:#000}; snippet oc:i outline-color: invert; snippet oo - outline-offset: ${1}; + outline-offset: ${0}; snippet os - outline-style: ${1}; + outline-style: ${0}; snippet ow - outline-width: ${1}; + outline-width: ${0}; snippet o - outline: ${1}; + outline: ${0}; snippet o:n outline: none; snippet ovs - overflow-style: ${1}; + overflow-style: ${0}; snippet ovs:a overflow-style: auto; snippet ovs:mq @@ -654,7 +654,7 @@ snippet ovs:p snippet ovs:s overflow-style: scrollbar; snippet ovx - overflow-x: ${1}; + overflow-x: ${0}; snippet ovx:a overflow-x: auto; snippet ovx:h @@ -664,7 +664,7 @@ snippet ovx:s snippet ovx:v overflow-x: visible; snippet ovy - overflow-y: ${1}; + overflow-y: ${0}; snippet ovy:a overflow-y: auto; snippet ovy:h @@ -674,7 +674,7 @@ snippet ovy:s snippet ovy:v overflow-y: visible; snippet ov - overflow: ${1}; + overflow: ${0}; snippet ov:a overflow: auto; snippet ov:h @@ -684,25 +684,25 @@ snippet ov:s snippet ov:v overflow: visible; snippet pb - padding-bottom: ${1}; + padding-bottom: ${0}; snippet pl - padding-left: ${1}; + padding-left: ${0}; snippet pr - padding-right: ${1}; + padding-right: ${0}; snippet pt - padding-top: ${1}; + padding-top: ${0}; snippet p - padding: ${1}; + padding: ${0}; snippet p:4 - padding: ${1:0} ${2:0} ${3:0} ${4:0}; + padding: ${1:0} ${2:0} ${3:0} ${0:0}; snippet p:3 - padding: ${1:0} ${2:0} ${3:0}; + padding: ${1:0} ${2:0} ${0:0}; snippet p:2 - padding: ${1:0} ${2:0}; + padding: ${1:0} ${0:0}; snippet p:0 padding: 0; snippet pgba - page-break-after: ${1}; + page-break-after: ${0}; snippet pgba:aw page-break-after: always; snippet pgba:a @@ -712,7 +712,7 @@ snippet pgba:l snippet pgba:r page-break-after: right; snippet pgbb - page-break-before: ${1}; + page-break-before: ${0}; snippet pgbb:aw page-break-before: always; snippet pgbb:a @@ -722,13 +722,13 @@ snippet pgbb:l snippet pgbb:r page-break-before: right; snippet pgbi - page-break-inside: ${1}; + page-break-inside: ${0}; snippet pgbi:a page-break-inside: auto; snippet pgbi:av page-break-inside: avoid; snippet pos - position: ${1}; + position: ${0}; snippet pos:a position: absolute; snippet pos:f @@ -738,7 +738,7 @@ snippet pos:r snippet pos:s position: static; snippet q - quotes: ${1}; + quotes: ${0}; snippet q:en quotes: '\201C' '\201D' '\2018' '\2019'; snippet q:n @@ -746,7 +746,7 @@ snippet q:n snippet q:ru quotes: '\00AB' '\00BB' '\201E' '\201C'; snippet rz - resize: ${1}; + resize: ${0}; snippet rz:b resize: both; snippet rz:h @@ -756,17 +756,17 @@ snippet rz:n snippet rz:v resize: vertical; snippet r - right: ${1}; + right: ${0}; snippet r:a right: auto; snippet tbl - table-layout: ${1}; + table-layout: ${0}; snippet tbl:a table-layout: auto; snippet tbl:f table-layout: fixed; snippet tal - text-align-last: ${1}; + text-align-last: ${0}; snippet tal:a text-align-last: auto; snippet tal:c @@ -776,7 +776,7 @@ snippet tal:l snippet tal:r text-align-last: right; snippet ta - text-align: ${1}; + text-align: ${0}; snippet ta:c text-align: center; snippet ta:l @@ -784,7 +784,7 @@ snippet ta:l snippet ta:r text-align: right; snippet td - text-decoration: ${1}; + text-decoration: ${0}; snippet td:l text-decoration: line-through; snippet td:n @@ -794,7 +794,7 @@ snippet td:o snippet td:u text-decoration: underline; snippet te - text-emphasis: ${1}; + text-emphasis: ${0}; snippet te:ac text-emphasis: accent; snippet te:a @@ -810,7 +810,7 @@ snippet te:dt snippet te:n text-emphasis: none; snippet th - text-height: ${1}; + text-height: ${0}; snippet th:a text-height: auto; snippet th:f @@ -820,11 +820,11 @@ snippet th:m snippet th:t text-height: text-size; snippet ti - text-indent: ${1}; + text-indent: ${0}; snippet ti:- text-indent: -9999px; snippet tj - text-justify: ${1}; + text-justify: ${0}; snippet tj:a text-justify: auto; snippet tj:d @@ -840,23 +840,23 @@ snippet tj:k snippet tj:t text-justify: tibetan; snippet to+ - text-outline: ${1:0} ${2:0} #${3:000}; + text-outline: ${1:0} ${2:0} #${0:000}; snippet to - text-outline: ${1}; + text-outline: ${0}; snippet to:n text-outline: none; snippet tr - text-replace: ${1}; + text-replace: ${0}; snippet tr:n text-replace: none; snippet tsh+ - text-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + text-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet tsh - text-shadow: ${1}; + text-shadow: ${0}; snippet tsh:n text-shadow: none; snippet tt - text-transform: ${1}; + text-transform: ${0}; snippet tt:c text-transform: capitalize; snippet tt:l @@ -866,7 +866,7 @@ snippet tt:n snippet tt:u text-transform: uppercase; snippet tw - text-wrap: ${1}; + text-wrap: ${0}; snippet tw:no text-wrap: none; snippet tw:n @@ -876,11 +876,11 @@ snippet tw:s snippet tw:u text-wrap: unrestricted; snippet t - top: ${1}; + top: ${0}; snippet t:a top: auto; snippet va - vertical-align: ${1}; + vertical-align: ${0}; snippet va:bl vertical-align: baseline; snippet va:b @@ -898,7 +898,7 @@ snippet va:tt snippet va:t vertical-align: top; snippet v - visibility: ${1}; + visibility: ${0}; snippet v:c visibility: collapse; snippet v:h @@ -906,7 +906,7 @@ snippet v:h snippet v:v visibility: visible; snippet whsc - white-space-collapse: ${1}; + white-space-collapse: ${0}; snippet whsc:ba white-space-collapse: break-all; snippet whsc:bs @@ -918,7 +918,7 @@ snippet whsc:l snippet whsc:n white-space-collapse: normal; snippet whs - white-space: ${1}; + white-space: ${0}; snippet whs:n white-space: normal; snippet whs:nw @@ -930,13 +930,13 @@ snippet whs:pw snippet whs:p white-space: pre; snippet wid - widows: ${1}; + widows: ${0}; snippet w - width: ${1}; + width: ${0}; snippet w:a width: auto; snippet wob - word-break: ${1}; + word-break: ${0}; snippet wob:ba word-break: break-all; snippet wob:bs @@ -948,9 +948,9 @@ snippet wob:l snippet wob:n word-break: normal; snippet wos - word-spacing: ${1}; + word-spacing: ${0}; snippet wow - word-wrap: ${1}; + word-wrap: ${0}; snippet wow:no word-wrap: none; snippet wow:n @@ -960,7 +960,7 @@ snippet wow:s snippet wow:u word-wrap: unrestricted; snippet z - z-index: ${1}; + z-index: ${0}; snippet z:a z-index: auto; snippet zoo diff --git a/sources_non_forked/vim-snippets/snippets/dart.snippets b/sources_non_forked/vim-snippets/snippets/dart.snippets index 6f0b8ac5..0093f2bf 100644 --- a/sources_non_forked/vim-snippets/snippets/dart.snippets +++ b/sources_non_forked/vim-snippets/snippets/dart.snippets @@ -1,82 +1,82 @@ snippet lib #library('${1}'); - ${2} + ${0} snippet im #import('${1}'); - ${2} + ${0} snippet so #source('${1}'); - ${2} + ${0} snippet main static void main() { - ${1:/* code */} + ${0} } snippet st - static ${1} + static ${0} snippet fi - final ${1} + final ${0} snippet re - return ${1} + return ${0} snippet br break; snippet th - throw ${1} + throw ${0} snippet cl - class ${1:`Filename("", "untitled")`} ${2} + class ${1:`vim_snippets#Filename("", "untitled")`} ${0} snippet in - interface ${1:`Filename("", "untitled")`} ${2} + interface ${1:`vim_snippets#Filename("", "untitled")`} ${0} snippet imp - implements ${1} + implements ${0} snippet ext - extends ${1} + extends ${0} snippet if if (${1:true}) { - ${2} + ${0} } snippet ife if (${1:true}) { ${2} } else { - ${3} + ${0} } snippet el else snippet sw switch (${1}) { - ${2} + ${0} } snippet cs case ${1}: - ${2} + ${0} snippet de default: - ${1} + ${0} snippet for for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) { - ${4:$1[$2]} + ${0:$1[$2]} } snippet fore for (final ${2:item} in ${1:itemList}) { - ${3:/* code */} + ${0} } snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${0} } snippet dowh do { - ${2:/* code */} - } while (${1:/* condition */}); + ${0} + } while (${0:/* condition */}); snippet as - assert(${1:/* condition */}); + assert(${0:/* condition */}); snippet try try { - ${2} + ${0} } catch (${1:Exception e}) { } snippet tryf try { - ${2} + ${0} } catch (${1:Exception e}) { } finally { } diff --git a/sources_non_forked/vim-snippets/snippets/diff.snippets b/sources_non_forked/vim-snippets/snippets/diff.snippets index 7ba288de..89bc31d7 100644 --- a/sources_non_forked/vim-snippets/snippets/diff.snippets +++ b/sources_non_forked/vim-snippets/snippets/diff.snippets @@ -7,5 +7,5 @@ snippet header DEP-3 style header Author: ${6:`g:snips_author`} Reviewed-by: ${7:name and email} Last-Update: ${8:`strftime("%Y-%m-%d")`} - Applied-Upstream: ${9:upstream version|url|commit} + Applied-Upstream: ${0:upstream version|url|commit} diff --git a/sources_non_forked/vim-snippets/snippets/django.snippets b/sources_non_forked/vim-snippets/snippets/django.snippets index 8296cce2..cad80eb2 100644 --- a/sources_non_forked/vim-snippets/snippets/django.snippets +++ b/sources_non_forked/vim-snippets/snippets/django.snippets @@ -9,100 +9,100 @@ # can either not specify them, or override them, e.g. auto_now_add=False. snippet auto - ${1:FIELDNAME} = models.AutoField(${2}) + ${1:FIELDNAME} = models.AutoField(${0}) snippet bool - ${1:FIELDNAME} = models.BooleanField(${2:default=True}) + ${1:FIELDNAME} = models.BooleanField(${0:default=True}) snippet char - ${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True}) + ${1:FIELDNAME} = models.CharField(max_length=${2}${0:, blank=True}) snippet comma - ${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True}) + ${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${0:, blank=True}) snippet date - ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet datetime - ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet decimal - ${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3}) + ${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${0}) snippet email - ${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True}) + ${1:FIELDNAME} = models.EmailField(max_length=${2:75}${0:, blank=True}) snippet file - ${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, max_length=100}) + ${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${0:, max_length=100}) snippet filepath - ${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${6:, blank=True, }) + ${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${0:, blank=True, }) snippet float - ${1:FIELDNAME} = models.FloatField(${2}) + ${1:FIELDNAME} = models.FloatField(${0}) snippet image - ${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100}) + ${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${0:, max_length=100}) snippet int - ${1:FIELDNAME} = models.IntegerField(${2}) + ${1:FIELDNAME} = models.IntegerField(${0}) snippet ip - ${1:FIELDNAME} = models.IPAddressField(${2}) + ${1:FIELDNAME} = models.IPAddressField(${0}) snippet nullbool - ${1:FIELDNAME} = models.NullBooleanField(${2}) + ${1:FIELDNAME} = models.NullBooleanField(${0}) snippet posint - ${1:FIELDNAME} = models.PositiveIntegerField(${2}) + ${1:FIELDNAME} = models.PositiveIntegerField(${0}) snippet possmallint - ${1:FIELDNAME} = models.PositiveSmallIntegerField(${2}) + ${1:FIELDNAME} = models.PositiveSmallIntegerField(${0}) snippet slug - ${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True}) + ${1:FIELDNAME} = models.SlugField(max_length=${2:50}${0:, blank=True}) snippet smallint - ${1:FIELDNAME} = models.SmallIntegerField(${2}) + ${1:FIELDNAME} = models.SmallIntegerField(${0}) snippet text - ${1:FIELDNAME} = models.TextField(${2:blank=True}) + ${1:FIELDNAME} = models.TextField(${0:blank=True}) snippet time - ${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet url - ${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True}) + ${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${0:, blank=True}) snippet xml - ${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True}) + ${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${0:, blank=True}) # Relational Fields snippet fk - ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''}) + ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${0:, to_field=''}) snippet m2m - ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''}) + ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${0:, db_table=''}) snippet o2o - ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''}) + ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${0:, to_field=''}) # Code Skeletons snippet form class ${1:FormName}(forms.Form): """${2:docstring}""" - ${3} + ${0} snippet model class ${1:ModelName}(models.Model): """${2:docstring}""" ${3} - + class Meta: ${4} - + def __unicode__(self): ${5} - + def save(self, force_insert=False, force_update=False): ${6} - + @models.permalink def get_absolute_url(self): - return ('${7:view_or_url_name}' ${8}) + return ('${7:view_or_url_name}' ${0}) snippet modeladmin class ${1:ModelName}Admin(admin.ModelAdmin): - ${2} - + ${0} + admin.site.register($1, $1Admin) - + snippet tabularinline - class ${1:ModelName}Inline(admin.TabularInline): + class ${0:ModelName}Inline(admin.TabularInline): model = $1 snippet stackedinline - class ${1:ModelName}Inline(admin.StackedInline): + class ${0:ModelName}Inline(admin.StackedInline): model = $1 snippet r2r return render_to_response('${1:template.html}', { ${2} - }${3:, context_instance=RequestContext(request)} + }${0:, context_instance=RequestContext(request)} ) diff --git a/sources_non_forked/vim-snippets/snippets/dosini.snippets b/sources_non_forked/vim-snippets/snippets/dosini.snippets new file mode 100644 index 00000000..95c759cb --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/dosini.snippets @@ -0,0 +1,12 @@ +snippet ec + ; http://editorconfig.org + + root = true + + [*] + indent_style = ${1:space_or_tab} + indent_size = ${2:indent_size} + end_of_line = lf + charset = utf-8 + trim_trailing_whitespace = true + insert_final_newline = true diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets new file mode 100644 index 00000000..54aa180b --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -0,0 +1,127 @@ +snippet do + do + ${0} + end +snippet if if .. do .. end + if ${1} do + ${0} + end + +snippet if if .. do: .. + if ${1:condition}, do: ${0} + +snippet ife if .. do .. else .. end + if ${1:condition} do + ${2} + else + ${0} + end + +snippet ife if .. do: .. else: + if ${1:condition}, do: ${2}, else: ${0} + +snippet unless unless .. do .. end + unless ${1} do + ${0} + end + +snippet unless unless .. do: .. + unless ${1:condition}, do: ${0} + +snippet unlesse unless .. do .. else .. end + unless ${1:condition} do + ${2} + else + ${0} + end + +snippet unlesse unless .. do: .. else: + unless ${1:condition}, do: ${2}, else: ${0} + +snippet cond + cond do + ${1} -> + ${0} + end + +snippet case + case ${1} do + ${2} -> + ${0} + end + +snippet def + def ${1:name} do + ${0} + end + +snippet defim + defimpl ${1:protocol_name}, for: ${2:data_type} do + ${0} + end + +snippet defma + defmacro ${1:name} do + ${0} + end + +snippet defmo + defmodule ${1:module_name} do + ${0} + end + +snippet defp + defp ${1:name} do + ${0} + end + +snippet defpr + defprotocol ${1:name}, [${0:function}] + +snippet defr + defrecord ${1:record_name}, ${0:fields} + +snippet doc + @doc """ + ${0} + """ + +snippet fn + fn(${1:args}) -> ${0} end + +snippet fun + function do + ${0} + end + +snippet mdoc + @moduledoc """ + ${0} + """ + +snippet rec + receive do + ${1} -> + ${0} + end + +snippet req + require ${0:module_name} + +snippet imp + import ${0:module_name} + +snippet ali + alias ${0:module_name} + +snippet test + test "${1:test_name}" do + ${0} + end + +snippet try try .. rescue .. end + try do + ${1} + rescue + ${2} -> ${0} + end diff --git a/sources_non_forked/vim-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets index acc6fd19..88458703 100644 --- a/sources_non_forked/vim-snippets/snippets/erlang.snippets +++ b/sources_non_forked/vim-snippets/snippets/erlang.snippets @@ -1,79 +1,82 @@ # module and export all snippet mod - -module(${1:`Filename('', 'my')`}). - + -module(${1:`vim_snippets#Filename('', 'my')`}). + -compile([export_all]). - + start() -> - ${2} - + ${0} + stop() -> ok. # define directive snippet def - -define(${1:macro}, ${2:body}).${3} + -define(${1:macro}, ${2:body}). # export directive snippet exp - -export([${1:function}/${2:arity}]). + -export([${1:function}/${0:arity}]). # include directive snippet inc - -include("${1:file}").${2} + -include("${1:file}"). +# include_lib directive +snippet incl + -include_lib("${1:lib}/include/${1}.hrl").${2} # behavior directive snippet beh - -behaviour(${1:behaviour}).${2} + -behaviour(${1:behaviour}). # if expression snippet if if ${1:guard} -> - ${2:body} + ${0:body} end # case expression snippet case case ${1:expression} of ${2:pattern} -> - ${3:body}; + ${0:body}; end # anonymous function snippet fun - fun (${1:Parameters}) -> ${2:body} end${3} + fun (${1:Parameters}) -> ${2:body} end # try...catch snippet try try ${1} catch - ${2:_:_} -> ${3:got_some_exception} + ${2:_:_} -> ${0:got_some_exception} end # record directive snippet rec -record(${1:record}, { - ${2:field}=${3:value}}).${4} + ${2:field}=${3:value}}). # todo comment snippet todo - %% TODO: ${1} + %% TODO: ${0} ## Snippets below (starting with '%') are in EDoc format. ## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details # doc comment snippet %d - %% @doc ${1} + %% @doc ${0} # end of doc comment snippet %e %% @end # specification comment snippet %s - %% @spec ${1} + %% @spec ${0} # private function marker snippet %p %% @private # OTP application snippet application - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -behaviour(application). -export([start/2, stop/1]). start(_Type, _StartArgs) -> - case ${2:root_supervisor}:start_link() of + case ${0:root_supervisor}:start_link() of {ok, Pid} -> {ok, Pid}; Other -> @@ -81,10 +84,10 @@ snippet application end. stop(_State) -> - ok. + ok. # OTP supervisor snippet supervisor - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -behaviour(supervisor). @@ -100,14 +103,14 @@ snippet supervisor supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> - Server = {${2:my_server}, {$2, start_link, []}, + Server = {${0:my_server}, {$2, start_link, []}, permanent, 2000, worker, [$2]}, Children = [Server], RestartStrategy = {one_for_one, 0, 1}, {ok, {RestartStrategy, Children}}. # OTP gen_server snippet gen_server - -module(${1:`Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename('', 'my')`}). -behaviour(gen_server). @@ -157,4 +160,194 @@ snippet gen_server %%%=================================================================== %%% Internal functions %%%=================================================================== +# common_test test_SUITE +snippet testsuite + -module(${0:`vim_snippets#Filename('', 'my')`}). + + -include_lib("common_test/include/ct.hrl"). + + %% Test server callbacks + -export([suite/0, all/0, groups/0, + init_per_suite/1, end_per_suite/1, + init_per_group/2, end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). + + %% Test cases + -export([ + ]). + + %%-------------------------------------------------------------------- + %% COMMON TEST CALLBACK FUNCTIONS + %%-------------------------------------------------------------------- + + %%-------------------------------------------------------------------- + %% Function: suite() -> Info + %% + %% Info = [tuple()] + %% List of key/value pairs. + %% + %% Description: Returns list of tuples to set default properties + %% for the suite. + %% + %% Note: The suite/0 function is only meant to be used to return + %% default data values, not perform any other operations. + %%-------------------------------------------------------------------- + suite() -> + [{timetrap,{minutes,10}}]. + + %%-------------------------------------------------------------------- + %% Function: init_per_suite(Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the suite. + %% + %% Description: Initialization before the suite. + %% + %% Note: This function is free to add any key/value pairs to the Config + %% variable, but should NOT alter/remove any existing entries. + %%-------------------------------------------------------------------- + init_per_suite(Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_suite(Config0) -> void() | {save_config,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% + %% Description: Cleanup after the suite. + %%-------------------------------------------------------------------- + end_per_suite(_Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: init_per_group(GroupName, Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% GroupName = atom() + %% Name of the test case group that is about to run. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding configuration data for the group. + %% Reason = term() + %% The reason for skipping all test cases and subgroups in the group. + %% + %% Description: Initialization before each test case group. + %%-------------------------------------------------------------------- + init_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_group(GroupName, Config0) -> + %% void() | {save_config,Config1} + %% + %% GroupName = atom() + %% Name of the test case group that is finished. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding configuration data for the group. + %% + %% Description: Cleanup after each test case group. + %%-------------------------------------------------------------------- + end_per_group(_GroupName, _Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: init_per_testcase(TestCase, Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% TestCase = atom() + %% Name of the test case that is about to run. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the test case. + %% + %% Description: Initialization before each test case. + %% + %% Note: This function is free to add any key/value pairs to the Config + %% variable, but should NOT alter/remove any existing entries. + %%-------------------------------------------------------------------- + init_per_testcase(_TestCase, Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_testcase(TestCase, Config0) -> + %% void() | {save_config,Config1} | {fail,Reason} + %% + %% TestCase = atom() + %% Name of the test case that is finished. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for failing the test case. + %% + %% Description: Cleanup after each test case. + %%-------------------------------------------------------------------- + end_per_testcase(_TestCase, _Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: groups() -> [Group] + %% + %% Group = {GroupName,Properties,GroupsAndTestCases} + %% GroupName = atom() + %% The name of the group. + %% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] + %% Group properties that may be combined. + %% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] + %% TestCase = atom() + %% The name of a test case. + %% Shuffle = shuffle | {shuffle,Seed} + %% To get cases executed in random order. + %% Seed = {integer(),integer(),integer()} + %% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | + %% repeat_until_any_ok | repeat_until_any_fail + %% To get execution of cases repeated. + %% N = integer() | forever + %% + %% Description: Returns a list of test case group definitions. + %%-------------------------------------------------------------------- + groups() -> + []. + + %%-------------------------------------------------------------------- + %% Function: all() -> GroupsAndTestCases | {skip,Reason} + %% + %% GroupsAndTestCases = [{group,GroupName} | TestCase] + %% GroupName = atom() + %% Name of a test case group. + %% TestCase = atom() + %% Name of a test case. + %% Reason = term() + %% The reason for skipping all groups and test cases. + %% + %% Description: Returns the list of groups and test cases that + %% are to be executed. + %%-------------------------------------------------------------------- + all() -> + []. + + + %%-------------------------------------------------------------------- + %% TEST CASES + %%-------------------------------------------------------------------- + + %%-------------------------------------------------------------------- + %% Function: TestCase(Config0) -> + %% ok | exit() | {skip,Reason} | {comment,Comment} | + %% {save_config,Config1} | {skip_and_save,Reason,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the test case. + %% Comment = term() + %% A comment about the test case that will be printed in the html log. + %% + %% Description: Test case function. (The name of it must be specified in + %% the all/0 list or in a test case group for the test case + %% to be executed). + %%-------------------------------------------------------------------- diff --git a/sources_non_forked/vim-snippets/snippets/eruby.snippets b/sources_non_forked/vim-snippets/snippets/eruby.snippets index 592e490b..95418350 100644 --- a/sources_non_forked/vim-snippets/snippets/eruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/eruby.snippets @@ -4,110 +4,124 @@ # Rails ***************************** snippet rc - <% ${1} %> + <% ${0} %> snippet rce - <%= ${1} %>${2} + <%= ${1} %> snippet % - <% ${1} %> + <% ${0} %> snippet = - <%= ${1} %>${2} + <%= ${1} %> snippet end - <% end %>${1} + <% end %> snippet ead <% ${1}.each do |${2}| %> - ${3} + ${0} <% end %> snippet for <% for ${2:item} in ${1} %> - ${3} + ${0} <% end %> snippet rp - <%= render :partial => '${1:item}' %> + <%= render :partial => '${0:item}' %> snippet rpl - <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %> + <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %> snippet rps - <%= render :partial => '${1:item}', :status => ${2:500} %> + <%= render :partial => '${1:item}', :status => ${0:500} %> snippet rpc - <%= render :partial => '${1:item}', :collection => ${2:items} %> + <%= render :partial => '${1:item}', :collection => ${0:items} %> snippet lia - <%= link_to '${1:link text...}', :action => '${2:index}' %> + <%= link_to '${1:link text...}', :action => '${0:index}' %> snippet liai - <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %> + <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %> snippet lic - <%= link_to '${1:link text...}', :controller => '${2:items}' %> + <%= link_to '${1:link text...}', :controller => '${0:items}' %> snippet lica - <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %> + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %> snippet licai - <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %> + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %> snippet yield - <%= yield ${1::content_symbol} %>${2} + <%= yield ${1::content_symbol} %> snippet conf <% content_for :${1:head} do %> - ${2} + ${0} <% end %> snippet cs <%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %> snippet ct - <%= content_tag '${1:DIV}', ${2:content}${3:,options} %> + <%= content_tag '${1:DIV}', ${2:content}${0:,options} %> snippet ff <%= form_for @${1:model} do |f| %> - ${2} + ${0} <% end %> +snippet ffi + <%= ${1:f}.input :${0:attribute} %> snippet ffcb - <%= ${1:f}.check_box :${2:attribute} %> + <%= ${1:f}.check_box :${0:attribute} %> snippet ffe <% error_messages_for :${1:model} %> <%= form_for @${2:model} do |f| %> - ${3} + ${0} <% end %> snippet ffff - <%= ${1:f}.file_field :${2:attribute} %> + <%= ${1:f}.file_field :${0:attribute} %> snippet ffhf - <%= ${1:f}.hidden_field :${2:attribute} %> + <%= ${1:f}.hidden_field :${0:attribute} %> snippet ffl - <%= ${1:f}.label :${2:attribute}, '${3:$2}' %> + <%= ${1:f}.label :${2:attribute}, '${0:$2}' %> snippet ffpf - <%= ${1:f}.password_field :${2:attribute} %> + <%= ${1:f}.password_field :${0:attribute} %> snippet ffrb - <%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %> + <%= ${1:f}.radio_button :${2:attribute}, :${0:tag_value} %> snippet ffs - <%= ${1:f}.submit "${2:submit}" %> + <%= ${1:f}.submit "${0:submit}" %> snippet ffta - <%= ${1:f}.text_area :${2:attribute} %> + <%= ${1:f}.text_area :${0:attribute} %> snippet fftf - <%= ${1:f}.text_field :${2:attribute} %> + <%= ${1:f}.text_field :${0:attribute} %> snippet fields <%= fields_for :${1:model}, @$1 do |${2:f}| %> - ${3} + ${0} <% end %> snippet i18 - I18n.t('${1:type.key}')${2} + I18n.t('${1:type.key}') snippet it - <%= image_tag "${1}"${2} %> + <%= image_tag "${1}"${0} %> snippet jit - <%= javascript_include_tag ${1::all} %> + <%= javascript_include_tag ${0::all} %> snippet jsit - <%= javascript_include_tag "${1}" %> + <%= javascript_include_tag "${0}" %> snippet lim - <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %> + <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${0:$1}) %> snippet linp - <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %> + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${0:@$3}) %> snippet linpp - <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %> + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${0:@$2}) %> snippet lip - <%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %> + <%= link_to "${1:Link text...}", ${2:model}_path(${0:@$2}) %> snippet lipp - <%= link_to "${1:Link text...}", ${2:model}s_path %> + <%= link_to "${1:Link text...}", ${0:model}s_path %> snippet lt - <%= link_to "${1:name}", ${2:dest} %> + <%= link_to "${1:name}", ${0:dest} %> +snippet ntc + <%= number_to_currency(${1}) %> snippet ofcfs - <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %> + <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %> snippet rf - <%= render :file => "${1:file}"${2} %> + <%= render :file => "${1:file}"${0} %> snippet rt - <%= render :template => "${1:file}"${2} %> + <%= render :template => "${1:file}"${0} %> snippet slt - <%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %> + <%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %> snippet sslt - <%= stylesheet_link_tag "${1}" %> + <%= stylesheet_link_tag "${0}" %> +snippet if + <% if ${1} %> + ${0} + <% end %> +snippet ife + <% if ${1} %> + ${2} + <% else %> + ${0} + <% end %> diff --git a/sources_non_forked/vim-snippets/snippets/falcon.snippets b/sources_non_forked/vim-snippets/snippets/falcon.snippets index 85fb918d..c523980d 100644 --- a/sources_non_forked/vim-snippets/snippets/falcon.snippets +++ b/sources_non_forked/vim-snippets/snippets/falcon.snippets @@ -1,71 +1,71 @@ snippet #! #!/usr/bin/env falcon -# Import +# Import snippet imp - import ${1:module} + import ${0:module} # Function snippet fun - function ${2:function_name}(${3}) - ${4:/* code */} - end + function ${2:function_name}(${3}) + ${0} + end # Class snippet class class ${1:class_name}(${2:class_params}) - ${3:/* members/methods */} + ${0:/* members/methods */} end -# If +# If snippet if if ${1:condition} - ${2:/* code */} + ${0} end # If else snippet ife if ${1:condition} - ${2:/* code */} + ${0} else - ${1} + ${1} end -# If else if -snippet elif +# If else if +snippet eif elif ${1:condition} - ${2:/* code */} + ${0} # Switch case snippet switch switch ${1:expression} case ${2:item} - case ${3:item} - default + case ${0:item} + default end # Select -snippet select +snippet select select ${1:variable} case ${2:TypeSpec} - case ${3:TypeSpec} + case ${0:TypeSpec} default end # For/in Loop snippet forin for ${1:element} in ${2:container} - ${3:/* code */} + ${0} end # For/to Loop snippet forto for ${1:lowerbound} to ${2:upperbound} - ${3:/* code */} + ${0} end # While Loop -snippet while +snippet wh while ${1:conidition} - ${2:/* code */} + ${0} end diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index c64db91f..0239a3fb 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -1,10 +1,24 @@ +# shorthand variable declaration +snippet v + ${1} := ${2} +# variable initialization +snippet vr + var ${1:t} ${0:string} +# variable declaration +snippet var + var ${1} ${2} = ${3} +# variables declaration +snippet vars + var ( + ${1} ${2} = ${3} + ) # append snippet ap - append(${1:slice}, ${2:value}) + append(${1:slice}, ${0:value}) # bool snippet bl bool -# byte +# byte snippet bt byte # break @@ -12,31 +26,31 @@ snippet br break # channel snippet ch - chan ${1:int} + chan ${0:int} # case snippet cs case ${1:value}: - ${2:/* code */} + ${0} # const snippet c - const ${1:NAME} = ${2:0} + const ${1:NAME} = ${0:0} # constants with iota snippet co const ( ${1:NAME1} = iota - ${2:NAME2} + ${0:NAME2} ) # continue snippet cn continue -# defer +# defer snippet df - defer ${1:func}() + defer ${0:func}() # defer recover snippet dfr defer func() { if err := recover(); err != nil { - ${1:/* code */} + ${0} } }() # gpl @@ -57,40 +71,40 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - - ${2} + + ${0} # int snippet i int -# import +# import snippet im import ( - "${1:package}" - )${2} -# interface + "${1:package}" + ) +# interface snippet in interface{} -# full interface snippet +# full interface snippet snippet inf interface ${1:name} { ${2:/* methods */} - }${3} + } # if condition snippet if if ${1:/* condition */} { - ${2:/* code */} - }${2} + ${2} + } # else snippet snippet el else { ${1} - }${2} + } # error snippet snippet ir if err != nil { return err } - ${1} + ${0} # false snippet f false @@ -109,80 +123,80 @@ snippet f6 # if else snippet ie if ${1:/* condition */} { - ${2:/* code */} + ${2} } else { ${3} } - ${4} + ${0} # for loop snippet fo for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { - ${4:/* code */} + ${4} } - ${5} + ${0} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { - ${4:/* code */} + ${4} } - ${5} -# function simple + ${0} +# function simple snippet fun func ${1:funcName}(${2}) ${3:error} { - ${4:/* code */} + ${4} } - ${5} -# function on receiver + ${0} +# function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { - ${5:/* code */} + ${5} } - ${6} + ${0} # log printf snippet lf - log.Printf("%${1:s}", ${2:var})${3} + log.Printf("%${1:s}", ${2:var}) # log printf snippet lp - log.Println("${1}")${2} + log.Println("${1}") # make snippet mk - make(${1:[]string}, ${2:0}) -# map + make(${1:[]string}, ${0:0}) +# map snippet mp - map[${1:string}]${2:int} + map[${1:string}]${0:int} # main() snippet main func main() { - ${1:/* code */} + ${1} } - ${2} + ${0} # new snippet nw - new(${1:type}) -# panic + new(${0:type}) +# panic snippet pn - panic("${1:msg}") + panic("${0:msg}") # print snippet pr - fmt.Printf("%${1:s}\n", ${2:var})${3} -# range + fmt.Printf("%${1:s}\n", ${2:var}) +# range snippet rn - range ${1} -# return + range ${0} +# return snippet rt - return ${1} -# result + return ${0} +# result snippet rs result # select snippet sl select { case ${1:v1} := <-${2:chan1} - ${3:/* code */} + ${3} case ${4:v2} := <-${5:chan2} - ${6:/* code */} + ${6} default: - ${7:/* code */} + ${0} } # string snippet sr @@ -192,22 +206,27 @@ snippet st struct ${1:name} { ${2:/* data */} } - ${3} -# switch + ${0} +# switch snippet sw switch ${1:var} { case ${2:value1}: - ${3:/* code */} + ${3} case ${4:value2}: - ${5:/* code */} + ${5} default: - ${6:/* code */} + ${0} } snippet sp - fmt.Sprintf("%${1:s}", ${2:var})${3} -# true + fmt.Sprintf("%${1:s}", ${2:var}) +# true snippet t true -# variable declaration -snippet v - var ${1:t} ${2:string} +# goroutine named function +snippet g + go ${1:funcName}(${0}) +# goroutine anonymous function +snippet ga + go func(${1} ${2:type}) { + ${3:/* code */} + }(${0}) diff --git a/sources_non_forked/vim-snippets/snippets/haml.snippets b/sources_non_forked/vim-snippets/snippets/haml.snippets index 61e9cf28..09217c6c 100644 --- a/sources_non_forked/vim-snippets/snippets/haml.snippets +++ b/sources_non_forked/vim-snippets/snippets/haml.snippets @@ -5,16 +5,33 @@ snippet t ${1:headers} %tr %td - ${2:headers} + ${0:headers} snippet ul %ul %li - ${1:item} + ${0:item} %li -snippet =rp - = render :partial => '${1:partial}' -snippet =rpl - = render :partial => '${1:partial}', :locals => {} -snippet =rpc - = render :partial => '${1:partial}', :collection => @$1 - +snippet rp + = render :partial => "${0:item}" +snippet rpc + = render :partial => "${1:item}", :collection => ${0:@$1s} +snippet rpl + = render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} +snippet rpo + = render :partial => "${1:item}", :object => ${0:@$1} +snippet lt + = link_to ${1:name}, ${2:dest} +snippet mt + = mail_to ${1:email_address}, ${2:name} +snippet mts + = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} +snippet ife + - if ${1:condition} + ${2} + - else + ${0} +snippet ifp + - if ${1:condition}.presence? + ${0} +snippet ntc + = number_to_currency(${1}) diff --git a/sources_non_forked/vim-snippets/snippets/haskell.snippets b/sources_non_forked/vim-snippets/snippets/haskell.snippets index bcda8a5b..f5f15984 100644 --- a/sources_non_forked/vim-snippets/snippets/haskell.snippets +++ b/sources_non_forked/vim-snippets/snippets/haskell.snippets @@ -1,5 +1,5 @@ snippet lang - {-# LANGUAGE ${1:OverloadedStrings} #-} + {-# LANGUAGE ${0:OverloadedStrings} #-} snippet info -- | -- Module : ${1:Module.Namespace} @@ -10,26 +10,26 @@ snippet info -- Stability : ${6:experimental} -- Portability : ${7:unknown} -- - -- ${8:Description} + -- ${0:Description} -- snippet import - import ${1:Data.Text} + import ${0:Data.Text} snippet import2 - import ${1:Data.Text} (${2:head}) + import ${1:Data.Text} (${0:head}) snippet importq - import qualified ${1:Data.Text} as ${2:T} + import qualified ${1:Data.Text} as ${0:T} snippet inst instance ${1:Monoid} ${2:Type} where - ${3} + ${0} snippet type - type ${1:Type} = ${2:Type} + type ${1:Type} = ${0:Type} snippet data - data ${1:Type} = ${2:$1} ${3:Int} + data ${1:Type} = ${2:$1} ${0:Int} snippet newtype - newtype ${1:Type} = ${2:$1} ${3:Int} + newtype ${1:Type} = ${2:$1} ${0:Int} snippet class class ${1:Class} a where - ${2} + ${0} snippet module module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( ) where @@ -37,46 +37,46 @@ snippet module snippet const ${1:name} :: ${2:a} - $1 = ${3:undefined} + $1 = ${0:undefined} snippet fn ${1:fn} :: ${2:a} -> ${3:a} - $1 ${4} = ${5:undefined} + $1 ${4} = ${0:undefined} snippet fn2 ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} - $1 ${5} = ${6:undefined} + $1 ${5} = ${0:undefined} snippet ap - ${1:map} ${2:fn} ${3:list} + ${1:map} ${2:fn} ${0:list} snippet do do - + snippet λ - \${1:x} -> ${2} + \${1:x} -> ${0} snippet \ - \${1:x} -> ${2} + \${1:x} -> ${0} snippet <- - ${1:a} <- ${2:m a} + ${1:a} <- ${0:m a} snippet ← - ${1:a} <- ${2:m a} + ${1:a} <- ${0:m a} snippet -> - ${1:m a} -> ${2:a} + ${1:m a} -> ${0:a} snippet → - ${1:m a} -> ${2:a} + ${1:m a} -> ${0:a} snippet tup - (${1:a}, ${2:b}) + (${1:a}, ${0:b}) snippet tup2 - (${1:a}, ${2:b}, ${3:c}) + (${1:a}, ${2:b}, ${0:c}) snippet tup3 - (${1:a}, ${2:b}, ${3:c}, ${4:d}) + (${1:a}, ${2:b}, ${3:c}, ${0:d}) snippet rec ${1:Record} { ${2:recFieldA} = ${3:undefined} - , ${4:recFieldB} = ${5:undefined} + , ${4:recFieldB} = ${0:undefined} } snippet case case ${1:something} of - ${2} -> ${3} + ${2} -> ${0} snippet let let ${1} = ${2} in ${3} snippet where where - ${1:fn} = ${2:undefined} + ${1:fn} = ${0:undefined} diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index cfc44ad1..f25e1bc7 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -97,532 +97,532 @@ snippet docx "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> # Attributes snippet attr - ${1:attribute}="${2:property}" + ${1:attribute}="${0:property}" snippet attr+ - ${1:attribute}="${2:property}" attr+${3} + ${1:attribute}="${2:property}" attr+ snippet . - class="${1}"${2} + class="${1}" snippet # - id="${1}"${2} + id="${1}" snippet alt - alt="${1}"${2} + alt="${1}" snippet charset - charset="${1:utf-8}"${2} + charset="${1:utf-8}" snippet data - data-${1}="${2:$1}"${3} + data-${1}="${2:$1}" snippet for - for="${1}"${2} + for="${1}" snippet height - height="${1}"${2} + height="${1}" snippet href - href="${1:#}"${2} + href="${1:#}" snippet lang - lang="${1:en}"${2} + lang="${1:en}" snippet media - media="${1}"${2} + media="${1}" snippet name - name="${1}"${2} + name="${1}" snippet rel - rel="${1}"${2} + rel="${1}" snippet scope - scope="${1:row}"${2} + scope="${1:row}" snippet src - src="${1}"${2} + src="${1}" snippet title= - title="${1}"${2} + title="${1}" snippet type - type="${1}"${2} + type="${1}" snippet value - value="${1}"${2} + value="${1}" snippet width - width="${1}"${2} + width="${1}" # Elements snippet a - ${2:$1} + ${0:$1} snippet a. - ${3:$1} + ${0:$1} snippet a# - ${3:$1} + ${0:$1} snippet a:ext - ${2:$1} + ${0:$1} snippet a:mail - ${3:email me} + ${0:email me} snippet abbr - ${2} + ${0} snippet address