diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 08:50:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 08:50:31 +0000 |
commit | aed8ce9da277f5ecffe968b324f242c41c3b752a (patch) | |
tree | d2e538394cb7a8a7c42a4aac6ccf1a8e3256999b /runtime/plugin | |
parent | Initial commit. (diff) | |
download | vim-aed8ce9da277f5ecffe968b324f242c41c3b752a.tar.xz vim-aed8ce9da277f5ecffe968b324f242c41c3b752a.zip |
Adding upstream version 2:9.0.1378.upstream/2%9.0.1378upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/plugin')
-rw-r--r-- | runtime/plugin/README.txt | 21 | ||||
-rw-r--r-- | runtime/plugin/getscriptPlugin.vim | 41 | ||||
-rw-r--r-- | runtime/plugin/gzip.vim | 60 | ||||
-rw-r--r-- | runtime/plugin/logiPat.vim | 339 | ||||
-rw-r--r-- | runtime/plugin/manpager.vim | 51 | ||||
-rw-r--r-- | runtime/plugin/matchparen.vim | 225 | ||||
-rw-r--r-- | runtime/plugin/netrwPlugin.vim | 223 | ||||
-rw-r--r-- | runtime/plugin/rrhelper.vim | 48 | ||||
-rw-r--r-- | runtime/plugin/spellfile.vim | 15 | ||||
-rw-r--r-- | runtime/plugin/tarPlugin.vim | 56 | ||||
-rw-r--r-- | runtime/plugin/tohtml.vim | 235 | ||||
-rw-r--r-- | runtime/plugin/vimballPlugin.vim | 43 | ||||
-rw-r--r-- | runtime/plugin/zipPlugin.vim | 56 |
13 files changed, 1413 insertions, 0 deletions
diff --git a/runtime/plugin/README.txt b/runtime/plugin/README.txt new file mode 100644 index 0000000..11bf1e9 --- /dev/null +++ b/runtime/plugin/README.txt @@ -0,0 +1,21 @@ +The plugin directory is for standard Vim plugin scripts. + +All files here ending in .vim will be sourced by Vim when it starts up. +Look in the file for hints on how it can be disabled without deleting it. + +getscriptPlugin.vim get latest version of Vim scripts +gzip.vim edit compressed files +logiPat.vim logical operators on patterns +manpager.vim using Vim as manpager +matchparen.vim highlight paren matching the one under the cursor +netrwPlugin.vim edit files over a network and browse (remote) directories +rrhelper.vim used for --remote-wait editing +spellfile.vim download a spellfile when it's missing +tarPlugin.vim edit (compressed) tar files +tohtml.vim convert a file with syntax highlighting to HTML +vimballPlugin.vim create and unpack .vba files +zipPlugin.vim edit zip archives + +Note: the explorer.vim plugin is no longer here, the netrw.vim plugin has +taken over browsing directories (also for remote directories). + diff --git a/runtime/plugin/getscriptPlugin.vim b/runtime/plugin/getscriptPlugin.vim new file mode 100644 index 0000000..8faa029 --- /dev/null +++ b/runtime/plugin/getscriptPlugin.vim @@ -0,0 +1,41 @@ +" --------------------------------------------------------------------- +" getscriptPlugin.vim +" Author: Charles E. Campbell +" Date: Nov 29, 2013 +" Installing: :help glvs-install +" Usage: :help glvs +" +" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim +" +" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let +" all the peoples praise Him." +" --------------------------------------------------------------------- +" Initialization: {{{1 +" if you're sourcing this file, surely you can't be +" expecting vim to be in its vi-compatible mode +if exists("g:loaded_getscriptPlugin") + finish +endif +if &cp + if &verbose + echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" + endif + finish +endif +let g:loaded_getscriptPlugin = "v36" +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() +com! -nargs=0 GetScripts call getscript#GetLatestVimScripts() +sil! com -nargs=0 GLVS call getscript#GetLatestVimScripts() + +" --------------------------------------------------------------------- +" Restore Options: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo + +" --------------------------------------------------------------------- +" vim: ts=8 sts=2 fdm=marker nowrap diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim new file mode 100644 index 0000000..7214488 --- /dev/null +++ b/runtime/plugin/gzip.vim @@ -0,0 +1,60 @@ +" Vim plugin for editing compressed files. +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2016 Oct 30 + +" Exit quickly when: +" - this plugin was already loaded +" - when 'compatible' is set +" - some autocommands are already taking care of compressed files +if exists("loaded_gzip") || &cp || exists("#BufReadPre#*.gz") + finish +endif +let loaded_gzip = 1 + +augroup gzip + " Remove all gzip autocommands + au! + + " Enable editing of gzipped files. + " The functions are defined in autoload/gzip.vim. + " + " Set binary mode before reading the file. + " Use "gzip -d", gunzip isn't always available. + autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz,*.zst,*.br,*.lzo setlocal bin + autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") + autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") + autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") + autocmd BufReadPost,FileReadPost *.lzma call gzip#read("lzma -d") + autocmd BufReadPost,FileReadPost *.xz call gzip#read("xz -d") + autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d") + autocmd BufReadPost,FileReadPost *.zst call gzip#read("zstd -d --rm") + autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm") + autocmd BufReadPost,FileReadPost *.lzo call gzip#read("lzop -d -U") + autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") + autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") + autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") + autocmd BufWritePost,FileWritePost *.lzma call gzip#write("lzma -z") + autocmd BufWritePost,FileWritePost *.xz call gzip#write("xz -z") + autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip") + autocmd BufWritePost,FileWritePost *.zst call gzip#write("zstd --rm") + autocmd BufWritePost,FileWritePost *.br call gzip#write("brotli --rm") + autocmd BufWritePost,FileWritePost *.lzo call gzip#write("lzop -U") + autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") + autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") + autocmd FileAppendPre *.Z call gzip#appre("uncompress") + autocmd FileAppendPre *.lzma call gzip#appre("lzma -d") + autocmd FileAppendPre *.xz call gzip#appre("xz -d") + autocmd FileAppendPre *.lz call gzip#appre("lzip -d") + autocmd FileAppendPre *.zst call gzip#appre("zstd -d --rm") + autocmd FileAppendPre *.br call gzip#appre("brotli -d --rm") + autocmd FileAppendPre *.lzo call gzip#appre("lzop -d -U") + autocmd FileAppendPost *.gz call gzip#write("gzip") + autocmd FileAppendPost *.bz2 call gzip#write("bzip2") + autocmd FileAppendPost *.Z call gzip#write("compress -f") + autocmd FileAppendPost *.lzma call gzip#write("lzma -z") + autocmd FileAppendPost *.xz call gzip#write("xz -z") + autocmd FileAppendPost *.lz call gzip#write("lzip") + autocmd FileAppendPost *.zst call gzip#write("zstd --rm") + autocmd FileAppendPost *.br call gzip#write("brotli --rm") + autocmd FileAppendPost *.lzo call gzip#write("lzop -U") +augroup END diff --git a/runtime/plugin/logiPat.vim b/runtime/plugin/logiPat.vim new file mode 100644 index 0000000..47fabe9 --- /dev/null +++ b/runtime/plugin/logiPat.vim @@ -0,0 +1,339 @@ +" LogiPat: Boolean logical pattern matcher +" Author: Charles E. Campbell +" Date: Apr 04, 2016 +" Version: 4 +" Purpose: to do Boolean-logic based regular expression pattern matching +" Copyright: Copyright (C) 1999-2011 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like most anything else that's free, +" LogiPat.vim is provided *as is* and comes with no warranty +" of any kind, either expressed or implied. By using this +" plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. +" +" Usage: {{{1 +" :LogiPat ... +" +" Boolean logic supported: +" () grouping operators +" ! not the following pattern +" | logical or +" & logical and +" "..pattern.." +" Example: {{{1 +" :LogiPat !("january"|"february") +" would match all strings not containing the strings january +" or february +" GetLatestVimScripts: 1290 1 :AutoInstall: LogiPat.vim +" +" Behold, you will conceive in your womb, and bring forth a son, {{{1 +" and will call his name Jesus. He will be great, and will be +" called the Son of the Most High. The Lord God will give him the +" throne of his father, David, and he will reign over the house of +" Jacob forever. There will be no end to his kingdom. (Luke 1:31-33 WEB) + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("loaded_logiPat") + finish +endif +let g:loaded_logiPat = "v4" +let s:keepcpo = &cpo +set cpo&vim +"DechoRemOn + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=* LogiPat call LogiPat(<q-args>,1) +sil! com -nargs=* LP call LogiPat(<q-args>,1) +sil! com -nargs=* LPR call LogiPat(<q-args>,1,"r") +com! -nargs=+ LPE echomsg LogiPat(<q-args>) +com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>" +sil! com -nargs=+ LPF let s:LogiPatFlags="<args>" + +" ===================================================================== +" Functions: {{{1 + +" --------------------------------------------------------------------- +" LogiPat: this function interprets the boolean-logic pattern {{{2 +fun! LogiPat(pat,...) +" call Dfunc("LogiPat(pat<".a:pat.">)") + + " LogiPat(pat,dosearch) + if a:0 > 0 + let dosearch= a:1 + else + let dosearch= 0 + endif + if a:0 >= 3 + let s:LogiPatFlags= a:3 + endif + + let s:npatstack = 0 + let s:nopstack = 0 + let s:preclvl = 0 + let expr = a:pat + + " Lexer/Parser + while expr != "" +" call Decho("expr<".expr.">") + + if expr =~ '^"' + " push a Pattern; accept "" as a single " in the pattern + let expr = substitute(expr,'^\s*"','','') + let pat = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\1','') + let pat = substitute(pat,'""','"','g') + let expr = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\2','') + let expr = substitute(expr,'^\s*','','') +" call Decho("pat<".pat."> expr<".expr.">") + + call s:LP_PatPush('.*'.pat.'.*') + + elseif expr =~ '^[!()|&]' + " push an operator + let op = strpart(expr,0,1) + let expr = strpart(expr,strlen(op)) + " allow for those who can't resist doubling their and/or operators + if op =~ '[|&]' && expr[0] == op + let expr = strpart(expr,strlen(op)) + endif + call s:LP_OpPush(op) + + elseif expr =~ '^\s' + " skip whitespace + let expr= strpart(expr,1) + + else + echoerr "operator<".strpart(expr,0,1)."> not supported (yet)" + let expr= strpart(expr,1) + endif + + endwhile + + " Final Execution + call s:LP_OpPush('Z') + + let result= s:LP_PatPop(1) +" call Decho("result=".result) + + " sanity checks and cleanup + if s:npatstack > 0 + echoerr s:npatstack." patterns left on stack!" + let s:npatstack= 0 + endif + if s:nopstack > 0 + echoerr s:nopstack." operators left on stack!" + let s:nopstack= 0 + endif + + " perform the indicated search + if dosearch + if exists("s:LogiPatFlags") && s:LogiPatFlags != "" +" call Decho("search(result<".result."> LogiPatFlags<".s:LogiPatFlags.">)") + call search(result,s:LogiPatFlags) + else +" call Decho("search(result<".result.">)") + call search(result) + endif + let @/= result + endif + +" call Dret("LogiPat ".result) + return result +endfun + +" --------------------------------------------------------------------- +" s:String: Vim6.4 doesn't have string() {{{2 +func! s:String(str) + return "'".escape(a:str, '"')."'" +endfunc + +" --------------------------------------------------------------------- +" LP_PatPush: {{{2 +fun! s:LP_PatPush(pat) +" call Dfunc("LP_PatPush(pat<".a:pat.">)") + let s:npatstack = s:npatstack + 1 + let s:patstack_{s:npatstack} = a:pat +" call s:StackLook("patpush") "Decho +" call Dret("LP_PatPush : npatstack=".s:npatstack) +endfun + +" --------------------------------------------------------------------- +" LP_PatPop: pop a number/variable from LogiPat's pattern stack {{{2 +fun! s:LP_PatPop(lookup) +" call Dfunc("LP_PatPop(lookup=".a:lookup.")") + if s:npatstack > 0 + let ret = s:patstack_{s:npatstack} + let s:npatstack = s:npatstack - 1 + else + let ret= "---error---" + echoerr "(LogiPat) invalid expression" + endif +" call s:StackLook("patpop") "Decho +" call Dret("LP_PatPop ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_OpPush: {{{2 +fun! s:LP_OpPush(op) +" call Dfunc("LP_OpPush(op<".a:op.">)") + + " determine new operator's precedence level + if a:op == '(' + let s:preclvl= s:preclvl + 10 + let preclvl = s:preclvl + elseif a:op == ')' + let s:preclvl= s:preclvl - 10 + if s:preclvl < 0 + let s:preclvl= 0 + echoerr "too many )s" + endif + let preclvl= s:preclvl + elseif a:op =~ '|' + let preclvl= s:preclvl + 2 + elseif a:op =~ '&' + let preclvl= s:preclvl + 4 + elseif a:op == '!' + let preclvl= s:preclvl + 6 + elseif a:op == 'Z' + let preclvl= -1 + else + echoerr "expr<".expr."> not supported (yet)" + let preclvl= s:preclvl + endif +" call Decho("new operator<".a:op."> preclvl=".preclvl) + + " execute higher-precdence operators +" call Decho("execute higher-precedence operators") + call s:LP_Execute(preclvl) + + " push new operator onto operator-stack +" call Decho("push new operator<".a:op."> onto stack with preclvl=".preclvl." at nopstack=".(s:nopstack+1)) + if a:op =~ '!' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + elseif a:op =~ '|' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + elseif a:op == '&' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + endif + +" call s:StackLook("oppush") "Decho +" call Dret("LP_OpPush : s:preclvl=".s:preclvl) +endfun + +" --------------------------------------------------------------------- +" LP_Execute: execute operators from opstack using pattern stack {{{2 +fun! s:LP_Execute(preclvl) +" call Dfunc("LP_Execute(preclvl=".a:preclvl.") npatstack=".s:npatstack." nopstack=".s:nopstack) + + " execute all higher precedence operators + while s:nopstack > 0 && a:preclvl < s:opprec_{s:nopstack} + let op= s:opstack_{s:nopstack} +" call Decho("op<".op."> nop=".s:nopstack." [preclvl=".a:preclvl."] < [opprec_".s:nopstack."=".s:opprec_{s:nopstack}."]") + + let s:nopstack = s:nopstack - 1 + + if op == '!' + let n1= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_Not(n1)) + + elseif op == '|' + let n1= s:LP_PatPop(1) + let n2= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_Or(n2,n1)) + + elseif op =~ '&' + let n1= s:LP_PatPop(1) + let n2= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_And(n2,n1)) + endif + +" call s:StackLook("execute") "Decho + endwhile + +" call Dret("LP_Execute") +endfun + +" --------------------------------------------------------------------- +" LP_Not: writes a logical-not for a pattern {{{2 +fun! s:LP_Not(pat) +" call Dfunc("LP_Not(pat<".a:pat.">)") + if a:pat =~ '^\.\*' && a:pat =~ '\.\*$' + let pat= substitute(a:pat,'^\.\*\(.*\)\.\*$','\1','') + let ret= '^\%(\%('.pat.'\)\@!.\)*$' + else + let ret= '^\%(\%('.a:pat.'\)\@!.\)*$' + endif +" call Dret("LP_Not ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_Or: writes a logical-or branch using two patterns {{{2 +fun! s:LP_Or(pat1,pat2) +" call Dfunc("LP_Or(pat1<".a:pat1."> pat2<".a:pat2.">)") + let ret= '\%('.a:pat1.'\|'.a:pat2.'\)' +" call Dret("LP_Or ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_And: writes a logical-and concat using two patterns {{{2 +fun! s:LP_And(pat1,pat2) +" call Dfunc("LP_And(pat1<".a:pat1."> pat2<".a:pat2.">)") + let ret= '\%('.a:pat1.'\&'.a:pat2.'\)' +" call Dret("LP_And ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" StackLook: {{{2 +fun! s:StackLook(description) +" call Dfunc("StackLook(description<".a:description.">)") + let iop = 1 + let ifp = 1 +" call Decho("Pattern Operator") + + " print both pattern and operator + while ifp <= s:npatstack && iop <= s:nopstack + let fp = s:patstack_{ifp} + let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')' + let fplen= strlen(fp) + if fplen < 30 + let fp= fp.strpart(" ",1,30-fplen) + endif +" call Decho(fp.op) + let ifp = ifp + 1 + let iop = iop + 1 + endwhile + + " print just pattern + while ifp <= s:npatstack + let fp = s:patstack_{ifp} +" call Decho(fp) + let ifp = ifp + 1 + endwhile + + " print just operator + while iop <= s:nopstack + let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')' +" call Decho(" ".op) + let iop = iop + 1 + endwhile +" call Dret("StackLook") +endfun + +" --------------------------------------------------------------------- +" Cleanup And Modeline: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" vim: ts=4 fdm=marker diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim new file mode 100644 index 0000000..1738dc9 --- /dev/null +++ b/runtime/plugin/manpager.vim @@ -0,0 +1,51 @@ +" Vim plugin for using Vim as manpager. +" Maintainer: Enno Nagel <ennonagel+vim@gmail.com> +" Last Change: 2022 Oct 17 + +if exists('g:loaded_manpager_plugin') + finish +endif +let g:loaded_manpager_plugin = 1 + +" Set up the current buffer (likely read from stdin) as a manpage +command MANPAGER call s:ManPager() + +function s:ManPager() + " global options, keep these to a minimum to avoid side effects + if &compatible + set nocompatible + endif + if exists('+viminfofile') + set viminfofile=NONE + endif + syntax on + + " Make this an unlisted, readonly scratch buffer + setlocal buftype=nofile noswapfile bufhidden=hide nobuflisted readonly + + " Ensure text width matches window width + setlocal foldcolumn& nofoldenable nonumber norelativenumber + + " In case Vim was invoked with -M + setlocal modifiable + + " Emulate 'col -b' + silent! keepj keepp %s/\v(.)\b\ze\1?//ge + + " Remove ansi sequences + silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge + + " Remove empty lines above the header + call cursor(1, 1) + let n = search(".*(.*)", "c") + if n > 1 + exe "1," . n-1 . "d" + endif + + " Finished preprocessing the buffer, prevent any further modifications + setlocal nomodified nomodifiable + + " Set filetype to man even if ftplugin is disabled + setlocal filetype=man + runtime ftplugin/man.vim +endfunction diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim new file mode 100644 index 0000000..e19b283 --- /dev/null +++ b/runtime/plugin/matchparen.vim @@ -0,0 +1,225 @@ +" Vim plugin for showing matching parens +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2022 Dec 01 + +" Exit quickly when: +" - this plugin was already loaded (or disabled) +" - when 'compatible' is set +if exists("g:loaded_matchparen") || &cp + finish +endif +let g:loaded_matchparen = 1 + +if !exists("g:matchparen_timeout") + let g:matchparen_timeout = 300 +endif +if !exists("g:matchparen_insert_timeout") + let g:matchparen_insert_timeout = 60 +endif + +augroup matchparen + " Replace all matchparen autocommands + autocmd! CursorMoved,CursorMovedI,WinEnter,BufWinEnter,WinScrolled * call s:Highlight_Matching_Pair() + autocmd! WinLeave,BufLeave * call s:Remove_Matches() + if exists('##TextChanged') + autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair() + endif +augroup END + +" Skip the rest if it was already done. +if exists("*s:Highlight_Matching_Pair") + finish +endif + +let s:cpo_save = &cpo +set cpo-=C + +" The function that is invoked (very often) to define a ":match" highlighting +" for any matching paren. +func s:Highlight_Matching_Pair() + " Remove any previous match. + call s:Remove_Matches() + + " Avoid that we remove the popup menu. + " Return when there are no colors (looks like the cursor jumps). + if pumvisible() || (&t_Co < 8 && !has("gui_running")) + return + endif + + " Get the character under the cursor and check if it's in 'matchpairs'. + let c_lnum = line('.') + let c_col = col('.') + let before = 0 + + let text = getline(c_lnum) + let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)') + if empty(matches) + let [c_before, c] = ['', ''] + else + let [c_before, c] = matches[1:2] + endif + let plist = split(&matchpairs, '.\zs[:,]') + let i = index(plist, c) + if i < 0 + " not found, in Insert mode try character before the cursor + if c_col > 1 && (mode() == 'i' || mode() == 'R') + let before = strlen(c_before) + let c = c_before + let i = index(plist, c) + endif + if i < 0 + " not found, nothing to do + return + endif + endif + + " Figure out the arguments for searchpairpos(). + if i % 2 == 0 + let s_flags = 'nW' + let c2 = plist[i + 1] + else + let s_flags = 'nbW' + let c2 = c + let c = plist[i - 1] + endif + if c == '[' + let c = '\[' + let c2 = '\]' + endif + + " Find the match. When it was just before the cursor move it there for a + " moment. + if before > 0 + let has_getcurpos = exists("*getcurpos") + if has_getcurpos + " getcurpos() is more efficient but doesn't exist before 7.4.313. + let save_cursor = getcurpos() + else + let save_cursor = winsaveview() + endif + call cursor(c_lnum, c_col - before) + endif + + if !has("syntax") || !exists("g:syntax_on") + let s_skip = "0" + else + " Build an expression that detects whether the current cursor position is + " in certain syntax types (string, comment, etc.), for use as + " searchpairpos()'s skip argument. + " We match "escape" for special items, such as lispEscapeSpecial, and + " match "symbol" for lispBarSymbol. + let s_skip = 'synstack(".", col("."))' + \ . '->indexof({_, id -> synIDattr(id, "name") =~? ' + \ . '"string\\|character\\|singlequote\\|escape\\|symbol\\|comment"}) >= 0' + " If executing the expression determines that the cursor is currently in + " one of the syntax types, then we want searchpairpos() to find the pair + " within those syntax types (i.e., not skip). Otherwise, the cursor is + " outside of the syntax types and s_skip should keep its value so we skip + " any matching pair inside the syntax types. + " Catch if this throws E363: pattern uses more memory than 'maxmempattern'. + try + execute 'if ' . s_skip . ' | let s_skip = "0" | endif' + catch /^Vim\%((\a\+)\)\=:E363/ + " We won't find anything, so skip searching, should keep Vim responsive. + return + endtry + endif + + " Limit the search to lines visible in the window. + let stoplinebottom = line('w$') + let stoplinetop = line('w0') + if i % 2 == 0 + let stopline = stoplinebottom + else + let stopline = stoplinetop + endif + + " Limit the search time to 300 msec to avoid a hang on very long lines. + " This fails when a timeout is not supported. + if mode() == 'i' || mode() == 'R' + let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout + else + let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout + endif + try + let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) + catch /E118/ + " Can't use the timeout, restrict the stopline a bit more to avoid taking + " a long time on closed folds and long lines. + " The "viewable" variables give a range in which we can scroll while + " keeping the cursor at the same position. + " adjustedScrolloff accounts for very large numbers of scrolloff. + let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) + let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) + let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) + " one of these stoplines will be adjusted below, but the current values are + " minimal boundaries within the current window + if i % 2 == 0 + if has("byte_offset") && has("syntax_items") && &smc > 0 + let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) + let stopline = min([bottom_viewable, byte2line(stopbyte)]) + else + let stopline = min([bottom_viewable, c_lnum + 100]) + endif + let stoplinebottom = stopline + else + if has("byte_offset") && has("syntax_items") && &smc > 0 + let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) + let stopline = max([top_viewable, byte2line(stopbyte)]) + else + let stopline = max([top_viewable, c_lnum - 100]) + endif + let stoplinetop = stopline + endif + let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) + endtry + + if before > 0 + if has_getcurpos + call setpos('.', save_cursor) + else + call winrestview(save_cursor) + endif + endif + + " If a match is found setup match highlighting. + if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom + if exists('*matchaddpos') + call matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10, 3) + else + exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . + \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' + endif + let w:paren_hl_on = 1 + endif +endfunction + +func s:Remove_Matches() + if exists('w:paren_hl_on') && w:paren_hl_on + silent! call matchdelete(3) + let w:paren_hl_on = 0 + endif +endfunc + + +" Define commands that will disable and enable the plugin. +command DoMatchParen call s:DoMatchParen() +command NoMatchParen call s:NoMatchParen() + +func s:NoMatchParen() + let w = winnr() + noau windo silent! call matchdelete(3) + unlet! g:loaded_matchparen + exe "noau ". w . "wincmd w" + au! matchparen +endfunc + +func s:DoMatchParen() + runtime plugin/matchparen.vim + let w = winnr() + silent windo doau CursorMoved + exe "noau ". w . "wincmd w" +endfunc + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim new file mode 100644 index 0000000..d309f81 --- /dev/null +++ b/runtime/plugin/netrwPlugin.vim @@ -0,0 +1,223 @@ +" netrwPlugin.vim: Handles file transfer and remote directory listing across a network +" PLUGIN SECTION +" Date: Feb 09, 2021 +" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2021 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided +" *as is* and comes with no warranty of any kind, either +" expressed or implied. By using this plugin, you agree that +" in no event will the copyright holder be liable for any damages +" resulting from the use of this software. +" +" But be doers of the Word, and not only hearers, deluding your own selves {{{1 +" (James 1:22 RSV) +" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +" Load Once: {{{1 +if &cp || exists("g:loaded_netrwPlugin") + finish +endif +let g:loaded_netrwPlugin = "v171" +let s:keepcpo = &cpo +set cpo&vim +"DechoRemOn + +" --------------------------------------------------------------------- +" Public Interface: {{{1 + +" Local Browsing Autocmds: {{{2 +augroup FileExplorer + au! + au BufLeave * if &ft != "netrw"|let w:netrw_prvfile= expand("%:p")|endif + au BufEnter * sil call s:LocalBrowse(expand("<amatch>")) + au VimEnter * sil call s:VimEnter(expand("<amatch>")) + if has("win32") || has("win95") || has("win64") || has("win16") + au BufEnter .* sil call s:LocalBrowse(expand("<amatch>")) + endif +augroup END + +" Network Browsing Reading Writing: {{{2 +augroup Network + au! + au BufReadCmd file://* call netrw#FileUrlEdit(expand("<amatch>")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) + au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) + au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) + try + au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) + catch /^Vim\%((\a\+)\)\=:E216/ + au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) + endtry +augroup END + +" Commands: :Nread, :Nwrite, :NetUserPass {{{2 +com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos) +com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos) +com! -nargs=* NetUserPass call NetUserPass(<f-args>) +com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos) +com! -nargs=? Ntree call netrw#SetTreetop(1,<q-args>) + +" Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2 +com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>) +com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>) +com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>) +com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(<count>,<bang>0,<q-args>) + +" Commands: NetrwSettings {{{2 +com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings() +com! -bang NetrwClean call netrw#Clean(<bang>0) + +" Maps: +if !exists("g:netrw_nogx") + if maparg('gx','n') == "" + if !hasmapto('<Plug>NetrwBrowseX') + nmap <unique> gx <Plug>NetrwBrowseX + endif + nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr> + endif + if maparg('gx','x') == "" + if !hasmapto('<Plug>NetrwBrowseXVis') + xmap <unique> gx <Plug>NetrwBrowseXVis + endif + xno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr> + endif +endif +if exists("g:netrw_usetab") && g:netrw_usetab + if maparg('<c-tab>','n') == "" + nmap <unique> <c-tab> <Plug>NetrwShrink + endif + nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr> +endif + +" --------------------------------------------------------------------- +" LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2 +fun! s:LocalBrowse(dirname) + " Unfortunate interaction -- only DechoMsg debugging calls can be safely used here. + " Otherwise, the BufEnter event gets triggered when attempts to write to + " the DBG buffer are made. + + if !exists("s:vimentered") + " If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will, + " and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined. +" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered doesn't exist)") +" call Dret("s:LocalBrowse") + return + endif + +" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")") + + if has("amiga") + " The check against '' is made for the Amiga, where the empty + " string is the current directory and not checking would break + " things such as the help command. +" call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)") + if a:dirname != '' && isdirectory(a:dirname) + sil! call netrw#LocalBrowseCheck(a:dirname) + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt + exe w:netrw_bannercnt + endif + endif + + elseif isdirectory(a:dirname) +" call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") +" call Dredir("LocalBrowse ft last set: ","verbose set ft") + " Jul 13, 2021: for whatever reason, preceding the following call with + " a sil! causes an unbalanced if-endif vim error + call netrw#LocalBrowseCheck(a:dirname) + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt + exe w:netrw_bannercnt + endif + + else + " not a directory, ignore it +" call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") + endif + +" call Dret("s:LocalBrowse") +endfun + +" --------------------------------------------------------------------- +" s:VimEnter: after all vim startup stuff is done, this function is called. {{{2 +" Its purpose: to look over all windows and run s:LocalBrowse() on +" them, which checks if they're directories and will create a directory +" listing when appropriate. +" It also sets s:vimentered, letting s:LocalBrowse() know that s:VimEnter() +" has already been called. +fun! s:VimEnter(dirname) +" call Dfunc("s:VimEnter(dirname<".a:dirname.">) expand(%)<".expand("%").">") + if has('nvim') || v:version < 802 + " Johann Höchtl: reported that the call range... line causes an E488: Trailing characters + " error with neovim. I suspect its because neovim hasn't updated with recent + " vim patches. As is, this code will have problems with popup terminals + " instantiated before the VimEnter event runs. + " Ingo Karkat : E488 also in Vim 8.1.1602 + let curwin = winnr() + let s:vimentered = 1 + windo call s:LocalBrowse(expand("%:p")) + exe curwin."wincmd w" + else + " the following complicated expression comes courtesy of lacygoill; largely does the same thing as the windo and + " wincmd which are commented out, but avoids some side effects. Allows popup terminal before VimEnter. + let s:vimentered = 1 + call range(1, winnr('$'))->map({_, v -> win_execute(win_getid(v), 'call expand("%:p")->s:LocalBrowse()')}) + endif +" call Dret("s:VimEnter") +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{1 +fun! NetrwStatusLine() +" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".") + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + let &stl= s:netrw_explore_stl + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun + +" ------------------------------------------------------------------------ +" NetUserPass: set username and password for subsequent ftp transfer {{{1 +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +fun! NetUserPass(...) + + " get/set userid + if a:0 == 0 +" call Dfunc("NetUserPass(a:0<".a:0.">)") + if !exists("g:netrw_uid") || g:netrw_uid == "" + " via prompt + let g:netrw_uid= input('Enter username: ') + endif + else " from command line +" call Dfunc("NetUserPass(a:1<".a:1.">) {") + let g:netrw_uid= a:1 + endif + + " get password + if a:0 <= 1 " via prompt +" call Decho("a:0=".a:0." case <=1:") + let g:netrw_passwd= inputsecret("Enter Password: ") + else " from command line +" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") + let g:netrw_passwd=a:2 + endif +" call Dret("NetUserPass") +endfun + +" ------------------------------------------------------------------------ +" Modelines And Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" vim:ts=8 fdm=marker diff --git a/runtime/plugin/rrhelper.vim b/runtime/plugin/rrhelper.vim new file mode 100644 index 0000000..b09cbc1 --- /dev/null +++ b/runtime/plugin/rrhelper.vim @@ -0,0 +1,48 @@ +" Vim plugin with helper function(s) for --remote-wait +" Maintainer: Flemming Madsen <fma@cci.dk> +" Last Change: 2008 May 29 + +" Has this already been loaded? +if exists("loaded_rrhelper") || !has("clientserver") + finish +endif +let loaded_rrhelper = 1 + +" Setup answers for a --remote-wait client who will assume +" a SetupRemoteReplies() function in the command server + +function SetupRemoteReplies() + let cnt = 0 + let max = argc() + + let id = expand("<client>") + if id == 0 + return + endif + while cnt < max + " Handle same file from more clients and file being more than once + " on the command line by encoding this stuff in the group name + let uniqueGroup = "RemoteReply_".id."_".cnt + + " Path separators are always forward slashes for the autocommand pattern. + " Escape special characters with a backslash. + let f = substitute(argv(cnt), '\\', '/', "g") + if exists('*fnameescape') + let f = fnameescape(f) + else + let f = escape(f, " \t\n*?[{`$\\%#'\"|!<") + endif + execute "augroup ".uniqueGroup + execute "autocmd ".uniqueGroup." BufUnload ". f ." call DoRemoteReply('".id."', '".cnt."', '".uniqueGroup."', '". f ."')" + let cnt = cnt + 1 + endwhile + augroup END +endfunc + +function DoRemoteReply(id, cnt, group, file) + call server2client(a:id, a:cnt) + execute 'autocmd! '.a:group.' BufUnload '.a:file + execute 'augroup! '.a:group +endfunc + +" vim: set sw=2 sts=2 : diff --git a/runtime/plugin/spellfile.vim b/runtime/plugin/spellfile.vim new file mode 100644 index 0000000..4372960 --- /dev/null +++ b/runtime/plugin/spellfile.vim @@ -0,0 +1,15 @@ +" Vim plugin for downloading spell files +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2006 Feb 01 + +" Exit quickly when: +" - this plugin was already loaded +" - when 'compatible' is set +" - some autocommands are already taking care of spell files +if exists("loaded_spellfile_plugin") || &cp || exists("#SpellFileMissing") + finish +endif +let loaded_spellfile_plugin = 1 + +" The function is in the autoload directory. +autocmd SpellFileMissing * call spellfile#LoadFile(expand('<amatch>')) diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim new file mode 100644 index 0000000..d55492a --- /dev/null +++ b/runtime/plugin/tarPlugin.vim @@ -0,0 +1,56 @@ +" tarPlugin.vim -- a Vim plugin for browsing tarfiles +" Original was copyright (c) 2002, Michael C. Toren <mct@toren.net> +" Modified by Charles E. Campbell +" Distributed under the GNU General Public License. +" +" Updates are available from <http://michael.toren.net/code/>. If you +" find this script useful, or have suggestions for improvements, please +" let me know. +" Also look there for further comments and documentation. +" +" This part only sets the autocommands. The functions are in autoload/tar.vim. +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_tarPlugin") + finish +endif +let g:loaded_tarPlugin = "v32" +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +augroup tar + au! + au BufReadCmd tarfile::* call tar#Read(expand("<amatch>"), 1) + au FileReadCmd tarfile::* call tar#Read(expand("<amatch>"), 0) + au BufWriteCmd tarfile::* call tar#Write(expand("<amatch>")) + au FileWriteCmd tarfile::* call tar#Write(expand("<amatch>")) + + if has("unix") + au BufReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 1) + au FileReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 0) + au BufWriteCmd tarfile::*/* call tar#Write(expand("<amatch>")) + au FileWriteCmd tarfile::*/* call tar#Write(expand("<amatch>")) + endif + + au BufReadCmd *.tar.gz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar call tar#Browse(expand("<amatch>")) + au BufReadCmd *.lrp call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tbz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tgz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.txz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tar.zst call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tzs call tar#Browse(expand("<amatch>")) +augroup END +com! -nargs=? -complete=file Vimuntar call tar#Vimuntar(<q-args>) + +" --------------------------------------------------------------------- +" Restoration And Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim new file mode 100644 index 0000000..0369313 --- /dev/null +++ b/runtime/plugin/tohtml.vim @@ -0,0 +1,235 @@ +" Vim plugin for converting a syntax highlighted file to HTML. +" Maintainer: Ben Fritz <fritzophrenic@gmail.com> +" Last Change: 2023 Jan 01 +" +" The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and +" $VIMRUNTIME/syntax/2html.vim +" +if exists('g:loaded_2html_plugin') + finish +endif +let g:loaded_2html_plugin = 'vim9.0_v1' + +" +" Changelog: {{{ +" 9.0_v1 (this version): - Implement g:html_no_doc and g:html_no_modeline +" for diff mode. Add tests. +" (Vim 9.0.1122): NOTE: no version string update for this version! +" - Bugfix for variable name in g:html_no_doc +" (Vim 9.0.0819): NOTE: no version string update for this version! +" - Add options g:html_no_doc, g:html_no_lines, +" and g:html_no_modeline (partially included in Vim +" runtime prior to version string update). +" - Updates for new Vim9 string append style (i.e. use +" ".." instead of ".") +" +" 8.1 updates: {{{ +" 8.1_v2 (Vim 8.1.2312): - Fix SourceForge issue #19: fix calculation of tab +" stop position to use in expanding a tab, when that +" tab occurs after a syntax match which in turn +" comes after previously expanded tabs. +" - Set eventignore while splitting a window for the +" destination file to ignore FileType events; +" speeds up processing when the destination file +" already exists and HTML highlight takes too long. +" - Fix SourceForge issue #20: progress bar could not be +" seen when DiffDelete background color matched +" StatusLine background color. Added TOhtmlProgress +" highlight group for manual user override, but +" calculate it to be visible compared to StatusLine +" by default. +" - Fix SourceForge issue #1: Remove workaround for old +" browsers which don't support 'ch' CSS unit, since +" all modern browsers, including IE>=9, support it. +" - Fix SourceForge issue #10: support termguicolors +" - Fix SourceForge issue #21: default to using +" generated content instead of <input> tags for +" uncopyable text, so that text is correctly +" prevented from being copied in chrome. Use +" g:html_use_input_for_pc option to control the +" method used. +" - Switch to HTML5 to allow using vnu as a validator +" in unit test. +" - Fix fallback sizing of <input> tags for browsers +" without "ch" support. +" - Fix cursor on unselectable diff filler text. +" 8.1_v1 (Vim 8.1.0528): - Fix SourceForge issue #6: Don't generate empty +" script tag. +" - Fix SourceForge issue #5: javascript should +" declare variables with "var". +" - Fix SourceForge issue #13: errors thrown sourcing +" 2html.vim directly when plugins not loaded. +" - Fix SourceForge issue #16: support 'vartabstop'. +"}}} +" +" 7.4 updates: {{{ +" 7.4_v2 (Vim 7.4.0899): Fix error raised when converting a diff containing +" an empty buffer. Jan Stocker: allow g:html_font to +" take a list so it is easier to specfiy fallback +" fonts in the generated CSS. +" 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and +" also for version-specific modelines like "vim>703:". +"}}} +" +" 7.3 updates: {{{ +" 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using +" g:html_line_ids=0. Allow customizing +" important IDs (like line IDs and fold IDs) using +" g:html_id_expr evaluated when the buffer conversion +" is started. +" 7.3_v13 (Vim 7.3.1088): Keep foldmethod at manual in the generated file and +" insert modeline to set it to manual. +" Fix bug: diff mode with 2 unsaved buffers creates a +" duplicate of one buffer instead of including both. +" Add anchors to each line so you can put '#L123' +" or '#123' at the end of the URL to jump to line 123 +" (idea by Andy Spencer). Add javascript to open folds +" to show the anchor being jumped to if it is hidden. +" Fix XML validation error: &nsbp; not part of XML. +" Allow TOhtml to chain together with other commands +" using |. +" 7.3_v12 (Vim 7.3.0616): Fix modeline mangling to also work for when multiple +" highlight groups make up the start-of-modeline text. +" Improve render time of page with uncopyable regions +" by not using one-input-per-char. Change name of +" uncopyable option from html_unselectable to +" html_prevent_copy. Added html_no_invalid option and +" default to inserting invalid markup for uncopyable +" regions to prevent MS Word from pasting undeletable +" <input> elements. Fix 'cpo' handling (Thilo Six). +" 7.3_v12b1: Add html_unselectable option. Rework logic to +" eliminate post-processing substitute commands in +" favor of doing the work up front. Remove unnecessary +" special treatment of 'LineNr' highlight group. Minor +" speed improvements. Fix modeline mangling in +" generated output so it works for text in the first +" column. Fix missing line number and fold column in +" diff filler lines. Fix that some fonts have a 1px +" gap (using a dirty hack, improvements welcome). Add +" "colorscheme" meta tag. Does NOT include support for +" the new default foldtext added in v11, as the patch +" adding it has not yet been included in Vim. +" 7.3_v11 ( unreleased ): Support new default foldtext from patch by Christian +" Brabandt in +" http://groups.google.com/d/topic/vim_dev/B6FSGfq9VoI/discussion. +" This patch has not yet been included in Vim, thus +" these changes are removed in the next version. +" 7.3_v10 (Vim 7.3.0227): Fix error E684 when converting a range wholly inside +" multiple nested folds with dynamic folding on. +" Also fix problem with foldtext in this situation. +" 7.3_v9 (Vim 7.3.0170): Add html_pre_wrap option active with html_use_css +" and without html_no_pre, default value same as +" 'wrap' option, (Andy Spencer). Don't use +" 'fileencoding' for converted document encoding if +" 'buftype' indicates a special buffer which isn't +" written. +" 7.3_v8 (Vim 7.3.0100): Add html_expand_tabs option to allow leaving tab +" characters in generated output (Andy Spencer). +" Escape text that looks like a modeline so Vim +" doesn't use anything in the converted HTML as a +" modeline. Bugfixes: Fix folding when a fold starts +" before the conversion range. Remove fold column when +" there are no folds. +" 7.3_v7 (Vim 7-3-0063): see betas released on vim_dev below: +" 7.3_v7b3: Fixed bug, convert Unicode to UTF-8 all the way. +" 7.3_v7b2: Remove automatic detection of encodings that are not +" supported by all major browsers according to +" http://wiki.whatwg.org/wiki/Web_Encodings and +" convert to UTF-8 for all Unicode encodings. Make +" HTML encoding to Vim encoding detection be +" case-insensitive for built-in pairs. +" 7.3_v7b1: Remove use of setwinvar() function which cannot be +" called in restricted mode (Andy Spencer). Use +" 'fencoding' instead of 'encoding' to determine by +" charset, and make sure the 'fenc' of the generated +" file matches its indicated charset. Add charsets for +" all of Vim's natively supported encodings. +" 7.3_v6 (Vim 7.3.0000): Really fix bug with 'nowrapscan', 'magic' and other +" user settings interfering with diff mode generation, +" trailing whitespace (e.g. line number column) when +" using html_no_pre, and bugs when using +" html_hover_unfold. +" 7.3_v5 ( unreleased ): Fix bug with 'nowrapscan' and also with out-of-sync +" folds in diff mode when first line was folded. +" 7.3_v4 (Vim 7.3.0000): Bugfixes, especially for xhtml markup, and diff mode +" 7.3_v3 (Vim 7.3.0000): Refactor option handling and make html_use_css +" default to true when not set to anything. Use strict +" doctypes where possible. Rename use_xhtml option to +" html_use_xhtml for consistency. Use .xhtml extension +" when using this option. Add meta tag for settings. +" 7.3_v2 (Vim 7.3.0000): Fix syntax highlighting in diff mode to use both the +" diff colors and the normal syntax colors +" 7.3_v1 (Vim 7.3.0000): Add conceal support and meta tags in output +"}}} +"}}} + +" TODO: {{{ +" * Check the issue tracker: +" https://sourceforge.net/p/vim-tohtml/issues/search/?q=%21status%3Aclosed +" * Options for generating the CSS in external style sheets. New :TOcss +" command to convert the current color scheme into a (mostly) generic CSS +" stylesheet which can be re-used. Alternate stylesheet support? Good start +" by Erik Falor +" ( https://groups.google.com/d/topic/vim_use/7XTmC4D22dU/discussion ). +" * Add optional argument to :TOhtml command to specify mode (gui, cterm, +" term) to use for the styling. Suggestion by "nacitar". +" * Add way to override or specify which RGB colors map to the color numbers +" in cterm. Get better defaults than just guessing? Suggestion by "nacitar". +" * Disable filetype detection until after all processing is done. +" * Add option for not generating the hyperlink on stuff that looks like a +" URL? Or just color the link to fit with the colorscheme (and only special +" when hovering)? +" * Bug: Opera does not allow printing more than one page if uncopyable +" regions is turned on. Possible solution: Add normal text line numbers with +" display:none, set to display:inline for print style sheets, and hide +" <input> elements for print, to allow Opera printing multiple pages (and +" other uncopyable areas?). May need to make the new text invisible to IE +" with conditional comments to prevent copying it, IE for some reason likes +" to copy hidden text. Other browsers too? +" * Bug: still a 1px gap throughout the fold column when html_prevent_copy is +" "fn" in some browsers. Specifically, in Chromium on Ubuntu (but not Chrome +" on Windows). Perhaps it is font related? +" * Bug: still some gaps in the fold column when html_prevent_copy contains +" 'd' and showing the whole diff (observed in multiple browsers). Only gaps +" on diff lines though. +" * Undercurl support via CSS3, with fallback to dotted or something: +" https://groups.google.com/d/topic/vim_use/BzXA6He1pHg/discussion +" * Redo updates for modified default foldtext (v11) when/if the patch is +" accepted to modify it. +" * Test case +diff_one_file-dynamic_folds+expand_tabs-hover_unfold +" +ignore_conceal-ignore_folding+no_foldcolumn+no_pre+no_progress +" +number_lines-pre_wrap-use_css+use_xhtml+whole_filler.xhtml +" does not show the whole diff filler as it is supposed to? +" * Bug: when 'isprint' is wrong for the current encoding, will generate +" invalid content. Can/should anything be done about this? Maybe a separate +" plugin to correct 'isprint' based on encoding? +" * Check to see if the windows-125\d encodings actually work in Unix without +" the 8bit- prefix. Add prefix to autoload dictionaries for Unix if not. +" * Font auto-detection similar to +" http://www.vim.org/scripts/script.php?script_id=2384 but for a variety of +" platforms. +" * Pull in code from http://www.vim.org/scripts/script.php?script_id=3113 : +" - listchars support +" - full-line background highlight +" - other? +" * Make it so deleted lines in a diff don't create side-scrolling (get it +" free with full-line background highlight above). +" * Restore open/closed folds and cursor position after processing each file +" with option not to restore for speed increase. +" * Add extra meta info (generation time, etc.)? +" * Tidy up so we can use strict doctype in even more situations +" * Implementation detail: add threshold for writing the lines to the html +" buffer before we're done (5000 or so lines should do it) +" * TODO comments for code cleanup scattered throughout +"}}} + +" Define the :TOhtml command when: +" - 'compatible' is not set +" - this plugin or user override was not already loaded +" - user commands are available. {{{ +if !&cp && !exists(":TOhtml") && has("user_commands") + command -range=% -bar TOhtml :call tohtml#Convert2HTML(<line1>, <line2>) +endif "}}} + +" Make sure any patches will probably use consistent indent +" vim: ts=8 sw=2 sts=2 noet fdm=marker diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim new file mode 100644 index 0000000..d7473a0 --- /dev/null +++ b/runtime/plugin/vimballPlugin.vim @@ -0,0 +1,43 @@ +" vimballPlugin : construct a file containing both paths and files +" Author: Charles E. Campbell +" Copyright: (c) 2004-2014 by Charles E. Campbell +" The VIM LICENSE applies to Vimball.vim, and Vimball.txt +" (see |copyright|) except use "Vimball" instead of "Vim". +" No warranty, express or implied. +" *** *** Use At-Your-Own-Risk! *** *** +" +" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who +" judge. For in that which you judge another, you condemn yourself. For +" you who judge practice the same things. +" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_vimballPlugin") + finish +endif +let g:loaded_vimballPlugin = "v37" +let s:keepcpo = &cpo +set cpo&vim + +" ------------------------------------------------------------------------------ +" Public Interface: {{{1 +com! -range -complete=file -nargs=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) +com! -nargs=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) +com! -nargs=0 VimballList call vimball#Vimball(0) +com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() +augroup Vimball + au! + au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif + au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif +augroup END + +" ===================================================================== +" Restoration And Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/runtime/plugin/zipPlugin.vim b/runtime/plugin/zipPlugin.vim new file mode 100644 index 0000000..edc5271 --- /dev/null +++ b/runtime/plugin/zipPlugin.vim @@ -0,0 +1,56 @@ +" zipPlugin.vim: Handles browsing zipfiles +" PLUGIN PORTION +" Date: Jan 07, 2020 +" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> +" License: Vim License (see vim's :help license) +" Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" zipPlugin.vim is provided *as is* and comes with no warranty +" of any kind, either expressed or implied. By using this +" plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. +" +" (James 4:8 WEB) Draw near to God, and he will draw near to you. +" Cleanse your hands, you sinners; and purify your hearts, you double-minded. +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_zipPlugin") + finish +endif +let g:loaded_zipPlugin = "v32" +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Options: {{{1 +if !exists("g:zipPlugin_ext") + let g:zipPlugin_ext='*.aar,*.apk,*.celzip,*.crtx,*.docm,*.docx,*.dotm,*.dotx,*.ear,*.epub,*.gcsx,*.glox,*.gqsx,*.ja,*.jar,*.kmz,*.odb,*.odc,*.odf,*.odg,*.odi,*.odm,*.odp,*.ods,*.odt,*.otc,*.otf,*.otg,*.oth,*.oti,*.otp,*.ots,*.ott,*.oxt,*.potm,*.potx,*.ppam,*.ppsm,*.ppsx,*.pptm,*.pptx,*.sldx,*.thmx,*.vdw,*.war,*.wsz,*.xap,*.xlam,*.xlam,*.xlsb,*.xlsm,*.xlsx,*.xltm,*.xltx,*.xpi,*.zip' +endif + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +augroup zip + au! + au BufReadCmd zipfile:* call zip#Read(expand("<amatch>"), 1) + au FileReadCmd zipfile:* call zip#Read(expand("<amatch>"), 0) + au BufWriteCmd zipfile:* call zip#Write(expand("<amatch>")) + au FileWriteCmd zipfile:* call zip#Write(expand("<amatch>")) + + if has("unix") + au BufReadCmd zipfile:*/* call zip#Read(expand("<amatch>"), 1) + au FileReadCmd zipfile:*/* call zip#Read(expand("<amatch>"), 0) + au BufWriteCmd zipfile:*/* call zip#Write(expand("<amatch>")) + au FileWriteCmd zipfile:*/* call zip#Write(expand("<amatch>")) + endif + + exe "au BufReadCmd ".g:zipPlugin_ext.' call zip#Browse(expand("<amatch>"))' +augroup END + +" --------------------------------------------------------------------- +" Restoration And Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo |