Update plugins to latest versions
This commit is contained in:
parent
f80daa060a
commit
2b4197a006
29 changed files with 595 additions and 212 deletions
|
@ -203,7 +203,7 @@ function! s:goyo_on(dim)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vim-signify
|
" 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
|
if t:goyo_disabled_signify
|
||||||
SignifyToggle
|
SignifyToggle
|
||||||
endif
|
endif
|
||||||
|
@ -260,7 +260,7 @@ function! s:goyo_on(dim)
|
||||||
|
|
||||||
augroup goyo
|
augroup goyo
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd TabLeave * call s:goyo_off()
|
autocmd TabLeave * nested call s:goyo_off()
|
||||||
autocmd VimResized * call s:resize_pads()
|
autocmd VimResized * call s:resize_pads()
|
||||||
autocmd ColorScheme * call s:tranquilize()
|
autocmd ColorScheme * call s:tranquilize()
|
||||||
autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline()
|
autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline()
|
||||||
|
|
|
@ -32,8 +32,6 @@ INSTALLATION *goyo-installation*
|
||||||
|
|
||||||
Use your favorite plugin manager.
|
Use your favorite plugin manager.
|
||||||
|
|
||||||
*:PlugInstall*
|
|
||||||
|
|
||||||
- {vim-plug}{3}
|
- {vim-plug}{3}
|
||||||
1. Add `Plug 'junegunn/goyo.vim'` to .vimrc
|
1. Add `Plug 'junegunn/goyo.vim'` to .vimrc
|
||||||
2. Run `:PlugInstall`
|
2. Run `:PlugInstall`
|
||||||
|
|
|
@ -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*
|
|
|
@ -46,7 +46,7 @@ function! s:getpos()
|
||||||
let bop = get(g:, 'limelight_bop', '^\s*$\n\zs')
|
let bop = get(g:, 'limelight_bop', '^\s*$\n\zs')
|
||||||
let eop = get(g:, 'limelight_eop', '^\s*$')
|
let eop = get(g:, 'limelight_eop', '^\s*$')
|
||||||
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - s:empty(getline('.'))])
|
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)
|
for i in range(0, span)
|
||||||
let start = searchpos(bop, i == 0 ? 'cbW' : 'bW')[0]
|
let start = searchpos(bop, i == 0 ? 'cbW' : 'bW')[0]
|
||||||
endfor
|
endfor
|
||||||
|
@ -254,8 +254,8 @@ function! s:cleanup()
|
||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! limelight#execute(bang, visual, ...) range
|
function! limelight#execute(bang, visual, line1, line2, ...)
|
||||||
let range = a:visual ? [a:firstline, a:lastline] : []
|
let range = a:visual ? [a:line1, a:line2] : []
|
||||||
if a:bang
|
if a:bang
|
||||||
if a:0 > 0 && a:1 =~ '^!' && !s:is_on()
|
if a:0 > 0 && a:1 =~ '^!' && !s:is_on()
|
||||||
if len(a:1) > 1
|
if len(a:1) > 1
|
||||||
|
@ -274,7 +274,7 @@ function! limelight#execute(bang, visual, ...) range
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! limelight#operator(...)
|
function! limelight#operator(...)
|
||||||
'[,']call limelight#execute(0, 1)
|
call limelight#execute(0, 1, line("'["), line("']"))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
command! -nargs=? -bar -bang -range Limelight <line1>,<line2>call limelight#execute(<bang>0, <count> > 0, <f-args>)
|
command! -nargs=? -bar -bang -range Limelight call limelight#execute(<bang>0, <count> > 0, <line1>, <line2>, <f-args>)
|
||||||
|
|
||||||
nnoremap <silent> <Plug>(Limelight) :set opfunc=limelight#operator<CR>g@
|
nnoremap <silent> <Plug>(Limelight) :set opfunc=limelight#operator<CR>g@
|
||||||
xnoremap <silent> <Plug>(Limelight) :Limelight<CR>
|
xnoremap <silent> <Plug>(Limelight) :Limelight<CR>
|
||||||
|
|
|
@ -98,6 +98,9 @@ Execute (Unsupported. but g:limelight_conceal_???fg defined):
|
||||||
Limelight!
|
Limelight!
|
||||||
AssertOff
|
AssertOff
|
||||||
else
|
else
|
||||||
|
if exists('&termguicolors')
|
||||||
|
set notermguicolors
|
||||||
|
endif
|
||||||
colo default
|
colo default
|
||||||
let &t_Co = 256
|
let &t_Co = 256
|
||||||
|
|
||||||
|
@ -133,4 +136,4 @@ Execute (Cleanup):
|
||||||
delc AssertOff
|
delc AssertOff
|
||||||
unlet! msg
|
unlet! msg
|
||||||
Restore
|
Restore
|
||||||
execute 'colo '.g:colors_name
|
silent! execute 'colo '.g:colors_name
|
||||||
|
|
|
@ -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 MIPS: [mips](https://github.com/vim-scripts/mips.vim)
|
||||||
* Assembly GAS: [vim-gas](https://github.com/Shirk/vim-gas)
|
* Assembly GAS: [vim-gas](https://github.com/Shirk/vim-gas)
|
||||||
* Octave/MATLAB: [vim-octave](https://github.com/jvirtanen/vim-octave)
|
* 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)
|
* Dockerfile: [dockerfile.vim](https://github.com/docker/docker/tree/master/contrib/syntax/vim)
|
||||||
* NGINX: [nginx-vim-syntax](https://github.com/evanmiller/nginx-vim-syntax)
|
* NGINX: [nginx-vim-syntax](https://github.com/evanmiller/nginx-vim-syntax)
|
||||||
* Elixir: [vim-elixir](https://github.com/elixir-lang/vim-elixir)
|
* 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:
|
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:
|
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/)
|
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://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
|
[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
|
[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 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!
|
Feel free to add related projects here!
|
||||||
|
|
|
@ -1565,7 +1565,6 @@ fun! s:apply_syntax_highlightings()
|
||||||
exec 'hi pythonStrFormatting' . s:fg_olive . s:ft_bold
|
exec 'hi pythonStrFormatting' . s:fg_olive . s:ft_bold
|
||||||
|
|
||||||
exec 'hi pythonBoolean' . s:fg_green . 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 pythonBytesEscape' . s:fg_olive . s:ft_bold
|
||||||
exec 'hi pythonDottedName' . s:fg_purple
|
exec 'hi pythonDottedName' . s:fg_purple
|
||||||
exec 'hi pythonStrFormat' . s:fg_foreground
|
exec 'hi pythonStrFormat' . s:fg_foreground
|
||||||
|
@ -1610,7 +1609,16 @@ fun! s:apply_syntax_highlightings()
|
||||||
exec 'hi javaScriptMessage' . s:fg_foreground
|
exec 'hi javaScriptMessage' . s:fg_foreground
|
||||||
exec 'hi javaScriptMember' . 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
|
" @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 jsFuncParens' . s:fg_blue
|
||||||
exec 'hi jsFuncBraces' . s:fg_blue
|
exec 'hi jsFuncBraces' . s:fg_blue
|
||||||
exec 'hi jsParens' . s:fg_blue
|
exec 'hi jsParens' . s:fg_blue
|
||||||
|
|
1
pack/acp/start/vim-ps1/.gitignore
vendored
Normal file
1
pack/acp/start/vim-ps1/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/doc/tags
|
|
@ -9,8 +9,9 @@ files, and also includes a filetype plugin so Vim can autodetect your PS1 script
|
||||||
|
|
||||||
Includes contributions by:
|
Includes contributions by:
|
||||||
|
|
||||||
* Jared Parsons <jaredp@beanseed.org>
|
* Tomas Restrepo
|
||||||
* Heath Stewart <heaths@microsoft.com>
|
* Jared Parsons
|
||||||
|
* Heath Stewart
|
||||||
* Michael B. Smith
|
* Michael B. Smith
|
||||||
* Alexander Kostikov
|
* Alexander Kostikov
|
||||||
|
|
||||||
|
@ -19,17 +20,38 @@ Installation
|
||||||
|
|
||||||
Copy the included directories into your .vim or vimfiles directory.
|
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
|
cd ~/.vim/bundle
|
||||||
git clone https://github.com/PProvost/vim-ps1.git
|
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
|
Comments and Suggestions
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Please follow, fork or submit issues on [GitHub](https://github.com/PProvost/vim-ps1) and if you
|
Please follow, fork or submit issues on [GitHub][2] and if you
|
||||||
find it useful, please vote for it on [vim.org](http://www.vim.org/scripts/script.php?script_id=1327).
|
find it useful, please vote for it on [vim.org][3].
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
@ -51,6 +73,7 @@ License
|
||||||
Version History
|
Version History
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
* v2.10 (2013-06-24) Added Heath Stewart's here strings fix
|
||||||
* v2.9 (2012-03-08) Included tomasr's changes
|
* v2.9 (2012-03-08) Included tomasr's changes
|
||||||
* v2.81 (2012-03-05) Fixed a dumb typo
|
* v2.81 (2012-03-05) Fixed a dumb typo
|
||||||
* v2.8 (2012-03-05) Better number scanning, multiline comments, missing keywords and constants
|
* 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.3 (2005-12-20) Updates to syntax elements
|
||||||
* v1.2 (2005-08-13) Fix foreach and while problem
|
* v1.2 (2005-08-13) Fix foreach and while problem
|
||||||
* v1.1 (2005-08-12) Initial release
|
* 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
|
||||||
|
|
83
pack/acp/start/vim-ps1/compiler/powershell.vim
Normal file
83
pack/acp/start/vim-ps1/compiler/powershell.vim
Normal file
|
@ -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 <args>
|
||||||
|
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:
|
|
@ -1,16 +1,64 @@
|
||||||
*ps1.txt* A Windows PowerShell syntax plugin for Vim
|
*ps1.txt* A Windows PowerShell syntax plugin for Vim
|
||||||
|
|
||||||
Author: Peter Provost <http://www.github.com/PProvost>
|
Maintainer: Peter Provost <https://www.github.com/PProvost>
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
Version: 2.9
|
Version: 2.10
|
||||||
|
|
||||||
INTRODUCTION *ps1-syntax*
|
INTRODUCTION *ps1-syntax*
|
||||||
|
|
||||||
This plugin provides Vim syntax, indent and filetype detection for Windows
|
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:
|
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:
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
ps1-about ps1.txt /*ps1-about*
|
|
||||||
ps1-syntax ps1.txt /*ps1-syntax*
|
|
||||||
ps1.txt ps1.txt /*ps1.txt*
|
|
|
@ -1,9 +1,11 @@
|
||||||
" Vim ftdetect plugin file
|
" Vim ftdetect plugin file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.9
|
" Version: 2.10
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" 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
|
||||||
|
"
|
||||||
au BufNewFile,BufRead *.ps1 set ft=ps1
|
au BufNewFile,BufRead *.ps1 set ft=ps1
|
||||||
au BufNewFile,BufRead *.psm1 set ft=ps1
|
au BufNewFile,BufRead *.psd1 set ft=ps1
|
||||||
|
au BufNewFile,BufRead *.psm1 set ft=ps1
|
||||||
|
au BufNewFile,BufRead *.pssc set ft=ps1
|
||||||
|
|
8
pack/acp/start/vim-ps1/ftdetect/ps1xml.vim
Normal file
8
pack/acp/start/vim-ps1/ftdetect/ps1xml.vim
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
" Vim ftdetect plugin file
|
||||||
|
" Language: Windows PowerShell
|
||||||
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
|
" 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
|
9
pack/acp/start/vim-ps1/ftdetect/xml.vim
Normal file
9
pack/acp/start/vim-ps1/ftdetect/xml.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Vim ftdetect plugin file
|
||||||
|
" Language: Windows PowerShell
|
||||||
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
|
" 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
|
|
@ -1,9 +1,9 @@
|
||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.9
|
" Version: 2.10
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" 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
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
@ -14,13 +14,43 @@ let b:did_ftplugin = 1
|
||||||
setlocal tw=0
|
setlocal tw=0
|
||||||
setlocal commentstring=#%s
|
setlocal commentstring=#%s
|
||||||
setlocal formatoptions=tcqro
|
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
|
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||||
if has("gui_win32")
|
if has("gui_win32")
|
||||||
let b:browsefilter = "PowerShell Files (*.ps1)\t*.ps1\n" .
|
let b:browsefilter =
|
||||||
\ "All Files (*.*)\t*.*\n"
|
\ "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
|
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 "<args>" | ' . (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 "<args>"' . (executable('less') ? ' | less' : '')
|
||||||
|
else
|
||||||
|
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
setlocal keywordprg=:GetHelp
|
||||||
|
|
||||||
" Undo the stuff we changed
|
" Undo the stuff we changed
|
||||||
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
|
let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
|
||||||
\ " | unlet! b:browsefilter"
|
\ " | unlet! b:browsefilter"
|
||||||
|
|
||||||
|
|
31
pack/acp/start/vim-ps1/ftplugin/ps1xml.vim
Normal file
31
pack/acp/start/vim-ps1/ftplugin/ps1xml.vim
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Windows PowerShell
|
||||||
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
|
" 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"
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.9
|
" Version: 2.10
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" 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.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
" PS indenting is like indenting C
|
" smartindent is good enough for powershell
|
||||||
setlocal cindent cinoptions& cinoptions+=+0
|
setlocal smartindent
|
||||||
|
" disable the indent removal for # marks
|
||||||
|
inoremap <buffer> # X#
|
||||||
|
|
||||||
|
let b:undo_indent = "setl si<"
|
||||||
|
|
||||||
let b:undo_indent = "setl cin<"
|
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.9
|
" Version: 2.10
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" 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
|
" Compatible VIM syntax file start
|
||||||
if version < 600
|
if version < 600
|
||||||
syntax clear
|
syntax clear
|
||||||
elseif exists("b:current_syntax")
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Operators contain dashes
|
||||||
|
setlocal iskeyword+=-
|
||||||
|
|
||||||
" PowerShell doesn't care about case
|
" PowerShell doesn't care about case
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
|
||||||
|
@ -19,15 +27,15 @@ syn case ignore
|
||||||
syn sync minlines=100
|
syn sync minlines=100
|
||||||
|
|
||||||
" Certain tokens can't appear at the top level of the document
|
" 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
|
" Comments and special comment words
|
||||||
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained
|
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained
|
||||||
syn match ps1CDocParam /.*/ 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 ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
syn match ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
||||||
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc
|
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc,@Spell
|
||||||
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc
|
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc,@Spell
|
||||||
|
|
||||||
" Language keywords and elements
|
" Language keywords and elements
|
||||||
syn keyword ps1Conditional if else elseif switch default
|
syn keyword ps1Conditional if else elseif switch default
|
||||||
|
@ -36,10 +44,9 @@ syn match ps1Repeat /\<foreach\>/ nextgroup=ps1Block skipwhite
|
||||||
syn match ps1Keyword /\<while\>/ nextgroup=ps1Block skipwhite
|
syn match ps1Keyword /\<while\>/ nextgroup=ps1Block skipwhite
|
||||||
syn match ps1Keyword /\<where\>/ nextgroup=ps1Block skipwhite
|
syn match ps1Keyword /\<where\>/ 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 try catch finally throw
|
||||||
syn keyword ps1Keyword return filter in trap param data dynamicparam
|
syn keyword ps1Keyword return filter in trap param data dynamicparam
|
||||||
syn match ps1Keyword /&/
|
|
||||||
syn keyword ps1Constant $true $false $null
|
syn keyword ps1Constant $true $false $null
|
||||||
syn match ps1Constant +\$?+
|
syn match ps1Constant +\$?+
|
||||||
syn match ps1Constant +\$_+
|
syn match ps1Constant +\$_+
|
||||||
|
@ -49,51 +56,78 @@ syn match ps1Constant +\$^+
|
||||||
" Keywords reserved for future use
|
" Keywords reserved for future use
|
||||||
syn keyword ps1Keyword class define from using var
|
syn keyword ps1Keyword class define from using var
|
||||||
|
|
||||||
" Functions and Cmdlets
|
" Function declarations
|
||||||
syn match ps1Cmdlet /\w\+-\w\+/
|
|
||||||
syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
|
syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
|
||||||
syn keyword ps1Keyword filter 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
|
" Type declarations
|
||||||
syn match ps1Type /\[[a-z0-9_:.]\+\(\[\]\)\?\]/
|
syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/
|
||||||
syn match ps1StandaloneType /[a-z0-9_.]\+/ contained
|
|
||||||
syn keyword ps1Scope global local private script contained
|
|
||||||
|
|
||||||
" Variables and other user defined items
|
" Variable references
|
||||||
syn match ps1Variable /\$\w\+/
|
syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained
|
||||||
syn match ps1Variable /\${\w\+:\\\w\+}/
|
syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier
|
||||||
syn match ps1ScopedVariable /\$\w\+:\w\+/ contains=ps1Scope
|
syn match ps1Variable /\${\w\+\(:\?[[:alnum:]_()]\+\)\?}/ contains=ps1ScopeModifier
|
||||||
syn match ps1VariableName /\w\+/ contained
|
|
||||||
|
|
||||||
" Operators all start w/ dash
|
" Operators
|
||||||
syn match ps1OperatorStart /-c\?/ nextgroup=ps1Operator
|
syn keyword ps1Operator -eq -ne -ge -gt -lt -le -like -notlike -match -notmatch -replace -split -contains -notcontains
|
||||||
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
|
||||||
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
|
||||||
syn keyword ps1Operator ceq cne cge cgt clt cle clike cnotlike cmatch cnotmatch creplace csplit ccontains cnotcontains contained
|
syn keyword ps1Operator -in -notin
|
||||||
syn keyword ps1Operator is isnot as join contained
|
syn keyword ps1Operator -is -isnot -as -join
|
||||||
syn keyword ps1Operator and or not xor band bor bnot bxor contained
|
syn keyword ps1Operator -and -or -not -xor -band -bor -bnot -bxor
|
||||||
syn keyword ps1Operator f contained
|
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
|
" Regular Strings
|
||||||
" These aren't precisely correct and could use some work
|
" 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=/'/
|
syn region ps1String start=/'/ skip=/''/ end=/'/
|
||||||
|
|
||||||
" Here-Strings
|
" Here-Strings
|
||||||
syn region ps1String start=/@"$/ end=/^"@$/ contains=@ps1StringSpecial
|
syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell
|
||||||
syn region ps1String start=/@'$/ end=/^'@$/
|
syn region ps1String start=/@'$/ end=/^'@/
|
||||||
|
|
||||||
" Interpolation
|
" Interpolation
|
||||||
syn match ps1Escape /`./ contained
|
syn match ps1Escape /`./
|
||||||
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
|
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
|
||||||
syn region ps1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=ps1Interpolation end=")" transparent contained
|
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
|
" Numbers
|
||||||
" syn match ps1Number /\<[0-9]\+/
|
syn match ps1Number "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@="
|
||||||
syn match ps1Number "\<\(0[xX]\x\+\|\d\+\)\([MGTP][B]\)\=\>"
|
syn match ps1Number "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
|
||||||
syn match ps1Number "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
|
|
||||||
syn match ps1Number "\<\d\+[eE][-+]\=\d\+[dD]\=\>"
|
syn match ps1Number "\<\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\)\>"
|
syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
|
||||||
|
|
||||||
" Folding blocks
|
" 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
|
" Setup default color highlighting
|
||||||
if version >= 508 || !exists("did_ps1_syn_inits")
|
if version >= 508 || !exists("did_ps1_syn_inits")
|
||||||
if version < 508
|
if version < 508
|
||||||
let did_ps1_syn_inits = 1
|
let did_ps1_syn_inits = 1
|
||||||
command -nargs=+ HiLink hi link <args>
|
command -nargs=+ HiLink hi link <args>
|
||||||
else
|
else
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
HiLink ps1Number Number
|
HiLink ps1Number Number
|
||||||
HiLink ps1Block Block
|
HiLink ps1Block Block
|
||||||
|
HiLink ps1Region Region
|
||||||
HiLink ps1Exception Exception
|
HiLink ps1Exception Exception
|
||||||
HiLink ps1Constant Constant
|
HiLink ps1Constant Constant
|
||||||
HiLink ps1String String
|
HiLink ps1String String
|
||||||
HiLink ps1Escape SpecialChar
|
HiLink ps1Escape SpecialChar
|
||||||
HiLink ps1InterpolationDelimiter Delimiter
|
HiLink ps1InterpolationDelimiter Delimiter
|
||||||
HiLink ps1Conditional Conditional
|
HiLink ps1Conditional Conditional
|
||||||
HiLink ps1Function Function
|
HiLink ps1Cmdlet Function
|
||||||
HiLink ps1Variable Identifier
|
HiLink ps1Function Identifier
|
||||||
HiLink ps1ScopedVariable Identifier
|
HiLink ps1Variable Identifier
|
||||||
HiLink ps1VariableName Identifier
|
HiLink ps1Boolean Boolean
|
||||||
HiLink ps1Boolean Boolean
|
HiLink ps1Constant Constant
|
||||||
HiLink ps1Constant Constant
|
HiLink ps1BuiltIn StorageClass
|
||||||
HiLink ps1BuiltIn StorageClass
|
HiLink ps1Type Type
|
||||||
HiLink ps1Type Type
|
HiLink ps1ScopeModifier StorageClass
|
||||||
HiLink ps1Scope Type
|
HiLink ps1Comment Comment
|
||||||
HiLink ps1StandaloneType Type
|
HiLink ps1CommentTodo Todo
|
||||||
HiLink ps1Number Number
|
HiLink ps1CommentDoc Tag
|
||||||
HiLink ps1Comment Comment
|
HiLink ps1CDocParam Identifier
|
||||||
HiLink ps1CommentTodo Todo
|
HiLink ps1Operator Operator
|
||||||
HiLink ps1CommentDoc Tag
|
HiLink ps1Repeat Repeat
|
||||||
HiLink ps1CDocParam Todo
|
HiLink ps1RepeatAndCmdlet Repeat
|
||||||
HiLink ps1Operator Operator
|
HiLink ps1Keyword Keyword
|
||||||
HiLink ps1Repeat Repeat
|
HiLink ps1KeywordAndCmdlet Keyword
|
||||||
HiLink ps1RepeatAndCmdlet Repeat
|
delcommand HiLink
|
||||||
HiLink ps1Keyword Keyword
|
|
||||||
HiLink ps1KeywordAndCmdlet Keyword
|
|
||||||
HiLink ps1Cmdlet Statement
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:current_syntax = "powershell"
|
let b:current_syntax = "ps1"
|
||||||
|
|
56
pack/acp/start/vim-ps1/syntax/ps1xml.vim
Normal file
56
pack/acp/start/vim-ps1/syntax/ps1xml.vim
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Windows PowerShell XML
|
||||||
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
|
" 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 <sfile>:p:h/ps1.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn region ps1xmlScriptBlock
|
||||||
|
\ matchgroup=xmlTag start="<Script>"
|
||||||
|
\ matchgroup=xmlEndTag end="</Script>"
|
||||||
|
\ fold
|
||||||
|
\ contains=@ps1xmlScriptBlock
|
||||||
|
\ keepend
|
||||||
|
syn region ps1xmlScriptBlock
|
||||||
|
\ matchgroup=xmlTag start="<ScriptBlock>"
|
||||||
|
\ matchgroup=xmlEndTag end="</ScriptBlock>"
|
||||||
|
\ fold
|
||||||
|
\ contains=@ps1xmlScriptBlock
|
||||||
|
\ keepend
|
||||||
|
syn region ps1xmlScriptBlock
|
||||||
|
\ matchgroup=xmlTag start="<GetScriptBlock>"
|
||||||
|
\ matchgroup=xmlEndTag end="</GetScriptBlock>"
|
||||||
|
\ fold
|
||||||
|
\ contains=@ps1xmlScriptBlock
|
||||||
|
\ keepend
|
||||||
|
syn region ps1xmlScriptBlock
|
||||||
|
\ matchgroup=xmlTag start="<SetScriptBlock>"
|
||||||
|
\ matchgroup=xmlEndTag end="</SetScriptBlock>"
|
||||||
|
\ 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
|
||||||
|
|
2
pack/acp/start/vim-speeddating/.github/FUNDING.yml
vendored
Normal file
2
pack/acp/start/vim-speeddating/.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
github: tpope
|
||||||
|
custom: ["https://www.paypal.me/vimpope"]
|
|
@ -41,15 +41,13 @@ The `.` command will work as expected if you install
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
If you don't have a preferred installation method, I recommend
|
Install using your favorite package manager, or use Vim's built-in package
|
||||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
support:
|
||||||
then simply copy and paste:
|
|
||||||
|
|
||||||
cd ~/.vim/bundle
|
mkdir -p ~/.vim/pack/tpope/start
|
||||||
git clone git://github.com/tpope/vim-speeddating.git
|
cd ~/.vim/pack/tpope/start
|
||||||
|
git clone https://tpope.io/vim/speeddating.git
|
||||||
Once help tags have been generated, you can view the manual with
|
vim -u NONE -c "helptags speeddating/doc" -c q
|
||||||
`:help speeddating`.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,9 @@ function! speeddating#increment(increment)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if a:increment > 0
|
if a:increment > 0
|
||||||
exe "norm! ". a:increment."\<C-A>"
|
exe "norm ". a:increment."\<Plug>SpeedDatingFallbackUp"
|
||||||
else
|
else
|
||||||
exe "norm! ".-a:increment."\<C-X>"
|
exe "norm ".-a:increment."\<Plug>SpeedDatingFallbackDown"
|
||||||
endif
|
endif
|
||||||
silent! call repeat#set("\<Plug>SpeedDating" . (a:increment < 0 ? "Down" : "Up"),a:increment < 0 ? -a:increment : a:increment)
|
silent! call repeat#set("\<Plug>SpeedDating" . (a:increment < 0 ? "Down" : "Up"),a:increment < 0 ? -a:increment : a:increment)
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -461,7 +461,7 @@ function! s:strftime(pattern,time)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:localtime(...)
|
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 = matchstr(ts,'\.\zs.\{0,6\}')
|
||||||
let us .= repeat(0,6-strlen(us))
|
let us .= repeat(0,6-strlen(us))
|
||||||
let us = +matchstr(us,'[1-9].*')
|
let us = +matchstr(us,'[1-9].*')
|
||||||
|
|
|
@ -42,11 +42,22 @@ command! -bar -bang -count=0 -nargs=? SpeedDatingFormat :call s:add_format(<q-ar
|
||||||
|
|
||||||
nnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#increment(v:count1)<CR>
|
nnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#increment(v:count1)<CR>
|
||||||
nnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#increment(-v:count1)<CR>
|
nnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#increment(-v:count1)<CR>
|
||||||
vnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#incrementvisual(v:count1)<CR>
|
xnoremap <silent> <Plug>SpeedDatingUp :<C-U>call speeddating#incrementvisual(v:count1)<CR>
|
||||||
vnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#incrementvisual(-v:count1)<CR>
|
xnoremap <silent> <Plug>SpeedDatingDown :<C-U>call speeddating#incrementvisual(-v:count1)<CR>
|
||||||
nnoremap <silent> <Plug>SpeedDatingNowLocal :<C-U>call speeddating#timestamp(0,v:count)<CR>
|
nnoremap <silent> <Plug>SpeedDatingNowLocal :<C-U>call speeddating#timestamp(0,v:count)<CR>
|
||||||
nnoremap <silent> <Plug>SpeedDatingNowUTC :<C-U>call speeddating#timestamp(1,v:count)<CR>
|
nnoremap <silent> <Plug>SpeedDatingNowUTC :<C-U>call speeddating#timestamp(1,v:count)<CR>
|
||||||
|
|
||||||
|
for [s:key, s:type] in [['<C-A>', 'Up'], ['<C-X>', 'Down']]
|
||||||
|
let s:rhs = maparg(s:key, 'n')
|
||||||
|
if !empty(maparg('<Plug>SpeedDatingFallback'.s:type, 'n'))
|
||||||
|
continue
|
||||||
|
elseif s:rhs =~# '^$\|^<Plug>SpeedDating'
|
||||||
|
exe 'nnoremap <Plug>SpeedDatingFallback'.s:type s:key
|
||||||
|
else
|
||||||
|
exe 'nmap <Plug>SpeedDatingFallback'.s:type s:rhs
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
if !exists("g:speeddating_no_mappings") || !g:speeddating_no_mappings
|
if !exists("g:speeddating_no_mappings") || !g:speeddating_no_mappings
|
||||||
nmap <C-A> <Plug>SpeedDatingUp
|
nmap <C-A> <Plug>SpeedDatingUp
|
||||||
nmap <C-X> <Plug>SpeedDatingDown
|
nmap <C-X> <Plug>SpeedDatingDown
|
||||||
|
|
2
pack/acp/start/vim-surround/.github/FUNDING.yml
vendored
Normal file
2
pack/acp/start/vim-surround/.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
github: tpope
|
||||||
|
custom: ["https://www.paypal.me/vimpope"]
|
|
@ -1,5 +1,4 @@
|
||||||
surround.vim
|
# surround.vim
|
||||||
============
|
|
||||||
|
|
||||||
Surround.vim is all about "surroundings": parentheses, brackets, quotes,
|
Surround.vim is all about "surroundings": parentheses, brackets, quotes,
|
||||||
XML tags, and more. The plugin provides mappings to easily delete,
|
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
|
The `.` command will work with `ds`, `cs`, and `yss` if you install
|
||||||
[repeat.vim](https://github.com/tpope/vim-repeat).
|
[repeat.vim](https://github.com/tpope/vim-repeat).
|
||||||
|
|
||||||
Installation
|
## Installation
|
||||||
------------
|
|
||||||
|
|
||||||
If you don't have a preferred installation method, I recommend
|
Install using your favorite package manager, or use Vim's built-in package
|
||||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
support:
|
||||||
then simply copy and paste:
|
|
||||||
|
|
||||||
cd ~/.vim/bundle
|
mkdir -p ~/.vim/pack/tpope/start
|
||||||
git clone git://github.com/tpope/vim-surround.git
|
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
|
## Contributing
|
||||||
`:help surround`.
|
|
||||||
|
|
||||||
Contributing
|
|
||||||
------------
|
|
||||||
|
|
||||||
See the contribution guidelines for
|
See the contribution guidelines for
|
||||||
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).
|
[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
|
[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
|
[vim.org](https://www.vim.org/scripts/script.php?script_id=1697).
|
||||||
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
|
||||||
[Twitter](http://twitter.com/tpope) and
|
|
||||||
[GitHub](https://github.com/tpope).
|
|
||||||
|
|
||||||
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.
|
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
||||||
See `:help license`.
|
See `:help license`.
|
||||||
|
|
|
@ -130,9 +130,20 @@ code blocks in C-style languages, <C-}> (which is really <C-]>) adds braces on
|
||||||
lines separate from the content.
|
lines separate from the content.
|
||||||
|
|
||||||
If t or < is used, Vim prompts for an HTML/XML tag to insert. You may specify
|
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
|
attributes here and they will be stripped from the closing tag. If replacing a
|
||||||
input by pressing <CR> or >. If <C-T> is used, the tags will appear on lines
|
tag, its attributes are kept in the new tag. End your input with > to discard
|
||||||
by themselves.
|
the those attributes. If <C-T> is used, the tags will appear on lines by
|
||||||
|
themselves.
|
||||||
|
|
||||||
|
If f, F, or <C-F> 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. <C-F> inserts the
|
||||||
|
function name inside the parentheses.
|
||||||
|
|
||||||
|
Old text Command New text ~
|
||||||
|
"hello" ysWfprint<cr> print("hello")
|
||||||
|
"hello" ysWFprint<cr> print( "hello" )
|
||||||
|
"hello" ysW<C-f>print<cr> (print "hello")
|
||||||
|
|
||||||
If s is used, a leading but not trailing space is added. This is useful for
|
If s is used, a leading but not trailing space is added. This is useful for
|
||||||
removing parentheses from a function call with csbs.
|
removing parentheses from a function call with csbs.
|
||||||
|
|
|
@ -92,7 +92,7 @@ function! s:process(string)
|
||||||
let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i))
|
let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i))
|
||||||
if m != ''
|
if m != ''
|
||||||
let m = substitute(strpart(m,1),'\r.*','','')
|
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
|
endif
|
||||||
endfor
|
endfor
|
||||||
let s = ""
|
let s = ""
|
||||||
|
@ -124,13 +124,12 @@ function! s:process(string)
|
||||||
return s
|
return s
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:wrap(string,char,type,...)
|
function! s:wrap(string,char,type,removed,special)
|
||||||
let keeper = a:string
|
let keeper = a:string
|
||||||
let newchar = a:char
|
let newchar = a:char
|
||||||
let s:input = ""
|
let s:input = ""
|
||||||
let type = a:type
|
let type = a:type
|
||||||
let linemode = type ==# 'V' ? 1 : 0
|
let linemode = type ==# 'V' ? 1 : 0
|
||||||
let special = a:0 ? a:1 : 0
|
|
||||||
let before = ""
|
let before = ""
|
||||||
let after = ""
|
let after = ""
|
||||||
if type ==# "V"
|
if type ==# "V"
|
||||||
|
@ -165,13 +164,13 @@ function! s:wrap(string,char,type,...)
|
||||||
elseif newchar ==# ':'
|
elseif newchar ==# ':'
|
||||||
let before = ':'
|
let before = ':'
|
||||||
let after = ''
|
let after = ''
|
||||||
elseif newchar =~# "[tT\<C-T><,]"
|
elseif newchar =~# "[tT\<C-T><]"
|
||||||
let dounmapp = 0
|
let dounmapp = 0
|
||||||
let dounmapb = 0
|
let dounmapb = 0
|
||||||
if !maparg(">","c")
|
if !maparg(">","c")
|
||||||
let dounmapb = 1
|
let dounmapb = 1
|
||||||
" Hide from AsNeeded
|
" Hide from AsNeeded
|
||||||
exe "cn"."oremap > <CR>"
|
exe "cn"."oremap > ><CR>"
|
||||||
endif
|
endif
|
||||||
let default = ""
|
let default = ""
|
||||||
if newchar ==# "T"
|
if newchar ==# "T"
|
||||||
|
@ -181,21 +180,27 @@ function! s:wrap(string,char,type,...)
|
||||||
let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>')
|
let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>')
|
||||||
endif
|
endif
|
||||||
let tag = input("<",default)
|
let tag = input("<",default)
|
||||||
echo "<".substitute(tag,'>*$','>','')
|
|
||||||
if dounmapb
|
if dounmapb
|
||||||
silent! cunmap >
|
silent! cunmap >
|
||||||
endif
|
endif
|
||||||
let s:input = tag
|
let s:input = tag
|
||||||
if tag != ""
|
if tag != ""
|
||||||
|
let keepAttributes = ( match(tag, ">$") == -1 )
|
||||||
let tag = substitute(tag,'>*$','','')
|
let tag = substitute(tag,'>*$','','')
|
||||||
|
let attributes = ""
|
||||||
|
if keepAttributes
|
||||||
|
let attributes = matchstr(a:removed, '<[^ \t\n]\+\zs\_.\{-\}\ze>')
|
||||||
|
endif
|
||||||
let s:input = tag . '>'
|
let s:input = tag . '>'
|
||||||
let before = '<'.tag.'>'
|
|
||||||
if tag =~ '/$'
|
if tag =~ '/$'
|
||||||
|
let tag = substitute(tag, '/$', '', '')
|
||||||
|
let before = '<'.tag.attributes.' />'
|
||||||
let after = ''
|
let after = ''
|
||||||
else
|
else
|
||||||
|
let before = '<'.tag.attributes.'>'
|
||||||
let after = '</'.substitute(tag,' .*','','').'>'
|
let after = '</'.substitute(tag,' .*','','').'>'
|
||||||
endif
|
endif
|
||||||
if newchar == "\<C-T>" || newchar == ","
|
if newchar == "\<C-T>"
|
||||||
if type ==# "v" || type ==# "V"
|
if type ==# "v" || type ==# "V"
|
||||||
let before .= "\n\t"
|
let before .= "\n\t"
|
||||||
endif
|
endif
|
||||||
|
@ -207,10 +212,11 @@ function! s:wrap(string,char,type,...)
|
||||||
elseif newchar ==# 'l' || newchar == '\'
|
elseif newchar ==# 'l' || newchar == '\'
|
||||||
" LaTeX
|
" LaTeX
|
||||||
let env = input('\begin{')
|
let env = input('\begin{')
|
||||||
let env = '{' . env
|
|
||||||
let env .= s:closematch(env)
|
|
||||||
echo '\begin'.env
|
|
||||||
if env != ""
|
if env != ""
|
||||||
|
let s:input = env."\<CR>"
|
||||||
|
let env = '{' . env
|
||||||
|
let env .= s:closematch(env)
|
||||||
|
echo '\begin'.env
|
||||||
let before = '\begin'.env
|
let before = '\begin'.env
|
||||||
let after = '\end'.matchstr(env,'[^}]*').'}'
|
let after = '\end'.matchstr(env,'[^}]*').'}'
|
||||||
endif
|
endif
|
||||||
|
@ -246,7 +252,7 @@ function! s:wrap(string,char,type,...)
|
||||||
let after = ''
|
let after = ''
|
||||||
endif
|
endif
|
||||||
let after = substitute(after ,'\n','\n'.initspaces,'g')
|
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 before = substitute(before,' \+$','','')
|
||||||
let after = substitute(after ,'^ \+','','')
|
let after = substitute(after ,'^ \+','','')
|
||||||
if after !~ '^\n'
|
if after !~ '^\n'
|
||||||
|
@ -257,11 +263,16 @@ function! s:wrap(string,char,type,...)
|
||||||
elseif keeper =~ '\n$' && after =~ '^\n'
|
elseif keeper =~ '\n$' && after =~ '^\n'
|
||||||
let after = strpart(after,1)
|
let after = strpart(after,1)
|
||||||
endif
|
endif
|
||||||
if before !~ '\n\s*$'
|
if keeper !~ '^\n' && before !~ '\n\s*$'
|
||||||
let before .= "\n"
|
let before .= "\n"
|
||||||
if special
|
if a:special
|
||||||
let before .= "\t"
|
let before .= "\t"
|
||||||
endif
|
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
|
||||||
endif
|
endif
|
||||||
if type ==# 'V'
|
if type ==# 'V'
|
||||||
|
@ -289,11 +300,10 @@ function! s:wrap(string,char,type,...)
|
||||||
return keeper
|
return keeper
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:wrapreg(reg,char,...)
|
function! s:wrapreg(reg,char,removed,special)
|
||||||
let orig = getreg(a:reg)
|
let orig = getreg(a:reg)
|
||||||
let type = substitute(getregtype(a:reg),'\d\+$','','')
|
let type = substitute(getregtype(a:reg),'\d\+$','','')
|
||||||
let special = a:0 ? a:1 : 0
|
let new = s:wrap(orig,a:char,type,a:removed,a:special)
|
||||||
let new = s:wrap(orig,a:char,type,special)
|
|
||||||
call setreg(a:reg,new,type)
|
call setreg(a:reg,new,type)
|
||||||
endfunction
|
endfunction
|
||||||
" }}}1
|
" }}}1
|
||||||
|
@ -314,7 +324,7 @@ function! s:insert(...) " {{{1
|
||||||
set clipboard-=unnamed clipboard-=unnamedplus
|
set clipboard-=unnamed clipboard-=unnamedplus
|
||||||
let reg_save = @@
|
let reg_save = @@
|
||||||
call setreg('"',"\r",'v')
|
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,
|
" 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
|
" remove the initial newline. This fits a use case of mine but is a
|
||||||
" little inconsistent. Is there anyone that would prefer the simpler
|
" little inconsistent. Is there anyone that would prefer the simpler
|
||||||
|
@ -326,7 +336,16 @@ function! s:insert(...) " {{{1
|
||||||
if exists("g:surround_insert_tail")
|
if exists("g:surround_insert_tail")
|
||||||
call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
|
call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
|
||||||
endif
|
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
|
norm! ""p
|
||||||
else
|
else
|
||||||
norm! ""P
|
norm! ""P
|
||||||
|
@ -381,7 +400,7 @@ function! s:dosurround(...) " {{{1
|
||||||
let strcount = (scount == 1 ? "" : scount)
|
let strcount = (scount == 1 ? "" : scount)
|
||||||
if char == '/'
|
if char == '/'
|
||||||
exe 'norm! '.strcount.'[/d'.strcount.']/'
|
exe 'norm! '.strcount.'[/d'.strcount.']/'
|
||||||
elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>"''`]'
|
elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>"''`]'
|
||||||
exe 'norm! T'.char
|
exe 'norm! T'.char
|
||||||
if getline('.')[col('.')-1] == char
|
if getline('.')[col('.')-1] == char
|
||||||
exe 'norm! l'
|
exe 'norm! l'
|
||||||
|
@ -411,7 +430,7 @@ function! s:dosurround(...) " {{{1
|
||||||
norm! "_x
|
norm! "_x
|
||||||
call setreg('"','/**/',"c")
|
call setreg('"','/**/',"c")
|
||||||
let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
|
let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
|
||||||
elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]'
|
elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>]'
|
||||||
exe 'norm! F'.char
|
exe 'norm! F'.char
|
||||||
exe 'norm! df'.char
|
exe 'norm! df'.char
|
||||||
else
|
else
|
||||||
|
@ -428,7 +447,7 @@ function! s:dosurround(...) " {{{1
|
||||||
let keeper = substitute(keeper,'^\s\+','','')
|
let keeper = substitute(keeper,'^\s\+','','')
|
||||||
let keeper = substitute(keeper,'\s\+$','','')
|
let keeper = substitute(keeper,'\s\+$','','')
|
||||||
endif
|
endif
|
||||||
if col("']") == col("$") && col('.') + 1 == col('$')
|
if col("']") == col("$") && virtcol('.') + 1 == virtcol('$')
|
||||||
if oldhead =~# '^\s*$' && a:0 < 2
|
if oldhead =~# '^\s*$' && a:0 < 2
|
||||||
let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
|
let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
|
||||||
endif
|
endif
|
||||||
|
@ -442,7 +461,7 @@ function! s:dosurround(...) " {{{1
|
||||||
call setreg('"',keeper,regtype)
|
call setreg('"',keeper,regtype)
|
||||||
if newchar != ""
|
if newchar != ""
|
||||||
let special = a:0 > 2 ? a:3 : 0
|
let special = a:0 > 2 ? a:3 : 0
|
||||||
call s:wrapreg('"',newchar, special)
|
call s:wrapreg('"',newchar,removed,special)
|
||||||
endif
|
endif
|
||||||
silent exe 'norm! ""'.pcmd.'`['
|
silent exe 'norm! ""'.pcmd.'`['
|
||||||
if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n'
|
if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n'
|
||||||
|
@ -473,7 +492,11 @@ function! s:changesurround(...) " {{{1
|
||||||
call s:dosurround(a,b,a:0 && a:1)
|
call s:dosurround(a,b,a:0 && a:1)
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! s:opfunc(type,...) " {{{1
|
function! s:opfunc(type, ...) abort " {{{1
|
||||||
|
if a:type ==# 'setup'
|
||||||
|
let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$')
|
||||||
|
return 'g@'
|
||||||
|
endif
|
||||||
let char = s:inputreplacement()
|
let char = s:inputreplacement()
|
||||||
if char == ""
|
if char == ""
|
||||||
return s:beep()
|
return s:beep()
|
||||||
|
@ -518,7 +541,7 @@ function! s:opfunc(type,...) " {{{1
|
||||||
let keeper = substitute(keeper,'\_s\@<!\s*$','','')
|
let keeper = substitute(keeper,'\_s\@<!\s*$','','')
|
||||||
endif
|
endif
|
||||||
call setreg(reg,keeper,type)
|
call setreg(reg,keeper,type)
|
||||||
call s:wrapreg(reg,char,a:0 && a:1)
|
call s:wrapreg(reg,char,"",a:0 && a:1)
|
||||||
if type ==# "v" && a:type !=# "v" && append != ""
|
if type ==# "v" && a:type !=# "v" && append != ""
|
||||||
call setreg(reg,append,"ac")
|
call setreg(reg,append,"ac")
|
||||||
endif
|
endif
|
||||||
|
@ -536,8 +559,12 @@ function! s:opfunc(type,...) " {{{1
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:opfunc2(arg)
|
function! s:opfunc2(...) abort
|
||||||
call s:opfunc(a:arg,1)
|
if !a:0 || a:1 ==# 'setup'
|
||||||
|
let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$')
|
||||||
|
return 'g@'
|
||||||
|
endif
|
||||||
|
call s:opfunc(a:1, 1)
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! s:closematch(str) " {{{1
|
function! s:closematch(str) " {{{1
|
||||||
|
@ -560,11 +587,10 @@ nnoremap <silent> <Plug>SurroundRepeat .
|
||||||
nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR>
|
nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR>
|
||||||
nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR>
|
nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR>
|
||||||
nnoremap <silent> <Plug>CSurround :<C-U>call <SID>changesurround(1)<CR>
|
nnoremap <silent> <Plug>CSurround :<C-U>call <SID>changesurround(1)<CR>
|
||||||
nnoremap <silent> <Plug>Yssurround :<C-U>call <SID>opfunc(v:count1)<CR>
|
nnoremap <expr> <Plug>Yssurround '^'.v:count1.<SID>opfunc('setup').'g_'
|
||||||
nnoremap <silent> <Plug>YSsurround :<C-U>call <SID>opfunc2(v:count1)<CR>
|
nnoremap <expr> <Plug>YSsurround <SID>opfunc2('setup').'_'
|
||||||
" <C-U> discards the numerical argument but there's not much we can do with it
|
nnoremap <expr> <Plug>Ysurround <SID>opfunc('setup')
|
||||||
nnoremap <silent> <Plug>Ysurround :<C-U>set opfunc=<SID>opfunc<CR>g@
|
nnoremap <expr> <Plug>YSurround <SID>opfunc2('setup')
|
||||||
nnoremap <silent> <Plug>YSurround :<C-U>set opfunc=<SID>opfunc2<CR>g@
|
|
||||||
vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR>
|
vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR>
|
||||||
vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR>
|
vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR>
|
||||||
inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR>
|
inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR>
|
||||||
|
|
Loading…
Reference in a new issue