From 72006e9c21421baab4131d8cd83e35cbd208046a Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 5 Apr 2017 14:50:44 +0100 Subject: [PATCH] Stop using submodules and use native Vim8 plugin system --- bundle/TextFormat | 1 - bundle/jellybeans.vim | 1 - bundle/mom.vim | 1 - bundle/rust.vim | 1 - bundle/vim-airline | 1 - bundle/vim-pathogen | 1 - bundle/vim-ps1 | 1 - bundle/vim-sensible | 1 - bundle/vim-surround | 1 - pack/acp/README.md | 13 + pack/acp/start/TextFormat/README | 17 + .../start/TextFormat/autoload/textformat.vim | 610 +++++++++ pack/acp/start/TextFormat/doc/textformat.txt | 301 +++++ .../start/TextFormat/plugin/textformat.vim | 66 + pack/acp/start/jellybeans.vim/.gitignore | 3 + pack/acp/start/jellybeans.vim/README.markdown | 116 ++ .../start/jellybeans.vim/ansi-term-colors.txt | 8 + .../jellybeans.vim/colors/jellybeans.vim | 668 ++++++++++ pack/acp/start/mom.vim/README | 6 + pack/acp/start/mom.vim/syntax/mom.vim | 143 +++ pack/acp/start/rust.vim/.gitignore | 1 + pack/acp/start/rust.vim/LICENSE-APACHE | 201 +++ pack/acp/start/rust.vim/LICENSE-MIT | 25 + pack/acp/start/rust.vim/README.md | 87 ++ pack/acp/start/rust.vim/after/syntax/rust.vim | 34 + pack/acp/start/rust.vim/autoload/rust.vim | 414 ++++++ pack/acp/start/rust.vim/autoload/rustfmt.vim | 106 ++ pack/acp/start/rust.vim/compiler/cargo.vim | 28 + pack/acp/start/rust.vim/compiler/rustc.vim | 45 + pack/acp/start/rust.vim/doc/rust.txt | 237 ++++ pack/acp/start/rust.vim/ftdetect/rust.vim | 1 + pack/acp/start/rust.vim/ftplugin/rust.vim | 207 +++ pack/acp/start/rust.vim/indent/rust.vim | 206 +++ pack/acp/start/rust.vim/plugin/rust.vim | 22 + pack/acp/start/rust.vim/syntax/rust.vim | 294 +++++ .../rust.vim/syntax_checkers/rust/rustc.vim | 48 + pack/acp/start/vim-airline/.gitignore | 4 + pack/acp/start/vim-airline/.travis.yml | 8 + pack/acp/start/vim-airline/CHANGELOG.md | 120 ++ pack/acp/start/vim-airline/CONTRIBUTING.md | 32 + pack/acp/start/vim-airline/Gemfile | 2 + pack/acp/start/vim-airline/ISSUE_TEMPLATE.md | 21 + pack/acp/start/vim-airline/LICENSE | 21 + pack/acp/start/vim-airline/README.md | 253 ++++ pack/acp/start/vim-airline/Rakefile | 14 + .../start/vim-airline/autoload/airline.vim | 195 +++ .../vim-airline/autoload/airline/builder.vim | 205 +++ .../vim-airline/autoload/airline/debug.vim | 52 + .../autoload/airline/extensions.vim | 334 +++++ .../autoload/airline/extensions/ale.vim | 36 + .../autoload/airline/extensions/branch.vim | 403 ++++++ .../airline/extensions/bufferline.vim | 25 + .../autoload/airline/extensions/capslock.vim | 17 + .../autoload/airline/extensions/commandt.vim | 18 + .../autoload/airline/extensions/csv.vim | 33 + .../autoload/airline/extensions/ctrlp.vim | 82 ++ .../autoload/airline/extensions/ctrlspace.vim | 19 + .../autoload/airline/extensions/default.vim | 101 ++ .../autoload/airline/extensions/denite.vim | 43 + .../autoload/airline/extensions/eclim.vim | 62 + .../autoload/airline/extensions/example.vim | 56 + .../autoload/airline/extensions/hunks.vim | 96 ++ .../autoload/airline/extensions/neomake.vim | 25 + .../autoload/airline/extensions/netrw.vim | 34 + .../autoload/airline/extensions/nrrwrgn.vim | 57 + .../autoload/airline/extensions/obsession.vim | 22 + .../autoload/airline/extensions/po.vim | 93 ++ .../airline/extensions/promptline.vim | 35 + .../autoload/airline/extensions/quickfix.vim | 53 + .../autoload/airline/extensions/syntastic.vim | 21 + .../autoload/airline/extensions/tabline.vim | 193 +++ .../airline/extensions/tabline/autoshow.vim | 55 + .../airline/extensions/tabline/buffers.vim | 251 ++++ .../airline/extensions/tabline/buflist.vim | 44 + .../airline/extensions/tabline/ctrlspace.vim | 150 +++ .../extensions/tabline/formatters/default.vim | 41 + .../tabline/formatters/unique_tail.vim | 34 + .../formatters/unique_tail_improved.vim | 91 ++ .../airline/extensions/tabline/tabs.vim | 112 ++ .../autoload/airline/extensions/tagbar.vim | 47 + .../autoload/airline/extensions/tmuxline.vim | 28 + .../autoload/airline/extensions/undotree.vim | 29 + .../autoload/airline/extensions/unicode.vim | 24 + .../autoload/airline/extensions/unite.vim | 25 + .../autoload/airline/extensions/vimagit.vim | 30 + .../airline/extensions/virtualenv.vim | 31 + .../airline/extensions/whitespace.vim | 163 +++ .../airline/extensions/windowswap.vim | 29 + .../autoload/airline/extensions/wordcount.vim | 39 + .../wordcount/formatters/default.vim | 60 + .../autoload/airline/extensions/xkblayout.vim | 25 + .../autoload/airline/extensions/ycm.vim | 38 + .../autoload/airline/highlighter.vim | 225 ++++ .../vim-airline/autoload/airline/init.vim | 197 +++ .../vim-airline/autoload/airline/msdos.vim | 59 + .../vim-airline/autoload/airline/parts.vim | 99 ++ .../vim-airline/autoload/airline/section.vim | 85 ++ .../vim-airline/autoload/airline/themes.vim | 73 ++ .../autoload/airline/themes/dark.vim | 103 ++ .../vim-airline/autoload/airline/util.vim | 107 ++ pack/acp/start/vim-airline/doc/airline.txt | 1114 +++++++++++++++++ pack/acp/start/vim-airline/plugin/airline.vim | 150 +++ pack/acp/start/vim-airline/t/airline.vim | 87 ++ pack/acp/start/vim-airline/t/builder.vim | 106 ++ pack/acp/start/vim-airline/t/commands.vim | 35 + .../vim-airline/t/extensions_default.vim | 31 + pack/acp/start/vim-airline/t/highlighter.vim | 21 + pack/acp/start/vim-airline/t/init.vim | 78 ++ pack/acp/start/vim-airline/t/parts.vim | 39 + pack/acp/start/vim-airline/t/section.vim | 81 ++ pack/acp/start/vim-airline/t/themes.vim | 68 + pack/acp/start/vim-airline/t/util.vim | 54 + .../start/vim-pathogen/CONTRIBUTING.markdown | 14 + pack/acp/start/vim-pathogen/README.markdown | 141 +++ .../start/vim-pathogen/autoload/pathogen.vim | 289 +++++ pack/acp/start/vim-ps1/.gitignore | 1 + pack/acp/start/vim-ps1/README.markdown | 90 ++ pack/acp/start/vim-ps1/doc/ps1.txt | 38 + pack/acp/start/vim-ps1/ftdetect/ps1.vim | 11 + pack/acp/start/vim-ps1/ftdetect/ps1xml.vim | 8 + pack/acp/start/vim-ps1/ftdetect/xml.vim | 9 + pack/acp/start/vim-ps1/ftplugin/ps1.vim | 36 + pack/acp/start/vim-ps1/ftplugin/ps1xml.vim | 33 + pack/acp/start/vim-ps1/indent/ps1.vim | 20 + pack/acp/start/vim-ps1/syntax/ps1.vim | 185 +++ pack/acp/start/vim-ps1/syntax/ps1xml.vim | 56 + pack/acp/start/vim-sensible/README.markdown | 95 ++ .../start/vim-sensible/plugin/sensible.vim | 93 ++ pack/acp/start/vim-surround/.gitignore | 1 + pack/acp/start/vim-surround/README.markdown | 97 ++ pack/acp/start/vim-surround/doc/surround.txt | 207 +++ .../start/vim-surround/plugin/surround.vim | 598 +++++++++ vimrc | 6 +- 133 files changed, 12876 insertions(+), 11 deletions(-) delete mode 160000 bundle/TextFormat delete mode 160000 bundle/jellybeans.vim delete mode 160000 bundle/mom.vim delete mode 160000 bundle/rust.vim delete mode 160000 bundle/vim-airline delete mode 160000 bundle/vim-pathogen delete mode 160000 bundle/vim-ps1 delete mode 160000 bundle/vim-sensible delete mode 160000 bundle/vim-surround create mode 100644 pack/acp/README.md create mode 100644 pack/acp/start/TextFormat/README create mode 100644 pack/acp/start/TextFormat/autoload/textformat.vim create mode 100644 pack/acp/start/TextFormat/doc/textformat.txt create mode 100644 pack/acp/start/TextFormat/plugin/textformat.vim create mode 100644 pack/acp/start/jellybeans.vim/.gitignore create mode 100644 pack/acp/start/jellybeans.vim/README.markdown create mode 100644 pack/acp/start/jellybeans.vim/ansi-term-colors.txt create mode 100644 pack/acp/start/jellybeans.vim/colors/jellybeans.vim create mode 100644 pack/acp/start/mom.vim/README create mode 100644 pack/acp/start/mom.vim/syntax/mom.vim create mode 100644 pack/acp/start/rust.vim/.gitignore create mode 100644 pack/acp/start/rust.vim/LICENSE-APACHE create mode 100644 pack/acp/start/rust.vim/LICENSE-MIT create mode 100644 pack/acp/start/rust.vim/README.md create mode 100644 pack/acp/start/rust.vim/after/syntax/rust.vim create mode 100644 pack/acp/start/rust.vim/autoload/rust.vim create mode 100644 pack/acp/start/rust.vim/autoload/rustfmt.vim create mode 100644 pack/acp/start/rust.vim/compiler/cargo.vim create mode 100644 pack/acp/start/rust.vim/compiler/rustc.vim create mode 100644 pack/acp/start/rust.vim/doc/rust.txt create mode 100644 pack/acp/start/rust.vim/ftdetect/rust.vim create mode 100644 pack/acp/start/rust.vim/ftplugin/rust.vim create mode 100644 pack/acp/start/rust.vim/indent/rust.vim create mode 100644 pack/acp/start/rust.vim/plugin/rust.vim create mode 100644 pack/acp/start/rust.vim/syntax/rust.vim create mode 100644 pack/acp/start/rust.vim/syntax_checkers/rust/rustc.vim create mode 100644 pack/acp/start/vim-airline/.gitignore create mode 100644 pack/acp/start/vim-airline/.travis.yml create mode 100644 pack/acp/start/vim-airline/CHANGELOG.md create mode 100644 pack/acp/start/vim-airline/CONTRIBUTING.md create mode 100644 pack/acp/start/vim-airline/Gemfile create mode 100644 pack/acp/start/vim-airline/ISSUE_TEMPLATE.md create mode 100644 pack/acp/start/vim-airline/LICENSE create mode 100644 pack/acp/start/vim-airline/README.md create mode 100644 pack/acp/start/vim-airline/Rakefile create mode 100644 pack/acp/start/vim-airline/autoload/airline.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/builder.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/debug.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/ale.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/branch.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/bufferline.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/capslock.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/commandt.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/csv.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/ctrlp.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/ctrlspace.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/default.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/denite.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/eclim.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/example.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/hunks.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/neomake.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/netrw.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/nrrwrgn.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/obsession.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/po.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/promptline.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/quickfix.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/syntastic.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/autoshow.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buffers.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buflist.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/default.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tabline/tabs.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tagbar.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/tmuxline.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/undotree.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/unicode.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/unite.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/vimagit.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/virtualenv.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/whitespace.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/windowswap.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/wordcount.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/wordcount/formatters/default.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/xkblayout.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/extensions/ycm.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/highlighter.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/init.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/msdos.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/parts.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/section.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/themes.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/themes/dark.vim create mode 100644 pack/acp/start/vim-airline/autoload/airline/util.vim create mode 100644 pack/acp/start/vim-airline/doc/airline.txt create mode 100644 pack/acp/start/vim-airline/plugin/airline.vim create mode 100644 pack/acp/start/vim-airline/t/airline.vim create mode 100644 pack/acp/start/vim-airline/t/builder.vim create mode 100644 pack/acp/start/vim-airline/t/commands.vim create mode 100644 pack/acp/start/vim-airline/t/extensions_default.vim create mode 100644 pack/acp/start/vim-airline/t/highlighter.vim create mode 100644 pack/acp/start/vim-airline/t/init.vim create mode 100644 pack/acp/start/vim-airline/t/parts.vim create mode 100644 pack/acp/start/vim-airline/t/section.vim create mode 100644 pack/acp/start/vim-airline/t/themes.vim create mode 100644 pack/acp/start/vim-airline/t/util.vim create mode 100644 pack/acp/start/vim-pathogen/CONTRIBUTING.markdown create mode 100644 pack/acp/start/vim-pathogen/README.markdown create mode 100644 pack/acp/start/vim-pathogen/autoload/pathogen.vim create mode 100644 pack/acp/start/vim-ps1/.gitignore create mode 100644 pack/acp/start/vim-ps1/README.markdown create mode 100644 pack/acp/start/vim-ps1/doc/ps1.txt create mode 100644 pack/acp/start/vim-ps1/ftdetect/ps1.vim create mode 100644 pack/acp/start/vim-ps1/ftdetect/ps1xml.vim create mode 100644 pack/acp/start/vim-ps1/ftdetect/xml.vim create mode 100644 pack/acp/start/vim-ps1/ftplugin/ps1.vim create mode 100644 pack/acp/start/vim-ps1/ftplugin/ps1xml.vim create mode 100644 pack/acp/start/vim-ps1/indent/ps1.vim create mode 100644 pack/acp/start/vim-ps1/syntax/ps1.vim create mode 100644 pack/acp/start/vim-ps1/syntax/ps1xml.vim create mode 100644 pack/acp/start/vim-sensible/README.markdown create mode 100644 pack/acp/start/vim-sensible/plugin/sensible.vim create mode 100644 pack/acp/start/vim-surround/.gitignore create mode 100644 pack/acp/start/vim-surround/README.markdown create mode 100644 pack/acp/start/vim-surround/doc/surround.txt create mode 100644 pack/acp/start/vim-surround/plugin/surround.vim diff --git a/bundle/TextFormat b/bundle/TextFormat deleted file mode 160000 index 7fa3514..0000000 --- a/bundle/TextFormat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7fa3514aa0edef9d3acbca60ff2b81a1ccf25f11 diff --git a/bundle/jellybeans.vim b/bundle/jellybeans.vim deleted file mode 160000 index 8165fb5..0000000 --- a/bundle/jellybeans.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8165fb586b3220883974aafda74fa79a36bf85d8 diff --git a/bundle/mom.vim b/bundle/mom.vim deleted file mode 160000 index 1ca55ea..0000000 --- a/bundle/mom.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1ca55ea8c066cd6d05eef5b0853be31d9c984e50 diff --git a/bundle/rust.vim b/bundle/rust.vim deleted file mode 160000 index 732b5fc..0000000 --- a/bundle/rust.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 732b5fcb3652f81726d5f0f5b97c9027c01f057a diff --git a/bundle/vim-airline b/bundle/vim-airline deleted file mode 160000 index 396b49b..0000000 --- a/bundle/vim-airline +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 396b49be4c886c96e949d535b638cc5a79440148 diff --git a/bundle/vim-pathogen b/bundle/vim-pathogen deleted file mode 160000 index 020ab25..0000000 --- a/bundle/vim-pathogen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 020ab25c38f62627c1dab6c7a851176c6ad309f9 diff --git a/bundle/vim-ps1 b/bundle/vim-ps1 deleted file mode 160000 index 201d9d4..0000000 --- a/bundle/vim-ps1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 201d9d4d9be3236e8ac8be98c04cf7b73f2825da diff --git a/bundle/vim-sensible b/bundle/vim-sensible deleted file mode 160000 index e57222d..0000000 --- a/bundle/vim-sensible +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e57222db3b3236782dc33b7cdbb648528b7377d9 diff --git a/bundle/vim-surround b/bundle/vim-surround deleted file mode 160000 index e49d6c2..0000000 --- a/bundle/vim-surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e49d6c2459e0f5569ff2d533b4df995dd7f98313 diff --git a/pack/acp/README.md b/pack/acp/README.md new file mode 100644 index 0000000..d801ff8 --- /dev/null +++ b/pack/acp/README.md @@ -0,0 +1,13 @@ +# Vim plugin sources + +Git submodules are slow, so handle this manually. + +* [start/jellybeans.vim](https://github.com/nanotech/jellybeans.vim) +* [start/mom.vim](https://github.com/vim-scripts/mom.vim) +* [start/rust.vim](https://github.com/rust-lang/rust.vim) +* [start/TextFormat](https://github.com/vim-scripts/TextFormat) +* [start/vim-airline](https://github.com/bling/vim-airline) +* [start/vim-pathogen](https://github.com/tpope/vim-pathogen) +* [start/vim-ps1](https://github.com/PProvost/vim-ps1) +* [start/vim-sensible](https://github.com/tpope/vim-sensible) +* [start/vim-surround](https://github.com/tpope/vim-surround) diff --git a/pack/acp/start/TextFormat/README b/pack/acp/start/TextFormat/README new file mode 100644 index 0000000..57ec4e7 --- /dev/null +++ b/pack/acp/start/TextFormat/README @@ -0,0 +1,17 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=2324 + +This plugin provides commands and key mappings to quickly align and format text. Text can be easily reformatted and aligned to either left or right margin or justified to both margins or centered. The text formatting commands provided by this plugin are a bit more automatic and more intelligent than those integrated to Vim. Together they make more powerful command set for formatting text. + +Manual is included, just type + + :help textformat.txt + +Default keymappings: + + \al Left-align and reformat + \ar Right-align + \aj Left-right justify and reformat + \ac Center lines + +The prefix key is actually key. It's backlash by default but it is configurable. + diff --git a/pack/acp/start/TextFormat/autoload/textformat.vim b/pack/acp/start/TextFormat/autoload/textformat.vim new file mode 100644 index 0000000..2e85e04 --- /dev/null +++ b/pack/acp/start/TextFormat/autoload/textformat.vim @@ -0,0 +1,610 @@ +" Text formatter plugin for Vim text editor +" +" Version: 2.1 +" Last Change: 2008-09-13 +" Maintainer: Teemu Likonen +" License: This file is placed in the public domain. +" GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat + +"{{{1 The beginning stuff +if &compatible + finish +endif +let s:save_cpo = &cpo +set cpo&vim + +" Constant variables(s) {{{1 +let s:default_width = 80 + +function! s:Align_Range_Left(...) range "{{{1 + " The optional parameter is the left indent. If it is not given we + " detect the indent used in the buffer. + if a:0 && a:1 >= 0 + " The parameter was given so we just use that as the left + " indent. + let l:leading_ws = s:Retab_Indent(a:1) + for l:line in range(a:firstline,a:lastline) + let l:line_string = getline(l:line) + let l:line_replace = s:Align_String_Left(l:line_string) + if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' + " Preserve trailing whitespace because fo=~w + let l:line_replace .= ' ' + endif + if l:line_replace =~ '\m^\s*$' + call setline(l:line,'') + else + call setline(l:line,l:leading_ws.l:line_replace) + endif + endfor + else + " The parameter was not given so we detect each paragraph's + " indent. + let l:line = a:firstline + while l:line <= a:lastline + let l:line_string = getline(l:line) + if l:line_string =~ '\m^\s*$' + " The line is empty or contains only + " whitespaces so print empty line and + " continue. + call setline(l:line,'') + let l:line += 1 + continue + endif + + " Paragraph (or the whole line range) begins here so + " get the indent of the first line and print the line. + let l:leading_ws = s:Retab_Indent(indent(l:line)) + let l:line_replace = s:Align_String_Left(l:line_string) + if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' + let l:line_replace .= ' ' + endif + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + + " If fo=~w, does the paragraph end here? If yes, + " continue to next round and find a new first line. + if &formatoptions =~ 'w' && l:line_string =~ '\m\S$' + continue + endif + + " If fo=~2 get the indent of the second line + if &formatoptions =~ '2' + let l:leading_ws = s:Retab_Indent(indent(l:line)) + endif + + " This loop will go through all the lines in the + " paragraph (or till the a:lastline) - starting from + " the second line. + while l:line <= a:lastline && getline(l:line) !~ '\m^\s*$' + let l:line_string = getline(l:line) + let l:line_replace = s:Align_String_Left(l:line_string) + if &formatoptions =~ 'w' + if l:line_string =~ '\m\s$' + call setline(l:line,l:leading_ws.l:line_replace.' ') + let l:line += 1 + continue + else + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + " fo=~w and paragraph ends + " here so we break the loop. + " The next line is new first + " line. + break + endif + else + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + endif + endwhile + endwhile + endif +endfunction + +function! s:Align_Range_Right(width) "{{{1 + let l:line_replace = s:Align_String_Right(getline('.'),a:width) + if &formatoptions =~ 'w' && getline('.') =~ '\m\s$' + let l:line_replace .= ' ' + endif + if l:line_replace =~ '\m^\s*$' + " If line would be full of spaces just print empty line. + call setline(line('.'),'') + else + " Retab leading whitespaces + let l:leading_ws = s:Retab_Indent(strlen(substitute(l:line_replace,'\v^( *).*$','\1',''))) + " Get the rest of the line + let l:line_replace = substitute(l:line_replace,'^ *','','') + call setline(line('.'),l:leading_ws.l:line_replace) + endif +endfunction + +function! s:Align_Range_Justify(width, ...) range "{{{1 + " If the optional second argument is given (and is non-zero) each + " paragraph's last line and range's last line is left-aligned. + if a:0 && a:1 + let l:paragraph = 1 + else + let l:paragraph = 0 + endif + let l:line = a:firstline + while l:line <= a:lastline + let l:line_string = getline(l:line) + if l:line_string =~ '\m^\s*$' + " The line is empty or contains only + " whitespaces so print empty line and + " continue. + call setline(l:line,'') + let l:line += 1 + continue + endif + + " Paragraph (or the whole line range) begins here so + " get the indent of the first line and print the line. + let l:indent = indent(l:line) + let l:width = a:width - l:indent + let l:leading_ws = s:Retab_Indent(l:indent) + + if l:paragraph && (l:line == a:lastline || getline(l:line+1) =~ '\m^\s*$' || (&formatoptions =~ 'w' && l:line_string =~ '\m\S$')) + let l:line_replace = s:Align_String_Left(l:line_string) + else + let l:line_replace = s:Align_String_Justify(l:line_string,l:width) + endif + if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' + let l:line_replace .= ' ' + endif + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + + " If fo=~w, does the paragraph end here? If yes, + " continue to next round and find a new first line. + if &formatoptions =~ 'w' && l:line_string =~ '\m\S$' + continue + endif + + " If fo=~2 get the indent of the second line + if &formatoptions =~ '2' + let l:indent = indent(l:line) + let l:width = a:width - l:indent + let l:leading_ws = s:Retab_Indent(l:indent) + endif + + " This loop will go through all the lines in the + " paragraph (or till the a:lastline) - starting from + " paragraph's second line. + while l:line <= a:lastline && getline(l:line) !~ '\m^\s*$' + let l:line_string = getline(l:line) + if l:paragraph && (l:line == a:lastline || getline(l:line+1) =~ '\m^\s*$' || (&formatoptions =~ 'w' && l:line_string =~ '\m\S$')) + let l:line_replace = s:Align_String_Left(l:line_string) + else + let l:line_replace = s:Align_String_Justify(l:line_string,l:width) + endif + if &formatoptions =~ 'w' + if l:line_string =~ '\m\s$' + call setline(l:line,l:leading_ws.l:line_replace.' ') + let l:line += 1 + continue + else + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + " fo=~w and paragraph ends + " here so we break the loop. + " The next line is new first + " line. + break + endif + else + call setline(l:line,l:leading_ws.l:line_replace) + let l:line += 1 + endif + endwhile + endwhile +endfunction + +function! s:Align_Range_Center(width) "{{{1 + let l:line_replace = s:Truncate_Spaces(getline('.')) + let l:line_replace = s:Add_Double_Spacing(l:line_replace) + if &formatoptions =~ 'w' && getline('.') =~ '\m\s$' + let l:line_replace .= ' ' + endif + call setline(line('.'),l:line_replace) + execute '.center '.a:width +endfunction + +function! s:Align_String_Left(string) "{{{1 + let l:string_replace = s:Truncate_Spaces(a:string) + let l:string_replace = s:Add_Double_Spacing(l:string_replace) + return l:string_replace +endfunction + +function! s:Align_String_Right(string, width) "{{{1 + let l:string_replace = s:Truncate_Spaces(a:string) + let l:string_replace = s:Add_Double_Spacing(l:string_replace) + let l:string_width = s:String_Width(l:string_replace) + let l:more_spaces = a:width-l:string_width + return repeat(' ',l:more_spaces).l:string_replace +endfunction + +function! s:Align_String_Justify(string, width) "{{{1 + let l:string = s:Truncate_Spaces(a:string) + " If the parameter string is empty we can just return a line full of + " spaces. No need to go further. + if l:string =~ '\m^ *$' + return repeat(' ',a:width) + endif + if s:String_Width(s:Add_Double_Spacing(l:string)) >= a:width + " The original string is longer than width so we can just + " return the string. No need to go further. + return s:Add_Double_Spacing(l:string) + endif + let l:string_width = s:String_Width(l:string) + + " This many extra spaces we need. + let l:more_spaces = a:width-l:string_width + " Convert the string to a list of words. + let l:word_list = split(l:string) + " This is the amount of spaces available in the original string (word + " count minus one). + let l:string_spaces = len(l:word_list)-1 + " If there are no spaces there is only one word. We can just return + " the string with padded spaces. No need to go further. + if l:string_spaces == 0 + return l:string.repeat(' ',l:more_spaces) + endif + " Ok, there are more than one word in the string so we get to do some + " real work... + + " Make a list of which each item represent a space available in the + " string. The value means how many spaces there are. At the moment set + " every list item to one: [1, 1, 1, 1, ...] + let l:space_list = [] + for l:item in range(l:string_spaces) + let l:space_list += [1] + endfor + + " Repeat while there are no more need to add any spaces. + while l:more_spaces > 0 + if l:more_spaces >= l:string_spaces + " More extra spaces are needed than there are spaces + " available in the string so we add one more space + " after every word (add 1 to items of space list). + for l:i in range(l:string_spaces) + let l:space_list[l:i] += 1 + endfor + let l:more_spaces -= l:string_spaces + " And then another round... and a check if more spaces + " are needed. + else " l:more_spaces < l:string_spaces + " This list tells where .?! characters are. + let l:space_sentence_full = [] + " This list tells where ,:; characters are. + let l:space_sentence_semi = [] + " And this is for the rest of spaces. + let l:space_other = [] + " Now, find those things: + for l:i in range(l:string_spaces) + if l:word_list[l:i] =~ '\m\S[.?!]$' + let l:space_sentence_full += [l:i] + elseif l:word_list[l:i] =~ '\m\S[,:;]$' + let l:space_sentence_semi += [l:i] + else + let l:space_other += [l:i] + endif + endfor + + " First distribute spaces after .?! + if l:more_spaces >= len(l:space_sentence_full) + " If we need more extra spaces than there are + " .?! spaces, just add one after every item. + for l:i in l:space_sentence_full + let l:space_list[l:i] += 1 + endfor + let l:more_spaces -= len(l:space_sentence_full) + if l:more_spaces == 0 | break | endif + else + " Distribute the rest of spaces evenly and + " break the loop. All the spaces have been + " added. + for l:i in s:Distributed_Selection(l:space_sentence_full,l:more_spaces) + let l:space_list[l:i] +=1 + endfor + break + endif + + " Then distribute spaces after ,:; + if l:more_spaces >= len(l:space_sentence_semi) + " If we need more extra spaces than there are + " ,:; spaces available, just add one after + " every item. + for l:i in l:space_sentence_semi + let l:space_list[l:i] += 1 + endfor + let l:more_spaces -= len(l:space_sentence_semi) + if l:more_spaces == 0 | break | endif + else + " Distribute the rest of spaces evenly and + " break the loop. All the spaces have been + " added. + for l:i in s:Distributed_Selection(l:space_sentence_semi,l:more_spaces) + let l:space_list[l:i] +=1 + endfor + break + endif + + " Finally distribute spaces to other available + " positions and exit the loop. + for l:i in s:Distributed_Selection(l:space_other,l:more_spaces) + let l:space_list[l:i] +=1 + endfor + break + endif + endwhile + + " Now we now where all the extra spaces will go. We have to construct + " the string again. + let l:string = '' + for l:item in range(l:string_spaces) + let l:string .= l:word_list[l:item].repeat(' ',l:space_list[l:item]) + endfor + " Add the last word to the end and return the string. + return l:string.l:word_list[-1] +endfunction + +function! s:Truncate_Spaces(string) "{{{1 + let l:string = substitute(a:string,'\v\s+',' ','g') + let l:string = substitute(l:string,'\m^\s*','','') + let l:string = substitute(l:string,'\m\s*$','','') + return l:string +endfunction + +function! s:String_Width(string) "{{{1 + " This counts the string width in characters. Combining diacritical + " marks do not count so the base character with all the combined + " diacritics is just one character (which is good for our purposes). + " Double-wide characters will not get double width so unfortunately + " they don't work in our algorithm. + return strlen(substitute(a:string,'\m.','x','g')) +endfunction + +function! s:Add_Double_Spacing(string) "{{{1 + if &joinspaces + return substitute(a:string,'\m\S[.?!] ','& ','g') + else + return a:string + endif +endfunction + +function! s:Distributed_Selection(list, pick) "{{{1 + " 'list' is a list-type variable [ item1, item2, ... ] + " 'pick' is a number how many of the list's items we want to choose + " + " This function returns a list which has 'pick' number of items from + " the original list. Items are chosen in distributed manner. For + " example, if 'pick' is 1 then the algorithm chooses an item near the + " center of the 'list'. If 'pick' is 2 then the first one is about 1/3 + " from the beginning and the another one about 2/3 from the beginning. + + " l:pick_list is a list of 0's and 1's and its length will be the + " same as original list's. Number 1 means that this list item will be + " picked and 0 means that the item will be dropped. Finally + " l:pick_list could look like this: [0, 1, 0, 1, 0] + " (i.e., two items evenly picked from a list of five items) + let l:pick_list = [] + + " First pick items evenly from the beginning of the list. This also + " actually constructs the list. + let l:div1 = len(a:list) / a:pick + let l:mod1 = len(a:list) % a:pick + for l:i in range(len(a:list)-l:mod1) + if !eval(l:i%l:div1) + let l:pick_list += [1] + else + let l:pick_list += [0] + endif + endfor + + if l:mod1 > 0 + " The division wasn't even so we get the remaining items and + " distribute them evenly again to the list. + let l:div2 = len(l:pick_list) / l:mod1 + let l:mod2 = len(l:pick_list) % l:mod1 + for l:i in range(len(l:pick_list)-l:mod2) + if !eval(l:i%l:div2) + call insert(l:pick_list,0,l:i) + endif + endfor + endif + + " There may be very different number of zeros in the beginning and the + " end of the list. We count them. + let l:zeros_begin = 0 + for l:i in l:pick_list + if l:i == 0 + let l:zeros_begin += 1 + else + break + endif + endfor + let l:zeros_end = 0 + for l:i in reverse(copy(l:pick_list)) + if l:i == 0 + let l:zeros_end += 1 + else + break + endif + endfor + + " Then we remove them. + if l:zeros_end + " Remove "0" items from the end. We need to remove them first + " from the end because list items' index number will change + " when items are removed from the beginning. Then it would be + " more difficult to remove trailing zeros. + call remove(l:pick_list,len(l:pick_list)-l:zeros_end,-1) + endif + if l:zeros_begin + " Remove zero items from the beginning. + call remove(l:pick_list,0,l:zeros_begin-1) + endif + let l:zeros_both = l:zeros_begin + l:zeros_end + + " Put even amount of zeros to beginning and end + for l:i in range(l:zeros_both/2) + call insert(l:pick_list,0,0) + endfor + for l:i in range((l:zeros_both/2)+(l:zeros_both%2)) + call add(l:pick_list,0) + endfor + + " Finally construct and return a new list which has only the items we + " have chosen. + let l:new_list = [] + for l:i in range(len(l:pick_list)) + if l:pick_list[l:i] == 1 + let l:new_list += [a:list[l:i]] + endif + endfor + return l:new_list +endfunction + +function! s:Retab_Indent(column) "{{{1 + " column = the left indent column starting from 0 Function returns + " a string of whitespaces, a mixture of tabs and spaces depending on + " the 'expandtab' and 'tabstop' options. + if &expandtab + " Only spaces + return repeat(' ',a:column) + else + " Tabs and spaces + let l:tabs = a:column / &tabstop + let l:spaces = a:column % &tabstop + return repeat("\",l:tabs).repeat(' ',l:spaces) + endif +endfunction + +function! s:Reformat_Range(...) range "{{{1 + if a:0 == 2 + let l:first = a:1 + let l:last = a:2 + else + let l:first = a:firstline + let l:last = a:lastline + endif + let l:autoindent = &autoindent + setlocal autoindent + execute l:first + normal! 0 + execute 'normal! V'.l:last.'G$gw' + let &l:autoindent = l:autoindent + " The formatting may change the last line of the range so we return + " it. + return line("'>") +endfunction + +function! textformat#Visual_Align_Left() range "{{{1 + execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' + call s:Reformat_Range(a:firstline,a:lastline) +endfunction + +function! textformat#Visual_Align_Right() range "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + + execute a:firstline.','.a:lastline.'call s:Align_Range_Right('.l:width.')' + normal! '>$ +endfunction + +function! textformat#Visual_Align_Justify() range "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + + execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' + + let l:last = s:Reformat_Range(a:firstline,a:lastline) + let l:pos = getpos('.') + execute a:firstline.','.l:last.'call s:Align_Range_Justify('.l:width.',1)' + call setpos('.',l:pos) +endfunction + +function! textformat#Visual_Align_Center() range "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + + execute a:firstline.','.a:lastline.'call s:Align_Range_Center('.l:width.')' + normal! '>$ +endfunction + +function! textformat#Quick_Align_Left() "{{{1 + let l:autoindent = &autoindent + setlocal autoindent + let l:pos = getpos('.') + silent normal! vip:call s:Align_Range_Left() + call setpos('.',l:pos) + silent normal! gwip + let &l:autoindent = l:autoindent +endfunction + +function! textformat#Quick_Align_Right() "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + let l:pos = getpos('.') + silent normal! vip:call s:Align_Range_Right(l:width) + call setpos('.',l:pos) +endfunction + +function! textformat#Quick_Align_Justify() "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + let l:autoindent = &autoindent + setlocal autoindent + let l:pos = getpos('.') + silent normal! vip:call s:Align_Range_Left() + call setpos('.',l:pos) + silent normal! gwip + let l:pos = getpos('.') + silent normal! vip:call s:Align_Range_Justify(l:width,1) + call setpos('.',l:pos) + let &l:autoindent = l:autoindent +endfunction + +function! textformat#Quick_Align_Center() "{{{1 + let l:width = &textwidth + if l:width == 0 | let l:width = s:default_width | endif + let l:pos = getpos('.') + silent normal! vip:call s:Align_Range_Center(l:width) + call setpos('.',l:pos) +endfunction + +function! textformat#Align_Command(align, ...) range "{{{1 + " For left align the optional parameter a:1 is [indent]. For others + " it's [width]. + let l:pos = getpos('.') + if a:align ==? 'left' + if a:0 && a:1 >= 0 + execute a:firstline.','.a:lastline.'call s:Align_Range_Left('.a:1.')' + else + execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' + endif + else + if a:0 && a:1 > 0 + let l:width = a:1 + elseif &textwidth + let l:width = &textwidth + else + let l:width = s:default_width + endif + + if a:align ==? 'right' + execute a:firstline.','.a:lastline.'call s:Align_Range_Right('.l:width.')' + elseif a:align ==? 'justify' + execute a:firstline.','.a:lastline.'call s:Align_Range_Justify('.l:width.')' + elseif a:align ==? 'center' + execute a:firstline.','.a:lastline.'call s:Align_Range_Center('.l:width.')' + endif + endif + call setpos('.',l:pos) +endfunction + +"{{{1 The ending stuff +let &cpo = s:save_cpo + +" vim600: fdm=marker diff --git a/pack/acp/start/TextFormat/doc/textformat.txt b/pack/acp/start/TextFormat/doc/textformat.txt new file mode 100644 index 0000000..0f25724 --- /dev/null +++ b/pack/acp/start/TextFormat/doc/textformat.txt @@ -0,0 +1,301 @@ +*textformat.txt* Vim Text Formatter (version 2.1) 2008-09-13 + + +Description This plugin provides commands and key mappings to quickly + align and format text. Text can be easily reformatted and + aligned to either left or right margin or justified to both + margins or centered. The text formatting commands provided by + this plugin are a bit more automatic and more intelligent than + those integrated to Vim. Together they make more powerful + command set for formatting text. + +Author Teemu Likonen + + + + +Contents + + 1. Quick start |textformat-start| + 2. Commands |textformat-commands| + 3. Default key mappings |textformat-keymap| + 4. Configuration |textformat-config| + 5. Version history |textformat-history| + +============================================================================== +1. Quick start *textformat-start* + +The impatient are always with us so below is a short info on (probably) the +most important tools provided by this plugin. See the following sections of +this manual for more detailed instructions. + +al Left-align and reformat +ar Right-align +aj Left-right justify and reformat +ac Center lines + +In normal mode the commands operate on current paragraph; in visual mode they +operate on the selected lines. By default, is the backslash key, so +the mappings are actually \al, \ar, \aj and \ac, by default. If you have +changed the g:mapleader variable in your .vimrc file may be something +else. + +============================================================================== +2. Commands *textformat-commands* + +Let's start with the basic components of this plugin. These are the ex +commands. You probably don't need these very often but they can be handy if +you want to have text formatting and aligning as a part of a macro or function +or something. The "daily tools" are explained later. + +:[range]AlignLeft [indent] *:AlignLeft* + Align to left all the lines in [range] (default is + current line) and truncate all extra whitespace + characters. That is, if there are more than one space + between words they are reduced to just one. If + 'joinspaces' is set then two spaces are added after + every sentence ending with character ".", "?" or "!". + + If optional numeric argument [indent] is given then + that is used as the left margin. If [indent] is not + given the indent of the first line in the [range] (and + the first line of each paragraph within the [range]) + is used to define indent for the rest of the lines in + the paragraph. There is one exception: if + 'formatoptions' contains "2" then the second line + defines the indent for the rest of the lines in the + paragraph. + + Note: This is very similar to |:left| command except + that this also truncates whitespaces and that without + [indent] each paragraph's indent is detected and used. + + Note: There is a possible unexpected behaviour: If + command is run without [range] (i.e., it's just the + current line) and [indent] is not given then this + command just "aligns" to the current indent position + and truncates whitespaces. You might see nothing + happening if there weren't any extra whitespaces. Use + [indent] (or |:left| command) to align to desired + column. + +:[range]AlignRight [width] *:AlignRight* + Align to right all the lines in [range] (default is + current line) and truncate all extra whitespace + characters (honor 'joinspaces', as in :AlignLeft). + [width] is used as the right margin. If [width] is not + given the value of 'textwidth' option is used instead. + If 'textwidth' is zero then the value of 80 is used. + + Note: This is very similar to |:right| command except + that this also truncates whitespaces. + +:[range]AlignJustify [width] *:AlignJustify* + Left-right justify lines in [range] (default is + current line). This means adjusting spaces between + words so that the lines fit. If 'joinspaces' is set + then at least two spaces are printed after every + sentence ending with a ".", "?" or "!". The first line + in [range] (and the first line in each paragraph + within the [range]) defines the indent for the rest of + the lines in the paragraph, except if 'formatoptions' + contains "2" then it's the second line. + + Numeric argument [width] is used as the right margin. + If [width] is not given the value of 'textwidth' is + used instead. If 'textwidth' is zero then the value of + 80 is used. + + Also see the Discussion below. + +:[range]AlignCenter [width] *:AlignCenter* + Center lines in [range] (default is current line) + between the first column and [width]. All extra + whitespace characters are truncated (but honor + 'joinspaces', just like in :AlignLeft). If [width] is + not given the value of 'textwidth' option is used + instead. If 'textwidth' is zero the value of 80 is + used. + + Note: This is very similar to |:center| except that + this also truncates whitespaces. + + +Discussion ~ + +All the previous ex commands are rather "stupid" and operate on single lines +only. They do not wrap lines nor do other kind of formatting. If [width] (or +'textwidth') is too narrow for the line then some characters will go beyond +the right margin. This is similar to Vim's own |:left|, |:right| and |:center| +commands. More sophisticated formatting tools are provided as key mappings +(see below). + +Usually when paragraphs are justified the last line of each paragraph is +aligned to left. However, :AlignJustify command does not do this. The purpose +of this command is to do exactly what was asked for: left-right justify +a range of lines. More sophisticated justify tools is aj which +reformats the paragraph (like |gw|), justifies lines and aligns each +paragraph's last line to left. + +All the commands truncate extra whitespaces which makes them work well +together. This is particularly because the left-right justify needs to add +extra spaces to make lines fill the text area. If you later want to reformat +such previously justified paragraph and align it to left, for example, it's +convenient that the tool automatically handles this and removes extra spaces. +If you want to align text without truncating whitespaces use Vim's own align +commands: |:left|, |:right| and |:center|. + +============================================================================== +3. Default key mappings *textformat-keymap* + +By default this plugin provides a couple of key mappings for convenient text +formatting. If the mappings have already been defined by user (or are taken by +other plugins) then some of the following mappings may not be automatically +available. See the next section of this manual for information on how to +change the default mappings. + +There are key mappings available for normal mode and visual mode. As usual, + is the backslash key by default but it can be changed with +g:mapleader variable. Consult the Vim manual for more information on . + + +Normal mode (current paragraph) ~ + +al Left-align the current "inner paragraph" (see |ip|) + and reformat it according to 'textwidth'. + +ar Right-align the current "inner paragraph" (see |ip|) + to margin at 'textwidth'. This does not reformat the + paragraph because with right-aligned text user usually + wants to decide exactly what goes to what line. + +aj Left-right justify the current "inner paragraph" (see + |ip|). Technically each line's whitespaces are first + truncated, then the text is reformatted according to + 'textwidth' and finally lines are justified. The last + line (of each text paragraph) is aligned to left. + +ac Center lines of current "inner paragraph" (see |ip|) + between the first column and 'textwidth'. This does + not reformat the paragraph because with centered text + user usually wants to decide exactly what goes to what + line. + + +Visual mode (range of lines) ~ + +{Visual}al Left-align and reformat {Visual} lines so that they + fill 'textwidth'. + +{Visual}ar Right-align {Visual} lines. + +{Visual}aj Left-right justify {Visual} lines. First truncate all + extra whitespace characters, then reformat lines so + that they fill 'textwidth' and finally left-right + justify. The last line of each paragraph as well as + the last line in {Visual} range is aligned to left. + +{Visual}ac Center {Visual} lines. + + +Both normal mode and visual mode commands truncate extra whitespace +characters. If 'joinspaces' is set then an extra space is added after every +sentence ending with a ".", "?" or "!". The first line in each paragraph +inside the range defines the indent for the rest of the lines in the +paragraph, except if 'formatoptions' contains "2" then it's the second line. + + +Paragraph definitions ~ + +The normal mode commands operate on the concept of "inner paragraph" (see +|ip|). The effect is almost the same as selecting current paragraph with Vim's +"vip" command and then executing the equivalent visual mode command. Such +inner paragraph may contain several text paragraphs if 'formatoptions' +contains "w". Each of them is reformatted separately with al and +aj commands. + +New paragraph always begins after a blank line. If 'formatoptions' contains +"w" then new paragraph also begins after a line which ends with +a non-whitespace character. That is, with "w" in 'formatoptions' every line +which ends with a non-whitespace also ends a paragraph. In left-right justify +(aj) such line is aligned to left. You need to ensure that there is +a trailing whitespace in every consecutive line which belongs to same +paragraph (the whitespace is preserved after formatting). If 'formatoptions' +does not contain "w" then all consecutive non-blank lines belong to same +paragraph. + +============================================================================== +4. Configuration *textformat-config* + +The key mappings can be configured freely by user. This plugin uses the +default ones only if they are free and not used for other purposes. Here's an +example of lines you could put to your .vimrc file: +> + nmap Quick_Align_Paragraph_Left + nmap Quick_Align_Paragraph_Right + nmap Quick_Align_Paragraph_Justify + nmap Quick_Align_Paragraph_Center + + vmap Align_Range_Left + vmap Align_Range_Right + vmap Align_Range_Justify + vmap Align_Range_Center + +That is, |:nmap| command defines mappings for normal mode and |:vmap| for +visual mode. Function keys from to are used in this example. The +rest of the line is a code word for Vim and this plugin. They must be written +exactly as shown in the example. I think the code words are pretty much +self-descriptive. + +Don't use |:nnoremap| and |:vnoremap| commands here; they don't work because +the right-hand side (...) must be remappable. See Vim's manual for more +information about the key map commands. + +Most part of this plugin is loaded into memory when the text-formatting +commands or key maps are used for the first time. Only the very minimum is +automatically loaded when Vim is started. If you want to completely avoid +loading this plugin put the following line to your .vimrc file: +> + let g:loaded_textformat = 1 + +Happy formatting! + +============================================================================== +5. Version history *textformat-history* + + v2.1 2008-09-13 + + - Minor internal cleanup. + + v2.0 2008-08-10 + + - \al and \aj now reformat text also in visual mode. + - \al and \aj honor "w" in 'formatoptions' and detect paragraph + boundaries accordingly. + - :AlignLeft, :AlignJustify, \al and \aj recognize several + paragraphs within the range and detect indent for each + paragraph separately. + - Add logic to load the plugin script only once. + + v1.1 2008-08-04 + + - Keep cursor position more accurately when formatting + a paragraph with \al and \aj. + - When 'joinspaces' is set insert two spaces after .?! + punctuation with left-right justify. This is now similar to + other commands. + + v1.0 2008-08-03 + + - All the commands now follow user's 'expandtab' setting and + print leading whitespaces accordingly. Now this works just + like :left, :right and :center commands. + - The left-aligned last line in justified paragraph did not + honor 'joinspaces'. Fixed. + + v0.9 2008-08-01 + + - Initial upload to http://www.vim.org . + +============================================================================== +vim: ft=help tw=78 ts=8 et norl fo+=2aw diff --git a/pack/acp/start/TextFormat/plugin/textformat.vim b/pack/acp/start/TextFormat/plugin/textformat.vim new file mode 100644 index 0000000..b186c5d --- /dev/null +++ b/pack/acp/start/TextFormat/plugin/textformat.vim @@ -0,0 +1,66 @@ +" Text formatter plugin for Vim text editor +" +" Version: 2.1 +" Last Change: 2008-09-13 +" Maintainer: Teemu Likonen +" License: This file is placed in the public domain. +" GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat + +"{{{1 The beginning stuff +if &compatible || exists('g:loaded_textformat') + finish +endif +let s:save_cpo = &cpo +set cpo&vim +"}}}1 + +if v:version < 700 + echohl ErrorMsg + echomsg 'TextFormat plugin needs Vim version 7.0 or later. Sorry.' + echohl None + finish +endif + +if !exists(':AlignLeft') + command -nargs=? -range AlignLeft ,call textformat#Align_Command('left',) +endif +if !exists(':AlignRight') + command -nargs=? -range AlignRight ,call textformat#Align_Command('right',) +endif +if !exists(':AlignJustify') + command -nargs=? -range AlignJustify ,call textformat#Align_Command('justify',) +endif +if !exists(':AlignCenter') + command -nargs=? -range AlignCenter ,call textformat#Align_Command('center',) +endif + +nnoremap Quick_Align_Paragraph_Left :call textformat#Quick_Align_Left() +nnoremap Quick_Align_Paragraph_Right :call textformat#Quick_Align_Right() +nnoremap Quick_Align_Paragraph_Justify :call textformat#Quick_Align_Justify() +nnoremap Quick_Align_Paragraph_Center :call textformat#Quick_Align_Center() + +vnoremap Align_Range_Left :call textformat#Visual_Align_Left() +vnoremap Align_Range_Right :call textformat#Visual_Align_Right() +vnoremap Align_Range_Justify :call textformat#Visual_Align_Justify() +vnoremap Align_Range_Center :call textformat#Visual_Align_Center() + +function! s:Add_Mapping(mode, lhs, rhs) + if maparg(a:lhs, a:mode) == '' && !hasmapto(a:rhs, a:mode) + execute a:mode.'map '.a:lhs.' '.a:rhs + endif +endfunction + +call s:Add_Mapping('n', 'al', 'Quick_Align_Paragraph_Left') +call s:Add_Mapping('n', 'ar', 'Quick_Align_Paragraph_Right') +call s:Add_Mapping('n', 'aj', 'Quick_Align_Paragraph_Justify') +call s:Add_Mapping('n', 'ac', 'Quick_Align_Paragraph_Center') + +call s:Add_Mapping('v', 'al', 'Align_Range_Left') +call s:Add_Mapping('v', 'ar', 'Align_Range_Right') +call s:Add_Mapping('v', 'aj', 'Align_Range_Justify') +call s:Add_Mapping('v', 'ac', 'Align_Range_Center') + +delfunction s:Add_Mapping +let g:loaded_textformat = 1 +let &cpo = s:save_cpo +" vim600: fdm=marker diff --git a/pack/acp/start/jellybeans.vim/.gitignore b/pack/acp/start/jellybeans.vim/.gitignore new file mode 100644 index 0000000..6befc68 --- /dev/null +++ b/pack/acp/start/jellybeans.vim/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +Thumbs.db +*.swp diff --git a/pack/acp/start/jellybeans.vim/README.markdown b/pack/acp/start/jellybeans.vim/README.markdown new file mode 100644 index 0000000..55067fc --- /dev/null +++ b/pack/acp/start/jellybeans.vim/README.markdown @@ -0,0 +1,116 @@ +jellybeans.vim +============== + +A colorful, dark color scheme, inspired by [ir_black][] and [twilight][]. + +Designed primarily for a graphical Vim, but includes support for 256, 88, 16, +and 8 color terminals. On a 16 or 8 color terminal, replace its colors with +those in `ansi-term-colors.txt` for best results. + +This script is [vimscript #2555][vimscript] at Vim.org. + +Scroll down for [screenshots][ss-anchor]! + +## Options + +### Custom Highlights + +If you prefer slightly different colors from what Jellybeans defines, +you can set `g:jellybeans_overrides` in your .vimrc to a dictionary of +custom highlighting parameters: + + let g:jellybeans_overrides = { + \ 'Todo': { 'guifg': '303030', 'guibg': 'f0f000', + \ 'ctermfg': 'Black', 'ctermbg': 'Yellow', + \ 'attr': 'bold' }, + \ 'Comment': { 'guifg': 'cccccc' }, + \} + +This removes the need to edit Jellybeans directly, simplifying +upgrades. In addition, RGB colors specified this way are run through +the same color approximation algorithm that the core theme uses, so +your colors work just as well in 256-color terminals. + +If you can pick better colors than the approximator, specify them +in the `256ctermfg` and `256ctermbg` parameters to override +its choices. + +#### Custom Background Colors + +To set a custom background color, override the special +`background` highlight group: + + let g:jellybeans_overrides = { + \ 'background': { 'guibg': '000000' }, + \} + +Jellybeans uses the background color in multiple highlight +groups. Using the special `background` group overrides them all +at once. + +This replaces `g:jellybeans_background_color` and +`g:jellybeans_background_color_256` from Jellybeans versions +before 1.6. + +#### Terminal Background + +If you would prefer to use your terminal's default background +(e.g. for transparent backgrounds, image backgrounds, or a +different color) instead of the background color that Jellybeans +applies, use this `background` override: + + let g:jellybeans_overrides = { + \ 'background': { 'ctermbg': 'none', '256ctermbg': 'none' }, + \} + +### Italics + +Jellybeans disables italics in terminal Vim by default, as some +terminals do other things with the text's colors instead of +actually italicizing the text. If your terminal does fully +support italics, add + + let g:jellybeans_use_term_italics = 1 + +to your .vimrc to enable italics in terminal Vim. + +If you don't want italics even in GUI Vim, add + + let g:jellybeans_use_gui_italics = 0 + +### Low-Color Black (16 and 8 color terminals) + +Since the background on a dark terminal is usually black already, +Jellybeans appropriates the black ANSI color as a dark grey and +uses no color when it really wants black. + +If you can’t or don’t want to change your terminal’s color +mappings, add + + let g:jellybeans_use_lowcolor_black = 0 + +to your .vimrc to render “black” text as Vim’s grey (ANSI white). + +Users of Apple’s pre-10.7 Terminal.app can use the TerminalColours +plugin ([Leopard][tc-leopard], [Snow Leopard][tc-snowleopard]) to +change the default colors. + +## Screenshots + +![][preview-ss] + +The font in the screenshot is 10pt [Monaco][monaco]: + +```vim +set guifont=Monaco:h10 noanti +``` + + +[ir_black]: https://web.archive.org/web/20140211124943/http://toddwerth.com/2008/01/25/a-black-os-x-leopard-terminal-theme-that-is-actually-readable/ +[twilight]: http://www.vim.org/scripts/script.php?script_id=1677 +[vimscript]: http://www.vim.org/scripts/script.php?script_id=2555 +[tc-leopard]: http://ciaranwal.sh/2007/11/01/customising-colours-in-leopard-terminal +[tc-snowleopard]: https://github.com/timmfin/terminalcolours +[preview-ss]: https://nanotech.nanotechcorp.net/downloads/jellybeans-preview.png +[ss-anchor]: #screenshots +[monaco]: https://en.wikipedia.org/wiki/Monaco_(typeface) diff --git a/pack/acp/start/jellybeans.vim/ansi-term-colors.txt b/pack/acp/start/jellybeans.vim/ansi-term-colors.txt new file mode 100644 index 0000000..60db9f5 --- /dev/null +++ b/pack/acp/start/jellybeans.vim/ansi-term-colors.txt @@ -0,0 +1,8 @@ +Black rgb(59,59,59) #3b3b3b +Red rgb(207,106,76) #cf6a4c +Green rgb(153,173,106) #99ad6a +Yellow rgb(216,173,76) #d8ad4c +Blue rgb(89,123,197) #597bc5 +Magenta rgb(160,55,176) #a037b0 +Cyan rgb(113,185,248) #71b9f8 +White rgb(173,173,173) #adadad diff --git a/pack/acp/start/jellybeans.vim/colors/jellybeans.vim b/pack/acp/start/jellybeans.vim/colors/jellybeans.vim new file mode 100644 index 0000000..6c2bc47 --- /dev/null +++ b/pack/acp/start/jellybeans.vim/colors/jellybeans.vim @@ -0,0 +1,668 @@ +" Vim color file +" +" " __ _ _ _ " +" " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ " +" " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| " +" " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ " +" " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ " +" " \___/ " +" +" "A colorful, dark color scheme for Vim." +" +" File: jellybeans.vim +" URL: github.com/nanotech/jellybeans.vim +" Scripts URL: vim.org/scripts/script.php?script_id=2555 +" Maintainer: NanoTech (nanotech.nanotechcorp.net) +" Version: 1.6 +" Last Change: October 18th, 2016 +" License: MIT +" Contributors: Andrew Wong (w0ng) +" Brian Marshall (bmars) +" Daniel Herbert (pocketninja) +" David Liang +" Henry So, Jr. +" Joe Doherty (docapotamus) +" Karl Litterfeldt (Litterfeldt) +" Keith Pitt (keithpitt) +" Philipp Rustemeier (12foo) +" Rafael Bicalho (rbika) +" Rich Healey (richo) +" Siwen Yu (yusiwen) +" Tim Willis (willist) +" +" Copyright (c) 2009-2016 NanoTech +" +" Permission is hereby granted, free of charge, to any per‐ +" son obtaining a copy of this software and associated doc‐ +" umentation files (the “Software”), to deal in the Soft‐ +" ware without restriction, including without limitation +" the rights to use, copy, modify, merge, publish, distrib‐ +" ute, 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 PARTICU‐ +" LAR 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 CON‐ +" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ +" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +" THE SOFTWARE. + +set background=dark + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "jellybeans" + +if has("gui_running") || (has('termguicolors') && &termguicolors) || &t_Co >= 88 + let s:low_color = 0 +else + let s:low_color = 1 +endif + +" Configuration Variables: +" - g:jellybeans_overrides (default = {}) +" - g:jellybeans_use_lowcolor_black (default = 1) +" - g:jellybeans_use_gui_italics (default = 1) +" - g:jellybeans_use_term_italics (default = 0) + +let s:background_color = "151515" + +if exists("g:jellybeans_overrides") + let s:overrides = g:jellybeans_overrides +else + let s:overrides = {} +endif + +" Backwards compatibility +if exists("g:jellybeans_background_color") + \ || exists("g:jellybeans_background_color_256") + \ || exists("g:jellybeans_use_term_background_color") + + let s:overrides = deepcopy(s:overrides) + + if !has_key(s:overrides, "background") + let s:overrides["background"] = {} + endif + + if exists("g:jellybeans_background_color") + let s:overrides["background"]["guibg"] = g:jellybeans_background_color + endif + + if exists("g:jellybeans_background_color_256") + let s:overrides["background"]["256ctermbg"] = g:jellybeans_background_color_256 + endif + + if exists("g:jellybeans_use_term_background_color") + \ && g:jellybeans_use_term_background_color + let s:overrides["background"]["ctermbg"] = "NONE" + let s:overrides["background"]["256ctermbg"] = "NONE" + endif +endif + +if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black + let s:termBlack = "Black" +else + let s:termBlack = "Grey" +endif + +" Color approximation functions by Henry So, Jr. and David Liang {{{ +" Added to jellybeans.vim by Daniel Herbert + +" returns an approximate grey index for the given grey level +fun! s:grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif +endfun + +" returns the actual grey level represented by the grey index +fun! s:grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif +endfun + +" returns the palette index for the given grey index +fun! s:grey_color(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif +endfun + +" returns an approximate color index for the given color level +fun! s:rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif +endfun + +" returns the actual color level for the given color index +fun! s:rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif +endfun + +" returns the palette index for the given R/G/B color indices +fun! s:rgb_color(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif +endfun + +" returns the palette index to approximate the given R/G/B color levels +fun! s:color(r, g, b) + " map greys directly (see xterm's 256colres.pl) + if &t_Co == 256 && a:r == a:g && a:g == a:b && a:r > 3 && a:r < 243 + return (a:r - 8) / 10 + 232 + endif + + " get the closest grey + let l:gx = s:grey_number(a:r) + let l:gy = s:grey_number(a:g) + let l:gz = s:grey_number(a:b) + + " get the closest color + let l:x = s:rgb_number(a:r) + let l:y = s:rgb_number(a:g) + let l:z = s:rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " there are two possibilities + let l:dgr = s:grey_level(l:gx) - a:r + let l:dgg = s:grey_level(l:gy) - a:g + let l:dgb = s:grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = s:rgb_level(l:gx) - a:r + let l:dg = s:rgb_level(l:gy) - a:g + let l:db = s:rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " use the grey + return s:grey_color(l:gx) + else + " use the color + return s:rgb_color(l:x, l:y, l:z) + endif + else + " only one possibility + return s:rgb_color(l:x, l:y, l:z) + endif +endfun + +fun! s:is_empty_or_none(str) + return empty(a:str) || a:str ==? "NONE" +endfun + +" returns the palette index to approximate the 'rrggbb' hex string +fun! s:rgb(rgb) + if s:is_empty_or_none(a:rgb) + return "NONE" + endif + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + return s:color(l:r, l:g, l:b) +endfun + +fun! s:prefix_highlight_value_with(prefix, color) + if s:is_empty_or_none(a:color) + return "NONE" + else + return a:prefix . a:color + endif +endfun + +fun! s:remove_italic_attr(attr) + let l:attr = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",") + if empty(l:attr) + let l:attr = "NONE" + endif + return l:attr +endfun + +" sets the highlighting for the given group +fun! s:X(group, fg, bg, attr, lcfg, lcbg) + if s:low_color + exec "hi ".a:group. + \ " ctermfg=".s:prefix_highlight_value_with("", a:lcfg). + \ " ctermbg=".s:prefix_highlight_value_with("", a:lcbg) + else + exec "hi ".a:group. + \ " guifg=".s:prefix_highlight_value_with("#", a:fg). + \ " guibg=".s:prefix_highlight_value_with("#", a:bg). + \ " ctermfg=".s:rgb(a:fg). + \ " ctermbg=".s:rgb(a:bg) + endif + + let l:attr = s:prefix_highlight_value_with("", a:attr) + + if exists("g:jellybeans_use_term_italics") && g:jellybeans_use_term_italics + let l:cterm_attr = l:attr + else + let l:cterm_attr = s:remove_italic_attr(l:attr) + endif + + if !exists("g:jellybeans_use_gui_italics") || g:jellybeans_use_gui_italics + let l:gui_attr = l:attr + else + let l:gui_attr = s:remove_italic_attr(l:attr) + endif + + exec "hi ".a:group." gui=".l:gui_attr." cterm=".l:cterm_attr +endfun +" }}} + +call s:X("Normal","e8e8d3",s:background_color,"","White","") +set background=dark + +if version >= 700 + call s:X("CursorLine","","1c1c1c","","",s:termBlack) + call s:X("CursorColumn","","1c1c1c","","",s:termBlack) + call s:X("MatchParen","ffffff","556779","bold","","DarkCyan") + + call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack) + call s:X("TabLineFill","9098a0","","","",s:termBlack) + call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White") + + " Auto-completion + call s:X("Pmenu","ffffff","606060","","White",s:termBlack) + call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White") +endif + +call s:X("Visual","","404040","","",s:termBlack) +call s:X("Cursor",s:background_color,"b0d0f0","","","") + +call s:X("LineNr","605958",s:background_color,"NONE",s:termBlack,"") +call s:X("CursorLineNr","ccc5c4","","NONE","White","") +call s:X("Comment","888888","","italic","Grey","") +call s:X("Todo","c7c7c7","","bold","White",s:termBlack) + +call s:X("StatusLine","000000","dddddd","italic","","White") +call s:X("StatusLineNC","ffffff","403c41","italic","White","Black") +call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack) +call s:X("WildMenu","f0a0c0","302028","","Magenta","") + +call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"") +call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack) +call s:X("SignColumn","777777","333333","","",s:termBlack) +call s:X("ColorColumn","","000000","","",s:termBlack) + +call s:X("Title","70b950","","bold","Green","") + +call s:X("Constant","cf6a4c","","","Red","") +call s:X("Special","799d6a","","","Green","") +call s:X("Delimiter","668799","","","Grey","") + +call s:X("String","99ad6a","","","Green","") +call s:X("StringDelimiter","556633","","","DarkGreen","") + +call s:X("Identifier","c6b6ee","","","LightCyan","") +call s:X("Structure","8fbfdc","","","LightCyan","") +call s:X("Function","fad07a","","","Yellow","") +call s:X("Statement","8197bf","","","DarkBlue","") +call s:X("PreProc","8fbfdc","","","LightBlue","") + +hi! link Operator Structure +hi! link Conceal Operator + +call s:X("Type","ffb964","","","Yellow","") +call s:X("NonText","606060",s:background_color,"",s:termBlack,"") + +call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"") + +call s:X("Search","f0a0c0","302028","underline","Magenta","") + +call s:X("Directory","dad085","","","Yellow","") +call s:X("ErrorMsg","","902020","","","DarkRed") +hi! link Error ErrorMsg +hi! link MoreMsg Special +call s:X("Question","65C254","","","Green","") + + +" Spell Checking + +call s:X("SpellBad","","902020","underline","","DarkRed") +call s:X("SpellCap","","0000df","underline","","Blue") +call s:X("SpellRare","","540063","underline","","DarkMagenta") +call s:X("SpellLocal","","2D7067","underline","","Green") + +" Diff + +hi! link diffRemoved Constant +hi! link diffAdded String + +" VimDiff + +call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen") +call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed") +call s:X("DiffChange","","2B5B77","","White","DarkBlue") +call s:X("DiffText","8fbfdc","000000","reverse","Yellow","") + +" PHP + +hi! link phpFunctions Function +call s:X("StorageClass","c59f6f","","","Red","") +hi! link phpSuperglobal Identifier +hi! link phpQuoteSingle StringDelimiter +hi! link phpQuoteDouble StringDelimiter +hi! link phpBoolean Constant +hi! link phpNull Constant +hi! link phpArrayPair Operator +hi! link phpOperator Normal +hi! link phpRelation Normal +hi! link phpVarSelector Identifier + +" Python + +hi! link pythonOperator Statement + +" Ruby + +hi! link rubySharpBang Comment +call s:X("rubyClass","447799","","","DarkBlue","") +call s:X("rubyIdentifier","c6b6fe","","","Cyan","") +hi! link rubyConstant Type +hi! link rubyFunction Function + +call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","") +call s:X("rubySymbol","7697d6","","","Blue","") +hi! link rubyGlobalVariable rubyInstanceVariable +hi! link rubyModule rubyClass +call s:X("rubyControl","7597c6","","","Blue","") + +hi! link rubyString String +hi! link rubyStringDelimiter StringDelimiter +hi! link rubyInterpolationDelimiter Identifier + +call s:X("rubyRegexpDelimiter","540063","","","Magenta","") +call s:X("rubyRegexp","dd0093","","","DarkMagenta","") +call s:X("rubyRegexpSpecial","a40073","","","Magenta","") + +call s:X("rubyPredefinedIdentifier","de5577","","","Red","") + +" Erlang + +hi! link erlangAtom rubySymbol +hi! link erlangBIF rubyPredefinedIdentifier +hi! link erlangFunction rubyPredefinedIdentifier +hi! link erlangDirective Statement +hi! link erlangNode Identifier + +" Elixir + +hi! link elixirAtom rubySymbol + + +" JavaScript + +hi! link javaScriptValue Constant +hi! link javaScriptRegexpString rubyRegexp +hi! link javaScriptTemplateVar StringDelim +hi! link javaScriptTemplateDelim Identifier +hi! link javaScriptTemplateString String + +" CoffeeScript + +hi! link coffeeRegExp javaScriptRegexpString + +" Lua + +hi! link luaOperator Conditional + +" C + +hi! link cFormat Identifier +hi! link cOperator Constant + +" Objective-C/Cocoa + +hi! link objcClass Type +hi! link cocoaClass objcClass +hi! link objcSubclass objcClass +hi! link objcSuperclass objcClass +hi! link objcDirective rubyClass +hi! link objcStatement Constant +hi! link cocoaFunction Function +hi! link objcMethodName Identifier +hi! link objcMethodArg Normal +hi! link objcMessageName Identifier + +" Vimscript + +hi! link vimOper Normal + +" HTML + +hi! link htmlTag Statement +hi! link htmlEndTag htmlTag +hi! link htmlTagName htmlTag + +" XML + +hi! link xmlTag Statement +hi! link xmlEndTag xmlTag +hi! link xmlTagName xmlTag +hi! link xmlEqual xmlTag +hi! link xmlEntity Special +hi! link xmlEntityPunct xmlEntity +hi! link xmlDocTypeDecl PreProc +hi! link xmlDocTypeKeyword PreProc +hi! link xmlProcessingDelim xmlAttrib + +" Debugger.vim + +call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue") +call s:X("DbgBreakPt","","4F0037","","","DarkMagenta") + +" vim-indent-guides + +if !exists("g:indent_guides_auto_colors") + let g:indent_guides_auto_colors = 0 +endif +call s:X("IndentGuidesOdd","","232323","","","") +call s:X("IndentGuidesEven","","1b1b1b","","","") + +" Plugins, etc. + +hi! link TagListFileName Directory +call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green") + +" Manual overrides for 256-color terminals. Dark colors auto-map badly. +if !s:low_color + hi StatusLineNC ctermbg=235 + hi Folded ctermbg=236 + hi DiffText ctermfg=81 + hi DbgBreakPt ctermbg=53 + hi IndentGuidesOdd ctermbg=235 + hi IndentGuidesEven ctermbg=234 +endif + +if !empty("s:overrides") + fun! s:current_attr(group) + let l:synid = synIDtrans(hlID(a:group)) + let l:attrs = [] + for l:attr in ["bold", "italic", "reverse", "standout", "underline", "undercurl"] + if synIDattr(l:synid, l:attr, "gui") == 1 + call add(l:attrs, l:attr) + endif + endfor + return join(l:attrs, ",") + endfun + fun! s:current_color(group, what, mode) + let l:color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode) + if l:color == -1 + return "" + else + return substitute(l:color, "^#", "", "") + endif + endfun + fun! s:load_color_def(group, def) + call s:X(a:group, get(a:def, "guifg", s:current_color(a:group, "fg", "gui")), + \ get(a:def, "guibg", s:current_color(a:group, "bg", "gui")), + \ get(a:def, "attr", s:current_attr(a:group)), + \ get(a:def, "ctermfg", s:current_color(a:group, "fg", "cterm")), + \ get(a:def, "ctermbg", s:current_color(a:group, "bg", "cterm"))) + if !s:low_color + for l:prop in ["ctermfg", "ctermbg"] + let l:override_key = "256".l:prop + if has_key(a:def, l:override_key) + exec "hi ".a:group." ".l:prop."=".a:def[l:override_key] + endif + endfor + endif + endfun + fun! s:load_colors(defs) + for [l:group, l:def] in items(a:defs) + if l:group == "background" + call s:load_color_def("LineNr", l:def) + call s:load_color_def("NonText", l:def) + call s:load_color_def("Normal", l:def) + else + call s:load_color_def(l:group, l:def) + endif + unlet l:group + unlet l:def + endfor + endfun + call s:load_colors(s:overrides) + delf s:load_colors + delf s:load_color_def + delf s:current_color + delf s:current_attr +endif + +" delete functions {{{ +delf s:X +delf s:remove_italic_attr +delf s:prefix_highlight_value_with +delf s:rgb +delf s:is_empty_or_none +delf s:color +delf s:rgb_color +delf s:rgb_level +delf s:rgb_number +delf s:grey_color +delf s:grey_level +delf s:grey_number +" }}} diff --git a/pack/acp/start/mom.vim/README b/pack/acp/start/mom.vim/README new file mode 100644 index 0000000..84fa6d3 --- /dev/null +++ b/pack/acp/start/mom.vim/README @@ -0,0 +1,6 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=1231 + +Syntax highlighting for mom, a troff macro package, or as mom's homepage (http://faustus.dyn.ca/mom/mom.html) states: "mom is a typesetting and formatting package used to create high-quality, PostScript documents for printing." + +This script is specialized for mom, although that is a troff macro package, this script does only have limited troff highlighting capabilities. + diff --git a/pack/acp/start/mom.vim/syntax/mom.vim b/pack/acp/start/mom.vim/syntax/mom.vim new file mode 100644 index 0000000..2bbdab4 --- /dev/null +++ b/pack/acp/start/mom.vim/syntax/mom.vim @@ -0,0 +1,143 @@ +" Vim syntax file +" Language: mom +" Maintainer: Christian V. J. Brssow +" Last Change: So 06 Mr 2005 17:28:13 CET +" Filenames: *.mom +" URL: http://www.cvjb.de/comp/vim/mom.vim +" Note: Remove or overwrite troff syntax for *.mom-files with filetype/filedetect. +" Version: 0.1 +" +" Mom: Macro set for easy typesetting with troff/nroff/groff. + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Mom is case sensitive +syn case match + +" Synchronization, I know it is a huge number, but normal texts can be +" _very_ long ;-) +syn sync lines=1000 + +" Characters allowed in keywords +if version >= 600 + setlocal iskeyword=@,#,$,%,48-57,.,@-@,_,192-255 +else + set iskeyword=@,#,$,%,48-57,.,@-@,_,192-255 +endif + +" Some special keywords +syn keyword momTodo contained TODO FIXME +syn keyword momDefine .de .. .ALIAS .ALIASN + +" Preprocessor keywords +syn keyword momPreprocessor .EQ .EN .GS .GE .GF .PS .PE .R1 .R2 .TS .TE .TH +syn keyword momPreprocessor .G1 .G2 .IS .IE .cstart .cend + +" Number Registers +syn match momNumberReg '\.#[A-Za-z][_0-9A-Za-z]*' + +" String Registers +syn match momStringReg '\.\$[A-Za-z][_0-9A-Za-z]*' + +" Strings +syn region momString start='"' end='"' contains=momNoLineBreak,momGreek,momInteger,momFloatEN,momFloatDE,momBracketRegion,momBracketError,momSpecialMove + +" Special characters +syn match momSpecialChar '\\([-+A-Za-z0-9*<>=~!]\+' + +" Greek symbols +syn match momGreek '\\(\*[A-Za-z]\+' + +" Hyphenation marks +syn match momHyphenation '\\%' + +" Masking of line breaks +syn match momNoLineBreak '\\\s*$' + +" Numbers (with optional units) +syn match momInteger '[-+]\=[0-9]\+[iPpv]\=' +syn match momFloatEN '[-+]\=[0-9]*\.[0-9]\+[iPpv]\=' +syn match momFloatDE '[-+]\=[0-9]\+,[0-9]\+' + +" Mom Macros +syn match momKeyword '\(^\|\s\+\)\.[A-Za-z][_0-9A-Za-z]*' +syn match momKeywordParam '\(^\|\s\+\)\.[A-Za-z][_0-9A-Za-z]*\s\+[^-\\"]\+' contains=momInteger,momFloatEN,momString,momSpecialParam +syn keyword momSpecialParam contained ON OFF T H C R I B L J N QUAD CLEAR NAMED DRAFT FINAL DEFAULT TYPESET TYPEWRITE CHAPTER BLOCK + +" Brackets +syn match momBrackets '[[]]' +syn match momBracketError '\]' +syn region momBracketRegion transparent matchgroup=Delimiter start='\[' matchgroup=Delimiter end='\]' contains=ALLBUT,momBracketError + +" Special movements, e.g. \*[BU<#>] or \*[BP<#>] +syn region momSpecialMove matchgroup=Delimiter start='\\\*\[' matchgroup=Delimiter end='\]' contains=ALLBUT,momBracketError + +" Quotes +syn region momQuote matchgroup=momKeyword start='\<\.QUOTE\>' matchgroup=momKeyword end='\<\.QUOTE\s\+OFF\>' skip='$' contains=ALL +syn region momBlockQuote matchgroup=momKeyword start='\<\.BLOCKQUOTE\>' matchgroup=momKeyword end='\<\.BLOCKQUOTE\s\+OFF\>' skip='$' contains=ALL +syn keyword momBreakQuote .BREAK_QUOTE' + +" Footnotes +syn region momFootnote matchgroup=momKeyword start='\<\.FOOTNOTE\>' matchgroup=momKeyword end='\<\.FOOTNOTE\s\+OFF\>' skip='$' contains=ALL + +" Comments +syn region momCommentLine start='\(\\!\)\|\(\\"\)\|\(\\#\)' end='$' contains=momTodo +syn region momCommentRegion matchgroup=momKeyword start='\<\.\(COMMENT\)\|\(SILENT\)\>' matchgroup=momKeyword end='\<\.\(COMMENT\s\+OFF\)\|\(SILENT\s\+OFF\)\>' skip='$' + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_mom_syn_inits") + if version < 508 + let did_mom_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + " The default methods for highlighting. Can be overrriden later. + HiLink momTodo Todo + HiLink momDefine Define + HiLink momPreprocessor PreProc + HiLink momNumberReg Special + HiLink momStringReg Special + HiLink momCommentLine Comment + HiLink momCommentRegion Comment + HiLink momInteger Number + HiLink momFloatEN Number + HiLink momFloatDE Number + HiLink momString String + HiLink momHyphenation Tag + HiLink momNoLineBreak Special + HiLink momKeyword Keyword + HiLink momSpecialParam Special + HiLink momKeywordParam Keyword + + HiLink momBracketError Error + HiLink momBrackets Delimiter + + hi momNormal term=none cterm=none gui=none + hi momItalic term=italic cterm=italic gui=italic + hi momBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic + HiLink momGreek momBoldItalic + HiLink momSpecialChar momItalic + HiLink momSpecialMove momBoldItalic + + HiLink momQuote momBoldItalic + HiLink momBlockQuote momBoldItalic + HiLink momBreakQuote momNormal + + HiLink momFootnote momItalic + + delcommand HiLink +endif + +let b:current_syntax = "mom" + +" vim:ts=8:sw=4:nocindent:smartindent: diff --git a/pack/acp/start/rust.vim/.gitignore b/pack/acp/start/rust.vim/.gitignore new file mode 100644 index 0000000..0a56e3f --- /dev/null +++ b/pack/acp/start/rust.vim/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/pack/acp/start/rust.vim/LICENSE-APACHE b/pack/acp/start/rust.vim/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/pack/acp/start/rust.vim/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/pack/acp/start/rust.vim/LICENSE-MIT b/pack/acp/start/rust.vim/LICENSE-MIT new file mode 100644 index 0000000..e69282e --- /dev/null +++ b/pack/acp/start/rust.vim/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2015 The Rust Project Developers + +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/pack/acp/start/rust.vim/README.md b/pack/acp/start/rust.vim/README.md new file mode 100644 index 0000000..9fe8968 --- /dev/null +++ b/pack/acp/start/rust.vim/README.md @@ -0,0 +1,87 @@ +# rust.vim + +## Description + +This is a Vim plugin that provides [Rust][r] file detection, syntax highlighting, formatting, +[Syntastic][syn] integration, and more. + +## Installation + +### Using [Vundle][v] + +1. Add `Plugin 'rust-lang/rust.vim'` to `~/.vimrc` +2. `:PluginInstall` or `$ vim +PluginInstall +qall` + +*Note:* Vundle will not automatically detect Rust files properly if `filetype +on` is executed before Vundle. Please check the [quickstart][vqs] for more +details. + +### Using [Pathogen][p] + +```shell +git clone --depth=1 https://github.com/rust-lang/rust.vim.git ~/.vim/bundle/rust.vim +``` + +### Using [NeoBundle][nb] + +1. Add `NeoBundle 'rust-lang/rust.vim'` to `~/.vimrc` +2. Re-open vim or execute `:source ~/.vimrc` + +### Using [vim-plug][vp] + +1. Add `Plug 'rust-lang/rust.vim'` to `~/.vimrc` +2. `:PlugInstall` or `$ vim +PlugInstall +qall` + +## Features + +### Error checking with [Syntastic][syn] + +`rust.vim` automatically registers `rustc` as a syntax checker +with [Syntastic][syn]. Check Syntastic's documentation for +information on how to customize its behaviour. + +### Formatting with [rustfmt][rfmt] + +The `:RustFmt` command will format your code with +[rustfmt][rfmt] if installed. + +Placing `let g:rustfmt_autosave = 1` in your `~/.vimrc` will +enable automatic running of `:RustFmt` when you save a buffer. + +Do `:help :RustFmt` for further formatting help and customization +options. + +### [Playpen][pp] integration + +*Note:* This feature requires [webapi-vim][wav] to be installed. + +The `:RustPlay` command will send the current selection, or if +nothing is selected the current buffer, to the [Rust playpen][pp]. + +[rfmt]: https://crates.io/crates/rustfmt/ + +## Help + +Further help can be found in the documentation with `:Helptags` then `:help rust`. + +Detailed help can be found in the documentation with `:help rust`. +Helptags (`:help helptags`) need to be generated for this plugin +in order to navigate the help. Most plugin managers will do this +automatically, but check their documentation if that is not the case. + +## License + +Like Rust, rust.vim is primarily distributed under the terms of both the MIT +license and the Apache License (Version 2.0). See LICENSE-APACHE and +LICENSE-MIT for details. + +[r]: https://www.rust-lang.org +[v]: https://github.com/gmarik/vundle +[vqs]: https://github.com/gmarik/vundle#quick-start +[p]: https://github.com/tpope/vim-pathogen +[nb]: https://github.com/Shougo/neobundle.vim +[vp]: https://github.com/junegunn/vim-plug +[rfmt]: https://github.com/rust-lang-nursery/rustfmt +[syn]: https://github.com/scrooloose/syntastic +[wav]: https://github.com/mattn/webapi-vim +[pp]: https://play.rust-lang.org/ diff --git a/pack/acp/start/rust.vim/after/syntax/rust.vim b/pack/acp/start/rust.vim/after/syntax/rust.vim new file mode 100644 index 0000000..b0f7e62 --- /dev/null +++ b/pack/acp/start/rust.vim/after/syntax/rust.vim @@ -0,0 +1,34 @@ +if !exists('g:rust_conceal') || g:rust_conceal == 0 || !has('conceal') || &enc != 'utf-8' + finish +endif + +" For those who don't want to see `::`... +if exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0 + syn match rustNiceOperator "::" conceal cchar=ㆍ +endif + +syn match rustRightArrowHead contained ">" conceal cchar=  +syn match rustRightArrowTail contained "-" conceal cchar=⟶ +syn match rustNiceOperator "->" contains=rustRightArrowHead,rustRightArrowTail + +syn match rustFatRightArrowHead contained ">" conceal cchar=  +syn match rustFatRightArrowTail contained "=" conceal cchar=⟹ +syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrowTail + +syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=′ + +" For those who don't want to see `pub`... +if exists('g:rust_conceal_pub') && g:rust_conceal_pub != 0 + syn match rustPublicSigil contained "pu" conceal cchar=* + syn match rustPublicRest contained "b" conceal cchar=  + syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest +endif + +hi link rustNiceOperator Operator + +if !(exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0) + hi! link Conceal Operator + + " And keep it after a colorscheme change + au ColorScheme hi! link Conceal Operator +endif diff --git a/pack/acp/start/rust.vim/autoload/rust.vim b/pack/acp/start/rust.vim/autoload/rust.vim new file mode 100644 index 0000000..477f3c4 --- /dev/null +++ b/pack/acp/start/rust.vim/autoload/rust.vim @@ -0,0 +1,414 @@ +" Author: Kevin Ballard +" Description: Helper functions for Rust commands/mappings +" Last Modified: May 27, 2014 + +" Jump {{{1 + +function! rust#Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! s:Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! s:Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction + +" Run {{{1 + +function! rust#Run(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang + let idx = index(l:args, '--') + if idx != -1 + let rustc_args = idx == 0 ? [] : l:args[:idx-1] + let args = l:args[idx+1:] + else + let rustc_args = l:args + let args = [] + endif + else + let rustc_args = [] + endif + + let b:rust_last_rustc_args = l:rustc_args + let b:rust_last_args = l:args + + call s:WithPath(function("s:Run"), rustc_args, args) +endfunction + +function! s:Run(dict, rustc_args, args) + let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r') + if has('win32') + let exepath .= '.exe' + endif + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let rustc_args = [relpath, '-o', exepath] + a:rustc_args + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) + endif +endfunction + +" Expand {{{1 + +function! rust#Expand(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang && !empty(l:args) + let pretty = remove(l:args, 0) + else + let pretty = "expanded" + endif + call s:WithPath(function("s:Expand"), pretty, args) +endfunction + +function! s:Expand(dict, pretty, args) + try + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)' + let flag = '--xpretty' + else + let flag = '--pretty' + endif + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if v:shell_error + echohl WarningMsg + echo output + echohl None + else + new + silent put =output + 1 + d + setl filetype=rust + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.pretty.rs' + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endtry +endfunction + +function! rust#CompleteExpand(lead, line, pos) + if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' + " first argument and it has a ! + let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"] + if !empty(a:lead) + call filter(list, "v:val[:len(a:lead)-1] == a:lead") + endif + return list + endif + + return glob(escape(a:lead, "*?[") . '*', 0, 1) +endfunction + +" Emit {{{1 + +function! rust#Emit(type, args) + let args = s:ShellTokenize(a:args) + call s:WithPath(function("s:Emit"), a:type, args) +endfunction + +function! s:Emit(dict, type, args) + try + let output_path = a:dict.tmpdir.'/output' + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '--emit', a:type, '-o', output_path] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + new + exe 'silent keepalt read' fnameescape(output_path) + 1 + d + if a:type == "llvm-ir" + setl filetype=llvm + let extension = 'll' + elseif a:type == "asm" + setl filetype=asm + let extension = 's' + endif + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + if exists('l:extension') + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.'.extension + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endif + endtry +endfunction + +" Utility functions {{{1 + +" Invokes func(dict, ...) +" Where {dict} is a dictionary with the following keys: +" 'path' - The path to the file +" 'tmpdir' - The path to a temporary directory that will be deleted when the +" function returns. +" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise. +" If {istemp} is 1 then an additional key is provided: +" 'tmpdir_relpath' - The {path} relative to the {tmpdir}. +" +" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the +" existing path of the current buffer. If the path is inside of {dict.tmpdir} +" then it is guaranteed to have a '.rs' extension. +function! s:WithPath(func, ...) + let buf = bufnr('') + let saved = {} + let dict = {} + try + let saved.write = &write + set write + let dict.path = expand('%') + let pathisempty = empty(dict.path) + + " Always create a tmpdir in case the wrapped command wants it + let dict.tmpdir = tempname() + call mkdir(dict.tmpdir) + + if pathisempty || !saved.write + let dict.istemp = 1 + " if we're doing this because of nowrite, preserve the filename + if !pathisempty + let filename = expand('%:t:r').".rs" + else + let filename = 'unnamed.rs' + endif + let dict.tmpdir_relpath = filename + let dict.path = dict.tmpdir.'/'.filename + + let saved.mod = &mod + set nomod + + silent exe 'keepalt write! ' . fnameescape(dict.path) + if pathisempty + silent keepalt 0file + endif + else + let dict.istemp = 0 + update + endif + + call call(a:func, [dict] + a:000) + finally + if bufexists(buf) + for [opt, value] in items(saved) + silent call setbufvar(buf, '&'.opt, value) + unlet value " avoid variable type mismatches + endfor + endif + if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif + endtry +endfunction + +function! rust#AppendCmdLine(text) + call setcmdpos(getcmdpos()) + let cmd = getcmdline() . a:text + return cmd +endfunction + +" Tokenize the string according to sh parsing rules +function! s:ShellTokenize(text) + " states: + " 0: start of word + " 1: unquoted + " 2: unquoted backslash + " 3: double-quote + " 4: double-quoted backslash + " 5: single-quote + let l:state = 0 + let l:current = '' + let l:args = [] + for c in split(a:text, '\zs') + if l:state == 0 || l:state == 1 " unquoted + if l:c ==# ' ' + if l:state == 0 | continue | endif + call add(l:args, l:current) + let l:current = '' + let l:state = 0 + elseif l:c ==# '\' + let l:state = 2 + elseif l:c ==# '"' + let l:state = 3 + elseif l:c ==# "'" + let l:state = 5 + else + let l:current .= l:c + let l:state = 1 + endif + elseif l:state == 2 " unquoted backslash + if l:c !=# "\n" " can it even be \n? + let l:current .= l:c + endif + let l:state = 1 + elseif l:state == 3 " double-quote + if l:c ==# '\' + let l:state = 4 + elseif l:c ==# '"' + let l:state = 1 + else + let l:current .= l:c + endif + elseif l:state == 4 " double-quoted backslash + if stridx('$`"\', l:c) >= 0 + let l:current .= l:c + elseif l:c ==# "\n" " is this even possible? + " skip it + else + let l:current .= '\'.l:c + endif + let l:state = 3 + elseif l:state == 5 " single-quoted + if l:c == "'" + let l:state = 1 + else + let l:current .= l:c + endif + endif + endfor + if l:state != 0 + call add(l:args, l:current) + endif + return l:args +endfunction + +function! s:RmDir(path) + " sanity check; make sure it's not empty, /, or $HOME + if empty(a:path) + echoerr 'Attempted to delete empty path' + return 0 + elseif a:path == '/' || a:path == $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + return system("rm -rf " . shellescape(a:path)) +endfunction + +" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. +" If {pwd} is the empty string then it doesn't change the cwd. +function! s:system(pwd, cmd) + let cmd = a:cmd + if !empty(a:pwd) + let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd + endif + return system(cmd) +endfunction + +" Playpen Support {{{1 +" Parts of gist.vim by Yasuhiro Matsumoto reused +" gist.vim available under the BSD license, available at +" http://github.com/mattn/gist-vim +function! s:has_webapi() + if !exists("*webapi#http#post") + try + call webapi#http#post() + catch + endtry + endif + return exists("*webapi#http#post") +endfunction + +function! rust#Play(count, line1, line2, ...) abort + redraw + + let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/') + let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/') + + if !s:has_webapi() + echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None + return + endif + + let bufname = bufname('%') + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + + let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content) + + if strlen(body) > 5000 + echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None + return + endif + + let payload = "format=simple&url=".webapi#http#encodeURI(body) + let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {}) + let url = res.content + + redraw | echomsg 'Done: '.url +endfunction + +" }}}1 + +" vim: set noet sw=4 ts=4: diff --git a/pack/acp/start/rust.vim/autoload/rustfmt.vim b/pack/acp/start/rust.vim/autoload/rustfmt.vim new file mode 100644 index 0000000..e5f9830 --- /dev/null +++ b/pack/acp/start/rust.vim/autoload/rustfmt.vim @@ -0,0 +1,106 @@ +" Author: Stephen Sugden +" +" Adapted from https://github.com/fatih/vim-go + +if !exists("g:rustfmt_autosave") + let g:rustfmt_autosave = 0 +endif + +if !exists("g:rustfmt_command") + let g:rustfmt_command = "rustfmt" +endif + +if !exists("g:rustfmt_options") + let g:rustfmt_options = "" +endif + +if !exists("g:rustfmt_fail_silently") + let g:rustfmt_fail_silently = 0 +endif + +let s:got_fmt_error = 0 + +function! s:RustfmtCommandRange(filename, line1, line2) + let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} + return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg)) +endfunction + +function! s:RustfmtCommand(filename) + return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename) +endfunction + +function! s:RunRustfmt(command, curw, tmpname) + if exists("*systemlist") + let out = systemlist(a:command) + else + let out = split(system(a:command), '\r\?\n') + endif + + if v:shell_error == 0 || v:shell_error == 3 + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + " Replace current file with temp file, then reload buffer + call rename(a:tmpname, expand('%')) + silent edit! + let &syntax = &syntax + + " only clear location list if it was previously filled to prevent + " clobbering other additions + if s:got_fmt_error + let s:got_fmt_error = 0 + call setloclist(0, []) + lwindow + endif + elseif g:rustfmt_fail_silently == 0 + " otherwise get the errors and put them in the location list + let errors = [] + + for line in out + " src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value` + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[5]}) + endif + endfor + + if empty(errors) + % | " Couldn't detect rustfmt error format, output errors + endif + + if !empty(errors) + call setloclist(0, errors, 'r') + echohl Error | echomsg "rustfmt returned error" | echohl None + endif + + let s:got_fmt_error = 1 + lwindow + " We didn't use the temp file, so clean up + call delete(a:tmpname) + endif + + call winrestview(a:curw) +endfunction + +function! rustfmt#FormatRange(line1, line2) + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction + +function! rustfmt#Format() + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommand(l:tmpname) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction diff --git a/pack/acp/start/rust.vim/compiler/cargo.vim b/pack/acp/start/rust.vim/compiler/cargo.vim new file mode 100644 index 0000000..029c5c7 --- /dev/null +++ b/pack/acp/start/rust.vim/compiler/cargo.vim @@ -0,0 +1,28 @@ +" Vim compiler file +" Compiler: Cargo Compiler +" Maintainer: Damien Radtke +" Latest Revision: 2014 Sep 24 + +if exists('current_compiler') + finish +endif +runtime compiler/rustc.vim +let current_compiler = "cargo" + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists('g:cargo_makeprg_params') + execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*' +else + CompilerSet makeprg=cargo\ $* +endif + +" Ignore general cargo progress messages +CompilerSet errorformat+= + \%-G%\\s%#Downloading%.%#, + \%-G%\\s%#Compiling%.%#, + \%-G%\\s%#Finished%.%#, + \%-G%\\s%#error:\ Could\ not\ compile\ %.%#, + \%-G%\\s%#To\ learn\ more\\,%.%# diff --git a/pack/acp/start/rust.vim/compiler/rustc.vim b/pack/acp/start/rust.vim/compiler/rustc.vim new file mode 100644 index 0000000..ba29133 --- /dev/null +++ b/pack/acp/start/rust.vim/compiler/rustc.vim @@ -0,0 +1,45 @@ +" Vim compiler file +" Compiler: Rust Compiler +" Maintainer: Chris Morgan +" Latest Revision: 2013 Jul 12 + +if exists("current_compiler") + finish +endif +let current_compiler = "rustc" + +let s:cpo_save = &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 + CompilerSet makeprg=rustc +else + CompilerSet makeprg=rustc\ \% +endif + +" Old errorformat (before nightly 2016/08/10) +CompilerSet errorformat= + \%f:%l:%c:\ %t%*[^:]:\ %m, + \%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m, + \%-G%f:%l\ %s, + \%-G%*[\ ]^, + \%-G%*[\ ]^%*[~], + \%-G%*[\ ]... + +" New errorformat (after nightly 2016/08/10) +CompilerSet errorformat+= + \%-G, + \%-Gerror:\ aborting\ %.%#, + \%-Gerror:\ Could\ not\ compile\ %.%#, + \%Eerror:\ %m, + \%Eerror[E%n]:\ %m, + \%Wwarning:\ %m, + \%Inote:\ %m, + \%C\ %#-->\ %f:%l:%c + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/pack/acp/start/rust.vim/doc/rust.txt b/pack/acp/start/rust.vim/doc/rust.txt new file mode 100644 index 0000000..68fc1da --- /dev/null +++ b/pack/acp/start/rust.vim/doc/rust.txt @@ -0,0 +1,237 @@ +*rust.txt* Filetype plugin for Rust + +============================================================================== +CONTENTS *rust* *ft-rust* + +1. Introduction |rust-intro| +2. Settings |rust-settings| +3. Commands |rust-commands| +4. Mappings |rust-mappings| + +============================================================================== +INTRODUCTION *rust-intro* + +This plugin provides syntax and supporting functionality for the Rust +filetype. + +============================================================================== +SETTINGS *rust-settings* + +This plugin has a few variables you can define in your vimrc that change the +behavior of the plugin. + + *g:rustc_path* +g:rustc_path~ + Set this option to the path to rustc for use in the |:RustRun| and + |:RustExpand| commands. If unset, "rustc" will be located in $PATH: > + let g:rustc_path = $HOME."/bin/rustc" +< + + *g:rustc_makeprg_no_percent* +g:rustc_makeprg_no_percent~ + Set this option to 1 to have 'makeprg' default to "rustc" instead of + "rustc %": > + let g:rustc_makeprg_no_percent = 1 +< + + *g:rust_conceal* +g:rust_conceal~ + Set this option to turn on the basic |conceal| support: > + let g:rust_conceal = 1 +< + + *g:rust_conceal_mod_path* +g:rust_conceal_mod_path~ + Set this option to turn on |conceal| for the path connecting token + "::": > + let g:rust_conceal_mod_path = 1 +< + + *g:rust_conceal_pub* +g:rust_conceal_pub~ + Set this option to turn on |conceal| for the "pub" token: > + let g:rust_conceal_pub = 1 +< + + *g:rust_recommended_style* +g:rust_recommended_style~ + Set this option to enable vim indentation and textwidth settings to + conform to style conventions of the rust standard library (i.e. use 4 + spaces for indents and sets 'textwidth' to 99). This option is enabled + by default. To disable it: > + let g:rust_recommended_style = 0 +< + + *g:rust_fold* +g:rust_fold~ + Set this option to turn on |folding|: > + let g:rust_fold = 1 +< + Value Effect ~ + 0 No folding + 1 Braced blocks are folded. All folds are open by + default. + 2 Braced blocks are folded. 'foldlevel' is left at the + global value (all folds are closed by default). + + *g:rust_bang_comment_leader* +g:rust_bang_comment_leader~ + Set this option to 1 to preserve the leader on multi-line doc comments + using the /*! syntax: > + let g:rust_bang_comment_leader = 1 +< + + *g:ftplugin_rust_source_path* +g:ftplugin_rust_source_path~ + Set this option to a path that should be prepended to 'path' for Rust + source files: > + let g:ftplugin_rust_source_path = $HOME.'/dev/rust' +< + + *g:rustfmt_command* +g:rustfmt_command~ + Set this option to the name of the 'rustfmt' executable in your $PATH. If + not specified it defaults to 'rustfmt' : > + let g:rustfmt_command = 'rustfmt' +< + *g:rustfmt_autosave* +g:rustfmt_autosave~ + Set this option to 1 to run |:RustFmt| automatically when saving a + buffer. If not specified it defaults to 0 : > + let g:rustfmt_autosave = 0 +< + *g:rustfmt_fail_silently* +g:rustfmt_fail_silently~ + Set this option to 1 to prevent 'rustfmt' from populating the + |location-list| with errors. If not specified it defaults to 0: > + let g:rustfmt_fail_silently = 0 +< + *g:rustfmt_options* +g:rustfmt_options~ + Set this option to a string of options to pass to 'rustfmt'. The + write-mode is already set to 'overwrite'. If not specified it + defaults to '' : > + let g:rustfmt_options = '' +< + + *g:rust_playpen_url* +g:rust_playpen_url~ + Set this option to override the url for the playpen to use: > + let g:rust_playpen_url = 'https://play.rust-lang.org/' +< + + *g:rust_shortener_url* +g:rust_shortener_url~ + Set this option to override the url for the url shortener: > + let g:rust_shortener_url = 'https://is.gd/' +< + + +============================================================================== +COMMANDS *rust-commands* + +:RustRun [args] *:RustRun* +:RustRun! [rustc-args] [--] [args] + Compiles and runs the current file. If it has unsaved changes, + it will be saved first using |:update|. If the current file is + an unnamed buffer, it will be written to a temporary file + first. The compiled binary is always placed in a temporary + directory, but is run from the current directory. + + The arguments given to |:RustRun| will be passed to the + compiled binary. + + If ! is specified, the arguments are passed to rustc instead. + A "--" argument will separate the rustc arguments from the + arguments passed to the binary. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustExpand [args] *:RustExpand* +:RustExpand! [TYPE] [args] + Expands the current file using --pretty and displays the + results in a new split. If the current file has unsaved + changes, it will be saved first using |:update|. If the + current file is an unnamed buffer, it will be written to a + temporary file first. + + The arguments given to |:RustExpand| will be passed to rustc. + This is largely intended for specifying various --cfg + configurations. + + If ! is specified, the first argument is the expansion type to + pass to rustc --pretty. Otherwise it will default to + "expanded". + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitIr [args] *:RustEmitIr* + Compiles the current file to LLVM IR and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitIr| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitAsm [args] *:RustEmitAsm* + Compiles the current file to assembly and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitAsm| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustPlay *:RustPlay* + This command will only work if you have web-api.vim installed + (available at https://github.com/mattn/webapi-vim). It sends the + current selection, or if nothing is selected, the entirety of the + current buffer to the Rust playpen, and emits a message with the + shortened URL to the playpen. + + |g:rust_playpen_url| is the base URL to the playpen, by default + "https://play.rust-lang.org/". + + |g:rust_shortener_url| is the base url for the shorterner, by + default "https://is.gd/" + +:RustFmt *:RustFmt* + Runs |g:rustfmt_command| on the current buffer. If + |g:rustfmt_options| is set then those will be passed to the + executable. + + If |g:rustfmt_fail_silently| is 0 (the default) then it + will populate the |location-list| with the errors from + |g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1 + then it will not populate the |location-list|. + +:RustFmtRange *:RustFmtRange* + Runs |g:rustfmt_command| with selected range. See + |:RustFmt| for any other information. + +============================================================================== +MAPPINGS *rust-mappings* + +This plugin defines mappings for |[[| and |]]| to support hanging indents. + +It also has a few other mappings: + + *rust_* + Executes |:RustRun| with no arguments. + Note: This binding is only available in MacVim. + + *rust_* + Populates the command line with |:RustRun|! using the + arguments given to the last invocation, but does not + execute it. + Note: This binding is only available in MacVim. + +============================================================================== + vim:tw=78:sw=4:noet:ts=8:ft=help:norl: diff --git a/pack/acp/start/rust.vim/ftdetect/rust.vim b/pack/acp/start/rust.vim/ftdetect/rust.vim new file mode 100644 index 0000000..bf685d4 --- /dev/null +++ b/pack/acp/start/rust.vim/ftdetect/rust.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.rs set filetype=rust diff --git a/pack/acp/start/rust.vim/ftplugin/rust.vim b/pack/acp/start/rust.vim/ftplugin/rust.vim new file mode 100644 index 0000000..4e3cd4f --- /dev/null +++ b/pack/acp/start/rust.vim/ftplugin/rust.vim @@ -0,0 +1,207 @@ +" Language: Rust +" Description: Vim syntax file for Rust +" Maintainer: Chris Morgan +" Maintainer: Kevin Ballard +" Last Change: June 08, 2016 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +augroup rust.vim +autocmd! + +" Variables {{{1 + +" The rust source code at present seems to typically omit a leader on /*! +" comments, so we'll use that as our default, but make it easy to switch. +" This does not affect indentation at all (I tested it with and without +" leader), merely whether a leader is inserted by default or not. +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +else + setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// +endif +setlocal commentstring=//%s +setlocal formatoptions-=t formatoptions+=croqnl +" j was only added in 7.3.541, so stop complaints about its nonexistence +silent! setlocal formatoptions+=j + +" smartindent will be overridden by indentexpr if filetype indent is on, but +" otherwise it's better than nothing. +setlocal smartindent nocindent + +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif + +" This includeexpr isn't perfect, but it's a good start +setlocal includeexpr=substitute(v:fname,'::','/','g') + +setlocal suffixesadd=.rs + +if exists("g:ftplugin_rust_source_path") + let &l:path=g:ftplugin_rust_source_path . ',' . &l:path +endif + +if exists("g:loaded_delimitMate") + if exists("b:delimitMate_excluded_regions") + let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions + endif + + let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + " For this buffer, when delimitMate issues the `User delimitMate_map` + " event in the autocommand system, add the above-defined extra excluded + " regions to delimitMate's state, if they have not already been added. + autocmd User + \ if expand('') ==# 'delimitMate_map' && match( + \ delimitMate#Get("excluded_regions"), + \ s:delimitMate_extra_excluded_regions) == -1 + \| let b:delimitMate_excluded_regions = + \ delimitMate#Get("excluded_regions") + \ . s:delimitMate_extra_excluded_regions + \|endif + + " For this buffer, when delimitMate issues the `User delimitMate_unmap` + " event in the autocommand system, delete the above-defined extra excluded + " regions from delimitMate's state (the deletion being idempotent and + " having no effect if the extra excluded regions are not present in the + " targeted part of delimitMate's state). + autocmd User + \ if expand('') ==# 'delimitMate_unmap' + \| let b:delimitMate_excluded_regions = substitute( + \ delimitMate#Get("excluded_regions"), + \ '\C\V' . s:delimitMate_extra_excluded_regions, + \ '', 'g') + \|endif +endif + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 +endif + +" Motion Commands {{{1 + +" Bind motion commands to support hanging indents +nnoremap [[ :call rust#Jump('n', 'Back') +nnoremap ]] :call rust#Jump('n', 'Forward') +xnoremap [[ :call rust#Jump('v', 'Back') +xnoremap ]] :call rust#Jump('v', 'Forward') +onoremap [[ :call rust#Jump('o', 'Back') +onoremap ]] :call rust#Jump('o', 'Forward') + +" Commands {{{1 + +" See |:RustRun| for docs +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(0, ) + +" See |:RustExpand| for docs +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(0, ) + +" See |:RustEmitIr| for docs +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", ) + +" See |:RustEmitAsm| for docs +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", ) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(, , , ) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() + +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(, ) + +" Mappings {{{1 + +" Bind ⌘R in MacVim to :RustRun +nnoremap :RustRun +" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args +nnoremap :RustRun! =join(b:rust_last_rustc_args)erust#AppendCmdLine(' -- ' . join(b:rust_last_args)) + +if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] +endif + +" Cleanup {{{1 + +let b:undo_ftplugin = " + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand RustRun + \|delcommand RustExpand + \|delcommand RustEmitIr + \|delcommand RustEmitAsm + \|delcommand RustPlay + \|nunmap + \|nunmap + \|nunmap [[ + \|nunmap ]] + \|xunmap [[ + \|xunmap ]] + \|ounmap [[ + \|ounmap ]] + \|set matchpairs-=<:> + \|unlet b:match_skip + \" + +" }}}1 + +" Code formatting on save +if get(g:, "rustfmt_autosave", 0) + autocmd BufWritePre *.rs silent! call rustfmt#Format() +endif + +augroup END + +" %-matching. <:> is handy for generics. +set matchpairs+=<:> +" There are two minor issues with it; (a) comparison operators in expressions, +" where a less-than may match a greater-than later on—this is deemed a trivial +" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the +" highlighting perspective (built into Vim), but the actual % functionality +" can be fixed by this use of matchit.vim. +let b:match_skip = 's:comment\|string\|rustArrow' +source $VIMRUNTIME/macros/matchit.vim + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set noet sw=4 ts=4: diff --git a/pack/acp/start/rust.vim/indent/rust.vim b/pack/acp/start/rust.vim/indent/rust.vim new file mode 100644 index 0000000..774133d --- /dev/null +++ b/pack/acp/start/rust.vim/indent/rust.vim @@ -0,0 +1,206 @@ +" Vim indent file +" Language: Rust +" Author: Chris Morgan +" Last Change: 2016 Jul 15 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal cindent +setlocal cinoptions=L0,(0,Ws,J1,j1 +setlocal cinkeys=0{,0},!^F,o,O,0[,0] +" Don't think cinwords will actually do anything at all... never mind +setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern + +" Some preliminary settings +setlocal nolisp " Make sure lisp indenting doesn't supersede us +setlocal autoindent " indentexpr isn't much help otherwise +" Also do indentkeys, otherwise # gets shoved to column 0 :-/ +setlocal indentkeys=0{,0},!^F,o,O,0[,0] + +setlocal indentexpr=GetRustIndent(v:lnum) + +" Only define the function once. +if exists("*GetRustIndent") + finish +endif + +" Come here when loading the script the first time. + +function! s:get_line_trimmed(lnum) + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + " NOTE: this is not accurate; /* */ or a line continuation could trick it + let line = getline(a:lnum) + let line_len = strlen(line) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo' + let min = 1 + let max = line_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo' + let max = col + else + let min = col + 1 + endif + endwhile + let line = strpart(line, 0, min - 1) + endif + return substitute(line, "\s*$", "", "") + else + " Sorry, this is not complete, nor fully correct (e.g. string "//"). + " Such is life. + return substitute(line, "\s*//.*$", "", "") + endif +endfunction + +function! s:is_string_comment(lnum, col) + if has('syntax_items') + for id in synstack(a:lnum, a:col) + let synname = synIDattr(id, "name") + if synname == "rustString" || synname =~ "^rustComment" + return 1 + endif + endfor + else + " without syntax, let's not even try + return 0 + endif +endfunction + +function GetRustIndent(lnum) + + " Starting assumption: cindent (called at the end) will do it right + " normally. We just want to fix up a few cases. + + let line = getline(a:lnum) + + if has('syntax_items') + let synname = synIDattr(synID(a:lnum, 1, 1), "name") + if synname == "rustString" + " If the start of the line is in a string, don't change the indent + return -1 + elseif synname =~ '\(Comment\|Todo\)' + \ && line !~ '^\s*/\*' " not /* opening line + if synname =~ "CommentML" " multi-line + if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*' + " This is (hopefully) the line after a /*, and it has no + " leader, so the correct indentation is that of the + " previous line. + return GetRustIndent(a:lnum - 1) + endif + endif + " If it's in a comment, let cindent take care of it now. This is + " for cases like "/*" where the next line should start " * ", not + " "* " as the code below would otherwise cause for module scope + " Fun fact: " /*\n*\n*/" takes two calls to get right! + return cindent(a:lnum) + endif + endif + + " cindent gets second and subsequent match patterns/struct members wrong, + " as it treats the comma as indicating an unfinished statement:: + " + " match a { + " b => c, + " d => e, + " f => g, + " }; + + " Search backwards for the previous non-empty line. + let prevlinenum = prevnonblank(a:lnum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + while prevlinenum > 1 && prevline !~ '[^[:blank:]]' + let prevlinenum = prevnonblank(prevlinenum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + endwhile + + " Handle where clauses nicely: subsequent values should line up nicely. + if prevline[len(prevline) - 1] == "," + \ && prevline =~# '^\s*where\s' + return indent(prevlinenum) + 6 + endif + + if prevline[len(prevline) - 1] == "," + \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' + \ && prevline !~ '^\s*fn\s' + \ && prevline !~ '([^()]\+,$' + \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>' + " Oh ho! The previous line ended in a comma! I bet cindent will try to + " take this too far... For now, let's normally use the previous line's + " indent. + + " One case where this doesn't work out is where *this* line contains + " square or curly brackets; then we normally *do* want to be indenting + " further. + " + " Another case where we don't want to is one like a function + " definition with arguments spread over multiple lines: + " + " fn foo(baz: Baz, + " baz: Baz) // <-- cindent gets this right by itself + " + " Another case is similar to the previous, except calling a function + " instead of defining it, or any conditional expression that leaves + " an open paren: + " + " foo(baz, + " baz); + " + " if baz && (foo || + " bar) { + " + " Another case is when the current line is a new match arm. + " + " There are probably other cases where we don't want to do this as + " well. Add them as needed. + return indent(prevlinenum) + endif + + if !has("patch-7.4.355") + " cindent before 7.4.355 doesn't do the module scope well at all; e.g.:: + " + " static FOO : &'static [bool] = [ + " true, + " false, + " false, + " true, + " ]; + " + " uh oh, next statement is indented further! + + " Note that this does *not* apply the line continuation pattern properly; + " that's too hard to do correctly for my liking at present, so I'll just + " start with these two main cases (square brackets and not returning to + " column zero) + + call cursor(a:lnum, 1) + if searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + if searchpair('\[', '', '\]', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + " Global scope, should be zero + return 0 + else + " At the module scope, inside square brackets only + "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum + if line =~ "^\\s*]" + " It's the closing line, dedent it + return 0 + else + return &shiftwidth + endif + endif + endif + endif + + " Fall back on cindent, which does it mostly right + return cindent(a:lnum) +endfunction diff --git a/pack/acp/start/rust.vim/plugin/rust.vim b/pack/acp/start/rust.vim/plugin/rust.vim new file mode 100644 index 0000000..4ec4f33 --- /dev/null +++ b/pack/acp/start/rust.vim/plugin/rust.vim @@ -0,0 +1,22 @@ +" Vim syntastic plugin helper +" Language: Rust +" Maintainer: Andrew Gallant + +if exists("g:loaded_syntastic_rust_filetype") + finish +endif +let g:loaded_syntastic_rust_filetype = 1 +let s:save_cpo = &cpo +set cpo&vim + +" This is to let Syntastic know about the Rust filetype. +" It enables tab completion for the 'SyntasticInfo' command. +" (This does not actually register the syntax checker.) +if exists('g:syntastic_extra_filetypes') + call add(g:syntastic_extra_filetypes, 'rust') +else + let g:syntastic_extra_filetypes = ['rust'] +endif + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/pack/acp/start/rust.vim/syntax/rust.vim b/pack/acp/start/rust.vim/syntax/rust.vim new file mode 100644 index 0000000..8c73462 --- /dev/null +++ b/pack/acp/start/rust.vim/syntax/rust.vim @@ -0,0 +1,294 @@ +" Vim syntax file +" Language: Rust +" Maintainer: Patrick Walton +" Maintainer: Ben Blum +" Maintainer: Chris Morgan +" Last Change: Feb 24, 2016 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Syntax definitions {{{1 +" Basic keywords {{{2 +syn keyword rustConditional match if else +syn keyword rustRepeat for loop while +syn keyword rustTypedef type nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustStructure struct enum nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustUnion union nextgroup=rustIdentifier skipwhite skipempty contained +syn match rustUnionContextual /\/ + +syn keyword rustInvalidBareKeyword crate + +syn keyword rustPubScopeCrate crate contained +syn match rustPubScopeDelim /[()]/ contained +syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent + +syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty +" This is to get the `bar` part of `extern crate "foo" as bar;` highlighting. +syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator +syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty + +syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained +syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained + +syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained +" Ideally we'd have syntax rules set up to match arbitrary expressions. Since +" we don't, we'll just define temporary contained rules to handle balancing +" delimiters. +syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent +syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent +" {} are handled by rustFoldBraces + +syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount +syn match rustMacroRepeatCount ".\?[*+]" contained +syn match rustMacroVariable "$\w\+" + +" Reserved (but not yet used) keywords {{{2 +syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro + +" Built-in types {{{2 +syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32 +syn keyword rustType f64 i8 i16 i32 i64 i128 str Self + +" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2 +" This section is just straight transformation of the contents of the prelude, +" to make it easy to update. + +" Reexported core operators {{{3 +syn keyword rustTrait Copy Send Sized Sync +syn keyword rustTrait Drop Fn FnMut FnOnce + +" Reexported functions {{{3 +" There’s no point in highlighting these; when one writes drop( or drop::< it +" gets the same highlighting anyway, and if someone writes `let drop = …;` we +" don’t really want *that* drop to be highlighted. +"syn keyword rustFunction drop + +" Reexported types and traits {{{3 +syn keyword rustTrait Box +syn keyword rustTrait ToOwned +syn keyword rustTrait Clone +syn keyword rustTrait PartialEq PartialOrd Eq Ord +syn keyword rustTrait AsRef AsMut Into From +syn keyword rustTrait Default +syn keyword rustTrait Iterator Extend IntoIterator +syn keyword rustTrait DoubleEndedIterator ExactSizeIterator +syn keyword rustEnum Option +syn keyword rustEnumVariant Some None +syn keyword rustEnum Result +syn keyword rustEnumVariant Ok Err +syn keyword rustTrait SliceConcatExt +syn keyword rustTrait String ToString +syn keyword rustTrait Vec + +" Other syntax {{{2 +syn keyword rustSelf self +syn keyword rustBoolean true false + +" If foo::bar changes to foo.bar, change this ("::" to "\."). +" If foo::bar changes to Foo::bar, change this (first "\w" to "\u"). +syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3 +syn match rustModPathSep "::" + +syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1 +syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::(); + +" This is merely a convention; note also the use of [A-Z], restricting it to +" latin identifiers rather than the full Unicode uppercase. I have not used +" [:upper:] as it depends upon 'noignorecase' +"syn match rustCapsIdent display "[A-Z]\w\(\w\)*" + +syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?" +" This one isn't *quite* right, as we could have binary-& with a reference +syn match rustSigil display /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +" This isn't actually correct; a closure with no arguments can be `|| { }`. +" Last, because the & in && isn't a sigil +syn match rustOperator display "&&\|||" +" This is rustArrowCharacter rather than rustArrow for the sake of matchparen, +" so it skips the ->; see http://stackoverflow.com/a/30309949 for details. +syn match rustArrowCharacter display "->" +syn match rustQuestionMark display "?\([a-zA-Z]\+\)\@!" + +syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic +syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic + +syn match rustEscapeError display contained /\\./ +syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ +syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/ +syn match rustStringContinuation display contained /\\\n\s*/ +syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation +syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell +syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell + +syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError +syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait +" This list comes from src/libsyntax/ext/deriving/mod.rs +" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). +syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy + +" Number literals +syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" + +" Special case for numbers of the form "1." which are float literals, unless followed by +" an identifier, which makes them integer literals with a method call or field access, +" or by another ".", which makes them integer literals followed by the ".." token. +" (This must go first so the others take precedence.) +syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\|\.\)\@!" +" To mark a number as a normal float, it must have at least one of the three things integral values don't have: +" a decimal point and more numbers; an exponent; and a type suffix. +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)" + +" For the benefit of delimitMate +syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\x\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime +syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate +syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime + +"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting +syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" +syn match rustLabel display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*:" +syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ +" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). +syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ +syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode +syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid + +syn match rustShebang /\%^#![^[].*/ +syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDocError start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell contained +syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell +syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell +syn region rustCommentBlockDocError matchgroup=rustCommentBlockDocError start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained +syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent +syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent +syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent +" FIXME: this is a really ugly and not fully correct implementation. Most +" importantly, a case like ``/* */*`` should have the final ``*`` not being in +" a comment, but in practice at present it leaves comments open two levels +" deep. But as long as you stay away from that particular case, I *believe* +" the highlighting is correct. Due to the way Vim's syntax engine works +" (greedy for start matches, unlike Rust's tokeniser which is searching for +" the earliest-starting match, start or end), I believe this cannot be solved. +" Oh you who would fix it, don't bother with things like duplicating the Block +" rules and putting ``\*\@ +" +" See for details on how to add an external Syntastic checker: +" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external + +if exists("g:loaded_syntastic_rust_rustc_checker") + finish +endif +let g:loaded_syntastic_rust_rustc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_rust_rustc_GetLocList() dict + let makeprg = self.makeprgBuild({}) + + " Old errorformat (before nightly 2016/08/10) + let errorformat = + \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' . + \ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' . + \ '%C%f:%l %m' + + " New errorformat (after nightly 2016/08/10) + let errorformat .= + \ ',' . + \ '%-G,' . + \ '%-Gerror: aborting %.%#,' . + \ '%-Gerror: Could not compile %.%#,' . + \ '%Eerror: %m,' . + \ '%Eerror[E%n]: %m,' . + \ '%-Gwarning: the option `Z` is unstable %.%#,' . + \ '%Wwarning: %m,' . + \ '%Inote: %m,' . + \ '%C %#--> %f:%l:%c' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'rust', + \ 'name': 'rustc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/pack/acp/start/vim-airline/.gitignore b/pack/acp/start/vim-airline/.gitignore new file mode 100644 index 0000000..38ec5a0 --- /dev/null +++ b/pack/acp/start/vim-airline/.gitignore @@ -0,0 +1,4 @@ +doc/tags +*.lock +.vim-flavor +*.swp diff --git a/pack/acp/start/vim-airline/.travis.yml b/pack/acp/start/vim-airline/.travis.yml new file mode 100644 index 0000000..54deccf --- /dev/null +++ b/pack/acp/start/vim-airline/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +before_install: + - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim + - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim + - mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim +rvm: + - 1.9.3 +script: rake ci diff --git a/pack/acp/start/vim-airline/CHANGELOG.md b/pack/acp/start/vim-airline/CHANGELOG.md new file mode 100644 index 0000000..b37ee18 --- /dev/null +++ b/pack/acp/start/vim-airline/CHANGELOG.md @@ -0,0 +1,120 @@ +# Change Log + +This is the Changelog for the vim-airline project. + +## [Unreleased] + +## [0.8] - 2016-03-09 +- Changes + - Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline) + - Themes have been split into an separate repository [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) +- Improvements + - Extensions + - branch: support Git and Mercurial simultaneously, untracked files + - whitespace: new mixed-indent rule + - Windows support + - Many bug fixes + - Support for Neovim +- New features + - Many new themes + - Extensions/integration + - [taboo](https://github.com/gcmt/taboo.vim) + - [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) + - [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim) + - [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) + - [po.vim](http://www.vim.org/scripts/script.php?script_id=695) + - [unicode.vim](https://github.com/chrisbra/unicode.vim) + - wordcount + - crypt indicator + - byte order mark indicator + - Tabline's tab mode can display splits simultaneously + +## [0.7] - 2014-12-10 +- New features + - accents support; allowing multiple colors/styles in the same section + - extensions: eclim + - themes: understated, monochrome, murmur, sol, lucius +- Improvements + - solarized theme; support for 8 color terminals + - tabline resizes dynamically based on number of open buffers + - miscellaneous bug fixes + +## [0.6] - 2013-10-08 + +- New features + - accents support; allowing multiple colors/styles in the same section + - extensions: eclim + - themes: understated, monochrome, murmur, sol, lucius +- Improvements + - solarized theme; support for 8 color terminals + - tabline resizes dynamically based on number of open buffers + - miscellaneous bug fixes + +## [0.5] - 2013-09-13 + +- New features + - smart tabline extension which displays all buffers when only one tab is visible + - automatic section truncation when the window resizes + - support for a declarative style of configuration, allowing parts to contain metadata such as minimum window width or conditional visibility + - themes: zenburn, serene +- Other + - a sizable chunk of vim-airline is now running through a unit testing suite, automated via Travis CI + +## [0.4] - 2013-08-26 + + - New features + - integration with csv.vim and vim-virtualenv + - hunks extension for vim-gitgutter and vim-signify + - automatic theme switching with matching colorschemes + - commands: AirlineToggle + - themes: base16 (all variants) + - Improvements + - integration with undotree, tagbar, and unite + - Other + - refactored core and exposed statusline builder and pipeline + - all extension related g:airline_variables have been deprecated in favor of g:airline#extensions# variables + - extensions found in the runtimepath outside of the default distribution will be automatically loaded + +## [0.3] - 2013-08-12 + +- New features + - first-class integration with tagbar + - white space detection for trailing spaces and mixed indentation + - introduced warning section for syntastic and white space detection + - improved ctrlp integration: colors are automatically selected based on the current airline theme + - new themes: molokai, bubblegum, jellybeans, tomorrow +- Bug fixes + - improved handling of eventignore used by other plugins +- Other + - code cleaned up for clearer separation between core functionality and extensions + - introduced color extraction from highlight groups, allowing themes to be generated off of the active colorscheme (e.g. jellybeans and tomorrow) + - License changed to MIT + +## [0.2] - 2013-07-28 + +- New features + - iminsert detection + - integration with vimshell, vimfiler, commandt, lawrencium + - enhanced bufferline theming + - support for ctrlp theming + - support for custom window excludes +- New themes + - luna and wombat +- Bug fixes + - refresh branch name after switching with a shell command + +## [0.1] - 2013-07-17 + +- Initial release + - integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp + - support for themes: 8 included + +[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...HEAD +[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8 +[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7 +[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6 +[0.5]: https://github.com/vim-airline/vim-airline/compare/v0.4...v0.5 +[0.4]: https://github.com/vim-airline/vim-airline/compare/v0.3...v0.4 +[0.3]: https://github.com/vim-airline/vim-airline/compare/v0.2...v0.3 +[0.2]: https://github.com/vim-airline/vim-airline/compare/v0.1...v0.2 +[0.1]: https://github.com/vim-airline/vim-airline/releases/tag/v0.1 diff --git a/pack/acp/start/vim-airline/CONTRIBUTING.md b/pack/acp/start/vim-airline/CONTRIBUTING.md new file mode 100644 index 0000000..f97699e --- /dev/null +++ b/pack/acp/start/vim-airline/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# 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. + +# 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. Even better, create a `gist` of your vimrc that is compatible with [pathogen][11]. +* And to make it easier to reproduce, please supply the following: + * the `:version` of vim + * the commit of vim-airline you're using + * the OS that you're using, including terminal emulator, GUI vs non-GUI + +# Themes + +* If you submit a theme, please create a screenshot so it can be added to the [Wiki][14]. +* In the majority of cases, modifications to colors of existing themes will likely be rejected. Themes are a subjective thing, so while you may prefer that a particular color be darker, another user will prefer it to be lighter, or something entirely different. The more popular the theme, the more unlikely the change will be accepted. However, it's pretty simple to create your own theme; copy the theme to `~/.vim/autoload/airline/themes` under a new name with your modifications, and it can be used. + +# Maintenance + +If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43]. + + +[7]: https://github.com/bling/minivimrc +[11]: https://github.com/tpope/vim-pathogen +[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots +[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer diff --git a/pack/acp/start/vim-airline/Gemfile b/pack/acp/start/vim-airline/Gemfile new file mode 100644 index 0000000..088f22e --- /dev/null +++ b/pack/acp/start/vim-airline/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'vim-flavor', '~> 1.1' diff --git a/pack/acp/start/vim-airline/ISSUE_TEMPLATE.md b/pack/acp/start/vim-airline/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..a0a1a05 --- /dev/null +++ b/pack/acp/start/vim-airline/ISSUE_TEMPLATE.md @@ -0,0 +1,21 @@ +#### environment + +- vim: ???? +- vim-airline: ???? +- OS: ???? +- Have you reproduced with a minimal vimrc: ??? +- What is your airline configuration: ??? +if you are using terminal: +- terminal: ???? +- $TERM variable: ??? +- color configuration (:set t_Co?): +if you are using Neovim: +- does it happen in Vim: ??? + +#### actual behavior + +???? + +#### expected behavior + +???? diff --git a/pack/acp/start/vim-airline/LICENSE b/pack/acp/start/vim-airline/LICENSE new file mode 100644 index 0000000..875acca --- /dev/null +++ b/pack/acp/start/vim-airline/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2013-2016 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/pack/acp/start/vim-airline/README.md b/pack/acp/start/vim-airline/README.md new file mode 100644 index 0000000..c82b8d8 --- /dev/null +++ b/pack/acp/start/vim-airline/README.md @@ -0,0 +1,253 @@ +# vim-airline [![Build Status](https://travis-ci.org/vim-airline/vim-airline.png)](https://travis-ci.org/vim-airline/vim-airline) + +Lean & mean status/tabline for vim that's light as air. + +![img](https://github.com/vim-airline/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], [quickfixsigns][39], [syntastic][5], [eclim][34], + [lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37], + [ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51] and more. +* 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 color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others. + Note these are now external to this plugin. See [below][46] for detail. +* 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) + +## Themes + +Themes have moved to +another repository as of [this commit][45]. + +Install the themes as you would this plugin (Vundle example): + +```vim +Plugin 'vim-airline/vim-airline' +Plugin 'vim-airline/vim-airline-themes' +``` + +See https://github.com/vim-airline/vim-airline-themes for more. + +## 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) + +#### [denite.nvim][51] +![image](https://cloud.githubusercontent.com/assets/246230/23939717/f65bce6e-099c-11e7-85c3-918dbc839392.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) + +#### [vimagit][50] +![vim-airline-vimagit-demo](https://cloud.githubusercontent.com/assets/533068/22107273/2ea85ba0-de4d-11e6-9fa8-331103b88df4.gif) + +#### [virtualenv][31] +![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) + +#### [tmuxline][35] +![image](https://f.cloud.github.com/assets/1532071/1559276/4c28fbac-4fc7-11e3-90ef-7e833d980f98.gif) + +#### [promptline][36] +![airline-promptline-sc](https://f.cloud.github.com/assets/1532071/1871900/7d4b28a0-789d-11e3-90e4-16f37269981b.gif) + +#### [ctrlspace][38] +![papercolor_with_ctrlspace](https://cloud.githubusercontent.com/assets/493242/12912041/7fc3c6ec-cf16-11e5-8775-8492b9c64ebf.png) + +#### [xkb-switch][48]/[xkb-layout][49] +![image](https://cloud.githubusercontent.com/assets/5715281/22061422/347e7842-ddb8-11e6-8bdb-7abbd418653c.gif) + +## 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/vim-airline/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: + +| Plugin Manager | Install with... | +| ------------- | ------------- | +| [Pathogen][11] | `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`
Remember to run `:Helptags` to generate help tags | +| [NeoBundle][12] | `NeoBundle 'vim-airline/vim-airline'` | +| [Vundle][13] | `Plugin 'vim-airline/vim-airline'` | +| [Plug][40] | `Plug 'vim-airline/vim-airline'` | +| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` | +| manual | copy all of the files into your `~/.vim` directory | + +# Configuration + +`:help airline` + +The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc: +`set laststatus=2` + +# 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]. + +# Performance + +Whoa! Everything got slow all of a sudden... + +vim-airline strives to make it easy to use out of the box, which means that by default it will look for all compatible plugins that you have installed and enable the relevant extension. + +Many optimizations have been made such that the majority of users will not see any performance degradation, but it can still happen. For example, users who routinely open very large files may want to disable the `tagbar` extension, as it can be very expensive to scan for the name of the current function. + +The [minivimrc][7] project has some helper mappings to troubleshoot performance related issues. + +If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions. + +# Screenshots + +A full list of screenshots for various themes can be found in the [Wiki][14]. + +# Maintainers + +The project is currently being maintained by [Bailey Ling][41], [Christian Brabandt][42], and [Mike Hartington][44]. + +If you are interested in becoming a maintainer (we always welcome more maintainers), please [go here][43]. + +# License + +MIT License. Copyright (c) 2013-2016 Bailey Ling. + +[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/ctrlpvim/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/vim-airline/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/master/installation.html#patched-fonts +[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/vim-airline/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/vim-airline/vim-airline/wiki/Test-Plan +[34]: http://eclim.org +[35]: https://github.com/edkolev/tmuxline.vim +[36]: https://github.com/edkolev/promptline.vim +[37]: https://github.com/gcmt/taboo.vim +[38]: https://github.com/szw/vim-ctrlspace +[39]: https://github.com/tomtom/quickfixsigns_vim +[40]: https://github.com/junegunn/vim-plug +[41]: https://github.com/bling +[42]: https://github.com/chrisbra +[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer +[44]: https://github.com/mhartington +[45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b +[46]: https://github.com/vim-airline/vim-airline#themes +[47]: https://github.com/mildred/vim-bufmru +[48]: https://github.com/ierton/xkb-switch +[49]: https://github.com/vovkasm/input-source-switcher +[50]: https://github.com/jreybert/vimagit +[51]: https://github.com/Shougo/denite.nvim diff --git a/pack/acp/start/vim-airline/Rakefile b/pack/acp/start/vim-airline/Rakefile new file mode 100644 index 0000000..741cfc2 --- /dev/null +++ b/pack/acp/start/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/pack/acp/start/vim-airline/autoload/airline.vim b/pack/acp/start/vim-airline/autoload/airline.vim new file mode 100644 index 0000000..23d7fc7 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline.vim @@ -0,0 +1,195 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', []) + +let s:sections = ['a','b','c','gutter','x','y','z', 'error', '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() + call airline#update_statusline() +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#load_theme() + + silent doautocmd User AirlineAfterTheme + + " 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') + let existing = g:airline_theme + let theme = substitute(g:colors_name, '-', '_', 'g') + try + let palette = g:airline#themes#{theme}#palette + call airline#switch_theme(theme) + return 1 + catch + for map in items(g:airline_theme_map) + if match(g:colors_name, map[0]) > -1 + try + let palette = g:airline#themes#{map[1]}#palette + call airline#switch_theme(map[1]) + catch + call airline#switch_theme(existing) + endtry + return 1 + endif + endfor + endtry + endif + return 0 +endfunction + +function! airline#update_statusline() + if airline#util#getwinvar(winnr(), 'airline_disabled', 0) + return + endif + for nr in filter(range(1, winnr('$')), 'v:val != winnr()') + if airline#util#getwinvar(nr, 'airline_disabled', 0) + continue + endif + 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 w:airline_render_right + exe 'unlet! ' 'w:airline_section_'. join(s:sections, ' w:airline_section_') + + 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'] + elseif l:m ==# "t" + let l:mode = ['terminal'] + 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 && &modified + call add(l:mode, 'modified') + endif + + if g:airline_detect_paste && &paste + call add(l:mode, 'paste') + endif + + if g:airline_detect_crypt && exists("+key") && !empty(&key) + call add(l:mode, 'crypt') + endif + + if g:airline_detect_spell && &spell + call add(l:mode, 'spell') + endif + + if &readonly || ! &modifiable + call add(l:mode, 'readonly') + 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, context.bufnr) + let w:airline_lastmode = mode_string + endif + + return '' +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/builder.vim b/pack/acp/start/vim-airline/autoload/airline/builder.vim new file mode 100644 index 0000000..d566a32 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/builder.vim @@ -0,0 +1,205 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:prototype = {} + +function! s:prototype.split(...) dict + call add(self._sections, ['|', a:0 ? a:1 : '%=']) +endfunction + +function! s:prototype.add_section_spaced(group, contents) dict + let spc = empty(a:contents) ? '' : g:airline_symbols.space + call self.add_section(a:group, spc.a:contents.spc) +endfunction + +function! s:prototype.add_section(group, contents) dict + call add(self._sections, [a:group, a:contents]) +endfunction + +function! s:prototype.add_raw(text) dict + call add(self._sections, ['', a:text]) +endfunction + +function! s:get_prev_group(sections, i) + let x = a:i - 1 + while x >= 0 + let group = a:sections[x][0] + if group != '' && group != '|' + return group + endif + let x = x - 1 + endwhile + return '' +endfunction + +function! s:prototype.build() dict + let side = 1 + let line = '' + let i = 0 + let length = len(self._sections) + let split = 0 + let is_empty = 0 + let prev_group = '' + + while i < length + let section = self._sections[i] + let group = section[0] + let contents = section[1] + let pgroup = prev_group + let prev_group = s:get_prev_group(self._sections, i) + if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') + let group = 'airline_c'. self._context.bufnr + elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') + let prev_group = 'airline_c'. self._context.bufnr + endif + if is_empty + let prev_group = pgroup + endif + let is_empty = s:section_is_empty(self, contents) + + if is_empty + " need to fix highlighting groups, since we + " have skipped a section, we actually need + " the previous previous group and so the + " seperator goes from the previous previous group + " to the current group + let pgroup = group + endif + + if group == '' + let line .= contents + elseif group == '|' + let side = 0 + let line .= contents + let split = 1 + else + if prev_group == '' + let line .= '%#'.group.'#' + elseif split + if !is_empty + let line .= s:get_transitioned_seperator(self, prev_group, group, side) + endif + let split = 0 + else + if !is_empty + let line .= s:get_seperator(self, prev_group, group, side) + endif + endif + let line .= is_empty ? '' : s:get_accented_line(self, group, contents) + endif + + let i = i + 1 + endwhile + + if !self._context.active + "let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '') + let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g') + endif + return line +endfunction + +function! s:should_change_group(group1, group2) + if a:group1 == a:group2 + return 0 + endif + let color1 = airline#highlighter#get_highlight(a:group1) + let color2 = airline#highlighter#get_highlight(a:group2) + if g:airline_gui_mode ==# 'gui' + return color1[1] != color2[1] || color1[0] != color2[0] + else + return color1[3] != color2[3] || color1[2] != color2[2] + endif +endfunction + +function! s:get_transitioned_seperator(self, prev_group, group, side) + let line = '' + call airline#highlighter#add_separator(a:prev_group, a:group, a:side) + let line .= '%#'.a:prev_group.'_to_'.a:group.'#' + let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep + let line .= '%#'.a:group.'#' + return line +endfunction + +function! s:get_seperator(self, prev_group, group, side) + if s:should_change_group(a:prev_group, a:group) + return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side) + else + return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep + endif +endfunction + +function! s:get_accented_line(self, group, contents) + if a: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 + return line +endfunction + +function! s:section_is_empty(self, content) + let start=1 + + " do not check for inactive windows or the tabline + if a:self._context.active == 0 + return 0 + elseif get(a:self._context, 'tabline', 0) + return 0 + endif + + " only check, if airline#skip_empty_sections == 1 + if get(g:, 'airline_skip_empty_sections', 0) == 0 + return 0 + endif + " assume accents sections to be never empty + " (avoides, that on startup the mode message becomes empty) + if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1 + return 0 + endif + if empty(a:content) + return 1 + endif + let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) + if empty(list) + return 0 " no function in statusline text + endif + while len(list) > 0 + let expr = list[0] + try + " catch all exceptions, just in case + if !empty(eval(expr)) + return 0 + endif + catch + return 0 + endtry + let start += 1 + let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) + endw + return 1 +endfunction + +function! airline#builder#new(context) + let builder = copy(s:prototype) + let builder._context = a:context + let builder._sections = [] + + 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/pack/acp/start/vim-airline/autoload/airline/debug.vim b/pack/acp/start/vim-airline/autoload/airline/debug.vim new file mode 100644 index 0000000..18fc126 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/debug.vim @@ -0,0 +1,52 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions.vim b/pack/acp/start/vim-airline/autoload/airline/extensions.vim new file mode 100644 index 0000000..4059e63 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions.vim @@ -0,0 +1,334 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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 = { + \ 'nerdtree': [ 'NERD', '' ], + \ 'gundo': [ 'Gundo', '' ], + \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], + \ 'minibufexpl': [ 'MiniBufExplorer', '' ], + \ 'startify': [ 'startify', '' ], + \ 'vim-plug': [ 'Plugins', '' ], + \ } + +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() + let loaded_ext = [] + " non-trivial number of external plugins use eventignore=all, so we need to account for that + autocmd CursorMoved * call sync_active_winnr() + + if exists('g:airline_extensions') + for ext in g:airline_extensions + try + call airline#extensions#{ext}#init(s:ext) + catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist + call airline#util#warning("Extension '".ext."' not installed, ignoring!") + endtry + endfor + return + endif + + call airline#extensions#quickfix#init(s:ext) + call add(loaded_ext, 'quickfix') + + if get(g:, 'loaded_unite', 0) + call airline#extensions#unite#init(s:ext) + call add(loaded_ext, 'unite') + endif + + if get(g:, 'loaded_denite', 0) + call airline#extensions#denite#init(s:ext) + call add(loaded_ext, 'denite') + endif + + if exists(':NetrwSettings') + call airline#extensions#netrw#init(s:ext) + call add(loaded_ext, 'netrw') + endif + + if get(g:, 'airline#extensions#ycm#enabled', 0) + call airline#extensions#ycm#init(s:ext) + call add(loaded_ext, 'ycm') + 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) + call add(loaded_ext, 'ctrlp') + endif + + if get(g:, 'CtrlSpaceLoaded', 0) + call airline#extensions#ctrlspace#init(s:ext) + call add(loaded_ext, 'ctrlspace') + endif + + if get(g:, 'command_t_loaded', 0) + call airline#extensions#commandt#init(s:ext) + call add(loaded_ext, 'commandt') + endif + + if exists(':UndotreeToggle') + call airline#extensions#undotree#init(s:ext) + call add(loaded_ext, 'undotree') + endif + + if get(g:, 'airline#extensions#hunks#enabled', 1) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns')) + call airline#extensions#hunks#init(s:ext) + call add(loaded_ext, 'hunks') + endif + + if get(g:, 'airline#extensions#vimagit#enabled', 1) + \ && (exists('g:loaded_magit')) + call airline#extensions#vimagit#init(s:ext) + call add(loaded_ext, 'vimagit') + endif + + if get(g:, 'airline#extensions#tagbar#enabled', 1) + \ && exists(':TagbarToggle') + call airline#extensions#tagbar#init(s:ext) + call add(loaded_ext, 'tagbar') + endif + + if get(g:, 'airline#extensions#csv#enabled', 1) + \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) + call airline#extensions#csv#init(s:ext) + call add(loaded_ext, 'csv') + 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) + \ && (exists('*fugitive#head') || exists('*lawrencium#statusline') || + \ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine'))) + call airline#extensions#branch#init(s:ext) + call add(loaded_ext, 'branch') + endif + + if get(g:, 'airline#extensions#bufferline#enabled', 1) + \ && exists('*bufferline#get_status_string') + call airline#extensions#bufferline#init(s:ext) + call add(loaded_ext, 'bufferline') + endif + + if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV))) + call airline#extensions#virtualenv#init(s:ext) + call add(loaded_ext, 'virtualenv') + endif + + if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) + call airline#extensions#eclim#init(s:ext) + call add(loaded_ext, 'eclim') + endif + + if get(g:, 'airline#extensions#syntastic#enabled', 1) + \ && exists(':SyntasticCheck') + call airline#extensions#syntastic#init(s:ext) + call add(loaded_ext, 'syntastic') + endif + + if (get(g:, 'airline#extensions#ale#enabled', 1) && exists('g:loaded_ale')) + call airline#extensions#ale#init(s:ext) + call add(loaded_ext, 'ale') + endif + + if get(g:, 'airline#extensions#whitespace#enabled', 1) + call airline#extensions#whitespace#init(s:ext) + call add(loaded_ext, 'whitespace') + endif + + if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake')) + call airline#extensions#neomake#init(s:ext) + call add(loaded_ext, 'neomake') + endif + + if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt') + call airline#extensions#po#init(s:ext) + call add(loaded_ext, 'po') + endif + + if get(g:, 'airline#extensions#wordcount#enabled', 1) + call airline#extensions#wordcount#init(s:ext) + call add(loaded_ext, 'wordcount') + endif + + if get(g:, 'airline#extensions#tabline#enabled', 0) + call airline#extensions#tabline#init(s:ext) + call add(loaded_ext, 'tabline') + endif + + if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline') + call airline#extensions#tmuxline#init(s:ext) + call add(loaded_ext, 'tmuxline') + endif + + if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', '')) + call airline#extensions#promptline#init(s:ext) + call add(loaded_ext, 'promptline') + endif + + if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 + call airline#extensions#nrrwrgn#init(s:ext) + call add(loaded_ext, 'nrrwrgn') + endif + + if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2 + call airline#extensions#unicode#init(s:ext) + call add(loaded_ext, 'nrrwrgn') + endif + + if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline')) + call airline#extensions#capslock#init(s:ext) + call add(loaded_ext, 'capslock') + endif + + if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib')) + call airline#extensions#xkblayout#init(s:ext) + call add(loaded_ext, 'xkblayout') + endif + + if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0)) + call airline#extensions#windowswap#init(s:ext) + call add(loaded_ext, 'windowswap') + endif + + if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus')) + call airline#extensions#obsession#init(s:ext) + call add(loaded_ext, 'obsession') + endif + + if !get(g:, 'airline#extensions#disable_rtp_load', 0) + " load all other extensions, which are not part of the default distribution. + " (autoload/airline/extensions/*.vim outside of our s:script_path). + 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) || + \ index(loaded_ext, name) > -1 + continue + endif + try + call airline#extensions#{name}#init(s:ext) + catch + endtry + endif + endfor + endif +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/ale.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/ale.vim new file mode 100644 index 0000000..84b1b36 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/ale.vim @@ -0,0 +1,36 @@ +" MIT License. Copyright (c) 2013-2016 Bjorn Neergaard. +" vim: et ts=2 sts=2 sw=2 + +if !exists('g:loaded_ale') + finish +endif + +let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:') + +function! s:count(index) + let l:buf = bufnr('%') + let l:count = ale#statusline#Count(l:buf) + if type(l:count) ==# type(0) + let l:count = 0 + else + let l:count = l:count[a:index] + endif + + return l:count +endfunction + +function! airline#extensions#ale#get_errors() + let l:count = s:count(0) + return l:count ? s:error_symbol . l:count : '' +endfunction + +function! airline#extensions#ale#get_warnings() + let l:count = s:count(1) + return l:count ? s:warning_symbol . l:count : '' +endfunction + +function! airline#extensions#ale#init(ext) + call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_errors') + call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warnings') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/branch.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/branch.vim new file mode 100644 index 0000000..aa66457 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/branch.vim @@ -0,0 +1,403 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:has_fugitive = exists('*fugitive#head') +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:has_async = airline#util#async + +" s:vcs_config contains static configuration of VCSes and their status relative +" to the active file. +" 'branch' - The name of currently active branch. This field is empty iff it +" has not been initialized yet or the current file is not in +" an active branch. +" 'untracked' - Cache of untracked files represented as a dictionary with files +" as keys. A file has a not exists symbol set as its value if it +" is untracked. A file is present in this dictionary iff its +" status is considered up to date. +" 'untracked_mark' - used as regexp to test against the output of 'cmd' +let s:vcs_config = { +\ 'git': { +\ 'exe': 'git', +\ 'cmd': 'git status --porcelain -- ', +\ 'untracked_mark': '??', +\ 'update_branch': 's:update_git_branch', +\ 'branch': '', +\ 'untracked': {}, +\ }, +\ 'mercurial': { +\ 'exe': 'hg', +\ 'cmd': 'hg status -u -- ', +\ 'untracked_mark': '?', +\ 'update_branch': 's:update_hg_branch', +\ 'branch': '', +\ 'untracked': {}, +\ }, +\} + +" Initializes b:buffer_vcs_config. b:buffer_vcs_config caches the branch and +" untracked status of the file in the buffer. Caching those fields is necessary, +" because s:vcs_config may be updated asynchronously and s:vcs_config fields may +" be invalid during those updates. b:buffer_vcs_config fields are updated +" whenever corresponding fields in s:vcs_config are updated or an inconsistency +" is detected during update_* operation. +" +" b:airline_head caches the head string it is empty iff it needs to be +" recalculated. b:airline_head is recalculated based on b:buffer_vcs_config. +function! s:init_buffer() + let b:buffer_vcs_config = {} + for vcs in keys(s:vcs_config) + let b:buffer_vcs_config[vcs] = { + \ 'branch': '', + \ 'untracked': '', + \ } + endfor + unlet! b:airline_head +endfunction + +let s:head_format = get(g:, 'airline#extensions#branch#format', 0) +if s:head_format == 1 + function! s:format_name(name) + return fnamemodify(a:name, ':t') + endfunction +elseif s:head_format == 2 + function! s:format_name(name) + return pathshorten(a:name) + endfunction +elseif type(s:head_format) == type('') + function! s:format_name(name) + return call(s:head_format, [a:name]) + endfunction +else + function! s:format_name(name) + return a:name + endfunction +endif + +let s:git_dirs = {} + +function! s:update_git_branch(path) + if !s:has_fugitive + let s:vcs_config['git'].branch = '' + return + endif + + let name = fugitive#head(7) + if empty(name) + if has_key(s:git_dirs, a:path) + let s:vcs_config['git'].branch = s:git_dirs[a:path] + return + endif + + let dir = fugitive#extract_git_dir(a:path) + if empty(dir) + let name = '' + else + try + let line = join(readfile(dir . '/HEAD')) + if strpart(line, 0, 16) == 'ref: refs/heads/' + let name = strpart(line, 16) + else + " raw commit hash + let name = strpart(line, 0, 7) + endif + catch + let name = '' + endtry + endif + endif + + let s:git_dirs[a:path] = name + let s:vcs_config['git'].branch = name +endfunction + +function! s:update_hg_branch(path) + if s:has_lawrencium + let stl=lawrencium#statusline() + if !empty(stl) && s:has_async + call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p')) + endif + if exists("s:mq") && !empty(s:mq) + if stl is# 'default' + " Shorten default a bit + let stl='def' + endif + let stl.=' ['.s:mq.']' + endif + let s:vcs_config['mercurial'].branch = stl + else + let s:vcs_config['mercurial'].branch = '' + endif +endfunction + +function! s:update_branch() + let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h") + for vcs in keys(s:vcs_config) + call {s:vcs_config[vcs].update_branch}(l:path) + if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch + let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch + unlet! b:airline_head + endif + endfor +endfunction + +function! s:update_untracked_in_buffer_config(file, vcs) + if !has_key(s:vcs_config[a:vcs].untracked, a:file) + return + elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked + let b:buffer_vcs_config[a:vcs].untracked = s:vcs_config[a:vcs].untracked[a:file] + unlet! b:airline_head + endif +endfunction + +function! s:update_untracked() + let l:file = expand("%:p") + if empty(l:file) || isdirectory(l:file) + return + endif + + let l:needs_update = 1 + for vcs in keys(s:vcs_config) + if has_key(s:vcs_config[vcs].untracked, l:file) + let l:needs_update = 0 + call s:update_untracked_in_buffer_config(l:file, vcs) + endif + endfor + + if !l:needs_update + return + endif + + for vcs in keys(s:vcs_config) + let l:config = s:vcs_config[vcs] + if s:has_async + " Note that asynchronous update updates s:vcs_config only, and only + " s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is + " invalidated again before s:update_untracked is called, then we lose the + " result of the previous call, i.e. the head string is not updated. It + " doesn't happen often in practice, so we let it be. + call s:get_vcs_untracked_async(l:config, l:file) + else + let output = airline#util#system(l:config.cmd . shellescape(l:file)) + if output =~? ('^' . l:config.untracked_mark) + let l:config.untracked[l:file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) + else + let l:config.untracked[l:file] = '' + endif + call s:update_untracked_in_buffer_config(l:file, vcs) + endif + endfor +endfunction + +if s:has_async + let s:jobs = {} + + function! s:on_stdout(channel, msg) dict abort + let self.buf .= a:msg + endfunction + + function! s:on_exit(channel) dict abort + if self.buf =~? ('^' . self.config['untracked_mark']) + let self.config.untracked[self.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) + else + let self.config.untracked[self.file] = '' + endif + " b:buffer_vcs_config will be updated on next call of update_untracked if + " needed + if has_key(s:jobs, self.file) + call remove(s:jobs, self.file) + endif + endfunction + + function! s:get_vcs_untracked_async(config, file) + if g:airline#util#is_windows && &shell =~ 'cmd' + let cmd = a:config['cmd'] . shellescape(a:file) + else + let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)] + endif + + let options = {'config': a:config, 'buf': '', 'file': a:file} + if has_key(s:jobs, a:file) + if job_status(get(s:jobs, a:file)) == 'run' + return + elseif has_key(s:jobs, a:file) + call remove(s:jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit', options)}) + let s:jobs[a:file] = id + endfu + + function! s:on_exit_mq(channel) dict abort + if !empty(self.buf) + if self.buf is# 'no patches applied' || + \ self.buf =~# "unknown command 'qtop'" + let self.buf = '' + elseif exists("s:mq") && s:mq isnot# self.buf + " make sure, statusline is updated + unlet! b:airline_head + endif + let s:mq = self.buf + endif + if has_key(s:jobs, self.file) + call remove(s:jobs, self.file) + endif + endfunction + + function! s:get_mq_async(cmd, file) + if g:airline#util#is_windows && &shell =~ 'cmd' + let cmd = a:cmd + else + let cmd = ['sh', '-c', a:cmd] + endif + + let options = {'cmd': a:cmd, 'buf': '', 'file': a:file} + if has_key(s:jobs, a:file) + if job_status(get(s:jobs, a:file)) == 'run' + return + elseif has_key(s:jobs, a:file) + call remove(s:jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit_mq', options)}) + let s:jobs[a:file] = id + endfu +endif + +function! airline#extensions#branch#head() + if !exists('b:buffer_vcs_config') + call s:init_buffer() + endif + + call s:update_branch() + call s:update_untracked() + + if exists('b:airline_head') && !empty(b:airline_head) + return b:airline_head + endif + + let b:airline_head = '' + let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"]) + + let l:heads = {} + for vcs in l:vcs_priority + if !empty(b:buffer_vcs_config[vcs].branch) + let l:heads[vcs] = b:buffer_vcs_config[vcs].branch + endif + endfor + + for vcs in keys(l:heads) + if !empty(b:airline_head) + let b:airline_head .= ' | ' + endif + let b:airline_head .= (len(l:heads) > 1 ? s:vcs_config[l:vcs].exe : '') . s:format_name(l:heads[l:vcs]) + let b:airline_head .= b:buffer_vcs_config[vcs].untracked + endfor + + if empty(l:heads) + if s:has_vcscommand + call VCSCommandEnableBufferSetup() + if exists('b:VCSCommandBufferInfo') + let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, '')) + endif + endif + endif + + if exists("g:airline#extensions#branch#displayed_head_limit") + let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit + if len(b:airline_head) > w:displayed_head_limit - 1 + let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.') + endif + endif + + if has_key(l:heads, 'git') && !s:check_in_path() + let b:airline_head = '' + endif + let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7 + let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) + return b:airline_head +endfunction + +function! airline#extensions#branch#get_head() + let head = airline#extensions#branch#head() + let empty_message = get(g:, 'airline#extensions#branch#empty_message', '') + let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) + return empty(head) + \ ? empty_message + \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) +endfunction + +function! s:check_in_path() + if !exists('b:airline_file_in_root') + let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) + let bufferpath = resolve(fnamemodify(expand('%'), ':p')) + + 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 + " 1) check for worktrees + if match(root, 'worktrees') > -1 + " worktree can be anywhere, so simply assume true here + return 1 + endif + " 2) check for submodules + let pattern = '\.git[\\/]\(modules\)[\\/]' + if match(root, pattern) >= 0 + let root = substitute(root, pattern, '', '') + endif + endif + endif + + let b:airline_file_in_root = stridx(bufferpath, root) > -1 + endif + return b:airline_file_in_root +endfunction + +function! s:reset_untracked_cache(shellcmdpost) + " shellcmdpost - whether function was called as a result of ShellCmdPost hook + if !s:has_async && !has('nvim') + if a:shellcmdpost + " Clear cache only if there was no error or the script uses an + " asynchronous interface. Otherwise, cache clearing would overwrite + " v:shell_error with a system() call inside get_*_untracked. + if v:shell_error + return + endif + endif + endif + + let l:file = expand("%:p") + for vcs in keys(s:vcs_config) + " Dump the value of the cache for the current file. Partially mitigates the + " issue of cache invalidation happening before a call to + " s:update_untracked() + call s:update_untracked_in_buffer_config(l:file, l:vcs) + let s:vcs_config[vcs].untracked = {} + endfor +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 + autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head + autocmd User AirlineBeforeRefresh unlet! b:airline_head + autocmd BufWritePost * call s:reset_untracked_cache(0) + autocmd ShellCmdPost * call s:reset_untracked_cache(1) +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/bufferline.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/bufferline.vim new file mode 100644 index 0000000..8ca825f --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/bufferline.vim @@ -0,0 +1,25 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/capslock.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/capslock.vim new file mode 100644 index 0000000..d79c24e --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/capslock.vim @@ -0,0 +1,17 @@ +" MIT License. Copyright (c) 2014 Mathias Andersson. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('*CapsLockStatusline') + finish +endif + +function! airline#extensions#capslock#status() + return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : '' +endfunction + +function! airline#extensions#capslock#init(ext) + call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/commandt.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/commandt.vim new file mode 100644 index 0000000..93c6572 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/commandt.vim @@ -0,0 +1,18 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/csv.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/csv.vim new file mode 100644 index 0000000..b95aacd --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/csv.vim @@ -0,0 +1,33 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlp.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlp.vim new file mode 100644 index 0000000..3781108 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlp.vim @@ -0,0 +1,82 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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:2 == 'file' + call b.add_section_spaced('CtrlPlight', 'by fname') + endif + 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_section_spaced('CtrlPdark', a:1) + 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/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlspace.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlspace.vim new file mode 100644 index 0000000..57183d7 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/ctrlspace.vim @@ -0,0 +1,19 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space +let s:padding = s:spc . s:spc . s:spc + +function! airline#extensions#ctrlspace#statusline(...) + let b = airline#builder#new({ 'active': 1 }) + call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding)) + call b.split() + call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc) + return b.build() +endfunction + +function! airline#extensions#ctrlspace#init(ext) + let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/default.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/default.vim new file mode 100644 index 0000000..7c209a1 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/default.vim @@ -0,0 +1,101 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1) +let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { + \ 'b': 79, + \ 'x': 60, + \ 'y': 88, + \ 'z': 45, + \ 'warning': 80, + \ 'error': 80, + \ }) +let s:layout = get(g:, 'airline#extensions#default#layout', [ + \ [ 'a', 'b', 'c' ], + \ [ 'x', 'y', 'z', 'warning', 'error' ] + \ ]) + +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 + if !exists('g:airline_section_{a:key}') + return '' + endif + 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' || key == 'error') && !a:context.active + continue + endif + call s:add_section(a:builder, a:context, key) + endfor +endfunction + +" There still is a highlighting bug when using groups %(%) in the statusline, +" deactivate it, unless it is fixed (7.4.1511) +if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81'))) + function! s:add_section(builder, context, key) + let condition = (a:key is# "warning" || a:key is# "error") && + \ (v:version == 704 && !has("patch1511")) + " i have no idea why the warning section needs special treatment, but it's + " needed to prevent separators from showing up + if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) + return + endif + if condition + call a:builder.add_raw('%(') + endif + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + if condition + 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 == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) + return + endif + if a:key == 'warning' + call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) + elseif a:key == 'error' + call a:builder.add_raw('%#airline_error#'.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 s:build_sections(a:builder, a:context, s:layout[0]) + else + let text = s:get_section(winnr, 'c') + if empty(text) + let text = ' %f%m ' + endif + call a:builder.add_section('airline_c'.(a:context.bufnr), text) + endif + + call a:builder.split(s:get_section(winnr, 'gutter', '', '')) + + if airline#util#getwinvar(winnr, 'airline_render_right', 1) + call s:build_sections(a:builder, a:context, s:layout[1]) + endif + + return 1 +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/denite.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/denite.vim new file mode 100644 index 0000000..2662438 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/denite.vim @@ -0,0 +1,43 @@ +" MIT License. Copyright (c) 2017 Thomas Dy +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_denite', 0) + finish +endif + +" Denite does not use vim's built-in modal editing but has a custom prompt +" that implements its own insert/normal mode so we have to handle changing the +" highlight +function! airline#extensions#denite#check_denite_mode(bufnr) + let l:mode = split(denite#get_status_mode(), ' ') + let l:mode = tolower(l:mode[1]) + call airline#highlighter#highlight([l:mode], a:bufnr) + return '' +endfunction + +function! airline#extensions#denite#apply(...) + if &ft == 'denite' + call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') + call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') + call a:1.split() + call a:1.add_section('airline_y', ' %{denite#get_status_path()} ') + call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ') + return 1 + endif +endfunction + +function! airline#extensions#denite#init(ext) + call denite#custom#option('_', 'statusline', 0) + call a:ext.add_statusline_func('airline#extensions#denite#apply') + + " airline#extensions#denite#apply normally gets called only after the + " denite window gets closed, so we have to call airline#update_statusline + " ourselves to make sure it's applied when the window is opened. + augroup airline_denite + autocmd! + autocmd FileType denite call airline#update_statusline() + augroup END +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/eclim.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/eclim.vim new file mode 100644 index 0000000..44f1bb5 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/eclim.vim @@ -0,0 +1,62 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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() + " Cache vavlues, so that it isn't called too often + if exists("s:eclim_errors") && + \ get(b:, 'airline_changenr', 0) == changenr() + return s:eclim_errors + endif + let eclimList = eclim#display#signs#GetExisting() + let s:eclim_errors = '' + + if !empty(eclimList) + " Remove any non-eclim signs (see eclim#display#signs#Update) + " First check for just errors since they are more important. + " If there are no errors, then check for warnings. + let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"') + + if (empty(errorList)) + " use the warnings + call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(warning\\)$"') + let type = 'W' + else + " Use the errors + let eclimList = errorList + let type = 'E' + endif + + if !empty(eclimList) + let errorsLine = eclimList[0]['line'] + let errorsNumber = len(eclimList) + let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]" + if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' + let s:eclim_errors = errors.(g:airline_symbols.space) + endif + endif + endif + let b:airline_changenr = changenr() + return s:eclim_errors +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/pack/acp/start/vim-airline/autoload/airline/extensions/example.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/example.vim new file mode 100644 index 0000000..c81f6c3 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/example.vim @@ -0,0 +1,56 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" 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/pack/acp/start/vim-airline/autoload/airline/extensions/hunks.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/hunks.vim new file mode 100644 index 0000000..02a8ff4 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/hunks.vim @@ -0,0 +1,96 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 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:is_branch_empty() + return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head()) +endfunction + +function! s:get_hunks_gitgutter() + if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty() + return '' + endif + return GitGutterGetHunkSummary() +endfunction + +function! s:get_hunks_changes() + if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() + return [] + endif + let hunks = changes#GetStats() + for i in hunks + if i > 0 + return hunks + endif + endfor + return [] +endfunction + +function! s:get_hunks_empty() + return '' +endfunction + +function! s:get_hunks() + if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty' + if get(g:, 'loaded_signify') && sy#buffer_is_active() + let b:source_func = 's:get_hunks_signify' + elseif exists('*GitGutterGetHunkSummary') + let b:source_func = 's:get_hunks_gitgutter' + elseif exists('*changes#GetStats') + let b:source_func = 's:get_hunks_changes' + elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary') + let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary' + else + let b:source_func = 's:get_hunks_empty' + endif + endif + return {b:source_func}() +endfunction + +function! airline#extensions#hunks#get_hunks() + if !get(w:, 'airline_active', 0) + return '' + endif + " Cache vavlues, so that it isn't called too often + if exists("b:airline_hunks") && + \ get(b:, 'airline_changenr', 0) == changenr() && + \ winwidth(0) == get(s:, 'airline_winwidth', 0) && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' + return b:airline_hunks + endif + let hunks = s:get_hunks() + let string = '' + if !empty(hunks) + for i in [0, 1, 2] + if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0 + let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) + endif + endfor + endif + let b:airline_hunks = string + let b:airline_changenr = changenr() + let s:airline_winwidth = winwidth(0) + return string +endfunction + +function! airline#extensions#hunks#init(ext) + call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/neomake.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/neomake.vim new file mode 100644 index 0000000..6587f87 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/neomake.vim @@ -0,0 +1,25 @@ +" vim: et ts=2 sts=2 sw=2 + +if !exists(':Neomake') + finish +endif + +let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:') + +function! airline#extensions#neomake#get_warnings() + let counts = neomake#statusline#LoclistCounts() + let warnings = get(counts, 'W', 0) + return warnings ? s:warning_symbol.warnings : '' +endfunction + +function! airline#extensions#neomake#get_errors() + let counts = neomake#statusline#LoclistCounts() + let errors = get(counts, 'E', 0) + return errors ? s:error_symbol.errors : '' +endfunction + +function! airline#extensions#neomake#init(ext) + call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings') + call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/netrw.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/netrw.vim new file mode 100644 index 0000000..7af76d6 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/netrw.vim @@ -0,0 +1,34 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':NetrwSettings') + finish +endif + +function! airline#extensions#netrw#apply(...) + if &ft == 'netrw' + let spc = g:airline_symbols.space + + call a:1.add_section('airline_a', spc.'netrw'.spc) + if exists('*airline#extensions#branch#get_head') + call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) + endif + call a:1.add_section('airline_c', spc.'%f'.spc) + call a:1.split() + call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) + return 1 + endif +endfunction + +function! airline#extensions#netrw#init(ext) + let g:netrw_force_overwrite_statusline = 0 + call a:ext.add_statusline_func('airline#extensions#netrw#apply') +endfunction + + +function! airline#extensions#netrw#sortstring() + let order = (g:netrw_sort_direction =~ 'n') ? '+' : '-' + return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/nrrwrgn.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/nrrwrgn.vim new file mode 100644 index 0000000..4629915 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/nrrwrgn.vim @@ -0,0 +1,57 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_nrrw_rgn', 0) + finish +endif + +function! airline#extensions#nrrwrgn#apply(...) + if exists(":WidenRegion") == 2 + let spc = g:airline_symbols.space + if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus()) + call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) + let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), '')) + call a:1.add_section('airline_c', spc.bufname.spc) + call a:1.split() + else + let dict=nrrwrgn#NrrwRgnStatus() + let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '} + let mode = dict.visual ? vmode[dict.visual] : vmode['V'] + let winwidth = winwidth(0) + if winwidth < 80 + let mode = mode[0] + endif + let title = (winwidth < 80 ? "Nrrw" : "Narrowed ") + let multi = (winwidth < 80 ? 'M' : 'Multi') + call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""), + \ title, mode, b:nrrw_instn, spc)) + let name = dict.fullname + if name !=# '[No Name]' + if winwidth > 100 + " need some space + let name = fnamemodify(dict.fullname, ':~') + if strlen(name) > 8 + " shorten name + let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g') + endif + else + let name = fnamemodify(dict.fullname, ':t') + endif + endif + let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1])) + call a:1.add_section('airline_c', printf("%s %s %s", name, range, + \ dict.enabled ? (&encoding ==? 'utf-8' ? "\u2713" : '') : '!')) + call a:1.split() + call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc) + call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc) + call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z')) + endif + return 1 + endif +endfunction + +function! airline#extensions#nrrwrgn#init(ext) + call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/obsession.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/obsession.vim new file mode 100644 index 0000000..ca0fc16 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/obsession.vim @@ -0,0 +1,22 @@ +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('*ObsessionStatus') + finish +endif + +let s:spc = g:airline_symbols.space + +if !exists('g:airline#extensions#obsession#indicator_text') + let g:airline#extensions#obsession#indicator_text = '$' +endif + +function! airline#extensions#obsession#init(ext) + call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status') +endfunction + +function! airline#extensions#obsession#get_status() + return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '') +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/po.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/po.vim new file mode 100644 index 0000000..6536436 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/po.vim @@ -0,0 +1,93 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:has_async = airline#util#async + +function! s:shorten() + if exists("g:airline#extensions#po#displayed_limit") + let w:displayed_po_limit = g:airline#extensions#po#displayed_limit + if len(b:airline_po_stats) > w:displayed_po_limit - 1 + let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']' + endif + endif +endfunction + +if s:has_async + let s:jobs = {} + + function! s:on_stdout(channel, msg) dict abort + let self.buf = a:msg + endfunction + + function! s:on_exit(channel) dict abort + if !empty(self.buf) + let b:airline_po_stats = printf("[%s]", self.buf) + else + let b:airline_po_stats = '' + endif + if has_key(s:jobs, self.file) + call remove(s:jobs, self.file) + endif + call s:shorten() + endfunction + + function! s:get_msgfmt_stat_async(cmd, file) + if g:airline#util#is_windows || !executable('msgfmt') + " no msgfmt on windows? + return + else + let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] + endif + + let options = {'buf': '', 'file': a:file} + if has_key(s:jobs, a:file) + if job_status(get(s:jobs, a:file)) == 'run' + return + elseif has_key(s:jobs, a:file) + call remove(s:jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit', options)}) + let s:jobs[a:file] = id + endfu +endif + +function! airline#extensions#po#apply(...) + if &ft ==# 'po' + call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') + autocmd airline BufWritePost * unlet! b:airline_po_stats + endif +endfunction + +function! airline#extensions#po#stats() + if exists('b:airline_po_stats') && !empty(b:airline_po_stats) + return b:airline_po_stats + endif + + let cmd = 'msgfmt --statistics -o /dev/null -- ' + if s:has_async + call s:get_msgfmt_stat_async(cmd, expand('%:p')) + else + let airline_po_stats = system(cmd. shellescape(expand('%:p'))) + if v:shell_error + return '' + endif + try + let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']' + let b:airline_po_stats = substitute(b:airline_po_stats, ' \(message\|translation\)s*\.*', '', 'g') + catch + let b:airline_po_stats = '' + endtry + call s:shorten() + endif + return get(b:, 'airline_po_stats', '') +endfunction + +function! airline#extensions#po#init(ext) + call a:ext.add_statusline_func('airline#extensions#po#apply') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/promptline.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/promptline.vim new file mode 100644 index 0000000..9b76a1a --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/promptline.vim @@ -0,0 +1,35 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':PromptlineSnapshot') + finish +endif + +if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') + finish +endif + +let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') + +function! airline#extensions#promptline#init(ext) + call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') +endfunction + +function! airline#extensions#promptline#set_prompt_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + if !has_key(g:, 'promptline_symbols') + let g:promptline_symbols = { + \ 'left' : g:airline_left_sep, + \ 'right' : g:airline_right_sep, + \ 'left_alt' : g:airline_left_alt_sep, + \ 'right_alt' : g:airline_right_alt_sep} + endif + + let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) + call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/quickfix.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/quickfix.vim new file mode 100644 index 0000000..3441c3d --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/quickfix.vim @@ -0,0 +1,53 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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') + call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window') +endfunction + +function! airline#extensions#quickfix#inactive_qf_window(...) + if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', '')) + call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m') + endif +endfunction + +function! s:get_text() + if exists("*win_getid") && exists("*getwininfo") + let dict = getwininfo(win_getid()) + if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0) + return g:airline#extensions#quickfix#quickfix_text + elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0) + return g:airline#extensions#quickfix#location_text + endif + endif + 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, '\cQuickfix') > -1 + return g:airline#extensions#quickfix#quickfix_text + else + return g:airline#extensions#quickfix#location_text + endif + endif + endfor + return '' +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/syntastic.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/syntastic.vim new file mode 100644 index 0000000..adf5460 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/syntastic.vim @@ -0,0 +1,21 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/tabline.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline.vim new file mode 100644 index 0000000..cadb399 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline.vim @@ -0,0 +1,193 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) +let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree') + +let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) +if s:taboo + let g:taboo_tabline = 0 +endif + +let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0) + +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() + call airline#extensions#tabline#autoshow#off() + call airline#extensions#tabline#tabs#off() + call airline#extensions#tabline#buffers#off() + call airline#extensions#tabline#ctrlspace#off() +endfunction + +function! s:toggle_on() + call airline#extensions#tabline#autoshow#on() + call airline#extensions#tabline#tabs#on() + call airline#extensions#tabline#buffers#on() + call airline#extensions#tabline#ctrlspace#on() + + set tabline=%!airline#extensions#tabline#get() +endfunction + +function! s:update_tabline() + if get(g:, 'airline#extensions#tabline#disable_refresh', 0) + return + endif + let match = expand('') + if pumvisible() + return + elseif !get(g:, 'airline#extensions#tabline#enabled', 0) + return + " return, if buffer matches ignore pattern or is directory (netrw) + elseif empty(match) + \ || match(match, s:ignore_bufadd_pat) > -1 + \ || isdirectory(expand("")) + return + endif + doautocmd User BufMRUChange +endfunction + +function! airline#extensions#tabline#load_theme(palette) + if pumvisible() + return + endif + let colors = get(a:palette, 'tabline', {}) + " Theme for tabs on the left + 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) + if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') + let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) + else + "Fall back to normal airline_c if modified airline_c isn't present + let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) + endif + 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_tabmod_unsel', l:tabmodu) + call airline#highlighter#exec('airline_tabhid', l:tabhid) + + " Theme for tabs on the right + let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) + let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c) + let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a) + let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c) + if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') + let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c) + else + "Fall back to normal airline_c if modified airline_c isn't present + let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) + endif + call airline#highlighter#exec('airline_tab_right', l:tab_right) + call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right) + call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right) + call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right) + call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right) +endfunction + +let s:current_tabcnt = -1 +function! airline#extensions#tabline#get() + let curtabcnt = tabpagenr('$') + if curtabcnt != s:current_tabcnt + let s:current_tabcnt = curtabcnt + call airline#extensions#tabline#tabs#invalidate() + call airline#extensions#tabline#buffers#invalidate() + call airline#extensions#tabline#ctrlspace#invalidate() + endif + + if !exists('#airline#BufAdd#*') + autocmd airline BufAdd * call update_tabline() + endif + if s:ctrlspace + return airline#extensions#tabline#ctrlspace#get() + elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs + return airline#extensions#tabline#buffers#get() + else + return airline#extensions#tabline#tabs#get() + endif +endfunction + +function! airline#extensions#tabline#title(n) + let title = '' + if s:taboo + let title = TabooTabTitle(a:n) + endif + + if empty(title) && exists('*gettabvar') + let title = gettabvar(a:n, 'title') + endif + + if empty(title) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + let all_buffers = airline#extensions#tabline#buflist#list() + return airline#extensions#tabline#get_buffer_name( + \ buflist[winnr - 1], + \ filter(buflist, 'index(all_buffers, v:val) != -1')) + endif + + return title +endfunction + +function! airline#extensions#tabline#get_buffer_name(nr, ...) + let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list() + return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers) +endfunction + +function! airline#extensions#tabline#new_builder() + let builder_context = { + \ 'active' : 1, + \ 'tabline' : 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 builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep) + let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep) + else + let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') + let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') + endif + + return airline#builder#new(builder_context) +endfunction + +function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) + let cur = bufnr('%') + if cur == a:bufnr + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod' + else + let group = 'airline_tabsel' + endif + else + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod_unsel' + elseif index(a:tab_bufs, a:bufnr) > -1 + let group = 'airline_tab' + else + let group = 'airline_tabhid' + endif + endif + return group +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/autoshow.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/autoshow.vim new file mode 100644 index 0000000..a6782a8 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/autoshow.vim @@ -0,0 +1,55 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +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) + +function! airline#extensions#tabline#autoshow#off() + if exists('s:original_tabline') + let &tabline = s:original_tabline + let &showtabline = s:original_showtabline + endif + + augroup airline_tabline_autoshow + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#autoshow#on() + let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] + + augroup airline_tabline_autoshow + autocmd! + if s:buf_min_count <= 0 && s:tab_min_count <= 1 + if &lines > 3 + set showtabline=2 + endif + else + if s:show_buffers == 1 + autocmd BufEnter * call show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) + autocmd BufUnload * call show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1) + else + autocmd TabEnter * call show_tabline(s:tab_min_count, tabpagenr('$')) + endif + endif + + " Invalidate cache. This has to come after the BufUnload for + " s:show_buffers, to invalidate the cache for BufEnter. + autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate() + augroup END +endfunction + +function! s:show_tabline(min_count, total_count) + if a:total_count >= a:min_count + if &showtabline != 2 && &lines > 3 + set showtabline=2 + endif + else + if &showtabline != 0 + set showtabline=0 + endif + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buffers.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buffers.vim new file mode 100644 index 0000000..31ad4da --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buffers.vim @@ -0,0 +1,251 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) +let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') +let s:spc = g:airline_symbols.space + +let s:current_bufnr = -1 +let s:current_modified = 0 +let s:current_tabline = '' +let s:current_visible_buffers = [] + +let s:number_map = { + \ '0': '⁰', + \ '1': '¹', + \ '2': '²', + \ '3': '³', + \ '4': '⁴', + \ '5': '⁵', + \ '6': '⁶', + \ '7': '⁷', + \ '8': '⁸', + \ '9': '⁹' + \ } +let s:number_map = &encoding == 'utf-8' + \ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map) + \ : {} + +function! airline#extensions#tabline#buffers#off() + augroup airline_tabline_buffers + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#buffers#on() + augroup airline_tabline_buffers + autocmd! + autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate() + autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate() + autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate() + augroup END +endfunction + +function! airline#extensions#tabline#buffers#invalidate() + let s:current_bufnr = -1 +endfunction + +function! airline#extensions#tabline#buffers#get() + call map_keys() + let cur = bufnr('%') + if cur == s:current_bufnr + if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let l:index = 1 + let b = airline#extensions#tabline#new_builder() + let tab_bufs = tabpagebuflist(tabpagenr()) + for nr in s:get_visible_buffers() + if nr < 0 + call b.add_raw('%#airline_tabhid#...') + continue + endif + + let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr) + + if nr == cur + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + endif + + " Neovim feature: Have clickable buffers + if has("tablineat") + call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@') + endif + if s:buffer_idx_mode + if len(s:number_map) > 0 + call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc) + else + call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']') + endif + let l:index = l:index + 1 + else + call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) + endif + if has("tablineat") + call b.add_raw('%X') + endif + endfor + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabfill', '') + if s:show_tab_type + call b.add_section_spaced('airline_tabtype', s:buffers_label) + endif + if tabpagenr('$') > 1 + call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) + endif + + let s:current_bufnr = cur + let s:current_tabline = b.build() + return s:current_tabline +endfunction + +function! s:get_visible_buffers() + let buffers = airline#extensions#tabline#buflist#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 + + let s:current_visible_buffers = buffers + return buffers +endfunction + +function! s:select_tab(buf_index) + " no-op when called in the NERDTree buffer + if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName + return + endif + + let idx = a:buf_index + if s:current_visible_buffers[0] == -1 + let idx = idx + 1 + endif + + let buf = get(s:current_visible_buffers, idx, 0) + if buf != 0 + exec 'b!' . buf + endif +endfunction + +function! s:jump_to_tab(offset) + let l = s:current_visible_buffers + let i = index(l, bufnr('%')) + if i > -1 + exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))] + endif +endfunction + +function! s:map_keys() + if s:buffer_idx_mode + noremap AirlineSelectTab1 :call select_tab(0) + noremap AirlineSelectTab2 :call select_tab(1) + noremap AirlineSelectTab3 :call select_tab(2) + noremap AirlineSelectTab4 :call select_tab(3) + noremap AirlineSelectTab5 :call select_tab(4) + noremap AirlineSelectTab6 :call select_tab(5) + noremap AirlineSelectTab7 :call select_tab(6) + noremap AirlineSelectTab8 :call select_tab(7) + noremap AirlineSelectTab9 :call select_tab(8) + noremap AirlineSelectPrevTab :call jump_to_tab(-v:count1) + noremap AirlineSelectNextTab :call jump_to_tab(v:count1) + endif +endfunction + +function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort + " Clickable buffers + " works only in recent NeoVim with has('tablineat') + + " single mouse button click without modifiers pressed + if a:clicks == 1 && a:modifiers !~# '[^ ]' + if a:button is# 'l' + " left button - switch to buffer + silent execute 'buffer' a:minwid + elseif a:button is# 'm' + " middle button - delete buffer + + if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0 + " just simply delete the clicked buffer. This will cause windows + " associated with the clicked buffer to be closed. + silent execute 'bdelete' a:minwid + else + " find windows displaying the clicked buffer and open an new + " buffer in them. + let current_window = bufwinnr("%") + let window_number = bufwinnr(a:minwid) + let last_window_visited = -1 + + " Set to 1 if the clicked buffer was open in any windows. + let buffer_in_window = 0 + + " Find the next window with the clicked buffer open. If bufwinnr() + " returns the same window number, this is because we clicked a new + " buffer, and then tried editing a new buffer. Vim won't create a + " new empty buffer for the same window, so we get the same window + " number from bufwinnr(). In this case we just give up and don't + " delete the buffer. + " This could be made cleaner if we could check if the clicked buffer + " is a new buffer, but I don't know if there is a way to do that. + while window_number != -1 && window_number != last_window_visited + let buffer_in_window = 1 + silent execute window_number . 'wincmd w' + silent execute 'enew' + let last_window_visited = window_number + let window_number = bufwinnr(a:minwid) + endwhile + silent execute current_window . 'wincmd w' + if window_number != last_window_visited || buffer_in_window == 0 + silent execute 'bdelete' a:minwid + endif + endif + endif + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buflist.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buflist.vim new file mode 100644 index 0000000..f49eabc --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/buflist.vim @@ -0,0 +1,44 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#buflist#invalidate() + unlet! s:current_buffer_list +endfunction + +function! airline#extensions#tabline#buflist#list() + if exists('s:current_buffer_list') + return s:current_buffer_list + endif + + let excludes = get(g:, 'airline#extensions#tabline#excludes', []) + let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) + + let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) + + let buffers = [] + " If this is too slow, we can switch to a different algorithm. + " Basically branch 535 already does it, but since it relies on + " BufAdd autocommand, I'd like to avoid this if possible. + for nr in list + if buflisted(nr) + " Do not add to the bufferlist, if either + " 1) buffername matches exclude pattern + " 2) buffer is a quickfix buffer + " 3) exclude preview windows (if 'bufhidden' == wipe + " and 'buftype' == nofile + if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) || + \ (getbufvar(nr, 'current_syntax') == 'qf') || + \ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe' + \ && getbufvar(nr, '&buftype') == 'nofile') + continue + endif + call add(buffers, nr) + endif + endfor + + let s:current_buffer_list = buffers + return buffers +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim new file mode 100644 index 0000000..e2a1032 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim @@ -0,0 +1,150 @@ +" MIT License. Copyright (c) 2016 Kevin Sapper +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:current_bufnr = -1 +let s:current_tabnr = -1 +let s:current_tabline = '' + +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') +let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) + +function! airline#extensions#tabline#ctrlspace#off() + augroup airline_tabline_ctrlspace + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#ctrlspace#on() + augroup airline_tabline_ctrlspace + autocmd! + autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate() + augroup END +endfunction + +function! airline#extensions#tabline#ctrlspace#invalidate() + let s:current_bufnr = -1 + let s:current_tabnr = -1 +endfunction + +function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos) + if a:pos == 0 + let pos_extension = '' + else + let pos_extension = '_right' + endif + + let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab) + for buffer in s:buffer_list + if a:cur_buf == buffer.index + if buffer.modified + let group = 'airline_tabmod'.pos_extension + else + let group = 'airline_tabsel'.pos_extension + endif + else + if buffer.modified + let group = 'airline_tabmod_unsel'.pos_extension + elseif buffer.visible + let group = 'airline_tab'.pos_extension + else + let group = 'airline_tabhid'.pos_extension + endif + endif + + let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)' + + if has("tablineat") + let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X' + endif + + call a:builder.add_section_spaced(group, buf_name) + endfor +endfunction + +function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos) + if a:pos == 0 + let pos_extension = '' + else + let pos_extension = '_right' + endif + + for tab in s:tab_list + if tab.current + if tab.modified + let group = 'airline_tabmod'.pos_extension + else + let group = 'airline_tabsel'.pos_extension + endif + else + if tab.modified + let group = 'airline_tabmod_unsel'.pos_extension + else + let group = 'airline_tabhid'.pos_extension + endif + endif + + call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T') + endfor +endfunction + +function! airline#extensions#tabline#ctrlspace#get() + let cur_buf = bufnr('%') + + call airline#extensions#tabline#tabs#map_keys() + let s:tab_list = ctrlspace#api#TabList() + for tab in s:tab_list + if tab.current + let cur_tab = tab.index + endif + endfor + + if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr + return s:current_tabline + endif + + let builder = airline#extensions#tabline#new_builder() + + " Add left tabline content + if s:show_buffers == 0 + call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) + elseif s:show_tabs == 0 + call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) + else + if s:switch_buffers_and_tabs == 0 + call builder.add_section_spaced('airline_tabtype', s:buffers_label) + call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) + else + call builder.add_section_spaced('airline_tabtype', s:tabs_label) + call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) + endif + endif + + call builder.add_section('airline_tabfill', '') + call builder.split() + call builder.add_section('airline_tabfill', '') + + " Add right tabline content + if s:show_buffers == 0 + call builder.add_section_spaced('airline_tabtype', s:tabs_label) + elseif s:show_tabs == 0 + call builder.add_section_spaced('airline_tabtype', s:buffers_label) + else + if s:switch_buffers_and_tabs == 0 + call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1) + call builder.add_section_spaced('airline_tabtype', s:tabs_label) + else + call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) + call builder.add_section_spaced('airline_tabtype', s:buffers_label) + endif + endif + + let s:current_bufnr = cur_buf + let s:current_tabnr = cur_tab + let s:current_tabline = builder.build() + return s:current_tabline +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/default.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/default.vim new file mode 100644 index 0000000..1ecce32 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/default.vim @@ -0,0 +1,41 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) +let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0) +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#format(bufnr, buffers) + let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') + let _ = '' + + let name = bufname(a:bufnr) + if empty(name) + let _ .= '[No Name]' + else + if s:fnamecollapse + let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') + else + let _ .= fnamemodify(name, fmod) + endif + if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate + let _ = strpart(_, 0, s:fnametruncate) + endif + endif + + return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) +endfunction + +function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) + let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' + let _ .= substitute(a:buffer_name, '\\', '/', 'g') + + if getbufvar(a:bufnr, '&modified') == 1 + let _ .= s:buf_modified_symbol + endif + return _ +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail.vim new file mode 100644 index 0000000..d9c7d6a --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail.vim @@ -0,0 +1,34 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#formatters#unique_tail#format(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, ':s?/\+$??:t') + if has_key(tails, tail) + let duplicates[nr] = nr + endif + let tails[tail] = 1 + let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail) + endif + endfor + + for nr in values(duplicates) + let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) + endfor + + if has_key(map, a:bufnr) + return map[a:bufnr] + endif + + " if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim new file mode 100644 index 0000000..e860bd8 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim @@ -0,0 +1,91 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:skip_symbol = '…' + +function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers) + if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) + endif + + let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') + let do_deduplicate = 0 + let path_tokens = {} + + for nr in a:buffers + let name = bufname(nr) + if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique + let do_deduplicate = 1 + let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) + let token_index = 0 + for token in tokens + if token == '' | continue | endif + if token == '.' | break | endif + if !has_key(path_tokens, token_index) + let path_tokens[token_index] = {} + endif + let path_tokens[token_index][token] = 1 + let token_index += 1 + endfor + endif + endfor + + if do_deduplicate == 1 + let path = [] + let token_index = 0 + for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) + if token == '.' | break | endif + let duplicated = 0 + let uniq = 1 + let single = 1 + if has_key(path_tokens, token_index) + let duplicated = 1 + if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif + if has_key(path_tokens[token_index], token) | let uniq = 0 | endif + endif + call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) + let token_index += 1 + endfor + + let buf_name = [curbuf_tail] + let has_uniq = 0 + let has_skipped = 0 + for token1 in reverse(path) + if !token1['duplicated'] && len(buf_name) > 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if has_uniq == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if token1['uniq'] == 0 && token1['single'] == 1 + let has_skipped = 1 + else + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + endif + call insert(buf_name, token1['token']) + endif + + if token1['uniq'] == 1 + let has_uniq = 1 + endif + endfor + + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + endif + + return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/')) + else + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/tabs.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/tabs.vim new file mode 100644 index 0000000..63beee1 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tabline/tabs.vim @@ -0,0 +1,112 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1) +let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) +let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) +let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') +let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1) +let s:spc = g:airline_symbols.space + +let s:current_bufnr = -1 +let s:current_tabnr = -1 +let s:current_modified = 0 + +function! airline#extensions#tabline#tabs#off() + augroup airline_tabline_tabs + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#tabs#on() + augroup airline_tabline_tabs + autocmd! + autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate() + augroup END +endfunction + +function! airline#extensions#tabline#tabs#invalidate() + let s:current_bufnr = -1 +endfunction + +function! airline#extensions#tabline#tabs#get() + let curbuf = bufnr('%') + let curtab = tabpagenr() + call airline#extensions#tabline#tabs#map_keys() + if curbuf == s:current_bufnr && curtab == s:current_tabnr + if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#extensions#tabline#new_builder() + + for i in range(1, tabpagenr('$')) + if i == curtab + 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 + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + else + let group = 'airline_tab' + endif + let val = '%(' + if s:show_tab_nr + if s:tab_nr_type == 0 + let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}' + elseif s:tab_nr_type == 1 + let val .= (g:airline_symbols.space).i + else "== 2 + let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}' + endif + endif + call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') + endfor + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabfill', '') + + if s:show_close_button + call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ') + endif + + if s:show_splits == 1 + let buffers = tabpagebuflist(curtab) + for nr in buffers + let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" + call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') + endfor + elseif s:show_tab_type == 1 + call b.add_section_spaced('airline_tabtype', s:tabs_label) + endif + + let s:current_bufnr = curbuf + let s:current_tabnr = curtab + let s:current_tabline = b.build() + return s:current_tabline +endfunction + +function! airline#extensions#tabline#tabs#map_keys() + noremap AirlineSelectTab1 :1tabn + noremap AirlineSelectTab2 :2tabn + noremap AirlineSelectTab3 :3tabn + noremap AirlineSelectTab4 :4tabn + noremap AirlineSelectTab5 :5tabn + noremap AirlineSelectTab6 :6tabn + noremap AirlineSelectTab7 :7tabn + noremap AirlineSelectTab8 :8tabn + noremap AirlineSelectTab9 :9tabn + noremap AirlineSelectPrevTab gT + " tabn {count} goes to count tab does not go {count} tab pages forward! + noremap AirlineSelectNextTab :exe repeat(':tabn\|', v:count1) +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/tagbar.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tagbar.vim new file mode 100644 index 0000000..7e7665a --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,47 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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 + +let s:airline_tagbar_last_lookup_time = 0 +let s:airline_tagbar_last_lookup_val = '' +function! airline#extensions#tagbar#currenttag() + if get(w:, 'airline_active', 0) + if s:airline_tagbar_last_lookup_time != localtime() + let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags) + let s:airline_tagbar_last_lookup_time = localtime() + endif + return s:airline_tagbar_last_lookup_val + 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/pack/acp/start/vim-airline/autoload/airline/extensions/tmuxline.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/tmuxline.vim new file mode 100644 index 0000000..078d5dc --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/tmuxline.vim @@ -0,0 +1,28 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':Tmuxline') + finish +endif + +let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') + +function! airline#extensions#tmuxline#init(ext) + call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') +endfunction + +function! airline#extensions#tmuxline#set_tmux_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) + call tmuxline#api#set_theme(tmuxline_theme) + + if strlen(s:tmuxline_snapshot_file) + call tmuxline#api#snapshot(s:tmuxline_snapshot_file) + endif +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/undotree.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/undotree.vim new file mode 100644 index 0000000..36f8b9b --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/undotree.vim @@ -0,0 +1,29 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/unicode.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/unicode.vim new file mode 100644 index 0000000..30cb796 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/unicode.vim @@ -0,0 +1,24 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_unicodePlugin', 0) + finish +endif + +function! airline#extensions#unicode#apply(...) + if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable' + call airline#parts#define('unicode', { + \ 'text': '[UnicodeTable]', + \ 'accent': 'bold' }) + let w:airline_section_a = airline#section#create(['unicode']) + let w:airline_section_b = '' + let w:airline_section_c = '' + let w:airline_section_y = '' + endif +endfunction + +function! airline#extensions#unicode#init(ext) + call a:ext.add_statusline_func('airline#extensions#unicode#apply') +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/unite.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/unite.vim new file mode 100644 index 0000000..9467a7d --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/unite.vim @@ -0,0 +1,25 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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/pack/acp/start/vim-airline/autoload/airline/extensions/vimagit.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/vimagit.vim new file mode 100644 index 0000000..400792e --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/vimagit.vim @@ -0,0 +1,30 @@ +" MIT License. Copyright (c) 2016 Jerome Reybert +" vim: et ts=2 sts=2 sw=2 + +" This plugin replace the whole section_a when in vimagit buffer +scriptencoding utf-8 + +if !get(g:, 'loaded_magit', 0) + finish +endif + +function! airline#extensions#vimagit#init(ext) + call a:ext.add_statusline_func('airline#extensions#vimagit#apply') +endfunction + +function! airline#extensions#vimagit#get_mode() + if ( b:magit_current_commit_mode == '' ) + return "STAGING" + elseif ( b:magit_current_commit_mode == 'CC' ) + return "COMMIT" + elseif ( b:magit_current_commit_mode == 'CA' ) + return "AMEND" + else + return "???" +endfunction + +function! airline#extensions#vimagit#apply(...) + if ( &filetype == 'magit' ) + let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}' + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/virtualenv.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/virtualenv.vim new file mode 100644 index 0000000..0364434 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/virtualenv.vim @@ -0,0 +1,31 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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" + if get(g:, 'virtualenv_loaded', 0) + let statusline = virtualenv#statusline() + else + let statusline = fnamemodify($VIRTUAL_ENV, ':t') + endif + if !empty(statusline) + call airline#extensions#append_to_section('x', + \ s:spc.g:airline_right_alt_sep.s:spc.statusline) + endif + endif +endfunction + +function! airline#extensions#virtualenv#update() + if &filetype =~# "python" + call airline#extensions#virtualenv#apply() + call airline#update_statusline() + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/whitespace.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/whitespace.vim new file mode 100644 index 0000000..861fb28 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/whitespace.vim @@ -0,0 +1,163 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html + +scriptencoding utf-8 + +let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) +let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) +let s:default_checks = ['indent', 'trailing', 'mixed-indent-file'] + +let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing') +let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent') +let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long') +let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file') +let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) +let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] } +let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) +let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ]) + +function! s:check_mixed_indent() + if s:indent_algo == 1 + " [] + " spaces before or between tabs are not allowed + let t_s_t = '(^\t* +\t\s*\S)' + " ( x count) + " count of spaces at the end of tabs should be less than tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + return search('\v' . t_s_t . '|' . t_l_s, 'nw') + elseif s:indent_algo == 2 + return search('\v(^\t* +\t\s*\S)', 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') + endif +endfunction + +function! s:check_mixed_indent_file() + if index(s:c_like_langs, &ft) > -1 + " for C-like languages: allow /** */ comment style with one space before the '*' + let head_spc = '\v(^ +\*@!)' + else + let head_spc = '\v(^ +)' + endif + let indent_tabs = search('\v(^\t+)', 'nw') + let indent_spc = search(head_spc, 'nw') + if indent_tabs > 0 && indent_spc > 0 + return printf("%d:%d", indent_tabs, indent_spc) + else + return '' + endif +endfunction + +function! airline#extensions#whitespace#check() + if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines + \ || get(b:, 'airline_whitespace_disabled', 0) + return '' + endif + + if !exists('b:airline_whitespace_check') + let b:airline_whitespace_check = '' + let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks)) + + let trailing = 0 + if index(checks, 'trailing') > -1 + try + let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') + let trailing = search(regexp, 'nw') + catch + echomsg 'airline#whitespace: error occured evaluating '. regexp + echomsg v:exception + return '' + endtry + endif + + let mixed = 0 + let check = 'indent' + if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 + let mixed = s:check_mixed_indent() + endif + + let mixed_file = '' + let check = 'mixed-indent-file' + if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 + let mixed_file = s:check_mixed_indent_file() + endif + + let long = 0 + if index(checks, 'long') > -1 && &tw > 0 + let long = search('\%>'.&tw.'v.\+', 'nw') + endif + + if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) + let b:airline_whitespace_check = s:symbol + if strlen(s:symbol) > 0 + let space = (g:airline_symbols.space) + else + let space = '' + endif + + if s:show_message + if trailing != 0 + let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing) + endif + if mixed != 0 + let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed) + endif + if long != 0 + let b:airline_whitespace_check .= space.printf(s:long_format, long) + endif + if !empty(mixed_file) + let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file) + endif + endif + endif + endif + return airline#util#shorten(b:airline_whitespace_check, 120, 9) +endfunction + +function! airline#extensions#whitespace#toggle() + if s:enabled + augroup airline_whitespace + autocmd! + augroup END + augroup! airline_whitespace + let s:enabled = 0 + else + call airline#extensions#whitespace#init() + let s:enabled = 1 + endif + + if exists("g:airline#extensions#whitespace#enabled") + let g:airline#extensions#whitespace#enabled = s:enabled + if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 + let g:airline_section_warning .= airline#section#create(['whitespace']) + call airline#update_statusline() + endif + endif + echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') +endfunction + +function! airline#extensions#whitespace#disable() + if s:enabled + call airline#extensions#whitespace#toggle() + endif +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 * call ws_refresh() + augroup END +endfunction + +function! s:ws_refresh() + unlet! b:airline_whitespace_check + if get(g:, 'airline_skip_empty_sections', 0) + exe ':AirlineRefresh' + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/windowswap.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/windowswap.vim new file mode 100644 index 0000000..fde010d --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/windowswap.vim @@ -0,0 +1,29 @@ +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('g:loaded_windowswap') + finish +endif + +let s:spc = g:airline_symbols.space + +if !exists('g:airline#extensions#windowswap#indicator_text') + let g:airline#extensions#windowswap#indicator_text = 'WS' +endif + +function! airline#extensions#windowswap#init(ext) + call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') +endfunction + +function! airline#extensions#windowswap#get_status() + " use new tab-aware api if WS is up to date + let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ? + \WindowSwap#IsCurrentWindowMarked() : + \(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()) + if s:mark + return g:airline#extensions#windowswap#indicator_text.s:spc + endif + return '' +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount.vim new file mode 100644 index 0000000..4227769 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount.vim @@ -0,0 +1,39 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words') +let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') +let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes', + \ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail') + +function! s:update() + if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 + let l:mode = mode() + if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' + let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() + let b:airline_change_tick = b:changedtick + else + if get(b:, 'airline_wordcount_cache', '') is# '' || + \ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') || + \ get(b:, 'airline_change_tick', 0) != b:changedtick + " cache data + let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() + let b:airline_wordcount_cache = b:airline_wordcount + let b:airline_change_tick = b:changedtick + endif + endif + endif +endfunction + +function! airline#extensions#wordcount#apply(...) + if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 + call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}') + endif +endfunction + +function! airline#extensions#wordcount#init(ext) + call a:ext.add_statusline_func('airline#extensions#wordcount#apply') + autocmd BufReadPost,CursorMoved,CursorMovedI * call s:update() +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount/formatters/default.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount/formatters/default.vim new file mode 100644 index 0000000..bb49c3f --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/wordcount/formatters/default.vim @@ -0,0 +1,60 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#wordcount#formatters#default#format() + let words = string(s:wordcount()) + if empty(words) + return + endif + let separator = s:get_decimal_group() + if words > 999 && !empty(separator) + " Format number according to locale, e.g. German: 1.245 or English: 1,245 + let a = join(reverse(split(words, '.\zs')),'') + let a = substitute(a, '...', '&'.separator, 'g') + let words = join(reverse(split(a, '.\zs')),'') + endif + return words . " words" . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space +endfunction + +function! s:wordcount() + if exists("*wordcount") + let l:mode = mode() + if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' + let l:visual_words = wordcount()['visual_words'] + if l:visual_words != '' + return l:visual_words + else + return 0 + endif + else + return wordcount()['words'] + endif + elseif mode() =~? 's' + return + else + let old_status = v:statusmsg + let position = getpos(".") + exe "silent normal! g\" + let stat = v:statusmsg + call setpos('.', position) + let v:statusmsg = old_status + + let parts = split(stat) + if len(parts) > 11 + return str2nr(parts[11]) + else + return + endif + endif +endfunction + +function! s:get_decimal_group() + if match(v:lang, '\v\cC|en') > -1 + return ',' + elseif match(v:lang, '\v\cde|dk|fr|pt') > -1 + return '.' + endif + return '' +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/xkblayout.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/xkblayout.vim new file mode 100644 index 0000000..a9aef83 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/xkblayout.vim @@ -0,0 +1,25 @@ +" MIT License. Copyright (c) 2017 YoungHoon Rhiu. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('g:XkbSwitchLib') + finish +endif + +function! airline#extensions#xkblayout#status() + let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '') + let keyboard_layout = split(keyboard_layout, '\.')[-1] + let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'} + + if has_key(short_codes, keyboard_layout) + let keyboard_layout = short_codes[keyboard_layout] + endif + + return keyboard_layout +endfunction + +function! airline#extensions#xkblayout#init(ext) + call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status') +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/extensions/ycm.vim b/pack/acp/start/vim-airline/autoload/airline/extensions/ycm.vim new file mode 100644 index 0000000..a254b4b --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/extensions/ycm.vim @@ -0,0 +1,38 @@ +" MIT License. Copyright (c) 2015 Evgeny Firsov. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space +let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:') + +function! airline#extensions#ycm#init(ext) + call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count') + call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count') +endfunction + +function! airline#extensions#ycm#get_error_count() + if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount") + let cnt = youcompleteme#GetErrorCount() + + if cnt != 0 + return s:error_symbol.cnt + endif + endif + + return '' +endfunction + +function! airline#extensions#ycm#get_warning_count() + if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount") + let cnt = youcompleteme#GetWarningCount() + + if cnt != 0 + return s:warning_symbol.cnt.s:spc + endif + endif + + return '' +endfunction + diff --git a/pack/acp/start/vim-airline/autoload/airline/highlighter.vim b/pack/acp/start/vim-airline/autoload/airline/highlighter.vim new file mode 100644 index 0000000..16ae66e --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/highlighter.vim @@ -0,0 +1,225 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') && (empty($CONEMUBUILD) || &term !=? 'xterm') + +let s:separators = {} +let s:accents = {} + +function! s:gui2cui(rgb, fallback) + if a:rgb == '' + return a:fallback + elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1 + return a:rgb + endif + let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)') + return airline#msdos#round_msdos_colors(rgb) +endfunction + +function! s:get_syn(group, what) + if !exists("g:airline_gui_mode") + let g:airline_gui_mode = airline#init#gui_mode() + endif + let color = '' + if hlexists(a:group) + let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode) + endif + if empty(color) || color == -1 + " should always exists + let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode) + " however, just in case + if empty(color) || color == -1 + let color = 'NONE' + endif + endif + return color +endfunction + +function! s:get_array(fg, bg, opts) + return g:airline_gui_mode ==# 'gui' + \ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ] + \ : [ '', '', a:fg, a: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 = g:airline_gui_mode ==# 'gui' + \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') + \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') + \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', '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) + if pumvisible() + return + endif + 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 + let old_hi = airline#highlighter#get_highlight(a:group) + if len(colors) == 4 + call add(colors, '') + endif + let colors = s:CheckDefined(colors) + if old_hi != colors || !hlexists(a:group) + let cmd = printf('hi %s %s %s %s %s %s %s %s', + \ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''), + \ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''), + \ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''), + \ s:Get(colors, 4, 'term=', '')) + exe cmd + endif +endfunction + +function! s:CheckDefined(colors) + " Checks, whether the definition of the colors is valid and is not empty or NONE + " e.g. if the colors would expand to this: + " hi airline_c ctermfg=NONE ctermbg=NONE + " that means to clear that highlighting group, therefore, fallback to Normal + " highlighting group for the cterm values + + " This only works, if the Normal highlighting group is actually defined, so + " return early, if it has been cleared + if !exists("g:airline#highlighter#normal_fg_hi") + let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm') + endif + if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0 + return a:colors + endif + + for val in a:colors + if !empty(val) && val !=# 'NONE' + return a:colors + endif + endfor + " this adds the bold attribute to the term argument of the :hi command, + " but at least this makes sure, the group will be defined + let fg = g:airline#highlighter#normal_fg_hi + let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm') + if bg < 0 + " in case there is no background color defined for Normal + let bg = a:colors[3] + endif + return a:colors[0:1] + [fg, bg] + [a:colors[4]] +endfunction + +function! s:Get(dict, key, prefix, default) + if get(a:dict, a:key, a:default) isnot# a:default + return a:prefix. get(a:dict, a:key) + else + return '' + endif +endfunction + +function! s:exec_separator(dict, from, to, inverse, suffix) + if pumvisible() + return + endif + 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() + if pumvisible() + return + endif + for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') + call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) + endfor + call airline#highlighter#highlight(['inactive']) + if getbufvar( bufnr('%'), '&modified' ) + call airline#highlighter#highlight(['normal', 'modified']) + else + call airline#highlighter#highlight(['normal']) + endif +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 bufnr = a:0 ? a:1 : '' + 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] + let name = kvp[0] + if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive' + let name = 'airline_c'.bufnr + endif + call airline#highlighter#exec(name.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(name.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/pack/acp/start/vim-airline/autoload/airline/init.vim b/pack/acp/start/vim-airline/autoload/airline/init.vim new file mode 100644 index 0000000..67d4436 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/init.vim @@ -0,0 +1,197 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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 + + let g:airline#util#async = v:version >= 800 && has('job') + let g:airline#util#is_windows = has('win32') || has('win64') + + 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_crypt', 1) + call s:check_defined('g:airline_detect_spell', 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_gui_mode', airline#init#gui_mode()) + + 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', + \ 't' : 'TERMINAL', + \ }, 'keep') + + call s:check_defined('g:airline_theme_map', {}) + call extend(g:airline_theme_map, { + \ '\CTomorrow': 'tomorrow', + \ 'base16': 'base16', + \ 'mo[l|n]okai': 'molokai', + \ 'wombat': 'wombat', + \ 'zenburn': 'zenburn', + \ 'solarized': 'solarized', + \ 'flattened': 'solarized', + \ '\CNeoSolarized': 'solarized', + \ }, 'keep') + + call s:check_defined('g:airline_symbols', {}) + " First define the symbols, + " that are common in Powerline/Unicode/ASCII mode, + " then add specific symbols for either mode + call extend(g:airline_symbols, { + \ 'paste': 'PASTE', + \ 'spell': 'SPELL', + \ 'modified': '+', + \ 'space': ' ' + \ }, 'keep') + + if get(g:, 'airline_powerline_fonts', 0) + " Symbols for Powerline terminals + call s:check_defined('g:airline_left_sep', "\ue0b0") "  + call s:check_defined('g:airline_left_alt_sep', "\ue0b1") "  + call s:check_defined('g:airline_right_sep', "\ue0b2") "  + call s:check_defined('g:airline_right_alt_sep', "\ue0b3") "  + " ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\ue0a2", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630 ", + \ 'maxlinenr': " \ue0a1", + \ 'branch': "\ue0a0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0) + " Symbols for Unicode terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + " ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\u229D", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630 ", + \ 'maxlinenr': " \u33D1", + \ 'branch': "\u16A0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + else + " Symbols for ASCII terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + call extend(g:airline_symbols, { + \ 'readonly': 'RO', + \ 'whitespace': '!', + \ 'linenr': 'ln ', + \ 'maxlinenr': ' :', + \ 'branch': '', + \ 'notexists': '?', + \ 'crypt': 'cr', + \ }, 'keep') + endif + + 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('crypt', 'airline#parts#crypt') + call airline#parts#define_function('spell', 'airline#parts#spell') + 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('path', '%F%m') + call airline#parts#define('linenr', { + \ 'raw': '%{g:airline_symbols.linenr}%4l', + \ 'accent': 'bold'}) + call airline#parts#define('maxlinenr', { + \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', + \ 'accent': 'bold'}) + call airline#parts#define_function('ffenc', 'airline#parts#ffenc') + call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar', 'syntastic', + \ 'eclim', 'whitespace','windowswap', 'ycm_error_count', 'ycm_warning_count', + \ 'neomake_error_count', 'neomake_warning_count', 'ale_error_count', 'ale_warning_count']) + call airline#parts#define_text('capslock', '') + call airline#parts#define_text('xkblayout', '') + + unlet g:airline#init#bootstrapping +endfunction + +function! airline#init#gui_mode() + return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR') && !exists("+termguicolors")) + \ || has('gui_running') || (has("termtruecolor") && &guicolors == 1) || (has("termguicolors") && &termguicolors == 1)) ? + \ 'gui' : 'cterm' +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', 'crypt', 'paste', 'spell', 'capslock', 'xkblayout', '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') + if exists("+autochdir") && &autochdir == 1 + let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly']) + else + let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) + endif + 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') + if winwidth(0) > 80 + let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v']) + else + let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v']) + endif + endif + if !exists('g:airline_section_error') + let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim', 'neomake_error_count', 'ale_error_count']) + endif + if !exists('g:airline_section_warning') + let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'neomake_warning_count', 'ale_warning_count', 'whitespace']) + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/msdos.vim b/pack/acp/start/vim-airline/autoload/airline/msdos.vim new file mode 100644 index 0000000..0757de5 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/msdos.vim @@ -0,0 +1,59 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" basic 16 msdos from MSDOS +" see output of color, should be +" 0 Black +" 1 DarkBlue +" 2 DarkGreen +" 3 DarkCyan +" 4 DarkRed +" 5 DarkMagenta +" 6 Brown +" 7 LightGray +" 8 DarkGray +" 9 Blue +" 10 Green +" 11 Cyan +" 12 Red +" 13 Magenta +" 14 Yellow +" 15 White + +let s:basic16 = [ + \ [ 0x00, 0x00, 0x00 ], + \ [ 0x00, 0x00, 0x80 ], + \ [ 0x00, 0x80, 0x00 ], + \ [ 0x00, 0x80, 0x80 ], + \ [ 0x80, 0x00, 0x00 ], + \ [ 0x80, 0x00, 0x80 ], + \ [ 0x80, 0x80, 0x00 ], + \ [ 0xC0, 0xC0, 0xC0 ], + \ [ 0x80, 0x80, 0x80 ], + \ [ 0x00, 0x00, 0xFF ], + \ [ 0x00, 0xFF, 0x00 ], + \ [ 0x00, 0xFF, 0xFF ], + \ [ 0xFF, 0x00, 0x00 ], + \ [ 0xFF, 0x00, 0xFF ], + \ [ 0xFF, 0xFF, 0x00 ], + \ [ 0xFF, 0xFF, 0xFF ] + \ ] + +function! airline#msdos#round_msdos_colors(rgblist) + " Check for values from MSDOS 16 color terminal + let best = [] + let min = 100000 + let list = s:basic16 + for value in list + let t = abs(value[0] - a:rgblist[0]) + + \ abs(value[1] - a:rgblist[1]) + + \ abs(value[2] - a:rgblist[2]) + if min > t + let min = t + let best = value + endif + endfor + return index(s:basic16, best) +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/parts.vim b/pack/acp/start/vim-airline/autoload/airline/parts.vim new file mode 100644 index 0000000..6496bd9 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/parts.vim @@ -0,0 +1,99 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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 airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1) +endfunction + +function! airline#parts#crypt() + return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : '' +endfunction + +function! airline#parts#paste() + return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' +endfunction + +function! airline#parts#spell() + return g:airline_detect_spell && &spell ? g:airline_symbols.spell : '' +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() + if &readonly && &modifiable && !filereadable(bufname('%')) + return '[noperm]' + else + return &readonly ? g:airline_symbols.readonly : '' + endif +endfunction + +function! airline#parts#filetype() + return winwidth(0) < 100 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype +endfunction + +function! airline#parts#ffenc() + let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '') + let bomb = &l:bomb ? '[BOM]' : '' + let ff = strlen(&ff) ? '['.&ff.']' : '' + if expected is# &fenc.bomb.ff + return '' + else + return &fenc.bomb.ff + endif +endfunction diff --git a/pack/acp/start/vim-airline/autoload/airline/section.vim b/pack/acp/start/vim-airline/autoload/airline/section.vim new file mode 100644 index 0000000..8d08230 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/section.vim @@ -0,0 +1,85 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +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 = '' + let add_sep = get(l:, 'add_sep', 0) + + 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 t = '' + if !add_sep + let t = s:spc.g:airline_right_alt_sep.s:spc + endif + let val = t.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) + " will add an extra separator, if minwidth is zero + let add_sep = (minwidth == 0) + elseif a:append < 0 && idx != len(a:parts) - 1 + let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) + " will add an extra separator, if minwidth is zero + let add_sep = (minwidth == 0) + else + let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) + let add_sep = 0 + 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/pack/acp/start/vim-airline/autoload/airline/themes.vim b/pack/acp/start/vim-airline/autoload/airline/themes.vim new file mode 100644 index 0000000..75c2f40 --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/themes.vim @@ -0,0 +1,73 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" 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 + if !has_key(a:palette[mode], 'airline_error') + let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ] + endif + endfor + + let a:palette.accents = get(a:palette, 'accents', {}) + let a:palette.accents.none = [ '', '', '', '', '' ] + 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/pack/acp/start/vim-airline/autoload/airline/themes/dark.vim b/pack/acp/start/vim-airline/autoload/airline/themes/dark.vim new file mode 100644 index 0000000..c242d7b --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/themes/dark.vim @@ -0,0 +1,103 @@ +scriptencoding utf-8 + +" 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) + 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' ]) +endif + diff --git a/pack/acp/start/vim-airline/autoload/airline/util.vim b/pack/acp/start/vim-airline/autoload/airline/util.vim new file mode 100644 index 0000000..ef11cbe --- /dev/null +++ b/pack/acp/start/vim-airline/autoload/airline/util.vim @@ -0,0 +1,107 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +call airline#init#bootstrap() +let s:spc = g:airline_symbols.space + +function! airline#util#shorten(text, winwidth, minwidth) + if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth + return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' + else + return a:text + endif +endfunction + +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#warning(msg) + echohl WarningMsg + echomsg "airline: ".a:msg + echohl Normal +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 + +" Define a wrapper over system() that uses nvim's async job control if +" available. This way we avoid overwriting v:shell_error, which might +" potentially disrupt other plugins. +if has('nvim') + function! s:system_job_handler(job_id, data, event) dict + if a:event == 'stdout' + let self.buf .= join(a:data) + endif + endfunction + + function! airline#util#system(cmd) + let l:config = { + \ 'buf': '', + \ 'on_stdout': function('s:system_job_handler'), + \ } + let l:id = jobstart(a:cmd, l:config) + if l:id < 1 + return system(a:cmd) + endif + call jobwait([l:id]) + return l:config.buf + endfunction +else + function! airline#util#system(cmd) + return system(a:cmd) + endfunction +endif diff --git a/pack/acp/start/vim-airline/doc/airline.txt b/pack/acp/start/vim-airline/doc/airline.txt new file mode 100644 index 0000000..afd31c4 --- /dev/null +++ b/pack/acp/start/vim-airline/doc/airline.txt @@ -0,0 +1,1114 @@ +*airline.txt* Lean and mean status/tabline that's light as air +*airline* *vim-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. Autocommands ................................. |airline-autocommands| + 07. Customization ............................... |airline-customization| + 08. Extensions ..................................... |airline-extensions| + 09. Advanced Customization ............. |airline-advanced-customization| + 10. Funcrefs ......................................... |airline-funcrefs| + 11. Pipeline ......................................... |airline-pipeline| + 12. Writing Extensions ..................... |airline-writing-extensions| + 13. Writing Themes ..................................... |airline-themes| + 14. Troubleshooting ........................... |airline-troubleshooting| + 15. Contributions ............................... |airline-contributions| + 16. 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 crypt detection > + let g:airline_detect_crypt=1 + +* enable spell detection > + let g:airline_detect_spell=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='dark' +< + Note: Only the dark theme is distributed with vim-airline. For more themes, + checkout the vim-airline-themes repository + (github.com/vim-airline/vim-airline-themes) + +* 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 +< +* By default, airline will use unicode symbols if your encoding matches + utf-8. If you want the powerline symbols set this variable: > + let g:airline_powerline_fonts = 1 +< + If you want to use plain ascii symbols, set this variable: > + let g:airline_symbols_ascii = 1 +< +* 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 +< +* disable the Airline customization for selective windows (this is a + window-local variable so you can disable it for only some windows) > + let w:airline_disabled = 1 + +* Do not draw separators for empty sections (only for the active window) + > + let g:airline_skip_empty_sections = 1 +< +============================================================================== +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 and redraws the statusline. + +============================================================================== +AUTOCOMMANDS *airline-autocommands* + +Airline comes with some user-defined autocommands. + +|AirlineAfterInit| after plugin is initialized, but before the statusline + is replaced +|AirlineAfterTheme| after theme of the statusline has been changed +|AirlineToggledOn| after airline is activated and replaced the statusline +|AirlineToggledOff| after airline is deactivated and the statusline is + restored to the original + +============================================================================== +CUSTOMIZATION *airline-customization* + +The following are some unicode symbols for customizing the left/right +separators, as well as the powerline font glyphs. + +Note: You must define the dictionary first before setting values. Also, it's a +good idea to check whether it exists as to avoid accidentally overwriting +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.crypt = '🔒' + let g:airline_symbols.linenr = '␊' + let g:airline_symbols.linenr = '␤' + let g:airline_symbols.linenr = '¶' + let g:airline_symbols.maxlinenr = '☰' + let g:airline_symbols.maxlinenr = '' + let g:airline_symbols.branch = '⎇' + let g:airline_symbols.paste = 'ρ' + let g:airline_symbols.paste = 'Þ' + let g:airline_symbols.paste = '∥' + let g:airline_symbols.spell = 'Ꞩ' + let g:airline_symbols.notexists = '∄' + 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, crypt, paste, spell, 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_error (ycm_error_count, syntastic, eclim) + let g:airline_section_warning (ycm_warning_count, 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. + +By default, airline will attempt to load any extension it can find in the +'runtimepath'. On some systems this can result in an undesirable startup +cost. You can disable the check with the following flag. > + let g:airline#extensions#disable_rtp_load = 1 +< + Note: Third party plugins that rely on this behavior will be affected. You + will need to manually load them. + +Alternatively, if you want a minimalistic setup and would rather opt-in which +extensions get loaded instead of disabling each individually, you can declare +the following list variable: > + " an empty list disables all extensions + let g:airline_extensions = [] + + " or only load what you want + let g:airline_extensions = ['branch', 'tabline'] +< +------------------------------------- *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, + \ 'warning': 80, + \ 'error': 80, + \ } + + " Note: set to an empty dictionary to disable truncation. + let g:airline#extensions#default#section_truncate_width = {} +< +* configure the layout of the sections by specifying 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', 'error', 'warning' ] + \ ] +< +* configure the layout to not use %(%) grouping items in the statusline. + Try setting this to zero, if you notice bleeding color artifacts > + let airline#extensions#default#section_use_groupitems = 1 +< +* configure the fileformat output + By default, it will display something like 'utf-8[unix]', however, you can + skip displaying it, if the output matches a configured string. To do so, + set > + let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' +< +------------------------------------- *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* + +vim-airline will display the branch-indicator together with the branch name in +the statusline, if one of the following plugins is installed: + +fugitive.vim +lawrencium +vcscommand + +If a file is edited, that is not yet in the repository, the +notexists symbol will be displayed after the branch name. + +* 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 = '' +< +* define the order in which the branches of different vcs systems will be + displayed on the statusline (currently only for fugitive and lawrencium) > + let g:airline#extensions#branch#vcs_priority = ["git", "mercurial"] +< +* use vcscommand.vim if available > + let g:airline#extensions#branch#use_vcscommand = 0 +< +* truncate long branch names to a fixed length > + let g:airline#extensions#branch#displayed_head_limit = 10 +< +* customize formatting of branch name > + " default value leaves the name unmodifed + let g:airline#extensions#branch#format = 0 + + " to only show the tail, e.g. a branch 'feature/foo' becomes 'foo', use + let g:airline#extensions#branch#format = 1 + + " to truncate all path sections but the last one, e.g. a branch + " 'foo/bar/baz' becomes 'f/b/baz', use + let g:airline#extensions#branch#format = 2 + + " if a string is provided, it should be the name of a function that + " takes a string and returns the desired value + let g:airline#extensions#branch#format = 'CustomBranchName' + function! CustomBranchName(name) + return '[' . a:name . ']' + endfunction +< +------------------------------------- *airline-syntastic* +syntastic + +* enable/disable syntastic integration > + let g:airline#extensions#syntastic#enabled = 1 + + Note: The recommendation from syntastic to modify the statusline directly + does not apply, if you use vim-airline, since it will take care for you of + adjusting the statusline. +< +------------------------------------- *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 +changesPlugin +quickfixsigns + +* 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-vimagit* +vimagit + +* enable/disable vimagit integration > + let g:airline#extensions#vimagit#enabled = 1 +< +------------------------------------- *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-wordcount* +* enable/disable word counting. > + let g:airline#extensions#wordcount#enabled = 1 +< +* regex of filetypes to enable word counting. > + " the default value matches filetypes typically used for documentation + " such as markdown and help files. + let g:airline#extensions#wordcount#filetypes = ... + (default: markdown,rst,org,help,text,tex,mail) + +* defines the name of a formatter for word count will be displayed: > + " The default will try to guess LC_NUMERIC and format number accordingly + " e.g. 1,042 in English and 1.042 in German locale + let g:airline#extensions#wordcount#formatter = 'default' + + " here is how you can define a 'foo' formatter: + " create a file in the dir autoload/airline/extensions/wordcount/formatters/ + " called foo.vim + " this example needs at least Vim > 7.4.1042 + function! airline#extensions#wordcount#formatters#foo#format() + return (wordcount()['words'] == 0 ? 'NONE' : + \ wordcount()['words'] > 100 ? 'okay' : 'not enough') + endfunction + let g:airline#extensions#wordline#formatter = 'foo' + +* defines how to display the wordcount statistics: > + let g:airline#extensions#wordcount#format = '%d words' +< +------------------------------------- *airline-whitespace* +* enable/disable detection of whitespace errors. > + let g:airline#extensions#whitespace#enabled = 1 +< +* disable detection of whitespace errors. > + " useful to call for particular file types (e.g., in "ftplugin/*") + silent! call airline#extensions#whitespace#disable() +< +* customize the type of mixed indent checking to perform. > + " must be all spaces or all tabs before the first non-whitespace character + let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) + + " certain number of spaces are allowed after tabs, but not in between + " this algorithm works well for /** */ style comments in a tab-indented file + let g:airline#extensions#whitespace#mixed_indent_algo = 1 + + " spaces are allowed after tabs, but not in between + " this algorithm works well with programming styles that use tabs for + " indentation and spaces for alignment + let g:airline#extensions#whitespace#mixed_indent_algo = 2 +< +* customize the whitespace symbol. > + let g:airline#extensions#whitespace#symbol = '!' +< +* configure which whitespace checks to enable. > + " indent: mixed indent within a line + " long: overlong lines + " trailing: trailing whitespace + " mixed-indent-file: different indentation in different lines + let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ] + + " this can also be configured for an individual buffer + let b:airline_whitespace_checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ] +< +* configure the maximum number of lines where whitespace checking is enabled. > + let g:airline#extensions#whitespace#max_lines = 20000 +< +* 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]' + let g:airline#extensions#whitespace#long_format = 'long[%s]' + let g:airline#extensions#whitespace#mixed_indent_file_format = 'mix-indent-file[%s]' + +* configure custom trailing whitespace regexp rule > + let g:airline#extensions#whitespace#trailing_regexp = '\s$' + +* configure, which filetypes have special treatment of /* */ comments, + matters for mix-indent-file algorithm: > + let airline#extensions#c_like_langs = ['c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php'] +< +* disable whitespace checking for an individual buffer > + " Checking is enabled by default because b:airline_whitespace_disabled + " is by default not defined: + unlet b:airline_whitespace_disabled + + " If b:airline_whitespace_disabled is defined and is non-zero for a buffer, + " then whitespace checking will be disabled for that buffer; for example: + " let b:airline_whitespace_disabled = 1 +< +------------------------------------- *airline-tabline* +Note: If you're using the ctrlspace tabline only the option marked with (c) +are supported! + +* enable/disable enhanced tabline. (c) + let g:airline#extensions#tabline#enabled = 0 + +* enable/disable displaying open splits per tab (only when tabs are opened). > + let g:airline#extensions#tabline#show_splits = 1 + * +* switch position of buffers and tabs on splited tabline (c) + (only supported for ctrlspace plugin). > + let g:airline#extensions#tabline#switch_buffers_and_tabs = 0 +< +* enable/disable displaying buffers with a single tab. (c) + let g:airline#extensions#tabline#show_buffers = 1 +< + +Note: If you are using neovim (has('tablineat') = 1), then you can click +on the tabline with the left mouse button to switch to that buffer, and +with the middle mouse button to delete that buffer. + +* enable/disable displaying tabs, regardless of number. (c) + let g:airline#extensions#tabline#show_tabs = 1 +< +* configure filename match rules to exclude from the tabline. > + let g:airline#extensions#tabline#excludes = [] + +* enable/disable display preview window buffer in the tabline. > + let g:airline#extensions#tabline#exclude_preview = 1 + +* configure how numbers are displayed 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 + let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number +< +* enable/disable displaying tab number in tabs mode. > + let g:airline#extensions#tabline#show_tab_nr = 1 + +* enable/disable displaying tab type (far right) > + let g:airline#extensions#tabline#show_tab_type = 1 + + Note: The tab-type will only be displayed in tab-mode, + if there are no splits shown. (See: g:airline#extensions#tabline#show_splits) + +* rename label for buffers (default: 'buffers') (c) + let g:airline#extensions#tabline#buffers_label = 'b' + +* rename label for tabs (default: 'tabs') (c) + let g:airline#extensions#tabline#tabs_label = 't' + +* enable/disable displaying index of the buffer. + + When enabled, numbers will be displayed in the tabline and mappings will be + exposed to allow you to select a buffer directly. Up to 9 mappings will be + exposed. > + + let g:airline#extensions#tabline#buffer_idx_mode = 1 + nmap 1 AirlineSelectTab1 + nmap 2 AirlineSelectTab2 + nmap 3 AirlineSelectTab3 + nmap 4 AirlineSelectTab4 + nmap 5 AirlineSelectTab5 + nmap 6 AirlineSelectTab6 + nmap 7 AirlineSelectTab7 + nmap 8 AirlineSelectTab8 + nmap 9 AirlineSelectTab9 + nmap - AirlineSelectPrevTab + nmap + AirlineSelectNextTab + + Note: Mappings will be ignored within a NERDTree buffer. + + Note: In buffer_idx_mode these mappings won't change the + current tab, but switch to the buffer visible in that tab. + Use |gt| for switching tabs. + In tabmode, those mappings will switch to the specified tab. + +* change the display format of the buffer index > + let g:airline#extensions#tabline#buffer_idx_format = { + \ '0': '0 ', + \ '1': '1 ', + \ '2': '2 ', + \ '3': '3 ', + \ '4': '4 ', + \ '5': '5 ', + \ '6': '6 ', + \ '7': '7 ', + \ '8': '8 ', + \ '9': '9 ' + \} +< + +* defines the name of a formatter for how buffer names are displayed. (c) + let g:airline#extensions#tabline#formatter = 'default' + + " here is how you can define a 'foo' formatter: + " create a file in the dir autoload/airline/extensions/tabline/formatters/ + " called foo.vim > + function! airline#extensions#tabline#formatters#foo#format(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. + When no disambiguation is needed, both 'unique_tail_improved' and + 'unique_tail' delegate formatting to 'default', so these variables also + control rendering of unique filenames when using these formatters. + + * 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 +< + * configure truncating non-active buffer names to specified length. > + let g:airline#extensions#tabline#fnametruncate = 0 + + " 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' + + " The `unique_tail_improved` - another algorithm, that will smartly uniquify + " buffers names with similar filename, suppressing common parts of paths. + let g:airline#extensions#tabline#formatter = 'unique_tail_improved' +< +* 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 = '' + +* configure whether close button should be shown: > + let g:airline#extensions#tabline#show_close_button = 1 + +* configure symbol used to represent close button > + let g:airline#extensions#tabline#close_symbol = 'X' + +* configure pattern to be ignored on BufAdd autocommand > + " fixes unneccessary redraw, when e.g. opening Gundo window + let airline#extensions#tabline#ignore_bufadd_pat = + \ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree' + +Note: Enabling this extension will modify 'showtabline' and 'guioptions'. + +* enable Refresh of tabline buffers on |BufAdd| autocommands + (set this to one, if you note 'AirlineTablineRefresh', however, this + won't update airline on |:badd| commands) > + let airline#extensions#tabline#disable_refresh = 0 + +* preserve windows when closing a buffer from the bufferline (default: 0) > + + let airline#extensions#tabline#middle_click_preserves_windows = 1 +< +------------------------------------- *airline-tmuxline* +tmuxline + +* enable/disable tmuxline integration > + let g:airline#extensions#tmuxline#enabled = 0 +< +* configure which mode colors should be used in tmux statusline > + let airline#extensions#tmuxline#color_template = 'normal' (default) + let airline#extensions#tmuxline#color_template = 'insert' + let airline#extensions#tmuxline#color_template = 'visual' + let airline#extensions#tmuxline#color_template = 'replace' +< +* if specified, setting this option will trigger writing to the file whenever the + airline theme is applied, i.e. when :AirlineTheme is executed and on vim + startup > + airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf" +< +------------------------------------- *airline-promptline* +promptline + +* configure the path to the snapshot .sh file. Mandatory option. The created + file should be sourced by the shell on login > + " in .vimrc + airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh" + + " in .bashrc/.zshrc + [ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh +< +* enable/disable promptline integration > + let g:airline#extensions#promptline#enabled = 0 +< +* configure which mode colors should be used in prompt > + let airline#extensions#promptline#color_template = 'normal' (default) + let airline#extensions#promptline#color_template = 'insert' + let airline#extensions#promptline#color_template = 'visual' + let airline#extensions#promptline#color_template = 'replace' +< +------------------------------------- *airline-nrrwrgn* +NrrwRgn + +* enable/disable NrrwRgn integration > + let g:airline#extensions#nrrwrgn#enabled = 1 + +------------------------------------- *airline-capslock* +vim-capslock + +* enable/disable vim-capslock integration > + let g:airline#extensions#capslock#enabled = 1 + +------------------------------------- *airline-xkblayout* +vim-xkblayout + +* enable/disable vim-xkblayout extension > + let g:airline#extensions#xkblayout#enabled = 1 + +* define path to the backend switcher library + Linux (Install https://github.com/ierton/xkb-switch): + let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so' + macOS (Install https://github.com/vovkasm/input-source-switcher): + let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib' + +------------------------------------- *airline-windowswap* +vim-windowswap + +* enable/disable vim-windowswap integration > + let g:airline#extensions#windowswap#enabled = 1 + +* set marked window indicator string > + let g:airline#extensions#windowswap#indicator_text = 'WS' +< +------------------------------------- *airline-obsession* +vim-obsession + +* enable/disable vim-obsession integration > + let g:airline#extensions#obsession#enabled = 1 + +* set marked window indicator string > + let g:airline#extensions#obsession#indicator_text = '$' +< +------------------------------------- *airline-taboo* +taboo.vim + +* enable/disable taboo.vim integration > + let g:airline#extensions#taboo#enabled = 1 +< +------------------------------------- *airline-ctrlspace* +vim-ctrlspace + +* enable/disable vim-ctrlspace integration > + let g:airline#extensions#ctrlspace#enabled = 1 +< + To make the vim-ctrlspace integration work you will need to make the + ctrlspace statusline function call the correct airline function. Therefore + add the following line into your .vimrc: > + + let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" +< +------------------------------------- *airline-ycm* +YouCompleteMe + +Shows number of errors and warnings in the current file detected by YCM. + +* enable/disable YCM integration > + let g:airline#extensions#ycm#enabled = 1 + +* set error count prefix > + let g:airline#extensions#ycm#error_symbol = 'E:' + +* set warning count prefix > + let g:airline#extensions#ycm#warning_symbol = 'W:' +< +------------------------------------- *airline-po* +po.vim + +* enable/disable po integration > + let g:airline#extensions#po#enabled = 1 +< +* truncate width names to a fixed length > + let g:airline#extensions#po#displayed_limit = 0 +< +============================================================================== +ADVANCED CUSTOMIZATION *airline-advanced-customization* + +The defaults will accommodate 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"') +< + +Now add part "foo" to section section airline_section_y: > + let g:airline_section_y = airline#section#create_right(['ffenc','foo']) +< +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 +* `crypt` displays the crypted indicator +* `spell` displays the spell 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, none +< +The defaults configure the mode and line number parts to be bold, and the +readonly part to be red. + +"none" is special. This can be used, to remove a bold accent from an existing +theme. For example, usually the mode part of the statusline is usually defined +to be bold. However, it can be hard to remove an existing bold accent from the +default configuration. Therefore, you can use the none accent to remove +existing accents, so if you put > + call airline#parts#define_accent('mode', 'none') +the mode section will be set to non-bold font style. + +------------------------------------- *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 User AirlineAfterInit 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 absence 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 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. + +For other examples, you can visit the official themes repository at +. It also includes +examples such as |jellybeans.vim| which define colors by extracting highlight +groups from the underlying colorscheme. + +============================================================================== +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. + +Q. Themes are missing +A. Themes have been extracted into the vim-airlines-themes repository. Simply + clone https://github.com/vim-airline/vim-airline-themes and everything + should work again. + + +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-2016 Bailey Ling. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/pack/acp/start/vim-airline/plugin/airline.vim b/pack/acp/start/vim-airline/plugin/airline.vim new file mode 100644 index 0000000..3cbb998 --- /dev/null +++ b/pack/acp/start/vim-airline/plugin/airline.vim @@ -0,0 +1,150 @@ +" MIT License. Copyright (c) 2013-2016 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) + finish +endif +let g:loaded_airline = 1 + +let s:airline_initialized = 0 +function! s:init() + if s:airline_initialized + return + endif + let s:airline_initialized = 1 + + call airline#extensions#load() + call airline#init#sections() + + let s:theme_in_vimrc = exists('g:airline_theme') + if s:theme_in_vimrc + try + let palette = g:airline#themes#{g:airline_theme}#palette + catch + echom 'Could not resolve airline theme "' . g:airline_theme . '". Themes have been migrated to github.com/vim-airline/vim-airline-themes.' + let g:airline_theme = 'dark' + endtry + silent call airline#switch_theme(g:airline_theme) + else + let g:airline_theme = 'dark' + silent call s:on_colorscheme_changed() + endif + + silent doautocmd User AirlineAfterInit +endfunction + +function! s:on_window_changed() + if pumvisible() && (!&previewwindow || g:airline_exclude_preview) + return + endif + " Handle each window only once, since we might come here several times for + " different autocommands. + let l:key = [bufnr('%'), winnr(), winnr('$'), tabpagenr(), &ft] + if get(g:, 'airline_last_window_changed', []) == l:key + \ && &stl is# '%!airline#statusline('.winnr().')' + \ && &ft !~? 'gitcommit' + " fugitive is special, it changes names and filetypes several times, + " make sure the caching does not get into its way + return + endif + let g:airline_last_window_changed = l:key + call s:init() + call airline#update_statusline() +endfunction + +function! s:on_colorscheme_changed() + call s:init() + unlet! g:airline#highlighter#normal_fg_hi + let g:airline_gui_mode = airline#init#gui_mode() + if !s:theme_in_vimrc + call airline#switch_matching_theme() + 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 GUIEnter,ColorScheme * call on_colorscheme_changed() + autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload * + \ call on_window_changed() + if exists('#CompleteDone') + autocmd CompleteDone * call on_window_changed() + endif + + autocmd VimResized * unlet! w:airline_lastmode | :call airline_refresh() + autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1 + 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 + + if s:airline_initialized + call s:on_window_changed() + endif + + silent doautocmd User AirlineToggledOn + 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 + +function! s:airline_refresh() + if !exists("#airline") + " disabled + return + endif + let nomodeline='' + if v:version > 703 || v:version == 703 && has("patch438") + let nomodeline = '' + endif + exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline) + call airline#load_theme() + call airline#update_statusline() +endfunction + +command! -bar -nargs=? -complete=customlist,get_airline_themes AirlineTheme call airline_theme() +command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle() +command! -bar AirlineToggle call s:airline_toggle() +command! -bar AirlineRefresh call s:airline_refresh() + +call airline#init#bootstrap() +call s:airline_toggle() diff --git a/pack/acp/start/vim-airline/t/airline.vim b/pack/acp/start/vim-airline/t/airline.vim new file mode 100644 index 0000000..6e66aec --- /dev/null +++ b/pack/acp/start/vim-airline/t/airline.vim @@ -0,0 +1,87 @@ +let g:airline_theme = 'dark' + +source plugin/airline.vim +doautocmd VimEnter + +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/pack/acp/start/vim-airline/t/builder.vim b/pack/acp/start/vim-airline/t/builder.vim new file mode 100644 index 0000000..d3b0092 --- /dev/null +++ b/pack/acp/start/vim-airline/t/builder.vim @@ -0,0 +1,106 @@ +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('Search', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal#hello%#Normal_to_Search#%#Search#world' + end + + it 'should reuse highlight group if background colors match' + highlight Foo1 ctermfg=1 ctermbg=2 + highlight Foo2 ctermfg=1 ctermbg=2 + call s:builder.add_section('Foo1', 'hello') + call s:builder.add_section('Foo2', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Foo1#helloworld' + end + + it 'should switch highlight groups if foreground colors differ' + highlight Foo1 ctermfg=1 ctermbg=2 + highlight Foo2 ctermfg=2 ctermbg=2 + call s:builder.add_section('Foo1', 'hello') + call s:builder.add_section('Foo2', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#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('Search', 'world') + let stl = s:builder.build() + Expect stl =~ 'hello%#Normal_to_Search#%#Search#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#hellohello' + 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 + + it 'should blend colors from the left through the split to the right' + call s:builder.add_section('Normal', 'hello') + call s:builder.split() + call s:builder.add_section('Search', 'world') + let stl = s:builder.build() + Expect stl =~ 'Normal_to_Search' + 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('Search', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#%#Search_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/pack/acp/start/vim-airline/t/commands.vim b/pack/acp/start/vim-airline/t/commands.vim new file mode 100644 index 0000000..0f4bcb6 --- /dev/null +++ b/pack/acp/start/vim-airline/t/commands.vim @@ -0,0 +1,35 @@ +source plugin/airline.vim +doautocmd VimEnter + +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' + execute 'AirlineTheme doesnotexist' + Expect g:airline_theme == 'dark' + colors molokai + Expect g:airline_theme == 'molokai' + end + + it 'should have a refresh command' + Expect exists(':AirlineRefresh') to_be_true + end +end + diff --git a/pack/acp/start/vim-airline/t/extensions_default.vim b/pack/acp/start/vim-airline/t/extensions_default.vim new file mode 100644 index 0000000..e60d651 --- /dev/null +++ b/pack/acp/start/vim-airline/t/extensions_default.vim @@ -0,0 +1,31 @@ +let g:airline#extensions#default#layout = [ + \ [ 'c', 'a', 'b', 'warning' ], + \ [ 'x', 'z', 'y' ] + \ ] + +source plugin/airline.vim +doautocmd VimEnter + +describe 'default' + before + let s:builder = airline#builder#new({'active': 1}) + end + + it 'should use the layout' + 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/pack/acp/start/vim-airline/t/highlighter.vim b/pack/acp/start/vim-airline/t/highlighter.vim new file mode 100644 index 0000000..a1ed490 --- /dev/null +++ b/pack/acp/start/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/pack/acp/start/vim-airline/t/init.vim b/pack/acp/start/vim-airline/t/init.vim new file mode 100644 index 0000000..acb9f19 --- /dev/null +++ b/pack/acp/start/vim-airline/t/init.vim @@ -0,0 +1,78 @@ +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, spell, iminsert' + Expect g:airline_section_a =~ 'mode' + Expect g:airline_section_a =~ 'paste' + Expect g:airline_section_a =~ 'spell' + 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 =~ '%3v' + 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/pack/acp/start/vim-airline/t/parts.vim b/pack/acp/start/vim-airline/t/parts.vim new file mode 100644 index 0000000..ee7c92e --- /dev/null +++ b/pack/acp/start/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/pack/acp/start/vim-airline/t/section.vim b/pack/acp/start/vim-airline/t/section.vim new file mode 100644 index 0000000..d692f5d --- /dev/null +++ b/pack/acp/start/vim-airline/t/section.vim @@ -0,0 +1,81 @@ +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 + + it 'should not draw two separators after another' + let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}']) + Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}' + end +end + diff --git a/pack/acp/start/vim-airline/t/themes.vim b/pack/acp/start/vim-airline/t/themes.vim new file mode 100644 index 0000000..5a13993 --- /dev/null +++ b/pack/acp/start/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 == ['', '', 'NONE', 'NONE', 'bold,italic'] + + let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') + Expect hl == ['', '', 'NONE', 'NONE', '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/pack/acp/start/vim-airline/t/util.vim b/pack/acp/start/vim-airline/t/util.vim new file mode 100644 index 0000000..14c1d91 --- /dev/null +++ b/pack/acp/start/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/pack/acp/start/vim-pathogen/CONTRIBUTING.markdown b/pack/acp/start/vim-pathogen/CONTRIBUTING.markdown new file mode 100644 index 0000000..f5a62ca --- /dev/null +++ b/pack/acp/start/vim-pathogen/CONTRIBUTING.markdown @@ -0,0 +1,14 @@ +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 Vim script 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/pack/acp/start/vim-pathogen/README.markdown b/pack/acp/start/vim-pathogen/README.markdown new file mode 100644 index 0000000..ce1f77a --- /dev/null +++ b/pack/acp/start/vim-pathogen/README.markdown @@ -0,0 +1,141 @@ +# pathogen.vim + +Manage your `'runtimepath'` with ease. In practical terms, pathogen.vim +makes it super easy to install plugins and runtime files in their own +private directories. + +## Installation + +Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste: + + mkdir -p ~/.vim/autoload ~/.vim/bundle && \ + curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim + +If you're using Windows, change all occurrences of `~/.vim` to `~\vimfiles`. + +## Runtime Path Manipulation + +Add this to your vimrc: + + execute pathogen#infect() + +If you're brand new to Vim and lacking a vimrc, `vim ~/.vimrc` and paste +in the following super-minimal example: + + execute pathogen#infect() + syntax on + filetype plugin indent on + +Now any plugins you wish to install can be extracted to a subdirectory +under `~/.vim/bundle`, and they will be added to the `'runtimepath'`. +Observe: + + cd ~/.vim/bundle && \ + git clone https://github.com/tpope/vim-sensible.git + +Now [sensible.vim](https://github.com/tpope/vim-sensible) is installed. +If you really want to get crazy, you could set it up as a submodule in +whatever repository you keep your dot files in. I don't like to get +crazy. + +If you don't like the directory name `bundle`, you can pass a runtime relative +glob as an argument: + + execute pathogen#infect('stuff/{}') + +The `{}` indicates where the expansion should occur. + +You can also pass an absolute path instead. I keep the plugins I maintain under `~/src`, and this is how I add them: + + execute pathogen#infect('bundle/{}', '~/src/vim/bundle/{}') + +Normally to generate documentation, Vim expects you to run `:helptags` +on each directory with documentation (e.g., `:helptags ~/.vim/doc`). +Provided with pathogen.vim is a `:Helptags` command that does this on +every directory in your `'runtimepath'`. If you really want to get +crazy, you could even invoke `Helptags` in your vimrc. I don't like to +get crazy. + +Finally, pathogen.vim has a rich API that can manipulate `'runtimepath'` +and other comma-delimited path options in ways most people will never +need to do. If you're one of those edge cases, look at the source. +It's well documented. + +## Runtime File Editing + +`:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and +`:Vread` have all moved to [scriptease.vim][]. + +[scriptease.vim]: https://github.com/tpope/vim-scriptease + +## FAQ + +> Can I put pathogen.vim in a submodule like all my other plugins? + +Sure, stick it under `~/.vim/bundle`, and prepend the following to your +vimrc: + + runtime bundle/vim-pathogen/autoload/pathogen.vim + +Or if your bundles are somewhere other than `~/.vim` (say, `~/src/vim`): + + source ~/src/vim/bundle/vim-pathogen/autoload/pathogen.vim + +> Will you accept these 14 pull requests adding a `.gitignore` for +> `tags` so I don't see untracked changes in my dot files repository? + +No, but I'll teach you how to ignore `tags` globally: + + git config --global core.excludesfile '~/.cvsignore' + echo tags >> ~/.cvsignore + +While any filename will work, I've chosen to follow the ancient +tradition of `.cvsignore` because utilities like rsync use it, too. +Clever, huh? + +> What about Vimballs? + +If you really must use one: + + :e name.vba + :!mkdir ~/.vim/bundle/name + :UseVimball ~/.vim/bundle/name + +> Why don't my plugins load when I use Vim sessions? + +Vim sessions default to capturing all global options, which includes the +`'runtimepath'` that pathogen.vim manipulates. This can cause other problems +too, so I recommend turning that behavior off: + + set sessionoptions-=options + +## Contributing + +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 Vim script 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. + +## Self-Promotion + +Like pathogen.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-pathogen) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=2332). 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/pack/acp/start/vim-pathogen/autoload/pathogen.vim b/pack/acp/start/vim-pathogen/autoload/pathogen.vim new file mode 100644 index 0000000..dbe07f0 --- /dev/null +++ b/pack/acp/start/vim-pathogen/autoload/pathogen.vim @@ -0,0 +1,289 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.4 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/pack/acp/start/vim-ps1/.gitignore b/pack/acp/start/vim-ps1/.gitignore new file mode 100644 index 0000000..0a56e3f --- /dev/null +++ b/pack/acp/start/vim-ps1/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/pack/acp/start/vim-ps1/README.markdown b/pack/acp/start/vim-ps1/README.markdown new file mode 100644 index 0000000..bd641df --- /dev/null +++ b/pack/acp/start/vim-ps1/README.markdown @@ -0,0 +1,90 @@ +ps1.vim +======= + +If you are a Windows PowerShell user who uses Vim or Gvim for editing scripts, +then this plugin is for you. + +It provides nice syntax coloring and indenting for Windows PowerShell (.ps1) +files, and also includes a filetype plugin so Vim can autodetect your PS1 scripts. + +Includes contributions by: + +* Tomas Restrepo +* Jared Parsons +* Heath Stewart +* Michael B. Smith +* Alexander Kostikov + +Installation +------------ + +Copy the included directories into your .vim or vimfiles directory. + +Or even better, use [pathogen.vim][1] and simply pull it in like this: + + cd ~/.vim/bundle + git clone https://github.com/PProvost/vim-ps1.git + +Folding +------- + +The ps1 syntax file provides syntax folding for script blocks and digital +signatures in scripts. + +When 'foldmethod' is set to "syntax" then function script blocks will be +folded unless you use the following in your .vimrc or before opening a script: + + :let g:ps1_nofold_blocks = 1 + +Digital signatures in scripts will also be folded unless you use: + + :let g:ps1_nofold_sig = 1 + +Note: syntax folding might slow down syntax highlighting significantly, +especially for large files. + +Comments and Suggestions +------------------------ + +Please follow, fork or submit issues on [GitHub][2] and if you +find it useful, please vote for it on [vim.org][3]. + +License +------- + + Copyright 2005-2012 Peter Provost + + 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. + +Version History +--------------- + +* v2.10 (2013-06-24) Added Heath Stewart's here strings fix +* v2.9 (2012-03-08) Included tomasr's changes +* v2.81 (2012-03-05) Fixed a dumb typo +* v2.8 (2012-03-05) Better number scanning, multiline comments, missing keywords and constants +* v2.7 (2008-09-22) Begin, process & end keywords. Better highlighting of foreach and where +* v2.6 (2007-03-05) Added unary -not operator +* v2.5 (2007-03-03) Updates for here-strings, comment todos, other small cleanups +* v2.4 (2007-03-02) Added elseif keyword +* v2.3 (2007-02-27) Added param keyword +* v2.2 (2007-02-19) Missing keywords +* v2.1 (2006-07-31) Update for renaming +* v2.0 (2005-12-21) Big update from Jared Parsons +* v1.3 (2005-12-20) Updates to syntax elements +* v1.2 (2005-08-13) Fix foreach and while problem +* v1.1 (2005-08-12) Initial release + +[1]: https://github.com/tpope/vim-pathogen +[2]: https://github.com/PProvost/vim-ps1 +[3]: http://www.vim.org/scripts/script.php?script_id=1327 diff --git a/pack/acp/start/vim-ps1/doc/ps1.txt b/pack/acp/start/vim-ps1/doc/ps1.txt new file mode 100644 index 0000000..e865d98 --- /dev/null +++ b/pack/acp/start/vim-ps1/doc/ps1.txt @@ -0,0 +1,38 @@ +*ps1.txt* A Windows PowerShell syntax plugin for Vim + +Maintainer: Peter Provost +License: Apache 2.0 +Version: 2.10 + +INTRODUCTION *ps1-syntax* + +This plugin provides Vim syntax, indent and filetype detection for Windows +PowerShell scripts, modules, and XML configuration files. + + +ABOUT *ps1-about* + +Grab the latest version or report a bug on GitHub: + +http://github.com/PProvost/vim-ps1 + + +FOLDING *ps1-folding* + +The ps1 syntax file provides syntax folding (see |:syn-fold|) for script blocks +and digital signatures in scripts. + +When 'foldmethod' is set to "syntax" then function script blocks will be +folded unless you use the following in your .vimrc or before opening a script: > + + :let g:ps1_nofold_blocks = 1 +< +Digital signatures in scripts will also be folded unless you use: > + + :let g:ps1_nofold_sig = 1 +< +Note: syntax folding might slow down syntax highlighting significantly, +especially for large files. + +------------------------------------------------------------------------------ + vim:ft=help: diff --git a/pack/acp/start/vim-ps1/ftdetect/ps1.vim b/pack/acp/start/vim-ps1/ftdetect/ps1.vim new file mode 100644 index 0000000..efb7652 --- /dev/null +++ b/pack/acp/start/vim-ps1/ftdetect/ps1.vim @@ -0,0 +1,11 @@ +" Vim ftdetect plugin file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 +" +au BufNewFile,BufRead *.ps1 set ft=ps1 +au BufNewFile,BufRead *.psd1 set ft=ps1 +au BufNewFile,BufRead *.psm1 set ft=ps1 +au BufNewFile,BufRead *.pssc set ft=ps1 diff --git a/pack/acp/start/vim-ps1/ftdetect/ps1xml.vim b/pack/acp/start/vim-ps1/ftdetect/ps1xml.vim new file mode 100644 index 0000000..4f4bfe9 --- /dev/null +++ b/pack/acp/start/vim-ps1/ftdetect/ps1xml.vim @@ -0,0 +1,8 @@ +" Vim ftdetect plugin file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 + +au BufNewFile,BufRead *.ps1xml set ft=ps1xml diff --git a/pack/acp/start/vim-ps1/ftdetect/xml.vim b/pack/acp/start/vim-ps1/ftdetect/xml.vim new file mode 100644 index 0000000..2257d48 --- /dev/null +++ b/pack/acp/start/vim-ps1/ftdetect/xml.vim @@ -0,0 +1,9 @@ +" Vim ftdetect plugin file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 + +au BufNewFile,BufRead *.cdxml set ft=xml +au BufNewFile,BufRead *.psc1 set ft=xml diff --git a/pack/acp/start/vim-ps1/ftplugin/ps1.vim b/pack/acp/start/vim-ps1/ftplugin/ps1.vim new file mode 100644 index 0000000..58096a4 --- /dev/null +++ b/pack/acp/start/vim-ps1/ftplugin/ps1.vim @@ -0,0 +1,36 @@ +" Vim filetype plugin file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") | finish | endif + +" Don't load another plug-in for this buffer +let b:did_ftplugin = 1 + +setlocal tw=0 +setlocal commentstring=#%s +setlocal formatoptions=tcqro +" Enable autocompletion of hyphenated PowerShell commands, +" e.g. Get-Content or Get-ADUser +setlocal iskeyword+=- +" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8. +setlocal bomb + +" Change the browse dialog on Win32 to show mainly PowerShell-related files +if has("gui_win32") + let b:browsefilter = + \ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" . + \ "PowerShell Script Files (*.ps1)\t*.ps1\n" . + \ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" . + \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed +let b:undo_ftplugin = "setlocal tw< cms< fo<" . + \ " | unlet! b:browsefilter" + diff --git a/pack/acp/start/vim-ps1/ftplugin/ps1xml.vim b/pack/acp/start/vim-ps1/ftplugin/ps1xml.vim new file mode 100644 index 0000000..9352b9a --- /dev/null +++ b/pack/acp/start/vim-ps1/ftplugin/ps1xml.vim @@ -0,0 +1,33 @@ +" Vim filetype plugin file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") | finish | endif + +" Don't load another plug-in for this buffer +let b:did_ftplugin = 1 + +setlocal tw=0 +setlocal commentstring=#%s +setlocal formatoptions=tcqro +" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8. +setlocal bomb + +" Change the browse dialog on Win32 to show mainly PowerShell-related files +if has("gui_win32") + let b:browsefilter = + \ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" . + \ "PowerShell Script Files (*.ps1)\t*.ps1\n" . + \ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" . + \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed +let b:undo_ftplugin = "setlocal tw< cms< fo<" . + \ " | unlet! b:browsefilter" + diff --git a/pack/acp/start/vim-ps1/indent/ps1.vim b/pack/acp/start/vim-ps1/indent/ps1.vim new file mode 100644 index 0000000..8198a50 --- /dev/null +++ b/pack/acp/start/vim-ps1/indent/ps1.vim @@ -0,0 +1,20 @@ +" Vim indent file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327" + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" smartindent is good enough for powershell +setlocal smartindent +" disable the indent removal for # marks +inoremap # X# + +let b:undo_indent = "setl si<" + diff --git a/pack/acp/start/vim-ps1/syntax/ps1.vim b/pack/acp/start/vim-ps1/syntax/ps1.vim new file mode 100644 index 0000000..d034280 --- /dev/null +++ b/pack/acp/start/vim-ps1/syntax/ps1.vim @@ -0,0 +1,185 @@ +" Vim syntax file +" Language: Windows PowerShell +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327" +" +" The following settings are available for tuning syntax highlighting: +" let ps1_nofold_blocks = 1 +" let ps1_nofold_sig = 1 +" let ps1_nofold_region = 1 + +" Compatible VIM syntax file start +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Operators contain dashes +setlocal iskeyword+=- + +" PowerShell doesn't care about case +syn case ignore + +" Sync-ing method +syn sync minlines=100 + +" Certain tokens can't appear at the top level of the document +syn cluster ps1NotTop contains=@ps1Comment,ps1CDocParam,ps1FunctionDeclaration + +" Comments and special comment words +syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained +syn match ps1CDocParam /.*/ contained +syn match ps1CommentDoc /^\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained +syn match ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained +syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc,@Spell +syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc,@Spell + +" Language keywords and elements +syn keyword ps1Conditional if else elseif switch default +syn keyword ps1Repeat while for do until break continue foreach in +syn match ps1Repeat /\/ nextgroup=ps1Block skipwhite +syn match ps1Keyword /\/ nextgroup=ps1Block skipwhite +syn match ps1Keyword /\/ nextgroup=ps1Block skipwhite + +syn keyword ps1Exception begin process end exit inlinescript parallel sequence +syn keyword ps1Keyword try catch finally throw +syn keyword ps1Keyword return filter in trap param data dynamicparam +syn keyword ps1Constant $true $false $null +syn match ps1Constant +\$?+ +syn match ps1Constant +\$_+ +syn match ps1Constant +\$\$+ +syn match ps1Constant +\$^+ + +" Keywords reserved for future use +syn keyword ps1Keyword class define from using var + +" Function declarations +syn keyword ps1Keyword function nextgroup=ps1FunctionDeclaration skipwhite +syn keyword ps1Keyword filter nextgroup=ps1FunctionDeclaration skipwhite +syn keyword ps1Keyword workflow nextgroup=ps1FunctionDeclaration skipwhite +syn keyword ps1Keyword configuration nextgroup=ps1FunctionDeclaration skipwhite +syn keyword ps1Keyword class nextgroup=ps1FunctionDeclaration skipwhite +syn keyword ps1Keyword enum nextgroup=ps1FunctionDeclaration skipwhite +syn match ps1FunctionDeclaration /\w\+\(-\w\+\)*/ contained + +" Function invocations +syn match ps1FunctionInvocation /\w\+\(-\w\+\)\+/ + +" Type declarations +syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/ + +" Variable references +syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained +syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier +syn match ps1Variable /\${\w\+\(:\w\+\)\?}/ contains=ps1ScopeModifier + +" Operators +syn keyword ps1Operator -eq -ne -ge -gt -lt -le -like -notlike -match -notmatch -replace -split -contains -notcontains +syn keyword ps1Operator -ieq -ine -ige -igt -ile -ilt -ilike -inotlike -imatch -inotmatch -ireplace -isplit -icontains -inotcontains +syn keyword ps1Operator -ceq -cne -cge -cgt -clt -cle -clike -cnotlike -cmatch -cnotmatch -creplace -csplit -ccontains -cnotcontains +syn keyword ps1Operator -in -notin +syn keyword ps1Operator -is -isnot -as -join +syn keyword ps1Operator -and -or -not -xor -band -bor -bnot -bxor +syn keyword ps1Operator -f +syn match ps1Operator /!/ +syn match ps1Operator /=/ +syn match ps1Operator /+=/ +syn match ps1Operator /-=/ +syn match ps1Operator /\*=/ +syn match ps1Operator /\/=/ +syn match ps1Operator /%=/ +syn match ps1Operator /+/ +syn match ps1Operator /-\(\s\|\d\|\.\|\$\|(\)\@=/ +syn match ps1Operator /\*/ +syn match ps1Operator /\// +syn match ps1Operator /|/ +syn match ps1Operator /%/ +syn match ps1Operator /&/ +syn match ps1Operator /::/ +syn match ps1Operator /,/ +syn match ps1Operator /\(^\|\s\)\@<=\. \@=/ + +" Regular Strings +" These aren't precisely correct and could use some work +syn region ps1String start=/"/ skip=/`"/ end=/"/ contains=@ps1StringSpecial,@Spell +syn region ps1String start=/'/ skip=/''/ end=/'/ + +" Here-Strings +syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell +syn region ps1String start=/@'$/ end=/^'@/ + +" Interpolation +syn match ps1Escape /`./ +syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop +syn region ps1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=ps1Interpolation end=")" transparent contained +syn cluster ps1StringSpecial contains=ps1Escape,ps1Interpolation,ps1Variable,ps1Boolean,ps1Constant,ps1BuiltIn,@Spell + +" Numbers +syn match ps1Number "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@=" +syn match ps1Number "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\=" +syn match ps1Number "\<\d\+[eE][-+]\=\d\+[dD]\=\>" +syn match ps1Number "\<\d\+\([eE][-+]\=\d\+\)\=[dD]\>" + +" Constants +syn match ps1Boolean "$\%(true\|false\)\>" +syn match ps1Constant /\$null\>/ +syn match ps1BuiltIn "$^\|$?\|$_\|$\$" +syn match ps1BuiltIn "$\%(args\|error\|foreach\|home\|input\)\>" +syn match ps1BuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>" +syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>" + +" Folding blocks +if !exists('g:ps1_nofold_blocks') + syn region ps1Block start=/{/ end=/}/ transparent fold +endif + +if !exists('g:ps1_nofold_region') + syn region ps1Region start=/#region/ end=/#endregion/ transparent fold keepend extend +endif + +if !exists('g:ps1_nofold_sig') + syn region ps1Signature start=/# SIG # Begin signature block/ end=/# SIG # End signature block/ transparent fold +endif + +" Setup default color highlighting +if version >= 508 || !exists("did_ps1_syn_inits") + if version < 508 + let did_ps1_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink ps1Number Number + HiLink ps1Block Block + HiLink ps1Region Region + HiLink ps1Exception Exception + HiLink ps1Constant Constant + HiLink ps1String String + HiLink ps1Escape SpecialChar + HiLink ps1InterpolationDelimiter Delimiter + HiLink ps1Conditional Conditional + HiLink ps1FunctionDeclaration Function + HiLink ps1FunctionInvocation Function + HiLink ps1Variable Identifier + HiLink ps1Boolean Boolean + HiLink ps1Constant Constant + HiLink ps1BuiltIn StorageClass + HiLink ps1Type Type + HiLink ps1ScopeModifier StorageClass + HiLink ps1Comment Comment + HiLink ps1CommentTodo Todo + HiLink ps1CommentDoc Tag + HiLink ps1CDocParam Todo + HiLink ps1Operator Operator + HiLink ps1Repeat Repeat + HiLink ps1RepeatAndCmdlet Repeat + HiLink ps1Keyword Keyword + HiLink ps1KeywordAndCmdlet Keyword + delcommand HiLink +endif + +let b:current_syntax = "ps1" diff --git a/pack/acp/start/vim-ps1/syntax/ps1xml.vim b/pack/acp/start/vim-ps1/syntax/ps1xml.vim new file mode 100644 index 0000000..02407f5 --- /dev/null +++ b/pack/acp/start/vim-ps1/syntax/ps1xml.vim @@ -0,0 +1,56 @@ +" Vim syntax file +" Language: Windows PowerShell XML +" Maintainer: Peter Provost +" Version: 2.10 +" Project Repository: https://github.com/PProvost/vim-ps1 +" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327" + +" Compatible VIM syntax file start +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +let s:ps1xml_cpo_save = &cpo +set cpo&vim + +doau syntax xml +unlet b:current_syntax + +syn case ignore +syn include @ps1xmlScriptBlock :p:h/ps1.vim +unlet b:current_syntax + +syn region ps1xmlScriptBlock + \ matchgroup=xmlTag start="" + \ fold + \ contains=@ps1xmlScriptBlock + \ keepend +syn region ps1xmlScriptBlock + \ matchgroup=xmlTag start="" + \ matchgroup=xmlEndTag end="" + \ fold + \ contains=@ps1xmlScriptBlock + \ keepend +syn region ps1xmlScriptBlock + \ matchgroup=xmlTag start="" + \ matchgroup=xmlEndTag end="" + \ fold + \ contains=@ps1xmlScriptBlock + \ keepend +syn region ps1xmlScriptBlock + \ matchgroup=xmlTag start="" + \ matchgroup=xmlEndTag end="" + \ fold + \ contains=@ps1xmlScriptBlock + \ keepend + +syn cluster xmlRegionHook add=ps1xmlScriptBlock + +let b:current_syntax = "ps1xml" + +let &cpo = s:ps1xml_cpo_save +unlet s:ps1xml_cpo_save + diff --git a/pack/acp/start/vim-sensible/README.markdown b/pack/acp/start/vim-sensible/README.markdown new file mode 100644 index 0000000..8b4736d --- /dev/null +++ b/pack/acp/start/vim-sensible/README.markdown @@ -0,0 +1,95 @@ +# sensible.vim + +Think of sensible.vim as one step above `'nocompatible'` mode: a universal +set of defaults that (hopefully) everyone can agree on. + +* If you're new to Vim, you can install this as a starting point, rather than + copying some random vimrc you found. +* If you're pair programming and you can't agree on whose vimrc to use, this + can be your neutral territory. +* If you're administrating a server with an account that's not exclusively + yours, you can `scp` this up to make things a bit more tolerable. +* If you're troubleshooting a plugin and need to rule out interference from + your vimrc, having this installed will ensure you still have some basic + amenities. + +## 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-sensible.git + +## Features + +See the [source][] for the authoritative list of features. (Don't worry, it's +mostly `:set` calls.) Here's a taste: + +* `'backspace'`: Backspace through anything in insert mode. +* `'incsearch'`: Start searching before pressing enter. +* `'listchars'`: Makes `:set list` (visible whitespace) prettier. +* `'scrolloff'`: Always show at least one line above/below the cursor. +* `'autoread'`: Autoload file changes. You can undo by pressing `u`. +* `runtime! macros/matchit.vim`: Load the version of matchit.vim that ships + with Vim. + +[source]: https://github.com/tpope/vim-sensible/tree/master/plugin/sensible.vim + +## FAQ + +> How can I see what this plugin actually does? + +The [source][] is authoritative. Use `:help 'option'` to see the +documentation for an option. If you install [scriptease.vim][], you can press +`K` on an option (or command, or function) to jump to its documentation. + +[scriptease.vim]: https://github.com/tpope/vim-scriptease + +> How can I override a setting? + +Normally, sensible.vim loads after your vimrc, making it a bit tricky to +override (although you could use `after/plugin/sensible.vim`). If you want to +load it earlier, add the following line to you vimrc, then put your overrides +below. + + runtime! plugin/sensible.vim + +Feel free to [let me know][GitHub issues] which setting you object to, so I +can reassess whether it makes sense to include it. + +## Contributing + +I want this to be a plugin nobody objects to installing. [Let me +know][GitHub issues] if you have any objections to *anything*. There are a +handful of settings I figured *might* be controversial, but I included +anyways, just to settle the question once and for all. It won't take much +persuasion for me to remove them. Everything else is negotiable. + +Feel free to ask a question if you're not sure why I've set something, as I +haven't put much effort into documenting that. + +I'm a stickler for [commit messages][], so if you send me a pull request with +so much as a superfluous period in the subject line, I will close it without +so much as a second thought, and save my precious attention for someone who +can actually follow directions. + +[GitHub issues]: http://github.com/tpope/vim-sensible/issues +[commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html + +## Self-Promotion + +Like sensible.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-sensible) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=4391). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +This pairs great with [sleuth.vim](https://github.com/tpope/vim-sleuth). + +## License + +Copyright © Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/pack/acp/start/vim-sensible/plugin/sensible.vim b/pack/acp/start/vim-sensible/plugin/sensible.vim new file mode 100644 index 0000000..2fcbc86 --- /dev/null +++ b/pack/acp/start/vim-sensible/plugin/sensible.vim @@ -0,0 +1,93 @@ +" sensible.vim - Defaults everyone can agree on +" Maintainer: Tim Pope +" Version: 1.1 + +if exists('g:loaded_sensible') || &compatible + finish +else + let g:loaded_sensible = 1 +endif + +if has('autocmd') + filetype plugin indent on +endif +if has('syntax') && !exists('g:syntax_on') + syntax enable +endif + +" Use :help 'option' to see the documentation for the given option. + +set autoindent +set backspace=indent,eol,start +set complete-=i +set smarttab + +set nrformats-=octal + +set ttimeout +set ttimeoutlen=100 + +set incsearch +" Use to clear the highlighting of :set hlsearch. +if maparg('', 'n') ==# '' + nnoremap :nohlsearch=has('diff')?'diffupdate':'' +endif + +set laststatus=2 +set ruler +set wildmenu + +if !&scrolloff + set scrolloff=1 +endif +if !&sidescrolloff + set sidescrolloff=5 +endif +set display+=lastline + +if &encoding ==# 'latin1' && has('gui_running') + set encoding=utf-8 +endif + +if &listchars ==# 'eol:$' + set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ +endif + +if v:version > 703 || v:version == 703 && has("patch541") + set formatoptions+=j " Delete comment character when joining commented lines +endif + +if has('path_extra') + setglobal tags-=./tags tags-=./tags; tags^=./tags; +endif + +if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276')) + set shell=/bin/bash +endif + +set autoread + +if &history < 1000 + set history=1000 +endif +if &tabpagemax < 50 + set tabpagemax=50 +endif +if !empty(&viminfo) + set viminfo^=! +endif +set sessionoptions-=options + +" Allow color schemes to do bright colors without forcing bold. +if &t_Co == 8 && $TERM !~# '^linux\|^Eterm' + set t_Co=16 +endif + +" Load matchit.vim, but only if the user hasn't installed a newer version. +if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' + runtime! macros/matchit.vim +endif + +inoremap u + +" vim:set ft=vim et sw=2: diff --git a/pack/acp/start/vim-surround/.gitignore b/pack/acp/start/vim-surround/.gitignore new file mode 100644 index 0000000..0a56e3f --- /dev/null +++ b/pack/acp/start/vim-surround/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/pack/acp/start/vim-surround/README.markdown b/pack/acp/start/vim-surround/README.markdown new file mode 100644 index 0000000..fef61a8 --- /dev/null +++ b/pack/acp/start/vim-surround/README.markdown @@ -0,0 +1,97 @@ +surround.vim +============ + +Surround.vim is all about "surroundings": parentheses, brackets, quotes, +XML tags, and more. The plugin provides mappings to easily delete, +change and add such surroundings in pairs. + +It's easiest to explain with examples. Press `cs"'` inside + + "Hello world!" + +to change it to + + 'Hello world!' + +Now press `cs'` to change it to + + Hello world! + +To go full circle, press `cst"` to get + + "Hello world!" + +To remove the delimiters entirely, press `ds"`. + + Hello world! + +Now with the cursor on "Hello", press `ysiw]` (`iw` is a text object). + + [Hello] world! + +Let's make that braces and add some space (use `}` instead of `{` for no +space): `cs]{` + + { Hello } world! + +Now wrap the entire line in parentheses with `yssb` or `yss)`. + + ({ Hello } world!) + +Revert to the original text: `ds{ds)` + + Hello world! + +Emphasize hello: `ysiw` + + Hello world! + +Finally, let's try out visual mode. Press a capital V (for linewise +visual mode) followed by `S

