From 2b4197a0062d53a0aa198930318f5757d6bd3278 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 28 Oct 2020 13:44:54 +0000 Subject: [PATCH] Update plugins to latest versions --- pack/acp/start/goyo.vim/autoload/goyo.vim | 4 +- pack/acp/start/goyo.vim/doc/goyo.txt | 2 - pack/acp/start/goyo.vim/doc/tags | 17 -- .../limelight.vim/autoload/limelight.vim | 8 +- .../start/limelight.vim/plugin/limelight.vim | 2 +- .../start/limelight.vim/test/limelight.vader | 5 +- pack/acp/start/papercolor-theme/README.md | 16 +- .../papercolor-theme/colors/PaperColor.vim | 10 +- pack/acp/start/vim-ps1/.gitignore | 1 + pack/acp/start/vim-ps1/README.markdown | 38 +++- .../acp/start/vim-ps1/compiler/powershell.vim | 83 ++++++++ pack/acp/start/vim-ps1/doc/ps1.txt | 62 +++++- pack/acp/start/vim-ps1/doc/tags | 3 - pack/acp/start/vim-ps1/ftdetect/ps1.vim | 16 +- 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 | 46 ++++- pack/acp/start/vim-ps1/ftplugin/ps1xml.vim | 31 +++ pack/acp/start/vim-ps1/indent/ps1.vim | 19 +- pack/acp/start/vim-ps1/syntax/ps1.vim | 185 +++++++++++------- pack/acp/start/vim-ps1/syntax/ps1xml.vim | 56 ++++++ .../start/vim-speeddating/.github/FUNDING.yml | 2 + .../acp/start/vim-speeddating/README.markdown | 14 +- .../vim-speeddating/autoload/speeddating.vim | 6 +- .../vim-speeddating/plugin/speeddating.vim | 15 +- .../start/vim-surround/.github/FUNDING.yml | 2 + pack/acp/start/vim-surround/README.markdown | 40 ++-- pack/acp/start/vim-surround/doc/surround.txt | 17 +- .../start/vim-surround/plugin/surround.vim | 90 ++++++--- 29 files changed, 595 insertions(+), 212 deletions(-) delete mode 100644 pack/acp/start/goyo.vim/doc/tags create mode 100644 pack/acp/start/vim-ps1/.gitignore create mode 100644 pack/acp/start/vim-ps1/compiler/powershell.vim delete mode 100644 pack/acp/start/vim-ps1/doc/tags 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/ps1xml.vim create mode 100644 pack/acp/start/vim-ps1/syntax/ps1xml.vim create mode 100644 pack/acp/start/vim-speeddating/.github/FUNDING.yml create mode 100644 pack/acp/start/vim-surround/.github/FUNDING.yml diff --git a/pack/acp/start/goyo.vim/autoload/goyo.vim b/pack/acp/start/goyo.vim/autoload/goyo.vim index 94216d1..0593f78 100644 --- a/pack/acp/start/goyo.vim/autoload/goyo.vim +++ b/pack/acp/start/goyo.vim/autoload/goyo.vim @@ -203,7 +203,7 @@ function! s:goyo_on(dim) endif " vim-signify - let t:goyo_disabled_signify = exists('b:sy') && b:sy.active + let t:goyo_disabled_signify = !empty(getbufvar(bufnr(''), 'sy')) if t:goyo_disabled_signify SignifyToggle endif @@ -260,7 +260,7 @@ function! s:goyo_on(dim) augroup goyo autocmd! - autocmd TabLeave * call s:goyo_off() + autocmd TabLeave * nested call s:goyo_off() autocmd VimResized * call s:resize_pads() autocmd ColorScheme * call s:tranquilize() autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline() diff --git a/pack/acp/start/goyo.vim/doc/goyo.txt b/pack/acp/start/goyo.vim/doc/goyo.txt index b805022..0dc57b2 100644 --- a/pack/acp/start/goyo.vim/doc/goyo.txt +++ b/pack/acp/start/goyo.vim/doc/goyo.txt @@ -32,8 +32,6 @@ INSTALLATION *goyo-installation* Use your favorite plugin manager. - *:PlugInstall* - - {vim-plug}{3} 1. Add `Plug 'junegunn/goyo.vim'` to .vimrc 2. Run `:PlugInstall` diff --git a/pack/acp/start/goyo.vim/doc/tags b/pack/acp/start/goyo.vim/doc/tags deleted file mode 100644 index 79069f0..0000000 --- a/pack/acp/start/goyo.vim/doc/tags +++ /dev/null @@ -1,17 +0,0 @@ -:Goyo goyo.txt /*:Goyo* -:PlugInstall goyo.txt /*:PlugInstall* -g:goyo_height goyo.txt /*g:goyo_height* -g:goyo_linenr goyo.txt /*g:goyo_linenr* -g:goyo_width goyo.txt /*g:goyo_width* -goyo goyo.txt /*goyo* -goyo-callbacks goyo.txt /*goyo-callbacks* -goyo-configuration goyo.txt /*goyo-configuration* -goyo-dimension-expression goyo.txt /*goyo-dimension-expression* -goyo-inspiration goyo.txt /*goyo-inspiration* -goyo-installation goyo.txt /*goyo-installation* -goyo-license goyo.txt /*goyo-license* -goyo-pros goyo.txt /*goyo-pros* -goyo-toc goyo.txt /*goyo-toc* -goyo-usage goyo.txt /*goyo-usage* -goyo-vim goyo.txt /*goyo-vim* -goyo.txt goyo.txt /*goyo.txt* diff --git a/pack/acp/start/limelight.vim/autoload/limelight.vim b/pack/acp/start/limelight.vim/autoload/limelight.vim index f740f2d..0a4cd86 100644 --- a/pack/acp/start/limelight.vim/autoload/limelight.vim +++ b/pack/acp/start/limelight.vim/autoload/limelight.vim @@ -46,7 +46,7 @@ function! s:getpos() let bop = get(g:, 'limelight_bop', '^\s*$\n\zs') let eop = get(g:, 'limelight_eop', '^\s*$') let span = max([0, get(g:, 'limelight_paragraph_span', 0) - s:empty(getline('.'))]) - let pos = getpos('.') + let pos = exists('*getcurpos')? getcurpos() : getpos('.') for i in range(0, span) let start = searchpos(bop, i == 0 ? 'cbW' : 'bW')[0] endfor @@ -254,8 +254,8 @@ function! s:cleanup() end endfunction -function! limelight#execute(bang, visual, ...) range - let range = a:visual ? [a:firstline, a:lastline] : [] +function! limelight#execute(bang, visual, line1, line2, ...) + let range = a:visual ? [a:line1, a:line2] : [] if a:bang if a:0 > 0 && a:1 =~ '^!' && !s:is_on() if len(a:1) > 1 @@ -274,7 +274,7 @@ function! limelight#execute(bang, visual, ...) range endfunction function! limelight#operator(...) - '[,']call limelight#execute(0, 1) + call limelight#execute(0, 1, line("'["), line("']")) endfunction let &cpo = s:cpo_save diff --git a/pack/acp/start/limelight.vim/plugin/limelight.vim b/pack/acp/start/limelight.vim/plugin/limelight.vim index 427e54e..9b9140f 100644 --- a/pack/acp/start/limelight.vim/plugin/limelight.vim +++ b/pack/acp/start/limelight.vim/plugin/limelight.vim @@ -21,7 +21,7 @@ " OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION " WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -command! -nargs=? -bar -bang -range Limelight ,call limelight#execute(0, > 0, ) +command! -nargs=? -bar -bang -range Limelight call limelight#execute(0, > 0, , , ) nnoremap (Limelight) :set opfunc=limelight#operatorg@ xnoremap (Limelight) :Limelight diff --git a/pack/acp/start/limelight.vim/test/limelight.vader b/pack/acp/start/limelight.vim/test/limelight.vader index b3b7519..866d580 100644 --- a/pack/acp/start/limelight.vim/test/limelight.vader +++ b/pack/acp/start/limelight.vim/test/limelight.vader @@ -98,6 +98,9 @@ Execute (Unsupported. but g:limelight_conceal_???fg defined): Limelight! AssertOff else + if exists('&termguicolors') + set notermguicolors + endif colo default let &t_Co = 256 @@ -133,4 +136,4 @@ Execute (Cleanup): delc AssertOff unlet! msg Restore - execute 'colo '.g:colors_name + silent! execute 'colo '.g:colors_name diff --git a/pack/acp/start/papercolor-theme/README.md b/pack/acp/start/papercolor-theme/README.md index 41b587e..1b58984 100644 --- a/pack/acp/start/papercolor-theme/README.md +++ b/pack/acp/start/papercolor-theme/README.md @@ -187,7 +187,7 @@ There are syntax highlighting enhancement plugins that improve upon Vim built-in * Assembly MIPS: [mips](https://github.com/vim-scripts/mips.vim) * Assembly GAS: [vim-gas](https://github.com/Shirk/vim-gas) * Octave/MATLAB: [vim-octave](https://github.com/jvirtanen/vim-octave) -* Python: [python-syntax](https://github.com/hdima/python-syntax/) +* Python: [python-syntax](https://github.com/vim-python/python-syntax/) * Dockerfile: [dockerfile.vim](https://github.com/docker/docker/tree/master/contrib/syntax/vim) * NGINX: [nginx-vim-syntax](https://github.com/evanmiller/nginx-vim-syntax) * Elixir: [vim-elixir](https://github.com/elixir-lang/vim-elixir) @@ -233,11 +233,17 @@ There are syntax highlighting enhancement plugins that improve upon Vim built-in To set [vim-airline](https://github.com/bling/vim-airline) theme: - let g:airline_theme='papercolor' +```VimL +let g:airline_theme='papercolor' +``` + +Note: to be able to use this theme, it is also necessary to install [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) To set [lightline](https://github.com/itchyny/lightline.vim) theme: - let g:lightline = { 'colorscheme': 'PaperColor' } +```VimL +let g:lightline = { 'colorscheme': 'PaperColor' } +``` For more sceenshots, story behind the project, and other users' designs inspired by Paper Color, go to [this blog post](http://nlknguyen.com/2015/05/21/vim-paper-color-theme/) @@ -256,6 +262,8 @@ Suggestions/Wishes/Questions/Comments are welcome via [Github issues](https://gi [PaperColor Light for konsole](https://raw.githubusercontent.com/z2oh/dotfiles/82bf6835948674f0ed1f98a14b82975ff2dd8f3e/konsole/paperrlight.colorscheme) by [z2oh](https://github.com/z2oh) +[PaperColor Light for konsole](https://github.com/MaxG87/konsole-papercolor) (some palette collisions resolved) by [MaxG87](https://github.com/MaxG87) + [PaperColor Theme for Vis Editor](https://github.com/jceb/dotfiles/blob/master/config/vis/lexers/themes/papercolor.lua) by Jan Christoph Ebersbach [Airline PaperColor Theme for Emacs Powerline](https://github.com/AnthonyDiGirolamo/airline-themes) by Anthony DiGirolamo @@ -272,4 +280,6 @@ Suggestions/Wishes/Questions/Comments are welcome via [Github issues](https://gi [PaperColor Light theme for cmus](https://github.com/eremit/papercolor-light-cmus) by [eremit](https://github.com/eremit) +[PaperColor Light theme for Alacritty](https://github.com/eendroroy/alacritty-theme/blob/master/themes/papercolor_light.yaml) + Feel free to add related projects here! diff --git a/pack/acp/start/papercolor-theme/colors/PaperColor.vim b/pack/acp/start/papercolor-theme/colors/PaperColor.vim index e03886b..0d52afe 100755 --- a/pack/acp/start/papercolor-theme/colors/PaperColor.vim +++ b/pack/acp/start/papercolor-theme/colors/PaperColor.vim @@ -1565,7 +1565,6 @@ fun! s:apply_syntax_highlightings() exec 'hi pythonStrFormatting' . s:fg_olive . s:ft_bold exec 'hi pythonBoolean' . s:fg_green . s:ft_bold - exec 'hi pythonExClass' . s:fg_red exec 'hi pythonBytesEscape' . s:fg_olive . s:ft_bold exec 'hi pythonDottedName' . s:fg_purple exec 'hi pythonStrFormat' . s:fg_foreground @@ -1610,7 +1609,16 @@ fun! s:apply_syntax_highlightings() exec 'hi javaScriptMessage' . s:fg_foreground exec 'hi javaScriptMember' . s:fg_foreground + " TypeScript Highlighting + exec 'hi typescriptDecorators' . s:fg_orange + exec 'hi typescriptLabel' . s:fg_purple . s:ft_bold + " @target https://github.com/pangloss/vim-javascript + exec 'hi jsImport' . s:fg_pink . s:ft_bold + exec 'hi jsExport' . s:fg_pink . s:ft_bold + exec 'hi jsModuleAs' . s:fg_pink . s:ft_bold + exec 'hi jsFrom' . s:fg_pink . s:ft_bold + exec 'hi jsExportDefault' . s:fg_pink . s:ft_bold exec 'hi jsFuncParens' . s:fg_blue exec 'hi jsFuncBraces' . s:fg_blue exec 'hi jsParens' . s:fg_blue 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 index 0684352..2b6284c 100644 --- a/pack/acp/start/vim-ps1/README.markdown +++ b/pack/acp/start/vim-ps1/README.markdown @@ -9,8 +9,9 @@ files, and also includes a filetype plugin so Vim can autodetect your PS1 script Includes contributions by: -* Jared Parsons -* Heath Stewart +* Tomas Restrepo +* Jared Parsons +* Heath Stewart * Michael B. Smith * Alexander Kostikov @@ -19,17 +20,38 @@ Installation Copy the included directories into your .vim or vimfiles directory. -Or even better, use pathogen and simply pull it in like this: +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 + +If you use [vim-plug][4] add this to your config: + Plug 'pprovost/vim-ps1' + +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](https://github.com/PProvost/vim-ps1) and if you -find it useful, please vote for it on [vim.org](http://www.vim.org/scripts/script.php?script_id=1327). +Please follow, fork or submit issues on [GitHub][2] and if you +find it useful, please vote for it on [vim.org][3]. License ------- @@ -51,6 +73,7 @@ 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 @@ -65,3 +88,8 @@ Version History * 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 +[4]: https://github.com/junegunn/vim-plug diff --git a/pack/acp/start/vim-ps1/compiler/powershell.vim b/pack/acp/start/vim-ps1/compiler/powershell.vim new file mode 100644 index 0000000..3547659 --- /dev/null +++ b/pack/acp/start/vim-ps1/compiler/powershell.vim @@ -0,0 +1,83 @@ +" Compiler: powershell +" Run ps1 scripts in powershell and process their output. Quickly jump through +" stack traces and see script output in the quickfix. + +if exists("current_compiler") + finish +endif +let current_compiler = "powershell" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +if !exists("g:ps1_makeprg_cmd") + if executable('pwsh') + " pwsh is the future + let g:ps1_makeprg_cmd = 'pwsh' + elseif executable('pwsh.exe') + let g:ps1_makeprg_cmd = 'pwsh.exe' + elseif executable('powershell.exe') + let g:ps1_makeprg_cmd = 'powershell.exe' + else + let g:ps1_makeprg_cmd = '' + endif +endif + +if !executable(g:ps1_makeprg_cmd) + echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!" +endif + +" Show CategoryInfo, FullyQualifiedErrorId, etc? +let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0) + +" Use absolute path because powershell requires explicit relative paths +" (./file.ps1 is okay, but # expands to file.ps1) +let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S' + +" Parse file, line, char from callstacks: +" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a +" cmdlet, function, script file, or operable program. Check the spelling +" of the name, or if a path was included, verify that the path is correct +" and try again. +" At C:\script.ps1:11 char:5 +" + Write-Ouput $content +" + ~~~~~~~~~~~ +" + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException +" + FullyQualifiedErrorId : CommandNotFoundException + +" Showing error in context with underlining. +CompilerSet errorformat=%+G+%m +" Error summary. +CompilerSet errorformat+=%E%*\\S\ :\ %m +" Error location. +CompilerSet errorformat+=%CAt\ %f:%l\ char:%c +" Errors that span multiple lines (may be wrapped to width of terminal). +CompilerSet errorformat+=%C%m +" Ignore blank/whitespace-only lines. +CompilerSet errorformat+=%Z\\s%# + +if g:ps1_efm_show_error_categories + CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m +else + CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m +endif + + +" Parse file, line, char from of parse errors: +" At C:\script.ps1:22 char:16 +" + Stop-Process -Name "invalidprocess +" + ~~~~~~~~~~~~~~~ +" The string is missing the terminator: ". +" + CategoryInfo : ParserError: (:) [], ParseException +" + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString +CompilerSet errorformat+=At\ %f:%l\ char:%c + + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: diff --git a/pack/acp/start/vim-ps1/doc/ps1.txt b/pack/acp/start/vim-ps1/doc/ps1.txt index 49d0aac..9cf33e8 100644 --- a/pack/acp/start/vim-ps1/doc/ps1.txt +++ b/pack/acp/start/vim-ps1/doc/ps1.txt @@ -1,16 +1,64 @@ *ps1.txt* A Windows PowerShell syntax plugin for Vim -Author: Peter Provost -License: Apache 2.0 -Version: 2.9 +Maintainer: Peter Provost +License: Apache 2.0 +Version: 2.10 -INTRODUCTION *ps1-syntax* +INTRODUCTION *ps1-syntax* This plugin provides Vim syntax, indent and filetype detection for Windows -PowerShell. +PowerShell scripts, modules, and XML configuration files. -ABOUT *ps1-about* + +ABOUT *ps1-about* Grab the latest version or report a bug on GitHub: -http://github.com/PProvost/vim-ps1 +https://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. + + +COMPILER *ps1-compiler* + +The powershell |compiler| script configures |:make| to execute the script in +PowerShell. + +It tries to pick a smart default PowerShell command: `pwsh` if available and +`powershell` otherwise, but you can customize the command: > + + :let g:ps1_makeprg_cmd = '/path/to/pwsh' +< +To configure whether to show the exception type information: > + + :let g:ps1_efm_show_error_categories = 1 +< + +KEYWORD LOOKUP *ps1-keyword* + +To look up keywords using PowerShell's Get-Help, press the |K| key. For more +convenient paging, the pager `less` should be installed, which is included in +many Linux distributions and in macOS. + +Many other distributions are available for Windows like +https://chocolatey.org/packages/less/. Make sure `less` is in a directory +listed in the `PATH` environment variable, which chocolatey above does. + +------------------------------------------------------------------------------ + vim:ft=help: diff --git a/pack/acp/start/vim-ps1/doc/tags b/pack/acp/start/vim-ps1/doc/tags deleted file mode 100644 index a7dc221..0000000 --- a/pack/acp/start/vim-ps1/doc/tags +++ /dev/null @@ -1,3 +0,0 @@ -ps1-about ps1.txt /*ps1-about* -ps1-syntax ps1.txt /*ps1-syntax* -ps1.txt ps1.txt /*ps1.txt* diff --git a/pack/acp/start/vim-ps1/ftdetect/ps1.vim b/pack/acp/start/vim-ps1/ftdetect/ps1.vim index 4fc2f3d..efb7652 100644 --- a/pack/acp/start/vim-ps1/ftdetect/ps1.vim +++ b/pack/acp/start/vim-ps1/ftdetect/ps1.vim @@ -1,9 +1,11 @@ " Vim ftdetect plugin file -" Language: Windows PowerShell -" Maintainer: Peter Provost -" Version: 2.9 +" 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 *.psm1 set ft=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 index e902abd..2d6b65a 100644 --- a/pack/acp/start/vim-ps1/ftplugin/ps1.vim +++ b/pack/acp/start/vim-ps1/ftplugin/ps1.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file -" Language: Windows PowerShell -" Maintainer: Peter Provost -" Version: 2.9 +" 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 +" 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 @@ -14,13 +14,43 @@ 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+=- " Change the browse dialog on Win32 to show mainly PowerShell-related files if has("gui_win32") - let b:browsefilter = "PowerShell Files (*.ps1)\t*.ps1\n" . - \ "All Files (*.*)\t*.*\n" + 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 +" Look up keywords by Get-Help: +" check for PowerShell Core in Windows, Linux or MacOS +if executable('pwsh') | let s:pwsh_cmd = 'pwsh' + " on Windows Subsystem for Linux, check for PowerShell Core in Windows +elseif exists('$WSLENV') && executable('pwsh.exe') | let s:pwsh_cmd = 'pwsh.exe' + " check for PowerShell <= 5.1 in Windows +elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe' +endif + +if exists('s:pwsh_cmd') + if !has('gui_running') && executable('less') && + \ !(exists('$ConEmuBuild') && &term =~? '^xterm') + " For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048 + command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw! + elseif has('terminal') + command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full ""' . (executable('less') ? ' | less' : '') + else + command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full ') + endif +endif +setlocal keywordprg=:GetHelp + " Undo the stuff we changed -let b:undo_ftplugin = "setlocal tw< cms< fo<" . - \ " | unlet! b:browsefilter" +let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" . + \ " | 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..5f615c5 --- /dev/null +++ b/pack/acp/start/vim-ps1/ftplugin/ps1xml.vim @@ -0,0 +1,31 @@ +" 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 + +" 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 index 74bc47e..9eac9c9 100644 --- a/pack/acp/start/vim-ps1/indent/ps1.vim +++ b/pack/acp/start/vim-ps1/indent/ps1.vim @@ -1,17 +1,20 @@ " Vim indent file -" Language: Windows PowerShell -" Maintainer: Peter Provost -" Version: 2.9 +" 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" +" 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 + finish endif let b:did_indent = 1 -" PS indenting is like indenting C -setlocal cindent cinoptions& cinoptions+=+0 +" smartindent is good enough for powershell +setlocal smartindent +" disable the indent removal for # marks +inoremap # X# + +let b:undo_indent = "setl si<" -let b:undo_indent = "setl cin<" diff --git a/pack/acp/start/vim-ps1/syntax/ps1.vim b/pack/acp/start/vim-ps1/syntax/ps1.vim index 0984305..6d02756 100644 --- a/pack/acp/start/vim-ps1/syntax/ps1.vim +++ b/pack/acp/start/vim-ps1/syntax/ps1.vim @@ -1,17 +1,25 @@ " Vim syntax file -" Language: Windows PowerShell -" Maintainer: Peter Provost -" Version: 2.9 +" 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" +" 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 + syntax clear elseif exists("b:current_syntax") - finish + finish endif +" Operators contain dashes +setlocal iskeyword+=- + " PowerShell doesn't care about case syn case ignore @@ -19,15 +27,15 @@ syn case ignore syn sync minlines=100 " Certain tokens can't appear at the top level of the document -syn cluster ps1NotTop contains=@ps1Comment,ps1CDocParam,ps1Function +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 -syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc +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 @@ -36,10 +44,9 @@ 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 +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 match ps1Keyword /&/ syn keyword ps1Constant $true $false $null syn match ps1Constant +\$?+ syn match ps1Constant +\$_+ @@ -49,51 +56,78 @@ syn match ps1Constant +\$^+ " Keywords reserved for future use syn keyword ps1Keyword class define from using var -" Functions and Cmdlets -syn match ps1Cmdlet /\w\+-\w\+/ +" Function declarations syn keyword ps1Keyword function nextgroup=ps1Function skipwhite syn keyword ps1Keyword filter nextgroup=ps1Function skipwhite -syn match ps1Function /\w\+-*\w*/ contained +syn keyword ps1Keyword workflow nextgroup=ps1Function skipwhite +syn keyword ps1Keyword configuration nextgroup=ps1Function skipwhite +syn keyword ps1Keyword class nextgroup=ps1Function skipwhite +syn keyword ps1Keyword enum nextgroup=ps1Function skipwhite + +" Function declarations and invocations +syn match ps1Cmdlet /\v(add|clear|close|copy|enter|exit|find|format|get|hide|join|lock|move|new|open|optimize|pop|push|redo|remove|rename|reset|search|select|Set|show|skip|split|step|switch|undo|unlock|watch)(-\w+)+/ contained +syn match ps1Cmdlet /\v(connect|disconnect|read|receive|send|write)(-\w+)+/ contained +syn match ps1Cmdlet /\v(backup|checkpoint|compare|compress|convert|convertfrom|convertto|dismount|edit|expand|export|group|import|initialize|limit|merge|mount|out|publish|restore|save|sync|unpublish|update)(-\w+)+/ contained +syn match ps1Cmdlet /\v(debug|measure|ping|repair|resolve|test|trace)(-\w+)+/ contained +syn match ps1Cmdlet /\v(approve|assert|build|complete|confirm|deny|deploy|disable|enable|install|invoke|register|request|restart|resume|start|stop|submit|suspend|uninstall|unregister|wait)(-\w+)+/ contained +syn match ps1Cmdlet /\v(block|grant|protect|revoke|unblock|unprotect)(-\w+)+/ contained +syn match ps1Cmdlet /\v(use)(-\w+)+/ contained + +" Other functions +syn match ps1Function /\w\+\(-\w\+\)\+/ contains=ps1Cmdlet " Type declarations -syn match ps1Type /\[[a-z0-9_:.]\+\(\[\]\)\?\]/ -syn match ps1StandaloneType /[a-z0-9_.]\+/ contained -syn keyword ps1Scope global local private script contained +syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/ -" Variables and other user defined items -syn match ps1Variable /\$\w\+/ -syn match ps1Variable /\${\w\+:\\\w\+}/ -syn match ps1ScopedVariable /\$\w\+:\w\+/ contains=ps1Scope -syn match ps1VariableName /\w\+/ contained +" Variable references +syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained +syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier +syn match ps1Variable /\${\w\+\(:\?[[:alnum:]_()]\+\)\?}/ contains=ps1ScopeModifier -" Operators all start w/ dash -syn match ps1OperatorStart /-c\?/ nextgroup=ps1Operator -syn keyword ps1Operator eq ne ge gt lt le like notlike match notmatch replace split /contains/ notcontains contained -syn keyword ps1Operator ieq ine ige igt ile ilt ilike inotlike imatch inotmatch ireplace isplit icontains inotcontains contained -syn keyword ps1Operator ceq cne cge cgt clt cle clike cnotlike cmatch cnotmatch creplace csplit ccontains cnotcontains contained -syn keyword ps1Operator is isnot as join contained -syn keyword ps1Operator and or not xor band bor bnot bxor contained -syn keyword ps1Operator f contained +" 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 +syn region ps1String start=/"/ skip=/`"/ end=/"/ contains=@ps1StringSpecial,@Spell syn region ps1String start=/'/ skip=/''/ end=/'/ " Here-Strings -syn region ps1String start=/@"$/ end=/^"@$/ contains=@ps1StringSpecial -syn region ps1String start=/@'$/ end=/^'@$/ +syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell +syn region ps1String start=/@'$/ end=/^'@/ " Interpolation -syn match ps1Escape /`./ contained +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 +syn cluster ps1StringSpecial contains=ps1Escape,ps1Interpolation,ps1Variable,ps1Boolean,ps1Constant,ps1BuiltIn,@Spell " Numbers -" syn match ps1Number /\<[0-9]\+/ -syn match ps1Number "\<\(0[xX]\x\+\|\d\+\)\([MGTP][B]\)\=\>" -syn match ps1Number "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\=" +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]\>" @@ -106,47 +140,54 @@ syn match ps1BuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>" syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>" " Folding blocks -syn region ps1Block start=/{/ end=/}/ transparent fold +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 + 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 ps1Function Function - HiLink ps1Variable Identifier - HiLink ps1ScopedVariable Identifier - HiLink ps1VariableName Identifier - HiLink ps1Boolean Boolean - HiLink ps1Constant Constant - HiLink ps1BuiltIn StorageClass - HiLink ps1Type Type - HiLink ps1Scope Type - HiLink ps1StandaloneType Type - HiLink ps1Number Number - 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 - HiLink ps1Cmdlet Statement - delcommand HiLink + HiLink ps1String String + HiLink ps1Escape SpecialChar + HiLink ps1InterpolationDelimiter Delimiter + HiLink ps1Conditional Conditional + HiLink ps1Cmdlet Function + HiLink ps1Function Identifier + 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 Identifier + HiLink ps1Operator Operator + HiLink ps1Repeat Repeat + HiLink ps1RepeatAndCmdlet Repeat + HiLink ps1Keyword Keyword + HiLink ps1KeywordAndCmdlet Keyword + delcommand HiLink endif -let b:current_syntax = "powershell" +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-speeddating/.github/FUNDING.yml b/pack/acp/start/vim-speeddating/.github/FUNDING.yml new file mode 100644 index 0000000..e2a49d1 --- /dev/null +++ b/pack/acp/start/vim-speeddating/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: tpope +custom: ["https://www.paypal.me/vimpope"] diff --git a/pack/acp/start/vim-speeddating/README.markdown b/pack/acp/start/vim-speeddating/README.markdown index 797904c..ba59269 100644 --- a/pack/acp/start/vim-speeddating/README.markdown +++ b/pack/acp/start/vim-speeddating/README.markdown @@ -41,15 +41,13 @@ The `.` command will work as expected if you install ## 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: +Install using your favorite package manager, or use Vim's built-in package +support: - cd ~/.vim/bundle - git clone git://github.com/tpope/vim-speeddating.git - -Once help tags have been generated, you can view the manual with -`:help speeddating`. + mkdir -p ~/.vim/pack/tpope/start + cd ~/.vim/pack/tpope/start + git clone https://tpope.io/vim/speeddating.git + vim -u NONE -c "helptags speeddating/doc" -c q ## Contributing diff --git a/pack/acp/start/vim-speeddating/autoload/speeddating.vim b/pack/acp/start/vim-speeddating/autoload/speeddating.vim index bd425e2..c981d27 100644 --- a/pack/acp/start/vim-speeddating/autoload/speeddating.vim +++ b/pack/acp/start/vim-speeddating/autoload/speeddating.vim @@ -102,9 +102,9 @@ function! speeddating#increment(increment) endif endfor if a:increment > 0 - exe "norm! ". a:increment."\" + exe "norm ". a:increment."\SpeedDatingFallbackUp" else - exe "norm! ".-a:increment."\" + exe "norm ".-a:increment."\SpeedDatingFallbackDown" endif silent! call repeat#set("\SpeedDating" . (a:increment < 0 ? "Down" : "Up"),a:increment < 0 ? -a:increment : a:increment) endfunction @@ -461,7 +461,7 @@ function! s:strftime(pattern,time) endfunction function! s:localtime(...) - let ts = a:0 ? a:1 : has('unix') ? reltimestr(reltime()) : localtime().'.0' + let ts = a:0 ? a:1 : has('unix')&&!has('nvim') ? reltimestr(reltime()) : localtime().'.0' let us = matchstr(ts,'\.\zs.\{0,6\}') let us .= repeat(0,6-strlen(us)) let us = +matchstr(us,'[1-9].*') diff --git a/pack/acp/start/vim-speeddating/plugin/speeddating.vim b/pack/acp/start/vim-speeddating/plugin/speeddating.vim index 0982842..e225c0e 100644 --- a/pack/acp/start/vim-speeddating/plugin/speeddating.vim +++ b/pack/acp/start/vim-speeddating/plugin/speeddating.vim @@ -42,11 +42,22 @@ command! -bar -bang -count=0 -nargs=? SpeedDatingFormat :call s:add_format( SpeedDatingUp :call speeddating#increment(v:count1) nnoremap SpeedDatingDown :call speeddating#increment(-v:count1) -vnoremap SpeedDatingUp :call speeddating#incrementvisual(v:count1) -vnoremap SpeedDatingDown :call speeddating#incrementvisual(-v:count1) +xnoremap SpeedDatingUp :call speeddating#incrementvisual(v:count1) +xnoremap SpeedDatingDown :call speeddating#incrementvisual(-v:count1) nnoremap SpeedDatingNowLocal :call speeddating#timestamp(0,v:count) nnoremap SpeedDatingNowUTC :call speeddating#timestamp(1,v:count) +for [s:key, s:type] in [['', 'Up'], ['', 'Down']] + let s:rhs = maparg(s:key, 'n') + if !empty(maparg('SpeedDatingFallback'.s:type, 'n')) + continue + elseif s:rhs =~# '^$\|^SpeedDating' + exe 'nnoremap SpeedDatingFallback'.s:type s:key + else + exe 'nmap SpeedDatingFallback'.s:type s:rhs + endif +endfor + if !exists("g:speeddating_no_mappings") || !g:speeddating_no_mappings nmap SpeedDatingUp nmap SpeedDatingDown diff --git a/pack/acp/start/vim-surround/.github/FUNDING.yml b/pack/acp/start/vim-surround/.github/FUNDING.yml new file mode 100644 index 0000000..e2a49d1 --- /dev/null +++ b/pack/acp/start/vim-surround/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: tpope +custom: ["https://www.paypal.me/vimpope"] diff --git a/pack/acp/start/vim-surround/README.markdown b/pack/acp/start/vim-surround/README.markdown index fef61a8..5321eec 100644 --- a/pack/acp/start/vim-surround/README.markdown +++ b/pack/acp/start/vim-surround/README.markdown @@ -1,5 +1,4 @@ -surround.vim -============ +# surround.vim Surround.vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, @@ -61,37 +60,32 @@ 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 ------------- +## 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: +Install using your favorite package manager, or use Vim's built-in package +support: - cd ~/.vim/bundle - git clone git://github.com/tpope/vim-surround.git + mkdir -p ~/.vim/pack/tpope/start + cd ~/.vim/pack/tpope/start + git clone https://tpope.io/vim/surround.git + vim -u NONE -c "helptags surround/doc" -c q -Once help tags have been generated, you can view the manual with -`:help surround`. - -Contributing ------------- +## Contributing See the contribution guidelines for [pathogen.vim](https://github.com/tpope/vim-pathogen#readme). -Self-Promotion --------------- +## Self-Promotion -Like surround.vim? Follow the repository on +Like surround.vim? Star 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). +[vim.org](https://www.vim.org/scripts/script.php?script_id=1697). -License -------- +Love surround.vim? Follow [tpope](http://tpo.pe/) on +[GitHub](https://github.com/tpope) and +[Twitter](http://twitter.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 index 41943e7..fd395d2 100644 --- a/pack/acp/start/vim-surround/doc/surround.txt +++ b/pack/acp/start/vim-surround/doc/surround.txt @@ -130,9 +130,20 @@ 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. End your -input by pressing or >. If is used, the tags will appear on lines -by themselves. +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 f, F, or is used, Vim prompts for a function name to insert. The target +text will be wrapped in a function call. If f is used, the text is wrapped with +() parentheses; F adds additional spaces inside the parentheses. inserts the +function name inside the parentheses. + + Old text Command New text ~ + "hello" ysWfprint print("hello") + "hello" ysWFprint print( "hello" ) + "hello" ysWprint (print "hello") If s is used, a leading but not trailing space is added. This is useful for removing parentheses from a function call with csbs. diff --git a/pack/acp/start/vim-surround/plugin/surround.vim b/pack/acp/start/vim-surround/plugin/surround.vim index 44fd3c9..303bd2b 100644 --- a/pack/acp/start/vim-surround/plugin/surround.vim +++ b/pack/acp/start/vim-surround/plugin/surround.vim @@ -92,7 +92,7 @@ function! s:process(string) let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) if m != '' let m = substitute(strpart(m,1),'\r.*','','') - let repl_{i} = input(substitute(m,':\s*$','','').': ') + let repl_{i} = input(match(m,'\w\+$') >= 0 ? m.': ' : m) endif endfor let s = "" @@ -124,13 +124,12 @@ function! s:process(string) return s endfunction -function! s:wrap(string,char,type,...) +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 special = a:0 ? a:1 : 0 let before = "" let after = "" if type ==# "V" @@ -165,13 +164,13 @@ function! s:wrap(string,char,type,...) elseif newchar ==# ':' let before = ':' let after = '' - elseif newchar =~# "[tT\<,]" + elseif newchar =~# "[tT\<]" let dounmapp = 0 let dounmapb = 0 if !maparg(">","c") let dounmapb = 1 " Hide from AsNeeded - exe "cn"."oremap > " + exe "cn"."oremap > >" endif let default = "" if newchar ==# "T" @@ -181,21 +180,27 @@ function! s:wrap(string,char,type,...) let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') endif let tag = input("<",default) - echo "<".substitute(tag,'>*$','>','') 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 . '>' - let before = '<'.tag.'>' if tag =~ '/$' + let tag = substitute(tag, '/$', '', '') + let before = '<'.tag.attributes.' />' let after = '' else + let before = '<'.tag.attributes.'>' let after = '' endif - if newchar == "\" || newchar == "," + if newchar == "\" if type ==# "v" || type ==# "V" let before .= "\n\t" endif @@ -207,10 +212,11 @@ function! s:wrap(string,char,type,...) elseif newchar ==# 'l' || newchar == '\' " LaTeX let env = input('\begin{') - let env = '{' . env - let env .= s:closematch(env) - echo '\begin'.env 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 @@ -246,7 +252,7 @@ function! s:wrap(string,char,type,...) let after = '' endif let after = substitute(after ,'\n','\n'.initspaces,'g') - if type ==# 'V' || (special && type ==# "v") + if type ==# 'V' || (a:special && type ==# "v") let before = substitute(before,' \+$','','') let after = substitute(after ,'^ \+','','') if after !~ '^\n' @@ -257,11 +263,16 @@ function! s:wrap(string,char,type,...) elseif keeper =~ '\n$' && after =~ '^\n' let after = strpart(after,1) endif - if before !~ '\n\s*$' + if keeper !~ '^\n' && before !~ '\n\s*$' let before .= "\n" - if special + if a:special let before .= "\t" endif + elseif keeper =~ '^\n' && before =~ '\n\s*$' + let keeper = strcharpart(keeper,1) + endif + if type ==# 'V' && keeper =~ '\n\s*\n$' + let keeper = strcharpart(keeper,0,strchars(keeper) - 1) endif endif if type ==# 'V' @@ -289,11 +300,10 @@ function! s:wrap(string,char,type,...) return keeper endfunction -function! s:wrapreg(reg,char,...) +function! s:wrapreg(reg,char,removed,special) let orig = getreg(a:reg) let type = substitute(getregtype(a:reg),'\d\+$','','') - let special = a:0 ? a:1 : 0 - let new = s:wrap(orig,a:char,type,special) + let new = s:wrap(orig,a:char,type,a:removed,a:special) call setreg(a:reg,new,type) endfunction " }}}1 @@ -314,7 +324,7 @@ function! s:insert(...) " {{{1 set clipboard-=unnamed clipboard-=unnamedplus let reg_save = @@ call setreg('"',"\r",'v') - call s:wrapreg('"',char,linemode) + 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 @@ -326,7 +336,16 @@ function! s:insert(...) " {{{1 if exists("g:surround_insert_tail") call setreg('"',g:surround_insert_tail,"a".getregtype('"')) endif - if col('.') >= col('$') + if &ve != 'all' && col('.') >= col('$') + if &ve == 'insert' + let extra_cols = virtcol('.') - virtcol('$') + if extra_cols > 0 + let [regval,regtype] = [getreg('"',1,1),getregtype('"')] + call setreg('"',join(map(range(extra_cols),'" "'),''),'v') + norm! ""p + call setreg('"',regval,regtype) + endif + endif norm! ""p else norm! ""P @@ -381,7 +400,7 @@ function! s:dosurround(...) " {{{1 let strcount = (scount == 1 ? "" : scount) if char == '/' exe 'norm! '.strcount.'[/d'.strcount.']/' - elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>"''`]' + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>"''`]' exe 'norm! T'.char if getline('.')[col('.')-1] == char exe 'norm! l' @@ -411,7 +430,7 @@ function! s:dosurround(...) " {{{1 norm! "_x call setreg('"','/**/',"c") let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') - elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]' + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>]' exe 'norm! F'.char exe 'norm! df'.char else @@ -428,7 +447,7 @@ function! s:dosurround(...) " {{{1 let keeper = substitute(keeper,'^\s\+','','') let keeper = substitute(keeper,'\s\+$','','') endif - if col("']") == col("$") && col('.') + 1 == col('$') + if col("']") == col("$") && virtcol('.') + 1 == virtcol('$') if oldhead =~# '^\s*$' && a:0 < 2 let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') endif @@ -442,7 +461,7 @@ function! s:dosurround(...) " {{{1 call setreg('"',keeper,regtype) if newchar != "" let special = a:0 > 2 ? a:3 : 0 - call s:wrapreg('"',newchar, special) + call s:wrapreg('"',newchar,removed,special) endif silent exe 'norm! ""'.pcmd.'`[' if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' @@ -473,7 +492,11 @@ function! s:changesurround(...) " {{{1 call s:dosurround(a,b,a:0 && a:1) endfunction " }}}1 -function! s:opfunc(type,...) " {{{1 +function! s:opfunc(type, ...) abort " {{{1 + if a:type ==# 'setup' + let &opfunc = matchstr(expand(''), '\w\+$') + return 'g@' + endif let char = s:inputreplacement() if char == "" return s:beep() @@ -518,7 +541,7 @@ function! s:opfunc(type,...) " {{{1 let keeper = substitute(keeper,'\_s\@'), '\w\+$') + return 'g@' + endif + call s:opfunc(a:1, 1) endfunction " }}}1 function! s:closematch(str) " {{{1 @@ -560,11 +587,10 @@ 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@ +nnoremap Yssurround '^'.v:count1.opfunc('setup').'g_' +nnoremap YSsurround opfunc2('setup').'_' +nnoremap Ysurround opfunc('setup') +nnoremap YSurround opfunc2('setup') vnoremap VSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0) vnoremap VgSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1) inoremap Isurround =insert()