`. + +

+ Hello world! +

+ +This plugin is very powerful for HTML and XML editing, a niche which +currently seems underfilled in Vim land. (As opposed to HTML/XML +*inserting*, for which many plugins are available). Adding, changing, +and removing pairs of tags simultaneously is a breeze. + +The `.` command will work with `ds`, `cs`, and `yss` if you install +[repeat.vim](https://github.com/tpope/vim-repeat). + +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-surround.git + +Once help tags have been generated, you can view the manual with +`:help surround`. + +Contributing +------------ + +See the contribution guidelines for +[pathogen.vim](https://github.com/tpope/vim-pathogen#readme). + +Self-Promotion +-------------- + +Like surround.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-surround) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=1697). 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/pack/acp/start/vim-surround/doc/surround.txt b/pack/acp/start/vim-surround/doc/surround.txt new file mode 100644 index 0000000..674b6a9 --- /dev/null +++ b/pack/acp/start/vim-surround/doc/surround.txt @@ -0,0 +1,207 @@ +*surround.txt* Plugin for deleting, changing, and adding "surroundings" + +Author: Tim Pope +License: Same terms as Vim itself (see |license|) + +This plugin is only available if 'compatible' is not set. + +INTRODUCTION *surround* + +This plugin is a tool for dealing with pairs of "surroundings." Examples +of surroundings include parentheses, quotes, and HTML tags. They are +closely related to what Vim refers to as |text-objects|. Provided +are mappings to allow for removing, changing, and adding surroundings. + +Details follow on the exact semantics, but first, consider the following +examples. An asterisk (*) is used to denote the cursor position. + + Old text Command New text ~ + "Hello *world!" ds" Hello world! + [123+4*56]/2 cs]) (123+456)/2 + "Look ma, I'm *HTML!" cs" Look ma, I'm HTML! + if *x>3 { ysW( if ( x>3 ) { + my $str = *whee!; vllllS' my $str = 'whee!'; + +While a few features of this plugin will work in older versions of Vim, +Vim 7 is recommended for full functionality. + +MAPPINGS *surround-mappings* + +Delete surroundings is *ds* . The next character given determines the target +to delete. The exact nature of the target is explained in |surround-targets| +but essentially it is the last character of a |text-object|. This mapping +deletes the difference between the "i"nner object and "a"n object. This is +easiest to understand with some examples: + + Old text Command New text ~ + "Hello *world!" ds" Hello world! + (123+4*56)/2 ds) 123+456/2 +
Yo!*
dst Yo! + +Change surroundings is *cs* . It takes two arguments, a target like with +|ds|, and a replacement. *cS* changes surroundings, placing the surrounded +text on its own line(s) like |yS|. Details about the second argument can be +found below in |surround-replacements|. Once again, examples are in order. + + Old text Command New text ~ + "Hello *world!" cs"' 'Hello world!' + "Hello *world!" cs" Hello world! + (123+4*56)/2 cs)] [123+456]/2 + (123+4*56)/2 cs)[ [ 123+456 ]/2 +
Yo!*
cst

Yo!

+ +*ys* takes a valid Vim motion or text object as the first object, and wraps +it using the second argument as with |cs|. (It's a stretch, but a good +mnemonic for "ys" is "you surround".) + + Old text Command New text ~ + Hello w*orld! ysiw) Hello (world)! + +As a special case, *yss* operates on the current line, ignoring leading +whitespace. + + Old text Command New text ~ + Hello w*orld! yssB {Hello world!} + +There is also *yS* and *ySS* which indent the surrounded text and place it +on a line of its own. + +In visual mode, a simple "S" with an argument wraps the selection. This is +referred to as the *vS* mapping, although ordinarily there will be +additional keystrokes between the v and S. In linewise visual mode, the +surroundings are placed on separate lines and indented. In blockwise visual +mode, each line is surrounded. + +A "gS" in visual mode, known as *vgS* , behaves similarly. In linewise visual +mode, the automatic indenting is suppressed. In blockwise visual mode, this +enables surrounding past the end of the line with 'virtualedit' set (there +seems to be no way in Vim Script to differentiate between a jagged end of line +selection and a virtual block selected past the end of the line, so two maps +were needed). + + *i_CTRL-G_s* *i_CTRL-G_S* +Finally, there is an experimental insert mode mapping on s and . +Beware that the latter won't work on terminals with flow control (if you +accidentally freeze your terminal, use to unfreeze it). The mapping +inserts the specified surroundings and puts the cursor between them. If, +immediately after the mapping and before the replacement, a second or +carriage return is pressed, the prefix, cursor, and suffix will be placed on +three separate lines. S (not s) also exhibits this behavior. + +TARGETS *surround-targets* + +The |ds| and |cs| commands both take a target as their first argument. The +possible targets are based closely on the |text-objects| provided by Vim. +All targets are currently just one character. + +Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves +and their counterparts. If the opening mark is used, contained whitespace is +also trimmed. The targets b, B, r, and a are aliases for ), }, ], and > +(the first two mirror Vim; the second two are completely arbitrary and +subject to change). + +Three quote marks, ', ", `, represent themselves, in pairs. They are only +searched for on the current line. + +A t is a pair of HTML or XML tags. See |tag-blocks| for details. Remember +that you can specify a numerical argument if you want to get to a tag other +than the innermost one. + +The letters w, W, and s correspond to a |word|, a |WORD|, and a |sentence|, +respectively. These are special in that they have nothing to delete, and +used with |ds| they are a no-op. With |cs|, one could consider them a +slight shortcut for ysi (cswb == ysiwb, more or less). + +A p represents a |paragraph|. This behaves similarly to w, W, and s above; +however, newlines are sometimes added and/or removed. + +REPLACEMENTS *surround-replacements* + +A replacement argument is a single character, and is required by |cs|, |ys|, +and |vS|. Undefined replacement characters (with the exception of alphabetic +characters) default to placing themselves at the beginning and end of the +destination, which can be useful for characters like / and |. + +If either ), }, ], or > is used, the text is wrapped in the appropriate pair +of characters. Similar behavior can be found with (, {, and [ (but not <), +which append an additional space to the inside. Like with the targets above, +b, B, r, and a are aliases for ), }, ], and >. To fulfill the common need for +code blocks in C-style languages, (which is really ) adds braces on +lines separate from the content. + +If t or < is used, Vim prompts for an HTML/XML tag to insert. You may specify +attributes here and they will be stripped from the closing tag. If replacing a +tag, its attributes are kept in the new tag. End your input with > to discard +the those attributes. If is used, the tags will appear on lines by +themselves. + +If s is used, a leading but not trailing space is added. This is useful for +removing parentheses from a function call with csbs. + +CUSTOMIZING *surround-customizing* + +The following adds a potential replacement on "-" (ASCII 45) in PHP files. +(To determine the ASCII code to use, :echo char2nr("-")). The carriage +return will be replaced by the original text. +> + autocmd FileType php let b:surround_45 = "" +< +This can be used in a PHP file as in the following example. + + Old text Command New text ~ + print "Hello *world!" yss- + +Additionally, one can use a global variable for globally available +replacements. +> + let g:surround_45 = "<% \r %>" + let g:surround_61 = "<%= \r %>" +< +Advanced, experimental, and subject to change: One can also prompt for +replacement text. The syntax for this is to surround the replacement in pairs +of low numbered control characters. If this sounds confusing, that's because +it is (but it makes the parsing easy). Consider the following example for a +LaTeX environment on the "l" replacement. +> + let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\1}" +< +When this replacement is used, the user is prompted with an "environment: " +prompt for input. This input is inserted between each set of \1's. +Additional inputs up to \7 can be used. + +Furthermore, one can specify a regular expression substitution to apply. +> + let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\r}.*\r\1}" +< +This will remove anything after the first } in the input when the text is +placed within the \end{} slot. The first \r marks where the pattern begins, +and the second where the replacement text begins. + +Here's a second example for creating an HTML
. The substitution cleverly +prompts for an id, but only adds id="" if it is non-blank. You may have to +read this one a few times slowly before you understand it. +> + let g:surround_{char2nr("d")} = "\r
" +< +Inputting text replacements is a proof of concept at this point. The ugly, +unintuitive interface and the brevity of the documentation reflect this. + +Finally, It is possible to always append a string to surroundings in insert +mode (and only insert mode). This is useful with certain plugins and mappings +that allow you to jump to such markings. +> + let g:surround_insert_tail = "<++>" +< +ISSUES *surround-issues* + +Vim could potentially get confused when deleting/changing occurs at the very +end of the line. Please report any repeatable instances of this. + +Do we need to use |inputsave()|/|inputrestore()| with the tag replacement? + +Indenting is handled haphazardly. Need to decide the most appropriate +behavior and implement it. Right now one can do :let b:surround_indent = 1 +(or the global equivalent) to enable automatic re-indenting by Vim via |=|; +should this be the default? + + vim:tw=78:ts=8:ft=help:norl: diff --git a/pack/acp/start/vim-surround/plugin/surround.vim b/pack/acp/start/vim-surround/plugin/surround.vim new file mode 100644 index 0000000..46f3252 --- /dev/null +++ b/pack/acp/start/vim-surround/plugin/surround.vim @@ -0,0 +1,598 @@ +" surround.vim - Surroundings +" Author: Tim Pope +" Version: 2.1 +" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim + +if exists("g:loaded_surround") || &cp || v:version < 700 + finish +endif +let g:loaded_surround = 1 + +" Input functions {{{1 + +function! s:getchar() + let c = getchar() + if c =~ '^\d\+$' + let c = nr2char(c) + endif + return c +endfunction + +function! s:inputtarget() + let c = s:getchar() + while c =~ '^\d\+$' + let c .= s:getchar() + endwhile + if c == " " + let c .= s:getchar() + endif + if c =~ "\\|\\|\0" + return "" + else + return c + endif +endfunction + +function! s:inputreplacement() + let c = s:getchar() + if c == " " + let c .= s:getchar() + endif + if c =~ "\" || c =~ "\" + return "" + else + return c + endif +endfunction + +function! s:beep() + exe "norm! \" + return "" +endfunction + +function! s:redraw() + redraw + return "" +endfunction + +" }}}1 + +" Wrapping functions {{{1 + +function! s:extractbefore(str) + if a:str =~ '\r' + return matchstr(a:str,'.*\ze\r') + else + return matchstr(a:str,'.*\ze\n') + endif +endfunction + +function! s:extractafter(str) + if a:str =~ '\r' + return matchstr(a:str,'\r\zs.*') + else + return matchstr(a:str,'\n\zs.*') + endif +endfunction + +function! s:fixindent(str,spc) + let str = substitute(a:str,'\t',repeat(' ',&sw),'g') + let spc = substitute(a:spc,'\t',repeat(' ',&sw),'g') + let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g') + if ! &et + let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g') + endif + return str +endfunction + +function! s:process(string) + let i = 0 + for i in range(7) + let repl_{i} = '' + let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) + if m != '' + let m = substitute(strpart(m,1),'\r.*','','') + let repl_{i} = input(match(m,'\w\+$') >= 0 ? m.': ' : m) + endif + endfor + let s = "" + let i = 0 + while i < strlen(a:string) + let char = strpart(a:string,i,1) + if char2nr(char) < 8 + let next = stridx(a:string,char,i+1) + if next == -1 + let s .= char + else + let insertion = repl_{char2nr(char)} + let subs = strpart(a:string,i+1,next-i-1) + let subs = matchstr(subs,'\r.*') + while subs =~ '^\r.*\r' + let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*") + let subs = strpart(subs,strlen(sub)+1) + let r = stridx(sub,"\r") + let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'') + endwhile + let s .= insertion + let i = next + endif + else + let s .= char + endif + let i += 1 + endwhile + return s +endfunction + +function! s:wrap(string,char,type,removed,special) + let keeper = a:string + let newchar = a:char + let s:input = "" + let type = a:type + let linemode = type ==# 'V' ? 1 : 0 + let before = "" + let after = "" + if type ==# "V" + let initspaces = matchstr(keeper,'\%^\s*') + else + let initspaces = matchstr(getline('.'),'\%^\s*') + endif + let pairs = "b()B{}r[]a<>" + let extraspace = "" + if newchar =~ '^ ' + let newchar = strpart(newchar,1) + let extraspace = ' ' + endif + let idx = stridx(pairs,newchar) + if newchar == ' ' + let before = '' + let after = '' + elseif exists("b:surround_".char2nr(newchar)) + let all = s:process(b:surround_{char2nr(newchar)}) + let before = s:extractbefore(all) + let after = s:extractafter(all) + elseif exists("g:surround_".char2nr(newchar)) + let all = s:process(g:surround_{char2nr(newchar)}) + let before = s:extractbefore(all) + let after = s:extractafter(all) + elseif newchar ==# "p" + let before = "\n" + let after = "\n\n" + elseif newchar ==# 's' + let before = ' ' + let after = '' + elseif newchar ==# ':' + let before = ':' + let after = '' + elseif newchar =~# "[tT\<]" + let dounmapp = 0 + let dounmapb = 0 + if !maparg(">","c") + let dounmapb = 1 + " Hide from AsNeeded + exe "cn"."oremap > >" + endif + let default = "" + if newchar ==# "T" + if !exists("s:lastdel") + let s:lastdel = "" + endif + let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') + endif + let tag = input("<",default) + if dounmapb + silent! cunmap > + endif + let s:input = tag + if tag != "" + let keepAttributes = ( match(tag, ">$") == -1 ) + let tag = substitute(tag,'>*$','','') + let attributes = "" + if keepAttributes + let attributes = matchstr(a:removed, '<[^ \t\n]\+\zs\_.\{-\}\ze>') + endif + let s:input = tag . '>' + if tag =~ '/$' + let tag = substitute(tag, '/$', '', '') + let before = '<'.tag.attributes.' />' + let after = '' + else + let before = '<'.tag.attributes.'>' + let after = '' + endif + if newchar == "\" + if type ==# "v" || type ==# "V" + let before .= "\n\t" + endif + if type ==# "v" + let after = "\n". after + endif + endif + endif + elseif newchar ==# 'l' || newchar == '\' + " LaTeX + let env = input('\begin{') + if env != "" + let s:input = env."\" + let env = '{' . env + let env .= s:closematch(env) + echo '\begin'.env + let before = '\begin'.env + let after = '\end'.matchstr(env,'[^}]*').'}' + endif + elseif newchar ==# 'f' || newchar ==# 'F' + let fnc = input('function: ') + if fnc != "" + let s:input = fnc."\" + let before = substitute(fnc,'($','','').'(' + let after = ')' + if newchar ==# 'F' + let before .= ' ' + let after = ' ' . after + endif + endif + elseif newchar ==# "\" + let fnc = input('function: ') + let s:input = fnc."\" + let before = '('.fnc.' ' + let after = ')' + elseif idx >= 0 + let spc = (idx % 3) == 1 ? " " : "" + let idx = idx / 3 * 3 + let before = strpart(pairs,idx+1,1) . spc + let after = spc . strpart(pairs,idx+2,1) + elseif newchar == "\" || newchar == "\" + let before = "{\n\t" + let after = "\n}" + elseif newchar !~ '\a' + let before = newchar + let after = newchar + else + let before = '' + let after = '' + endif + let after = substitute(after ,'\n','\n'.initspaces,'g') + if type ==# 'V' || (a:special && type ==# "v") + let before = substitute(before,' \+$','','') + let after = substitute(after ,'^ \+','','') + if after !~ '^\n' + let after = initspaces.after + endif + if keeper !~ '\n$' && after !~ '^\n' + let keeper .= "\n" + elseif keeper =~ '\n$' && after =~ '^\n' + let after = strpart(after,1) + endif + if before !~ '\n\s*$' + let before .= "\n" + if a:special + let before .= "\t" + endif + endif + endif + if type ==# 'V' + let before = initspaces.before + endif + if before =~ '\n\s*\%$' + if type ==# 'v' + let keeper = initspaces.keeper + endif + let padding = matchstr(before,'\n\zs\s\+\%$') + let before = substitute(before,'\n\s\+\%$','\n','') + let keeper = s:fixindent(keeper,padding) + endif + if type ==# 'V' + let keeper = before.keeper.after + elseif type =~ "^\" + " Really we should be iterating over the buffer + let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g') + let repl = substitute(repl,'\n',' ','g') + let keeper = substitute(keeper."\n",'\(.\{-\}\)\(\n\)',repl.'\n','g') + let keeper = substitute(keeper,'\n\%$','','') + else + let keeper = before.extraspace.keeper.extraspace.after + endif + return keeper +endfunction + +function! s:wrapreg(reg,char,removed,special) + let orig = getreg(a:reg) + let type = substitute(getregtype(a:reg),'\d\+$','','') + let new = s:wrap(orig,a:char,type,a:removed,a:special) + call setreg(a:reg,new,type) +endfunction +" }}}1 + +function! s:insert(...) " {{{1 + " Optional argument causes the result to appear on 3 lines, not 1 + let linemode = a:0 ? a:1 : 0 + let char = s:inputreplacement() + while char == "\" || char == "\" + " TODO: use total count for additional blank lines + let linemode += 1 + let char = s:inputreplacement() + endwhile + if char == "" + return "" + endif + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let reg_save = @@ + call setreg('"',"\r",'v') + call s:wrapreg('"',char,"",linemode) + " If line mode is used and the surrounding consists solely of a suffix, + " remove the initial newline. This fits a use case of mine but is a + " little inconsistent. Is there anyone that would prefer the simpler + " behavior of just inserting the newline? + if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0 + call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"')) + endif + " This can be used to append a placeholder to the end + if exists("g:surround_insert_tail") + call setreg('"',g:surround_insert_tail,"a".getregtype('"')) + endif + if col('.') >= col('$') + norm! ""p + else + norm! ""P + endif + if linemode + call s:reindent() + endif + norm! `] + call search('\r','bW') + let @@ = reg_save + let &clipboard = cb_save + return "\" +endfunction " }}}1 + +function! s:reindent() " {{{1 + if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) + silent norm! '[='] + endif +endfunction " }}}1 + +function! s:dosurround(...) " {{{1 + let scount = v:count1 + let char = (a:0 ? a:1 : s:inputtarget()) + let spc = "" + if char =~ '^\d\+' + let scount = scount * matchstr(char,'^\d\+') + let char = substitute(char,'^\d\+','','') + endif + if char =~ '^ ' + let char = strpart(char,1) + let spc = 1 + endif + if char == 'a' + let char = '>' + endif + if char == 'r' + let char = ']' + endif + let newchar = "" + if a:0 > 1 + let newchar = a:2 + if newchar == "\" || newchar == "\" || newchar == "" + return s:beep() + endif + endif + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let append = "" + let original = getreg('"') + let otype = getregtype('"') + call setreg('"',"") + let strcount = (scount == 1 ? "" : scount) + if char == '/' + exe 'norm! '.strcount.'[/d'.strcount.']/' + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>"''`]' + exe 'norm! T'.char + if getline('.')[col('.')-1] == char + exe 'norm! l' + endif + exe 'norm! dt'.char + else + exe 'norm! d'.strcount.'i'.char + endif + let keeper = getreg('"') + let okeeper = keeper " for reindent below + if keeper == "" + call setreg('"',original,otype) + let &clipboard = cb_save + return "" + endif + let oldline = getline('.') + let oldlnum = line('.') + if char ==# "p" + call setreg('"','','V') + elseif char ==# "s" || char ==# "w" || char ==# "W" + " Do nothing + call setreg('"','') + elseif char =~ "[\"'`]" + exe "norm! i \d2i".char + call setreg('"',substitute(getreg('"'),' ','','')) + elseif char == '/' + norm! "_x + call setreg('"','/**/',"c") + let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>]' + exe 'norm! F'.char + exe 'norm! df'.char + else + " One character backwards + call search('\m.', 'bW') + exe "norm! da".char + endif + let removed = getreg('"') + let rem2 = substitute(removed,'\n.*','','') + let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2)) + let oldtail = strpart(oldline, strlen(oldline)-strlen(rem2)) + let regtype = getregtype('"') + if char =~# '[\[({ 2 ? a:3 : 0 + call s:wrapreg('"',newchar,removed,special) + endif + silent exe 'norm! ""'.pcmd.'`[' + if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' + call s:reindent() + endif + if getline('.') =~ '^\s\+$' && keeper =~ '^\s*\n' + silent norm! cc + endif + call setreg('"',original,otype) + let s:lastdel = removed + let &clipboard = cb_save + if newchar == "" + silent! call repeat#set("\Dsurround".char,scount) + else + silent! call repeat#set("\C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount) + endif +endfunction " }}}1 + +function! s:changesurround(...) " {{{1 + let a = s:inputtarget() + if a == "" + return s:beep() + endif + let b = s:inputreplacement() + if b == "" + return s:beep() + endif + call s:dosurround(a,b,a:0 && a:1) +endfunction " }}}1 + +function! s:opfunc(type,...) " {{{1 + let char = s:inputreplacement() + if char == "" + return s:beep() + endif + let reg = '"' + let sel_save = &selection + let &selection = "inclusive" + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let reg_save = getreg(reg) + let reg_type = getregtype(reg) + let type = a:type + if a:type == "char" + silent exe 'norm! v`[o`]"'.reg.'y' + let type = 'v' + elseif a:type == "line" + silent exe 'norm! `[V`]"'.reg.'y' + let type = 'V' + elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\" + let &selection = sel_save + let ve = &virtualedit + if !(a:0 && a:1) + set virtualedit= + endif + silent exe 'norm! gv"'.reg.'y' + let &virtualedit = ve + elseif a:type =~ '^\d\+$' + let type = 'v' + silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' + if mode() ==# 'v' + norm! v + return s:beep() + endif + else + let &selection = sel_save + let &clipboard = cb_save + return s:beep() + endif + let keeper = getreg(reg) + if type ==# "v" && a:type !=# "v" + let append = matchstr(keeper,'\_s\@Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:input,a:type) + else + silent! call repeat#set("\SurroundRepeat".char.s:input) + endif +endfunction + +function! s:opfunc2(arg) + call s:opfunc(a:arg,1) +endfunction " }}}1 + +function! s:closematch(str) " {{{1 + " Close an open (, {, [, or < on the command line. + let tail = matchstr(a:str,'.[^\[\](){}<>]*$') + if tail =~ '^\[.\+' + return "]" + elseif tail =~ '^(.\+' + return ")" + elseif tail =~ '^{.\+' + return "}" + elseif tail =~ '^<.+' + return ">" + else + return "" + endif +endfunction " }}}1 + +nnoremap SurroundRepeat . +nnoremap Dsurround :call dosurround(inputtarget()) +nnoremap Csurround :call changesurround() +nnoremap CSurround :call changesurround(1) +nnoremap Yssurround :call opfunc(v:count1) +nnoremap YSsurround :call opfunc2(v:count1) +" discards the numerical argument but there's not much we can do with it +nnoremap Ysurround :set opfunc=opfuncg@ +nnoremap YSurround :set opfunc=opfunc2g@ +vnoremap VSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0) +vnoremap VgSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1) +inoremap Isurround =insert() +inoremap ISurround =insert(1) + +if !exists("g:surround_no_mappings") || ! g:surround_no_mappings + nmap ds Dsurround + nmap cs Csurround + nmap cS CSurround + nmap ys Ysurround + nmap yS YSurround + nmap yss Yssurround + nmap ySs YSsurround + nmap ySS YSsurround + xmap S VSurround + xmap gS VgSurround + if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings + if !hasmapto("Isurround","i") && "" == mapcheck("","i") + imap Isurround + endif + imap s Isurround + imap S ISurround + endif +endif + +" vim:set ft=vim sw=2 sts=2 et: diff --git a/vimrc b/vimrc index ee31164..998c05d 100644 --- a/vimrc +++ b/vimrc @@ -1,5 +1,7 @@ -silent! runtime bundle/vim-pathogen/autoload/pathogen.vim -silent! execute pathogen#infect() +if version < 800 + silent! runtime pack/acp/start/vim-pathogen/autoload/pathogen.vim + silent! execute pathogen#infect('pack/acp/start/{}') +endif autocmd BufRead,BufNewFile *.md set filetype=markdown command Q q