From 97d62497f51902f404c7dcc72683411df911593e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 15 Nov 2012 21:28:22 +0100 Subject: Updated runtime files. --- runtime/autoload/netrw.vim | 832 +++++++++++++++++++++++------------- runtime/autoload/netrwSettings.vim | 6 +- runtime/autoload/syntaxcomplete.vim | 135 +++++- runtime/doc/change.txt | 9 +- runtime/doc/eval.txt | 5 +- runtime/doc/if_perl.txt | 5 +- runtime/doc/options.txt | 2 +- runtime/doc/pi_netrw.txt | 151 ++++--- runtime/doc/syntax.txt | 8 +- runtime/doc/todo.txt | 69 +-- runtime/doc/usr_21.txt | 14 +- runtime/doc/usr_22.txt | 8 +- runtime/doc/windows.txt | 8 +- runtime/plugin/netrwPlugin.vim | 2 +- runtime/syntax/abap.vim | 145 +++---- runtime/syntax/lex.vim | 81 ++-- runtime/syntax/progress.vim | 18 +- runtime/syntax/rst.vim | 24 +- runtime/syntax/sh.vim | 153 ++++--- runtime/syntax/sqlhana.vim | 293 +++++++++++++ runtime/syntax/tex.vim | 10 +- runtime/syntax/vim.vim | 73 +++- runtime/syntax/yacc.vim | 92 ++-- 23 files changed, 1453 insertions(+), 690 deletions(-) create mode 100644 runtime/syntax/sqlhana.vim (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 2700a8c82..3e9bd34b1 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Apr 05, 2012 -" Version: 145 +" Date: Oct 25, 2012 +" Version: 146 " Maintainer: Charles E Campbell, Jr " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2010 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{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, @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v145" +let g:loaded_netrw = "v146" if v:version < 702 echohl WarningMsg echo "***warning*** this version of netrw needs vim 7.2" @@ -55,12 +55,12 @@ set cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Apr 05, 2012 : max errnum currently is 88 +" Oct 24, 2012 : max errnum currently is 91 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) if a:level < g:netrw_errorlvl - call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g;netrw_errorlvl=".g:netrw_errorlvl) +" call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g;netrw_errorlvl=".g:netrw_errorlvl) return endif @@ -225,7 +225,7 @@ endif " Cygwin Detection ------- {{{3 if !exists("g:netrw_cygwin") if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' + if has("win32unix") && &shell =~ '\%(\\|\\)\%(\.exe\)\=$' let g:netrw_cygwin= 1 else let g:netrw_cygwin= 0 @@ -300,30 +300,27 @@ if exists("g:netrw_local_copycmd") let g:netrw_localcopycmd= g:netrw_local_copycmd" call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) endif +if !exists("g:netrw_localcmdshell") + let g:netrw_localcmdshell= "" +endif if !exists("g:netrw_localcopycmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin let g:netrw_localcopycmd= "cp" else - let g:netrw_localcopycmd= "copy" + let g:netrw_localcopycmd= "cmd /c copy" endif elseif has("unix") || has("macunix") let g:netrw_localcopycmd= "cp" else let g:netrw_localcopycmd= "" endif - if !executable(g:netrw_localcopycmd) - call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) - endif endif if exists("g:netrw_local_mkdir") - let g:netrw_localmkdir= g:netrw_local_mkdir" + let g:netrw_localmkdir= g:netrw_local_mkdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) endif call s:NetrwInit("g:netrw_localmkdir","mkdir") -if !executable(g:netrw_localmkdir) - call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -endif call s:NetrwInit("g:netrw_remote_mkdir","mkdir") if exists("g:netrw_local_movecmd") let g:netrw_localmovecmd= g:netrw_local_movecmd" @@ -334,25 +331,19 @@ if !exists("g:netrw_localmovecmd") if g:netrw_cygwin let g:netrw_localmovecmd= "mv" else - let g:netrw_localmovecmd= "move" + let g:netrw_localmovecmd= "cmd /c move" endif elseif has("unix") || has("macunix") let g:netrw_localmovecmd= "mv" else let g:netrw_localmovecmd= "" endif - if !executable(g:netrw_localmkdir) - call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",81) - endif endif call s:NetrwInit("g:netrw_localrmdir", "rmdir") if exists("g:netrw_local_rmdir") let g:netrw_localrmdir= g:netrw_local_rmdir" call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) endif -if !executable(g:netrw_localrmdir) - call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",82) -endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST @@ -607,7 +598,8 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_rokeep") |let &l:ro = {a:vt}netrw_rokeep |unlet {a:vt}netrw_rokeep |endif if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |endif if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif - if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif + " Problem: start with liststyle=0; press : result, following line resets l:ts. +" if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif if exists("{a:vt}netrw_wrapkeep") |let &l:wrap = {a:vt}netrw_wrapkeep |unlet {a:vt}netrw_wrapkeep |endif @@ -647,6 +639,7 @@ fun! s:NetrwOptionRestore(vt) " call Decho("(NetrwOptionRestore) fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) " call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Decho("(NetrwOptionRestore) diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) +" call Decho("(NetrwOptionRestore) ts=".&l:ts) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -956,7 +949,7 @@ fun! netrw#NetRead(mode,...) " call Decho("filter input: ".getline('.')) endif - if exists("g:netrw_uid" && g:netrw_uid != "" + if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 keepj put =g:netrw_uid " call Decho("filter input: ".getline('.')) @@ -1487,7 +1480,7 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (sftp) NetWrite Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") +" call Decho("write via sftp (method #9)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_uid .'@'. g:netrw_machine @@ -1505,7 +1498,8 @@ fun! netrw#NetWrite(...) range call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) " call Decho("filter input: ".getline('.')) " call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1) + let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") + exe s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1) let filtbuf= bufnr("%") exe curbuf."b!" let &l:bh = bhkeep @@ -1647,14 +1641,14 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " call Decho("exe sil! keepalt file ".fnameescape(rfile)) exe "sil! keepj keepalt file ".fnameescape(rfile) - " detect filetype of local version of remote file + " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim " to process this detection correctly. " call Decho("detect filetype of local version of remote file") - let iskkeep= &isk - set isk-=/ + let iskkeep= &l:isk + setl isk-=/ filetype detect - let &isk= iskkeep + let &l:isk= iskkeep " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") @@ -2013,11 +2007,17 @@ fun! NetUserPass(...) endif if a:0 == 0 + " case: no input arguments + + " change host and username if not previously entered; get new password + if !exists("g:netrw_machine") + let g:netrw_machine= input('Enter hostname: ') + endif if !exists("g:netrw_uid") || g:netrw_uid == "" - " get uid via prompt + " get username (user-id) via prompt let g:netrw_uid= input('Enter username: ') endif - " get password via prompt + " get password via prompting let s:netrw_passwd= inputsecret("Enter Password: ") " set up hup database @@ -2029,8 +2029,10 @@ fun! NetUserPass(...) let s:netrw_hup[host].passwd = s:netrw_passwd elseif a:0 == 1 + " case: one input argument if a:1 =~ '^ftp:' + " get host from ftp:... url " access userid and password from hup (host-user-passwd) dictionary let host = substitute(a:1,'^ftp:','','') let host = substitute(host,'\..*','','') @@ -2043,14 +2045,22 @@ fun! NetUserPass(...) let g:netrw_uid = input("Enter UserId: ") let s:netrw_passwd = inputsecret("Enter Password: ") endif + else - " set userid, prompt for password -" call Decho("set g:netrw_uid= <".a:1.">") + " case: one input argument, not an url. Using it as a new user-id. if exists("g:netrw_machine") let host= substitute(g:netrw_machine,'\..*$','','') + else + let g:netrw_machine= input('Enter hostname: ') + endif + let g:netrw_uid = a:1 +" call Decho("set g:netrw_uid= <".g:netrw_uid.">") + if exists("g:netrw_passwd") + " ask for password if one not previously entered + let s:netrw_passwd= g:netrw_passwd + else + let s:netrw_passwd = inputsecret("Enter Password: ") endif - let g:netrw_uid = a:1 - let s:netrw_passwd = inputsecret("Enter Password: ") endif " call Decho("host<".host.">") @@ -2161,6 +2171,7 @@ fun! s:NetrwMaps(islocal) nnoremap U :call NetrwBookHistHandler(5,expand("%")) nnoremap v :call NetrwSplit(5) nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + nnoremap X :call NetrwLocalExecute(expand(""))" " local insert-mode maps inoremap a :call NetrwHide(1) inoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) @@ -2283,7 +2294,7 @@ fun! s:NetrwMaps(islocal) nnoremap mx :call NetrwMarkFileExe(0) nnoremap mX :call NetrwMarkFileVimCmd(0) nnoremap mz :call NetrwMarkFileCompress(0) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_cur) + nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) nnoremap gh :call NetrwHidden(0) @@ -2330,7 +2341,7 @@ fun! s:NetrwMaps(islocal) inoremap mx :call NetrwMarkFileExe(0) inoremap mX :call NetrwMarkFileVimCmd(0) inoremap mz :call NetrwMarkFileCompress(0) - inoremap gb :call NetrwBookHistHandler(1,b:netrw_cur) + inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) inoremap gh :call NetrwHidden(0) inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) inoremap C :let g:netrw_chgwin= winnr() @@ -2431,6 +2442,7 @@ endfun fun! s:NetrwBookHistHandler(chg,curdir) " call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) + let ykeep= @@ if a:chg == 0 " bookmark the current directory " call Decho("(user: ) bookmark the current directory") @@ -2579,6 +2591,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) keepj call remove(g:netrw_bookmarklist,v:count-1) endif call s:NetrwBookmarkMenu() + let @@= ykeep " call Dret("s:NetrwBookHistHandler") endfun @@ -2587,6 +2600,7 @@ endfun " Sister function: s:NetrwBookHistSave() fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") + let ykeep= @@ if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" @@ -2604,6 +2618,7 @@ fun! s:NetrwBookHistRead() au VimLeave * call s:NetrwBookHistSave() endif endif + let @@= ykeep " call Dret("s:NetrwBookHistRead") endfun @@ -2678,11 +2693,12 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) " call Dredir("ls!") + " s:NetrwBrowse: initialize history {{{3 if !exists("s:netrw_initbookhist") keepj call s:NetrwBookHistRead() endif - " simplify the dirname (especially for ".."s in dirnames) + " s:NetrwBrowse: simplify the dirname (especially for ".."s in dirnames) {{{3 if a:dirname !~ '^\a\+://' let dirname= simplify(a:dirname) else @@ -2695,6 +2711,8 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse) return endif + + " s:NetrwBrowse: sanity checks: {{{3 if !exists("*shellescape") keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) " call Dret("s:NetrwBrowse : missing shellescape()") @@ -2706,15 +2724,17 @@ fun! s:NetrwBrowse(islocal,dirname) return endif + " s:NetrwBrowse: save options: {{{3 call s:NetrwOptionSave("w:") - " re-instate any marked files + " s:NetrwBrowse: re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") " call Decho("clearing marked files") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" endif if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep + " s:NetrwBrowse: set up "safe" options for local directory/file {{{3 " call Decho("handle w:netrw_acdkeep:") " call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") exe 'keepj lcd '.fnameescape(dirname) @@ -2722,17 +2742,17 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("getcwd<".getcwd().">") elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' - " looks like a regular file, attempt transfer + " s:NetrwBrowse: looks like a remote regular file, attempt transfer {{{3 " call Decho("attempt transfer as regular file<".dirname.">") - " remove any filetype indicator from end of dirname, except for the {{{3 + " remove any filetype indicator from end of dirname, except for the " "this is a directory" indicator (/). " There shouldn't be one of those here, anyway. let path= substitute(dirname,'[*=@|]\r\=$','','e') " call Decho("new path<".path.">") call s:RemotePathAnalysis(dirname) - " remote-read the requested file into current buffer {{{3 + " s:NetrwBrowse: remote-read the requested file into current buffer {{{3 keepj mark ' call s:NetrwEnew(dirname) call s:NetrwSafeOptions() @@ -2749,7 +2769,7 @@ fun! s:NetrwBrowse(islocal,dirname) exe "sil keepj keepalt doau BufReadPost ".fnameescape(s:fname) endif - " save certain window-oriented variables into buffer-oriented variables {{{3 + " s:NetrwBrowse: save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") " call Decho("setl ma nomod") @@ -2771,7 +2791,7 @@ fun! s:NetrwBrowse(islocal,dirname) " set up menu {{{3 keepj call s:NetrwMenu(1) - " set up buffer {{{3 + " get/set-up buffer {{{3 let reusing= s:NetrwGetBuffer(a:islocal,dirname) " maintain markfile highlighting if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -2852,11 +2872,11 @@ fun! s:NetrwBrowse(islocal,dirname) else " call Decho("remote only:") - " analyze dirname and g:netrw_list_cmd {{{4 + " analyze dirname and g:netrw_list_cmd {{{3 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") if dirname =~ "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was ".dirname.") dirname<".dirname.">") +" call Decho("(dirname was ) dirname<".dirname.">") elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' @@ -2914,6 +2934,7 @@ endfun " s:NetrwFileInfo: supports qf (query for file information) {{{2 fun! s:NetrwFileInfo(islocal,fname) " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">)") + let ykeep= @@ if a:islocal if (has("unix") || has("macunix")) && executable("/bin/ls") if exists("b:netrw_curdir") @@ -2943,6 +2964,7 @@ fun! s:NetrwFileInfo(islocal,fname) else echo "sorry, \"qf\" not supported yet for remote files" endif + let @@= ykeep " call Dret("s:NetrwFileInfo") endfun @@ -2958,22 +2980,22 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--re-use a buffer if possible--") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " find NetrwTreeList buffer if there is one -" call Decho("find NetrwTreeList buffer if there is one") +" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one") if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 " call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr) let eikeep= &ei set ei=all exe "sil! b ".w:netrw_treebufnr let &ei= eikeep -" call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."") - return +" call Dret("s:NetrwGetBuffer 1 : bufnum#".w:netrw_treebufnr."") + return 1 endif let bufnum= -1 " call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") else " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("--find buffer numnber of buffer named precisely the same as dirname--") +" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--") " call Dredir("ls!") " get dirname and associated buffer number @@ -3003,7 +3025,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">") +" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") let ibuf = 1 let buflast = bufnr("$") " call Decho(" findbuf2: buflast=bufnr($)=".buflast) @@ -3043,9 +3065,10 @@ fun! s:NetrwGetBuffer(islocal,dirname) endif " get enew buffer and name it -or- re-use buffer {{{3 +" call Decho(" get enew buffer and name it OR re-use buffer") sil! keepj mark ' if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")") +" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") call s:NetrwEnew(dirname) " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") " name the buffer @@ -3078,14 +3101,14 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")") +" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") let eikeep= &ei set ei=all if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" re-use buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: keepalt b ".bufnum) +" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) exe "sil! keepalt b ".bufnum else -" call Decho(" reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum) +" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) exe "sil! b ".bufnum endif if bufname("%") == '.' @@ -3095,17 +3118,22 @@ fun! s:NetrwGetBuffer(islocal,dirname) let &ei= eikeep if line("$") <= 1 keepj call s:NetrwListSettings(a:islocal) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") + return 0 + elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) + keepj call s:NetrwListSettings(a:islocal) + sil keepj %d +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) return 0 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("--re-use tree listing--") " call Decho(" clear buffer<".expand("%")."> with :%d") sil keepj %d keepj call s:NetrwListSettings(a:islocal) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") return 0 else -" call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) +" call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) return 1 endif endif @@ -3126,7 +3154,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" clear buffer<".expand("%")."> with :%d") sil! keepalt keepj %d -" call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) return 0 endfun @@ -3266,8 +3294,8 @@ fun! s:NetrwListSettings(islocal) setlocal noswf endif " call Dredir("ls!") -" call Decho("exe setlocal ts=".g:netrw_maxfilenamelen) - exe "setlocal ts=".g:netrw_maxfilenamelen +" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) setlocal isk+=.,~,- if g:netrw_fastbrowse > a:islocal setlocal bh=hide @@ -3283,6 +3311,7 @@ endfun " =1: local browsing fun! s:NetrwListStyle(islocal) " call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle) + let ykeep = @@ let fname = s:NetrwGetWord() if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST @@ -3340,6 +3369,7 @@ fun! s:NetrwListStyle(islocal) if result <= 0 && exists("w:netrw_bannercnt") exe "sil! keepj ".w:netrw_bannercnt endif + let @@= ykeep " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) endfun @@ -3349,6 +3379,7 @@ endfun fun! s:NetrwBannerCtrl(islocal) " call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner) + let ykeep= @@ " toggle the banner (enable/suppress) let g:netrw_banner= !g:netrw_banner @@ -3364,6 +3395,7 @@ fun! s:NetrwBannerCtrl(islocal) if result <= 0 && exists("w:netrw_bannercnt") exe "keepj ".w:netrw_bannercnt endif + let @@= ykeep " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) endfun @@ -3439,9 +3471,11 @@ endfun fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") + let ykeep= @@ if !exists("b:netrw_curdir") " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called " and the current window is the NetrwMessage window. + let @@= ykeep " call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!") " call Decho("(NetrwBrowseChgDir) getcwd<".getcwd().">") " call Dredir("ls!") @@ -3449,6 +3483,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) return endif + " NetrwBrowseChgDir: save options and initialize {{{3 keepj call s:NetrwOptionSave("s:") keepj call s:NetrwSafeOptions() let nbcd_curpos = netrw#NetrwSavePosn() @@ -3478,15 +3513,15 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif if newdir !~ dirpat - " ------------ - " edit a file: - " ------------ + " ------------------------------ + " NetrwBrowseChgDir: edit a file {{{3 + " ------------------------------ " call Decho('(NetrwBrowseChgDir) case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") - " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= netrw#NetrwSavePosn() + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= netrw#NetrwSavePosn() -" call Decho("(NetrwBrowseChgDir) setting s:rexposn_".bufnr("%")." to SavePosn") +" call Decho("(NetrwBrowseChgDir) setting s:rexposn_".bufnr("%")." to SavePosn") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' let dirname= s:NetrwTreeDir() if dirname =~ '/$' @@ -3507,20 +3542,26 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("(NetrwBrowseChgDir) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) keepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") +" call Decho("s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) if g:netrw_browse_split == 1 + " horizontally splitting the window first new if !&ea wincmd _ endif elseif g:netrw_browse_split == 2 + " vertically splitting the window first rightb vert new if !&ea wincmd | endif elseif g:netrw_browse_split == 3 + " open file in new tab tabnew elseif g:netrw_browse_split == 4 + " act like "P" (ie. open previous window) if s:NetrwPrevWinOpen(2) == 3 + let @@= ykeep " call Dret("s:NetrwBrowseChgDir") return endif @@ -3540,6 +3581,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if a:islocal " call Decho("(NetrwBrowseChgDir) edit local file: exe e! ".fnameescape(dirname)) exe "e! ".fnameescape(dirname) + call s:NetrwCursor() else " call Decho("(NetrwBrowseChgDir) remote file: NetrwBrowse will edit it") endif @@ -3566,25 +3608,25 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif elseif newdir =~ '^/' - " --------------------------------- - " just go to the new directory spec - " --------------------------------- + " ---------------------------------------------------- + " NetrwBrowseChgDir: just go to the new directory spec {{{3 + " ---------------------------------------------------- " call Decho('(NetrwBrowseChgDir) case "just go to new directory spec": newdir<'.newdir.'>') - let dirname= newdir + let dirname = newdir keepj call s:SetRexDir(a:islocal,dirname) keepj call s:NetrwOptionRestore("s:") elseif newdir == './' - " -------------------------- - " refresh the directory list - " -------------------------- + " --------------------------------------------- + " NetrwBrowseChgDir: refresh the directory list {{{3 + " --------------------------------------------- " call Decho('(NetrwBrowseChgDir) case "refresh directory listing": newdir == "./"') keepj call s:SetRexDir(a:islocal,dirname) elseif newdir == '../' - " ------------------- - " go up one directory - " ------------------- + " -------------------------------------- + " NetrwBrowseChgDir: go up one directory {{{3 + " -------------------------------------- " call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../"') if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") @@ -3622,6 +3664,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) keepj call s:SetRexDir(a:islocal,dirname) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") + " -------------------------------------- + " NetrwBrowseChgDir: Handle Tree Listing {{{3 + " -------------------------------------- " call Decho('(NetrwBrowseChgDir) case liststyle is TREELIST and w:netrw_treedict exists') " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) " call Decho("(NetrwBrowseChgDir) setl noro ma") @@ -3681,12 +3726,17 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let s:treeforceredraw = 1 else - " go down one directory - let dirname= s:ComposePath(dirname,newdir) + " ---------------------------------------- + " NetrwBrowseChgDir: Go down one directory {{{3 + " ---------------------------------------- + let dirname = s:ComposePath(dirname,newdir) " call Decho("(NetrwBrowseChgDir) go down one dir: dirname<".dirname."> newdir<".newdir.">") keepj call s:SetRexDir(a:islocal,dirname) endif + " -------------------------------------- + " NetrwBrowseChgDir: Restore and Cleanup {{{3 + " -------------------------------------- keepj call s:NetrwOptionRestore("s:") if dolockout " call Decho("(NetrwBrowseChgDir) filewritable(dirname<".dirname.">)=".filewritable(dirname)) @@ -3702,6 +3752,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("(NetrwBrowseChgDir) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif endif + let @@= ykeep " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") return dirname @@ -3714,6 +3765,9 @@ endfun fun! netrw#NetrwBrowseX(fname,remote) " call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") + let ykeep = @@ + let screenposn = netrw#NetrwSavePosn() + " special core dump handler if a:fname =~ '/core\(\.\d\+\)\=$' if exists("g:Netrw_corehandler") @@ -3730,6 +3784,8 @@ fun! netrw#NetrwBrowseX(fname,remote) endif endfor endif + call netrw#NetrwRestorePosn(screenposn) + let @@= ykeep " call Dret("NetrwBrowseX : coredump handler invoked") return endif @@ -3747,7 +3803,7 @@ fun! netrw#NetrwBrowseX(fname,remote) " gnome-open's subsidiary display tools are largely absent. Kde systems " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) if !exists("s:haskdeinit") - if has("unix") + if has("unix") && executable("ps") && !has("win32unix") let s:haskdeinit= system("ps -e") =~ 'kdeinit' if v:shell_error let s:haskdeinit = 0 @@ -3760,12 +3816,12 @@ fun! netrw#NetrwBrowseX(fname,remote) if a:remote == 1 " create a local copy -" call Decho("a:remote=".a:remote.": create a local copy of <".a:fname.">") +" call Decho("(remote) a:remote=".a:remote.": create a local copy of <".a:fname.">") setlocal bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') - let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') + let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') " call Decho("basename<".basename.">") " call Decho("newname <".newname.">") if rename(s:netrw_tmpfile,newname) == 0 @@ -3776,6 +3832,7 @@ fun! netrw#NetrwBrowseX(fname,remote) let fname= s:netrw_tmpfile endif else +" call Decho("(local) a:remote=".a:remote.": handling local copy of <".a:fname.">") let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" @@ -3798,9 +3855,10 @@ fun! netrw#NetrwBrowseX(fname,remote) else let redir= &srr . "/dev/null" endif -" call Decho("redir{".redir."} srr{".&srr."}") +" call Decho("set up redirection: redir{".redir."} srr{".&srr."}") " extract any viewing options. Assumes that they're set apart by quotes. +" call Decho("extract any viewing options") if exists("g:netrw_browsex_viewer") " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") if g:netrw_browsex_viewer =~ '\s' @@ -3823,6 +3881,7 @@ fun! netrw#NetrwBrowseX(fname,remote) endif " execute the file handler +" call Decho("execute the file handler (if any)") if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") let ret= netrwFileHandlers#Invoke(exten,fname) @@ -3834,6 +3893,7 @@ fun! netrw#NetrwBrowseX(fname,remote) let ret= v:shell_error elseif has("win32") || has("win64") +" call Decho("windows") if executable("start") " call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) @@ -3846,17 +3906,35 @@ fun! netrw#NetrwBrowseX(fname,remote) call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error - elseif has("unix") && executable("gnome-open") && !s:haskdeinit -" call Decho("exe sil !gnome-open ".shellescape(fname,1)." ".redir) - exe "sil !gnome-open ".shellescape(fname,1).redir + elseif has("win32unix") + let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') +" call Decho("cygwin: winfname<".shellescape(winfname,1).">") + if executable("start") +" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + elseif executable("rundll32") +" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + else + call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) + endif + call inputsave()|call input("Press to continue")|call inputrestore() + let ret= v:shell_error + + elseif has("unix") && executable("xdg-open") && !s:haskdeinit +" call Decho("unix and xdg-open") +" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir) + exe "sil !xdg-open ".shellescape(fname,1).redir let ret= v:shell_error elseif has("unix") && executable("kfmclient") && s:haskdeinit +" call Decho("unix and kfmclient") " call Decho("exe sil !kfmclient exec ".shellescape(fname,1)." ".redir) exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir let ret= v:shell_error elseif has("macunix") && executable("open") +" call Decho("macunix and open") " call Decho("exe sil !open ".shellescape(fname,1)." ".redir) exe "sil !open ".shellescape(fname,1)." ".redir let ret= v:shell_error @@ -3880,7 +3958,7 @@ fun! netrw#NetrwBrowseX(fname,remote) " Feb 12, 2008: had to de-activiate removal of " temporary file because it wasn't getting seen. " if a:remote == 1 && fname != a:fname -" call Decho("deleting temporary file<".fname.">") +"" call Decho("deleting temporary file<".fname.">") " call s:NetrwDelete(fname) " endif @@ -3892,6 +3970,8 @@ fun! netrw#NetrwBrowseX(fname,remote) exe "sil! keepj norm! \" " redraw! endif + call netrw#NetrwRestorePosn(screenposn) + let @@= ykeep " call Dret("NetrwBrowseX") endfun @@ -3900,6 +3980,7 @@ endfun " s:NetrwChgPerm: (implements "gp") change file permission {{{2 fun! s:NetrwChgPerm(islocal,curdir) " call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)") + let ykeep = @@ call inputsave() let newperm= input("Enter new permission: ") call inputrestore() @@ -3913,6 +3994,7 @@ fun! s:NetrwChgPerm(islocal,curdir) if a:islocal keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) endif + let @@= ykeep " call Dret("s:NetrwChgPerm") endfun @@ -4405,6 +4487,7 @@ endfun " s:NetrwForceChgDir: (gd support) Force treatment as a directory {{{2 fun! s:NetrwForceChgDir(islocal,newdir) " call Dfunc("s:NetrwForceChgDir(islocal=".a:islocal." newdir<".a:newdir.">)") + let ykeep= @@ if a:newdir !~ '/$' " ok, looks like force is needed to get directory-style treatment if a:newdir =~ '@$' @@ -4419,8 +4502,9 @@ fun! s:NetrwForceChgDir(islocal,newdir) " should already be getting treatment as a directory let newdir= a:newdir endif - call s:NetrwBrowseChgDir(a:islocal,newdir) + let newdir= s:NetrwBrowseChgDir(a:islocal,newdir) call s:NetrwBrowse(a:islocal,newdir) + let @@= ykeep " call Dret("s:NetrwForceChgDir") endfun @@ -4446,6 +4530,7 @@ endfun " 2: show hidden files only fun! s:NetrwHide(islocal) " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide) + let ykeep= @@ let svpos= netrw#NetrwSavePosn() if exists("s:netrwmarkfilelist_{bufnr('%')}") @@ -4481,6 +4566,7 @@ fun! s:NetrwHide(islocal) exe "keepj norm! 0" if g:netrw_hide && g:netrw_list_hide == "" keepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) + let @@= ykeep " call Dret("NetrwHide") return endif @@ -4488,6 +4574,7 @@ fun! s:NetrwHide(islocal) keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetrwHide") endfun @@ -4495,6 +4582,7 @@ endfun " s:NetrwHidden: invoked by "gh" {{{2 fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") + let ykeep= @@ " save current position let svpos= netrw#NetrwSavePosn() @@ -4510,6 +4598,7 @@ fun! s:NetrwHidden(islocal) " refresh screen and return to saved position keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("s:NetrwHidden") endfun @@ -4553,6 +4642,7 @@ endfun fun! s:NetrwLeftmouse(islocal) " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") + let ykeep= @@ " check if the status bar was clicked on instead of a file/directory name while getchar(0) != 0 "clear the input stream @@ -4566,10 +4656,12 @@ fun! s:NetrwLeftmouse(islocal) " call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0)) if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() " appears to be a status bar leftmouse click + let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click") return endif if v:mouse_col != col('.') + let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") return endif @@ -4583,6 +4675,7 @@ fun! s:NetrwLeftmouse(islocal) keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) endif endif + let @@= ykeep " call Dret("s:NetrwLeftmouse") endfun @@ -4591,6 +4684,7 @@ endfun " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() " call Dfunc("NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") + let ykeep= @@ " find a character not in the "hide" string to use as a separator for :g and :v commands " How-it-works: take the hiding command, convert it into a range. Duplicate @@ -4612,21 +4706,22 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 " call Decho("hiding<".hide."> listhide<".listhide.">") - exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' + exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 " call Decho("showing<".hide."> listhide<".listhide.">") - exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' + exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile if g:netrw_hide == 2 - exe 'sil keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' - exe 'sil keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' + exe 'sil! keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' + exe 'sil! keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' endif " remove any blank lines that have somehow remained. " This seems to happen under Windows. exe 'sil! keepj 1,$g@^\s*$@d' + let @@= ykeep " call Dret("NetrwListHide") endfun @@ -4635,6 +4730,7 @@ endfun fun! s:NetrwHideEdit(islocal) " call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") + let ykeep= @@ " save current cursor position let svpos= netrw#NetrwSavePosn() @@ -4650,6 +4746,7 @@ fun! s:NetrwHideEdit(islocal) " restore cursor position call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetrwHideEdit") endfun @@ -4659,6 +4756,7 @@ endfun fun! s:NetSortSequence(islocal) " call Dfunc("NetSortSequence(islocal=".a:islocal.")") + let ykeep= @@ let svpos= netrw#NetrwSavePosn() call inputsave() let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) @@ -4668,6 +4766,7 @@ fun! s:NetSortSequence(islocal) let g:netrw_sort_sequence= newsortseq keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetSortSequence") endfun @@ -4677,6 +4776,7 @@ endfun fun! s:NetrwMakeDir(usrhost) " call Dfunc("NetrwMakeDir(usrhost<".a:usrhost.">)") + let ykeep= @@ " get name of new directory from user. A bare will skip. " if its currently a directory, also request will be skipped, but with " a message. @@ -4686,6 +4786,7 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("newdirname<".newdirname.">") if newdirname == "" + let @@= ykeep " call Dret("NetrwMakeDir : user aborted with bare ") return endif @@ -4701,6 +4802,7 @@ fun! s:NetrwMakeDir(usrhost) if !exists("g:netrw_quiet") keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif + let @@= ykeep " call Dret("NetrwMakeDir : directory<".newdirname."> exists previously") return endif @@ -4708,6 +4810,7 @@ fun! s:NetrwMakeDir(usrhost) if !exists("g:netrw_quiet") keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) endif + let @@= ykeep " call Dret("NetrwMakeDir : file<".newdirname."> exists previously") return endif @@ -4722,6 +4825,12 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") " call Decho("exe sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) exe "sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1) + if v:shell_error != 0 + let @@= ykeep + call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) +" call Dret("NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) + return + endif if !g:netrw_keepdir exe 'keepj lcd '.fnameescape(netrw_origdir) " call Decho("netrw_keepdir=".g:netrw_keepdir.": keepjumps lcd ".fnameescape(netrw_origdir)." getcwd<".getcwd().">") @@ -4768,6 +4877,7 @@ fun! s:NetrwMakeDir(usrhost) keepj call netrw#NetrwRestorePosn(svpos) endif + let @@= ykeep " call Dret("NetrwMakeDir") endfun @@ -4790,9 +4900,10 @@ endfun " b:netrw_islocal fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") + let ykeep = @@ let curbufnr= bufnr("%") let curdir = b:netrw_curdir - let trailer = '[@=|\/\*]\=\>' + let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' if exists("s:netrwmarkfilelist_{curbufnr}") " markfile list pre-exists @@ -4881,6 +4992,7 @@ fun! s:NetrwMarkFile(islocal,fname) " call Decho("2match none") 2match none endif + let @@= ykeep " call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") endfun @@ -4972,9 +5084,19 @@ fun! s:NetrwMarkFileCopy(islocal) if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory " call Decho("copy from local to local") + if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^cmd ' + call netrw#ErrorMsg(s:ERROR,"g:netrw_localcopycmd<".g:netrw_localcopycmd."> not executable on your system, aborting",91) +" call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!") + return + endif let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")") call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) +" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) + return 0 + endif elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory @@ -4996,6 +5118,11 @@ fun! s:NetrwMarkFileCopy(islocal) call mkdir(tmpdir) else exe "sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) +" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) ) + return + endif endif if isdirectory(tmpdir) exe "keepj lcd ".fnameescape(tmpdir) @@ -5008,6 +5135,11 @@ fun! s:NetrwMarkFileCopy(islocal) endfor exe "keepj lcd ".fnameescape(curdir) exe "sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) +" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) ) + return + endif else exe "keepj lcd ".fnameescape(curdir) endif @@ -5348,9 +5480,9 @@ fun! s:NetrwMarkFileGrep(islocal) try exe "keepj noautocmd vimgrep".pat." ".netrwmarkfilelist catch /^Vim\%((\a\+)\)\=:E480/ - keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">") - return + keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) +" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">") + return endtry 2match none @@ -5388,18 +5520,19 @@ fun! s:NetrwMarkFileMove(islocal) " move: local -> local " call Decho("move from local to local") " call Decho("(s:NetrwMarkFileMove) local to local move") - if executable(g:netrw_localmovecmd) - for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")") - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt)) - if v:shell_error < 0 - call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54) - break - endif - endfor - else - keepj call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> is not executable!",57) + if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^cmd ' + call netrw#ErrorMsg(s:ERROR,"g:netrw_localmovecmd<".g:netrw_localmovecmd."> not executable on your system, aborting",90) +" call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!") + return endif + for fname in s:netrwmarkfilelist_{bufnr("%")} +" call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")") + let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt)) + if v:shell_error < 0 + call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54) + break + endif + endfor elseif a:islocal && !s:netrwmftgt_islocal " move: local -> remote @@ -5703,6 +5836,7 @@ endfun " s:NetrwOpenFile: query user for a filename and open it {{{2 fun! s:NetrwOpenFile(islocal) " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")") + let ykeep= @@ call inputsave() let fname= input("Enter filename: ") call inputrestore() @@ -5726,6 +5860,7 @@ fun! s:NetrwOpenFile(islocal) else exe "e ".fnameescape(fname) endif + let @@= ykeep " call Dret("s:NetrwOpenFile") endfun @@ -5899,6 +6034,7 @@ endfun fun! s:NetrwObtain(islocal) " call Dfunc("NetrwObtain(islocal=".a:islocal.")") + let ykeep= @@ if exists("s:netrwmarkfilelist_{bufnr('%')}") let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) @@ -5906,6 +6042,7 @@ fun! s:NetrwObtain(islocal) else call netrw#NetrwObtain(a:islocal,expand("")) endif + let @@= ykeep " call Dret("NetrwObtain") endfun @@ -5949,6 +6086,10 @@ fun! netrw#NetrwObtain(islocal,fname,...) for fname in fnamelist " call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) + return endfor else " transfer files with one command @@ -5956,6 +6097,10 @@ fun! netrw#NetrwObtain(islocal,fname,...) let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")") call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) + return endif elseif !exists("b:netrw_curdir") call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) @@ -6129,6 +6274,7 @@ endfun fun! s:NetrwPrevWinOpen(islocal) " call Dfunc("NetrwPrevWinOpen(islocal=".a:islocal.")") + let ykeep= @@ " grab a copy of the b:netrw_curdir to pass it along to newly split windows let curdir = b:netrw_curdir @@ -6187,6 +6333,7 @@ fun! s:NetrwPrevWinOpen(islocal) else wincmd p endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice." : unable to write <".bufname.">") return choice endif @@ -6206,6 +6353,7 @@ fun! s:NetrwPrevWinOpen(islocal) else wincmd p endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice." : cancelled") return choice endif @@ -6222,6 +6370,7 @@ fun! s:NetrwPrevWinOpen(islocal) call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword)) endif endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice) return choice endfun @@ -6415,6 +6564,7 @@ endfun " s:NetrwPreview: {{{2 fun! s:NetrwPreview(path) range " call Dfunc("NetrwPreview(path<".a:path.">)") + let ykeep= @@ keepj call s:NetrwOptionSave("s:") keepj call s:NetrwSafeOptions() if has("quickfix") @@ -6435,6 +6585,7 @@ fun! s:NetrwPreview(path) range keepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) endif keepj call s:NetrwOptionRestore("s:") + let @@= ykeep " call Dret("NetrwPreview") endfun @@ -6443,18 +6594,20 @@ endfun fun! s:NetrwRefresh(islocal,dirname) " call Dfunc("NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. - " NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here. - " Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself. + " (defunct) NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here. + " (defunct) Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself. setlocal ma noro " call Decho("setlocal ma noro") " call Decho("clear buffer<".expand("%")."> with :%d") + let ykeep = @@ + let screenposn = netrw#NetrwSavePosn() sil! keepj %d if a:islocal keepj call netrw#LocalBrowseCheck(a:dirname) else keepj call s:NetrwBrowse(a:islocal,a:dirname) endif - keepj call netrw#NetrwRestorePosn() + keepj call netrw#NetrwRestorePosn(screenposn) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -6465,7 +6618,8 @@ fun! s:NetrwRefresh(islocal,dirname) 2match none endif -" redraw! +" restore + let @@= ykeep " call Dret("NetrwRefresh") endfun @@ -6474,7 +6628,7 @@ endfun " Called by NetrwMarkFileCopy() " Interfaces to s:NetrwRefresh() and s:LocalBrowseShellCmdRefresh() fun! s:NetrwRefreshDir(islocal,dirname) -" call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) fastbrowse=".g:netrw_fastbrowse) +" call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse) if g:netrw_fastbrowse == 0 " slowest mode (keep buffers refreshed, local or remote) " call Decho("slowest mode: keep buffers refreshed, local or remote") @@ -6510,6 +6664,7 @@ endfun " front. An "*" pattern handles the default priority. fun! s:NetrwSetSort() " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) + let ykeep= @@ if w:netrw_liststyle == s:LONGLIST let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') else @@ -6570,6 +6725,7 @@ fun! s:NetrwSetSort() " be just digits themselves. exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' keepj call histdel("/",-1) + let @@= ykeep " call Dret("SetSort") endfun @@ -6600,6 +6756,7 @@ endfun fun! s:NetrwSplit(mode) " call Dfunc("s:NetrwSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv) + let ykeep= @@ call s:SaveWinVars() if a:mode == 0 @@ -6668,6 +6825,7 @@ fun! s:NetrwSplit(mode) keepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) endif + let @@= ykeep " call Dret("s:NetrwSplit") endfun @@ -7126,6 +7284,10 @@ fun! s:PerformListing(islocal) " set display to netrw display settings " call Decho("set display to netrw display settings (noma nomod etc)") exe "setl ".g:netrw_bufsettings + if g:netrw_liststyle == s:LONGLIST +" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) + endif if exists("s:treecurpos") keepj call netrw#NetrwRestorePosn(s:treecurpos) @@ -7250,7 +7412,8 @@ fun! s:NetrwRemoteListing() " if there's no ../ listed, then put ./ and ../ in let line1= line(".") exe "sil! keepj ".w:netrw_bannercnt - let line2= search('^\.\.\/\%(\s\|$\)','cnW') + let line2= search('\.\.\/\%(\s\|$\)','cnW') +" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) if line2 == 0 " call Decho("netrw is putting ./ and ../ into listing") sil! keepj put='../' @@ -7720,6 +7883,55 @@ endfun " Local Directory Browsing Support: {{{1 " ========================================== +" --------------------------------------------------------------------- +" netrw#FileUrlRead: handles reading file://* files {{{2 +" Should accept: file://localhost/etc/fstab +" file:///etc/fstab +" file:///c:/WINDOWS/clock.avi +" file:///c|/WINDOWS/clock.avi +" file://localhost/c:/WINDOWS/clock.avi +" file://localhost/c|/WINDOWS/clock.avi +" file://c:/foo.txt +" file:///c:/foo.txt +" and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value +fun! netrw#FileUrlRead(fname) +" call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") + let fname = a:fname + if fname =~ '^file://localhost/' +" call Decho('converting file://localhost/ -to- file:///') + let fname= substitute(fname,'^file://localhost/','file:///','') +" call Decho("fname<".fname.">") + endif + if (has("win32") || has("win95") || has("win64") || has("win16")) + if fname =~ '^file:///\=\a[|:]/' +" call Decho('converting file:///\a|/ -to- file://\a:/') + let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') +" call Decho("fname<".fname.">") + endif + endif + let fname2396 = netrw#RFC2396(fname) + let fname2396e= fnameescape(fname2396) + let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") + if (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("windows exception for plainfname") + if plainfname =~ '^/\+\a:' +" call Decho('removing leading "/"s') + let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') + endif + endif +" call Decho("fname2396<".fname2396.">") +" call Decho("plainfname<".plainfname.">") + exe "sil doau BufReadPre ".fname2396e + exe 'keepj r '.plainfname + exe 'file! '.plainfname + keepj 1d +" call Decho("(FileUrlRead) setl nomod") + setl nomod +" call Decho("(FileUrlRead) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("netrw#FileUrlRead") + exe "sil doau BufReadPost ".fname2396e +endfun + " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) @@ -7732,17 +7944,36 @@ fun! netrw#LocalBrowseCheck(dirname) " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) " call Dredir("LocalBrowseCheck","ls!")|redraw!|sleep 3 + let ykeep= @@ if isdirectory(a:dirname) -" call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")) - if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) +" call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) + let svposn= netrw#NetrwSavePosn() + if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 sil! keepj call s:NetrwBrowse(1,a:dirname) + call netrw#NetrwRestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 sil! keepj call s:NetrwBrowse(1,a:dirname) + call netrw#NetrwRestorePosn(svposn) elseif exists("s:treeforceredraw") unlet s:treeforceredraw sil! keepj call s:NetrwBrowse(1,a:dirname) + call netrw#NetrwRestorePosn(svposn) endif endif + " following code wipes out currently unused netrw buffers + " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) + " AND IF the listing style is not a tree listing + if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST + let ibuf = 1 + let buflast = bufnr("$") + while ibuf <= buflast + if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) + exe "sil! ".ibuf."bw!" + endif + let ibuf= ibuf + 1 + endwhile + endif + let @@= ykeep " not a directory, ignore it endfun @@ -7759,12 +7990,12 @@ fun! s:LocalListing() " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = s:Strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(fnameescape(dirname),"*")) + let filelist = glob(s:ComposePath(dirname,"*")) " call Decho("(LocalListing) glob(dirname<".dirname."/*>)=".filelist) if filelist != "" let filelist= filelist."\n" endif - let filelist= filelist.glob(s:ComposePath(fnameescape(dirname),".*")) + let filelist= filelist.glob(s:ComposePath(dirname,".*")) " call Decho("(LocalListing) glob(dirname<".dirname."/.*>)=".filelist) " Coding choice: either elide ./ if present @@ -7806,6 +8037,11 @@ fun! s:LocalListing() " call Decho("(LocalListing) (before while) dirnamelen<".dirnamelen.">") " call Decho("(LocalListing) (before while) filelist<".filelist.">") + + if get(g:, 'netrw_dynamic_maxfilenamelen', 0) + let g:netrw_maxfilenamelen = max(map(split(filelist, '\n'), 'len(fnamemodify(v:val, ":t"))')) + 1 + endif + while filelist != "" if filelist =~ '\n' let filename = substitute(filelist,'\n.*$','','e') @@ -7908,8 +8144,8 @@ fun! s:LocalListing() sil! keepj g/^$/d sil! keepj %s/\r$//e call histdel("/",-1) - exe "setl ts=".g:netrw_maxfilenamelen -" call Decho("(LocalListing) setl ts=".g:netrw_maxfilenamelen) +" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) " call Dret("s:LocalListing") endfun @@ -7940,6 +8176,7 @@ fun! s:LocalBrowseShellCmdRefresh() endif let itab = 1 let buftablist = [] + let ykeep = @@ while itab <= tabpagenr("$") let buftablist = buftablist + tabpagebuflist() let itab = itab + 1 @@ -7970,10 +8207,175 @@ fun! s:LocalBrowseShellCmdRefresh() let ibl= ibl + 1 endfor exe curwin."wincmd w" + let @@= ykeep " call Dret("LocalBrowseShellCmdRefresh") endfun +" --------------------------------------------------------------------- +" s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 +" +" g:netrw_ Directory Is +" fastbrowse Local Remote +" slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) +" med 1 D H H=Hiding a buffer implies it may be re-used (fast) +" fast 2 H H +" +" Deleting a buffer means that it will be re-loaded when examined, hence "slow". +" Hiding a buffer means that it will be re-used when examined, hence "fast". +" (re-using a buffer may not be as accurate) +fun! s:LocalFastBrowser() +" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse." s:netrw_browser_shellcmd ".(exists("s:netrw_browser_shellcmd")? "exists" : "does not exist")) + + " initialize browselist, a list of buffer numbers that the local browser has used + if !exists("s:netrw_browselist") +" call Decho("initialize s:netrw_browselist") + let s:netrw_browselist= [] + endif + + " append current buffer to fastbrowse list + if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] +" call Decho("appendng current buffer to browselist") + call add(s:netrw_browselist,bufnr("%")) +" call Decho("browselist=".string(s:netrw_browselist)) + endif + + " enable autocmd events to handle refreshing/removing local browser buffers + " If local browse buffer is currently showing: refresh it + " If local browse buffer is currently hidden : wipe it + " g:netrw_fastbrowse=0 : slow speed, never re-use directory listing + " =1 : medium speed, re-use directory listing for remote only + " =2 : fast speed, always re-use directory listing when possible + if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 +" call Decho("setting up local-browser shell command refresh") + let s:netrw_browser_shellcmd= 1 + augroup AuNetrwShellCmd + au! + if (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") + au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() + else + au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() +" call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") + endif + augroup END + endif + + " user must have changed fastbrowse to its fast setting, so remove + " the associated autocmd events + if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") +" call Decho("remove AuNetrwShellCmd autcmd group") + unlet s:netrw_browser_shellcmd + augroup AuNetrwShellCmd + au! + augroup END + augroup! AuNetrwShellCmd + endif + +" call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">") +endfun + +" --------------------------------------------------------------------- +" s:NetrwLocalExecute: uses system() to execute command under cursor ("X" command support) {{{2 +fun! s:NetrwLocalExecute(cmd) +" call Dfunc("s:NetrwLocalExecute(cmd<".a:cmd.">)") + let ykeep= @@ + " sanity check + if !executable(a:cmd) + call netrw#ErrorMsg(s:ERROR,"the file<".a:cmd."> is not executable!",89) + let @@= ykeep +" call Dret("s:NetrwLocalExecute") + return + endif + + let optargs= input(":!".a:cmd,"","file") +" call Decho("optargs<".optargs.">") + let result= system(a:cmd.optargs) +" call Decho(result) + + " strip any ansi escape sequences off + let result = substitute(result,"\e\\[[0-9;]*m","","g") + + " show user the result(s) + echomsg result + let @@= ykeep + +" call Dret("s:NetrwLocalExecute") +endfun + +" --------------------------------------------------------------------- +" s:NetrwLocalRename: rename a remote file or directory {{{2 +fun! s:NetrwLocalRename(path) range +" call Dfunc("NetrwLocalRename(path<".a:path.">)") + + " preparation for removing multiple files/directories + let ykeep = @@ + let ctr = a:firstline + let svpos = netrw#NetrwSavePosn() + + " rename files given by the markfilelist + if exists("s:netrwmarkfilelist_{bufnr('%')}") + for oldname in s:netrwmarkfilelist_{bufnr("%")} +" call Decho("oldname<".oldname.">") + if exists("subfrom") + let newname= substitute(oldname,subfrom,subto,'') +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") + else + call inputsave() + let newname= input("Moving ".oldname." to : ",oldname) + call inputrestore() + if newname =~ '^s/' + let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') + let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") + let newname = substitute(oldname,subfrom,subto,'') + endif + endif + call rename(oldname,newname) + endfor + call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + + else + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepj ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetrwGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + keepj norm! 0 + let oldname= s:ComposePath(a:path,curword) +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) + call inputrestore() + + call rename(oldname,newname) +" call Decho("renaming <".oldname."> to <".newname.">") + + let ctr= ctr + 1 + endwhile + endif + + " refresh the directory +" call Decho("refresh the directory listing") + keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep + +" call Dret("NetrwLocalRename") +endfun + " --------------------------------------------------------------------- " s:NetrwLocalRm: {{{2 fun! s:NetrwLocalRm(path) range @@ -7981,6 +8383,7 @@ fun! s:NetrwLocalRm(path) range " call Decho("firstline=".a:firstline." lastline=".a:lastline) " preparation for removing multiple files/directories + let ykeep = @@ let ret = 0 let all = 0 let svpos = netrw#NetrwSavePosn() @@ -8032,6 +8435,7 @@ fun! s:NetrwLocalRm(path) range keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) keepj call netrw#NetrwRestorePosn(svpos) endif + let @@= ykeep " call Dret("s:NetrwLocalRm") endfun @@ -8121,186 +8525,6 @@ fun! s:NetrwLocalRmFile(path,fname,all) return ok endfun -" --------------------------------------------------------------------- -" s:NetrwLocalRename: rename a remote file or directory {{{2 -fun! s:NetrwLocalRename(path) range -" call Dfunc("NetrwLocalRename(path<".a:path.">)") - - " preparation for removing multiple files/directories - let ctr = a:firstline - let svpos= netrw#NetrwSavePosn() - - " rename files given by the markfilelist - if exists("s:netrwmarkfilelist_{bufnr('%')}") - for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") - if exists("subfrom") - let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") - else - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) - call inputrestore() - if newname =~ '^s/' - let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') - let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") - let newname = substitute(oldname,subfrom,subto,'') - endif - endif - call rename(oldname,newname) - endfor - call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - - else - - " attempt to rename files/directories - while ctr <= a:lastline - exe "keepj ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue - endif - let curword= s:NetrwGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue - endif - - keepj norm! 0 - let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">") - - call inputsave() - let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) - call inputrestore() - - call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") - - let ctr= ctr + 1 - endwhile - endif - - " refresh the directory -" call Decho("refresh the directory listing") - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - keepj call netrw#NetrwRestorePosn(svpos) - -" call Dret("NetrwLocalRename") -endfun - -" --------------------------------------------------------------------- -" s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 -" -" g:netrw_ Directory Is -" fastbrowse Local Remote -" slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) -" med 1 D H H=Hiding a buffer implies it may be re-used (fast) -" fast 2 H H -" -" Deleting a buffer means that it will be re-loaded when examined, hence "slow". -" Hiding a buffer means that it will be re-used when examined, hence "fast". -" (re-using a buffer may not be as accurate) -fun! s:LocalFastBrowser() -" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) - - " initialize browselist, a list of buffer numbers that the local browser has used - if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist") - let s:netrw_browselist= [] - endif - - " append current buffer to fastbrowse list - if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] -" call Decho("appendng current buffer to browselist") - call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) - endif - - " enable autocmd events to handle refreshing/removing local browser buffers - " If local browse buffer is currently showing: refresh it - " If local browse buffer is currently hidden : wipe it - if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 -" call Decho("setting up local-browser shell command refresh") - let s:netrw_browser_shellcmd= 1 - augroup AuNetrwShellCmd - au! - if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") - au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() - else - au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() -" call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") - endif - augroup END - endif - - " user must have changed fastbrowse to its fast setting, so remove - " the associated autocmd events - if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") -" call Decho("remove AuNetrwShellCmd autcmd group") - unlet s:netrw_browser_shellcmd - augroup AuNetrwShellCmd - au! - augroup END - augroup! AuNetrwShellCmd - endif - -" call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">") -endfun - -" --------------------------------------------------------------------- -" netrw#FileUrlRead: handles reading file://* files {{{2 -" Should accept: file://localhost/etc/fstab -" file:///etc/fstab -" file:///c:/WINDOWS/clock.avi -" file:///c|/WINDOWS/clock.avi -" file://localhost/c:/WINDOWS/clock.avi -" file://localhost/c|/WINDOWS/clock.avi -" file://c:/foo.txt -" file:///c:/foo.txt -" and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value -fun! netrw#FileUrlRead(fname) -" call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") - let fname = a:fname - if fname =~ '^file://localhost/' -" call Decho('converting file://localhost/ -to- file:///') - let fname= substitute(fname,'^file://localhost/','file:///','') -" call Decho("fname<".fname.">") - endif - if (has("win32") || has("win95") || has("win64") || has("win16")) - if fname =~ '^file:///\=\a[|:]/' -" call Decho('converting file:///\a|/ -to- file://\a:/') - let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') -" call Decho("fname<".fname.">") - endif - endif - let fname2396 = netrw#RFC2396(fname) - let fname2396e= fnameescape(fname2396) - let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") - if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows exception for plainfname") - if plainfname =~ '^/\+\a:' -" call Decho('removing leading "/"s') - let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') - endif - endif -" call Decho("fname2396<".fname2396.">") -" call Decho("plainfname<".plainfname.">") - exe "sil doau BufReadPre ".fname2396e - exe 'keepj r '.plainfname - exe 'file! '.plainfname - keepj 1d -" call Decho("(FileUrlRead) setl nomod") - setl nomod -" call Decho("(FileUrlRead) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Dret("netrw#FileUrlRead") - exe "sil doau BufReadPost ".fname2396e -endfun - " --------------------------------------------------------------------- " Support Functions: {{{1 @@ -8739,7 +8963,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 fun! s:NetrwInsureWinVars() -" call Dfunc("s:NetrwInsureWinVars()") +" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) if !exists("w:netrw_liststyle") let curbuf = bufnr("%") let curwin = winnr() @@ -8753,7 +8977,7 @@ fun! s:NetrwInsureWinVars() endif let iwin= iwin + 1 endwhile - exe curbuf."wincmd w" + exe curwin."wincmd w" if exists("winvars") " call Decho("copying w#".iwin." window variables to w#".curwin) for k in keys(winvars) @@ -8761,7 +8985,7 @@ fun! s:NetrwInsureWinVars() endfor endif endif -" call Dret("s:NetrwInsureWinVars") +" call Dret("s:NetrwInsureWinVars win#".winnr()) endfun " ------------------------------------------------------------------------ @@ -8975,7 +9199,7 @@ fun! s:SetRexDir(islocal,dirname) " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)") let w:netrw_rexdir = a:dirname let w:netrw_rexlocal = a:islocal -" call Dret("s:SetRexDir") +" call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun " --------------------------------------------------------------------- diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index 38f729956..ef361dc21 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -106,7 +106,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_browsex_viewer = (not defined)' endif put = 'let g:netrw_compress = '.g:netrw_compress - put = 'let g:netrw_cursorline = '.g:netrw_cursorline + put = 'let g:netrw_cursor = '.g:netrw_cursor let decompressline= line("$") put ='let g:netrw_decompress...' put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax @@ -125,9 +125,9 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd - put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir + put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd - put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir + put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_menu = '.g:netrw_menu put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim index f36c6683a..9a1474f5e 100644 --- a/runtime/autoload/syntaxcomplete.vim +++ b/runtime/autoload/syntaxcomplete.vim @@ -1,12 +1,28 @@ " Vim completion script " Language: All languages, uses existing syntax highlighting rules " Maintainer: David Fishburn -" Version: 8.0 -" Last Change: 2011 Nov 02 +" Version: 10.0 +" Last Change: 2012 Oct 20 " Usage: For detailed help, ":help ft-syntax-omni" " History " +" Version 10.0 +" Cycle through all the character ranges specified in the +" iskeyword option and build a list of valid word separators. +" Prior to this change, only actual characters were used, +" where for example ASCII "45" == "-". If "45" were used +" in iskeyword the hyphen would not be picked up. +" This introduces a new option, since the character ranges +" specified could be multibyte: +" let g:omni_syntax_use_single_byte = 1 +" This by default will only allow single byte ASCII +" characters to be added and an additional check to ensure +" the charater is printable (see documentation for isprint). +" +" Version 9.0 +" Add the check for cpo. +" " Version 8.0 " Updated SyntaxCSyntaxGroupItems() " - Some additional syntax items were also allowed @@ -50,7 +66,11 @@ endif if exists('g:loaded_syntax_completion') finish endif -let g:loaded_syntax_completion = 80 +let g:loaded_syntax_completion = 100 + +" Turn on support for line continuations when creating the script +let s:cpo_save = &cpo +set cpo&vim " Set ignorecase to the ftplugin standard " This is the default setting, but if you define a buffer local @@ -67,6 +87,18 @@ if !exists('g:omni_syntax_use_iskeyword') let g:omni_syntax_use_iskeyword = 1 endif +" When using iskeyword, this setting controls whether the characters +" should be limited to single byte characters. +if !exists('g:omni_syntax_use_single_byte') + let g:omni_syntax_use_single_byte = 1 +endif + +" When using iskeyword, this setting controls whether the characters +" should be limited to single byte characters. +if !exists('g:omni_syntax_use_iskeyword_numeric') + let g:omni_syntax_use_iskeyword_numeric = 1 +endif + " Only display items in the completion window that are at least " this many characters in length. " This is the default setting, but if you define a buffer local @@ -446,19 +478,66 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " This will replace non-word characters with spaces. let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' ) else - let accept_chars = ','.&iskeyword.',' - " Remove all character ranges - " let accept_chars = substitute(accept_chars, ',[^,]\+-[^,]\+,', ',', 'g') - let accept_chars = substitute(accept_chars, ',\@<=[^,]\+-[^,]\+,', '', 'g') - " Remove all numeric specifications - " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') - let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') - " Remove all commas - let accept_chars = substitute(accept_chars, ',', '', 'g') - " Escape special regex characters - let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) - " Remove all characters that are not acceptable - let syn_list = substitute( syn_list, '[^0-9A-Za-z_ '.accept_chars.']', ' ', 'g' ) + if g:omni_syntax_use_iskeyword_numeric == 1 + " iskeyword can contain value like this + " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 + " Numeric values convert to their ASCII equivalent using the + " nr2char() function. + " & 38 + " * 42 + " + 43 + " - 45 + " ^ 94 + " Iterate through all numeric specifications and convert those + " to their ascii equivalent ensuring the character is printable. + " If so, add it to the list. + let accepted_chars = '' + for item in split(&iskeyword, ',') + if item =~ '-' + " This is a character range (ie 47-58), + " cycle through each character within the range + let [b:start, b:end] = split(item, '-') + for range_item in range( b:start, b:end ) + if range_item <= 127 || g:omni_syntax_use_single_byte == 0 + if nr2char(range_item) =~ '\p' + let accepted_chars = accepted_chars . nr2char(range_item) + endif + endif + endfor + elseif item =~ '^\d\+$' + " Only numeric, translate to a character + if item < 127 || g:omni_syntax_use_single_byte == 0 + if nr2char(item) =~ '\p' + let accepted_chars = accepted_chars . nr2char(item) + endif + endif + else + if char2nr(item) < 127 || g:omni_syntax_use_single_byte == 0 + if item =~ '\p' + let accepted_chars = accepted_chars . item + endif + endif + endif + endfor + " Escape special regex characters + let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' ) + " Remove all characters that are not acceptable + let syn_list = substitute( syn_list, '[^A-Za-z'.accepted_chars.']', ' ', 'g' ) + else + let accept_chars = ','.&iskeyword.',' + " Remove all character ranges + " let accept_chars = substitute(accept_chars, ',[^,]\+-[^,]\+,', ',', 'g') + let accept_chars = substitute(accept_chars, ',\@<=[^,]\+-[^,]\+,', '', 'g') + " Remove all numeric specifications + " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') + let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') + " Remove all commas + let accept_chars = substitute(accept_chars, ',', '', 'g') + " Escape special regex characters + let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) + " Remove all characters that are not acceptable + let syn_list = substitute( syn_list, '[^0-9A-Za-z_'.accept_chars.']', ' ', 'g' ) + endif endif if b:omni_syntax_minimum_length > 0 @@ -471,3 +550,27 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) return syn_list endfunction + +function! OmniSyntaxShowChars(spec) + let result = [] + for item in split(a:spec, ',') + if len(item) > 1 + if item == '@-@' + call add(result, char2nr(item)) + else + call extend(result, call('range', split(item, '-'))) + endif + else + if item == '@' " assume this is [A-Za-z] + for [c1, c2] in [['A', 'Z'], ['a', 'z']] + call extend(result, range(char2nr(c1), char2nr(c2))) + endfor + else + call add(result, char2nr(item)) + endif + endif + endfor + return join(map(result, 'nr2char(v:val)'), ', ') +endfunction +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 22eff706d..d5f19a634 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.3. Last change: 2012 Aug 08 +*change.txt* For Vim version 7.3. Last change: 2012 Nov 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -598,8 +598,11 @@ For other systems the tmpnam() library function is used. the flags. *g&* -g& Synonym for `:%s//~/&` (repeat last substitute on all - lines with the same flags). +g& Synonym for `:%s//~/&` (repeat last substitute with + last search pattern on all lines with the same flags). + For exaple, when you first do a substitution with + `:s/pattern/repl/flags` and then `/search` for + something else, `g&` will do `:%s/search/repl/flags`. Mnemonic: global substitute. {not in Vi} *:snomagic* *:sno* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f105cf104..bf89ee6bf 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.3. Last change: 2012 Oct 21 +*eval.txt* For Vim version 7.3. Last change: 2012 Nov 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5483,7 +5483,8 @@ split({expr} [, {pattern} [, {keepempty}]]) *split()* empty each white-separated sequence of characters becomes an item. Otherwise the string is split where {pattern} matches, - removing the matched characters. + removing the matched characters. 'ignorecase' is not used + here, add \c to ignore case. |/\c| When the first or last item is empty it is omitted, unless the {keepempty} argument is given and it's non-zero. Other empty items are kept when {pattern} matches at least one diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index a74d88048..05b8b4e86 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -1,4 +1,4 @@ -*if_perl.txt* For Vim version 7.3. Last change: 2012 Aug 02 +*if_perl.txt* For Vim version 7.3. Last change: 2012 Oct 25 VIM REFERENCE MANUAL by Sven Verdoolaege @@ -175,7 +175,8 @@ VIM::Windows([{wn}...]) With no arguments, returns a list of all the windows VIM::DoCommand({cmd}) Executes Ex command {cmd}. *perl-Eval* -VIM::Eval({expr}) Evaluates {expr} and returns (success, val). +VIM::Eval({expr}) Evaluates {expr} and returns (success, value) in list + context or just value in scalar context. success=1 indicates that val contains the value of {expr}; success=0 indicates a failure to evaluate the expression. '@x' returns the contents of register diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 53d4e8a55..a43923498 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -7496,7 +7496,7 @@ A jump table for the options with a short description can be found at |Q_op|. For more information about this feature see |undo-persistence|. The undo file is not read when 'undoreload' causes the buffer from before a reload to be saved for undo. - WARNING: this is a very new feature. Use at your own risk! + When 'undofile' is turned off the undo file is NOT deleted. *'undolevels'* *'ul'* 'undolevels' 'ul' number (default 100, 1000 for Unix, VMS, diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 142f08f16..c17ca5f7c 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Apr 05 +*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Oct 25 ----------------------------------------------------- NETRW REFERENCE MANUAL by Charles E. Campbell, Jr. @@ -143,7 +143,7 @@ and has lines resembling > Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' -< +< Netrw will substitute the host's machine name for MACHINE from the url it is attempting to open, and so one may specify > userid @@ -209,7 +209,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 default, the option arguments for the http-handling commands are: > elinks : "-source >" - links : "-source >" + links : "-dump >" curl : "-o" wget : "-q -O" fetch : "-o" @@ -1072,6 +1072,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 v Enter the file/directory under the cursor in a new |netrw-v| browser window. A vertical split is used. x View file with an associated program |netrw-x| + X Execute filename under cursor via |system()| |netrw-X| % Open a new file in netrw's current directory |netrw-%| @@ -1589,6 +1590,15 @@ Related topics: |netrw-s| |netrw-S| Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options| +EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* + +Pressing X while the cursor is atop an executable file will yield a prompt +using the filename asking for any arguments. Upon pressing a [return], netrw +will then call |system()| with that command and arguments. The result will +be displayed by |:echomsg|, and so |:messages| will repeat display of the +result. Ansi escape sequences will be stripped out. + + FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2 Remote symbolic links (ie. those listed via ssh or ftp) are problematic @@ -1596,10 +1606,10 @@ in that it is difficult to tell whether they link to a file or to a directory. To force treatment as a file: use > - gd + gf < To force treatment as a directory: use > - gf + gd < GOING UP *netrw--* {{{2 @@ -1957,7 +1967,7 @@ The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for this to work on remote systems. For your local system, see |ctags| on how to get a version. I myself use hdrtags, currently available at -http://mysite.verizon.net/astronaut/src/index.html , and have > +http://www.drchip.org/astronaut/src/index.html , and have > let g:netrw_ctags= "hdrtag" < @@ -2093,6 +2103,9 @@ your browsing preferences. (see also: |netrw-settings|) history. (related: |netrw-qb| |netrw-u| |netrw-U|) + *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of + |g:netrw_maxfilenamelen|, which affects + local file long listing. *g:netrw_errorlvl* =0: error levels greater than or equal to this are permitted to be displayed 0: notes @@ -2843,13 +2856,13 @@ which is loaded automatically at startup (assuming :set nocp). 1. Get the script, available as: - http://mysite.verizon.net/astronaut/vim/index.html#DECHO + http://www.drchip.org/astronaut/vim/index.html#DECHO or http://vim.sourceforge.net/scripts/script.php?script_id=120 It now comes as a "vimball"; if you're using vim 7.0 or earlier, you'll need to update vimball, too. See - http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL + http://www.drchip.org/astronaut/vim/index.html#VIMBALL 2. Edit the file by typing: > @@ -2882,57 +2895,77 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 12. History *netrw-history* {{{1 - v145: Apr 05, 2012 * moved some command from a g:netrw_local_... - format to g:netwr_local... format - * included some NOTE level messages about - commands that aren't executable - * |g:netrw_errorlvl| (default: NOTE=0) - option introduced - v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used, - or their wincmd equivalents, on a netrw - buffer, the netrw's w: variables were - not copied over. Fixed. - Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented - out, and was mistakenly used during - RestorePosn. Unfortunately, I'm not - sure why it was commented out, so this - "fix" may re-introduce an earlier problem. - Mar 21, 2012 * included s:rexposn internally to make - :Rex return the cursor to the same pos'n - upon restoration of netrw buffer - Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove - "/" from the netrw buffer's usual |'isk'| - in order to allow "filetype detect" to work - properly for scripts. - v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative - number; the absolute value of it will then - be used to specify lines/columns instead of - a percentage. - Jul 05, 2011 * the "d" map now supports mkdir via ftp - See |netrw-d| and |g:netrw_remote_mkdir| - Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore - to use a percentage of |winwidth()| instead - of a percentage of |winheight()|. - Jul 11, 2011 * included support for https://... I'm just - beginning to test this, however. - Aug 01, 2011 * changed RestoreOptions to also restore - cursor position in netrw buffers. - Aug 12, 2011 * added a note about "%" to the balloon - Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon - evaluation is suppressed. - Aug 31, 2011 * (Benjamin R Haskell) provided a patch that - implements non-standard port handling for - files opened via the remote browser. - Aug 31, 2011 * Fixed a **//pattern Explorer bug - Sep 15, 2011 * (reported by Francesco Campana) netrw - now permits the "@" to be part of the - user id (if there's an @ that appears - to the right). - Nov 21, 2011 * New option: |g:netrw_ftp_options| - Dec 07, 2011 * (James Sinclair) provided a fix handling - attempts to use a uid and password when - they weren't defined. This affected - NetWrite (NetRead already had that fix). + v146: Oct 20, 2012 * (David Kotchan) reported that under Windows, + directories named with unusual characters + such as "#" or "$" were not being listed + properly. + * (Kenny Lee) reported that the buffer list + was being populated by netrw buffers. + Netrw will now |:bwipe| netrw buffers + upon editing a file if g:netrw_fastbrowse + is zero and its not in tree listing style. + v145: Apr 05, 2012 * moved some command from a g:netrw_local_... + format to g:netwr_local... format + * included some NOTE level messages about + commands that aren't executable + * |g:netrw_errorlvl| (default: NOTE=0) + option introduced + May 18, 2012 * (Ilya Dogolazky) a scenario where a + |g:netrw_fastbrowse| of zero did not + have a local directory refreshed fixed. + Jul 10, 2012 * (Donatas) |netrw-gb| wasn't working due + to an incorrectly used variable. + Aug 09, 2012 * (Bart Baker) netrw was doubling + of entries after a split. + * (code by Takahiro Yoshihara) implemented + |g:netrw_dynamic_maxfilenamelen| + Aug 31, 2012 * (Andrew Wong) netrw refresh overwriting + the yank buffer. + v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used, + or their wincmd equivalents, on a netrw + buffer, the netrw's w: variables were + not copied over. Fixed. + Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented + out, and was mistakenly used during + RestorePosn. Unfortunately, I'm not + sure why it was commented out, so this + "fix" may re-introduce an earlier problem. + Mar 21, 2012 * included s:rexposn internally to make + :Rex return the cursor to the same pos'n + upon restoration of netrw buffer + Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove + "/" from the netrw buffer's usual |'isk'| + in order to allow "filetype detect" to work + properly for scripts. + v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative + number; the absolute value of it will then + be used to specify lines/columns instead of + a percentage. + Jul 05, 2011 * the "d" map now supports mkdir via ftp + See |netrw-d| and |g:netrw_remote_mkdir| + Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore + to use a percentage of |winwidth()| instead + of a percentage of |winheight()|. + Jul 11, 2011 * included support for https://... I'm just + beginning to test this, however. + Aug 01, 2011 * changed RestoreOptions to also restore + cursor position in netrw buffers. + Aug 12, 2011 * added a note about "%" to the balloon + Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon + evaluation is suppressed. + Aug 31, 2011 * (Benjamin R Haskell) provided a patch that + implements non-standard port handling for + files opened via the remote browser. + Aug 31, 2011 * Fixed a **//pattern Explorer bug + Sep 15, 2011 * (reported by Francesco Campana) netrw + now permits the "@" to be part of the + user id (if there's an @ that appears + to the right). + Nov 21, 2011 * New option: |g:netrw_ftp_options| + Dec 07, 2011 * (James Sinclair) provided a fix handling + attempts to use a uid and password when + they weren't defined. This affected + NetWrite (NetRead already had that fix). ============================================================================== diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index d3ab0ab23..3e1586851 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3. Last change: 2012 Jul 16 +*syntax.txt* For Vim version 7.3. Last change: 2012 Nov 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2489,6 +2489,12 @@ This will add highlighting for the commands that BASH (version 2.05a and later, and part earlier) adds. +RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* + +You may set what syntax definitions should be used for code blocks via + let rst_syntax_code_list = ['vim', 'lisp', ...] + + REXX *rexx.vim* *ft-rexx-syntax* If you notice highlighting errors while scrolling backwards, which are fixed diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 85673109f..4a221e890 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3. Last change: 2012 Oct 21 +*todo.txt* For Vim version 7.3. Last change: 2012 Nov 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -43,20 +43,9 @@ Checking runtime scripts: Thilo Six, 2012 Jun 6. GTK: problem with 'L' in 'guioptions' changing the window width. (Aaron Cornelius, 2012 Feb 6) -Patch to fix undofile hash computed when not necessary. (Christian Brabandt, -2012 Oct 16, update Oct 18) - -Patch to fix repeating "cgn". (Christian Brabandt, 2012 Oct 16) -Update Oct 17. - Javascript file where indent gets stuck on: GalaxyMaster, 2012 May 3. -Updated French and Esperanto files. (Dominique Pelle, 2012 Aug 19) - -When showing diffs filler lines may be hidden at first. -Patch by Christian Brabandt, 2012 Sep 6. Update Oct 11. - -Patch for memory leaks on exception. (ZyX, 2012 Sep 9) +Patches for two problems, with explanations. (Christian Brabandt, 2012 Oct 22) The CompleteDone autocommand needs some info passed to it: - The word that was selected (empty if abandoned complete) @@ -67,6 +56,19 @@ And use file name completion on a file with spaces. (Frederic Hardy, 2009 Mar 23) Patch by Christian Brabandt, 2012 Oct 18. Update Oct 19. +Patch to reset did_endif. (Christian Brabandt,, 2012 Oct 23) +How about a test? + +Patch for Tab behavior with 'conceal'. (Dominique Pelle, 2012 Mar 18) +Patch to test functionality of 'conceal' with tabs. (Simon Ruderich, 2012 Sep +5) Update with screencol() and screenrow() functions: Sep 7. + +Patch for integer overflow in move.c. (Dominique Pelle, 2012 Nov 6) + +Patch for undefined integer behavior. (Dominique Pelle, 2012 Nov 4, second one) + +Patch to have Python interface not depend on multi-byte. + mouse_sgr is not ordered alphabetically in :version output. Docs list mouse_urxvt as normal feature, should be big. (Hayaki Saito, 2012 Aug 16) @@ -76,12 +78,16 @@ the order they were made. Also ":gredo". Both with a count. Useful when tests fail after making changes and you forgot in which files. Patch to make updating tabline faster. (Arseny Kapoulkine, 2012 Oct 3) +Also remove the "rc" variable. Crash with vimdiff. (Don Cruickshank, 2012 Sep 23) Win32: use 'guifontwide' for IME composition. (Taro Muraoka, 2012 Sep 30) Update Oct 2. +Patch to fix :s command with confirm and typing "a". (Christian Brabandt, 2012 +Oct 28) + Patch to make multibyte input work on Win32 console when codepage differs from 'encoding'. (Ken Takata, 2012 Sep 29) @@ -92,6 +98,11 @@ Win32: When a directory name contains an exclamation mark, completion doesn't complete the contents of the directory. No escaping for the "!"? (Jan Stocker, 2012 Jan 5) +Problem caused by patch 7.3.638: window->open does not update window +correctly. Issue 91. + +Do allow real tags above the !_TAG entries. Undo older patch. Issue 90. + Patch to support 'u' in interactive substitute. (Christian Brabandt, 2012 Sep 28) With tests: Oct 9. @@ -103,14 +114,13 @@ Issue 54: document behavior of -complete, also expands arg. New syntax files for apt. (quidame, 2012 Sep 21) +'ff' is wrong for one-line file without EOL. (Issue 77) + Patch for if_lua. (Luis Carvalho, 2012 Aug 26, update Aug 29, another Aug 30, then Sep 1, reminder Oct 14) Issue 72: 'autochdir' causes problems for :vimgrep. -:setlocal does not work in the sandbox, but :set does. Both should work in a -similar way (not setting some options). (Michael Henry, 2012 Oct 20) - In the ATTENTION message about an existing swap file, mention the name of the process that is running. It might actually be some other program, e.g. after a reboot. @@ -118,9 +128,6 @@ a reboot. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) -Win32: patch for current directory, "loading iof conv". (Ken Takata, 2012 Sep -15) - It's probably a good idea to make a negative value for 'sts' use the value of 'sw'. Patch by So8res, Oct 3 2012 @@ -136,9 +143,12 @@ Or use expand('')? Patch for :tabcloseleft, after closing a tab go to left tab. (William Bowers, 2012 Aug 4) -Patch for Tab behavior with 'conceal'. (Dominique Pelle, 2012 Mar 18) -Patch to test functionality of 'conceal' with tabs. (Simon Ruderich, 2012 Sep -5) Update with screencol() and screenrow() functions: Sep 7. +Patch with suggestions for starting.txt. (Tony Mechelynck, 2012 Oct 24) +But use Gnome instead of GTK? + +Should be possible to enable/disable matchparen per window or buffer. +Add a check for b:no_match_paren in Highlight_matching_Pair() (Marcin +Szamotulski, 2012 Nov 8) Crash in autocmd that unloads buffers in a BufUnload event. (Andrew Pimlott, 2012 Aug 11) Disallow :new when BufUnload is being handled? @@ -158,6 +168,9 @@ MS-Windows resizing problems: Help for b:undo_indent'. (Thilo Six, 2012 May 28) Also question if examples are correct. +It should be possible to make globpath() return a list instead of a string, +like with glob(). (Greg Novack, 2012 Nov 2) + The input map for CTRL-O in mswin.vim causes problems after CTRL-X CTRL-O. Suggestion for another map. (Philip Mat, 2012 Jun 18) But use "gi" instead of "a". Or use CTRL-\ CTRL-O. @@ -169,11 +182,16 @@ Have an option for spell checking to not mark any Chinese, Japanese or other double-width characters as error. Or perhaps all characters above 256. (Bill Sun) Helps a lot for mixed Asian and latin text. +When there are no command line arguments ":next" and ":argu" give E163, which +is confusing. Should say "the argument list is empty". + URXVT: - will get stuck if byte sequence does not containe expected semicolon. - Use urxvt mouse support also in xterm. Explanations: http://www.midnight-commander.org/ticket/2662 +MS-Windows: test 17 fails. Analysis by Michael Soyka, 2012 Nov 5. + Patch to add tests for if_xcmdsrv.c., Jul 8, need some more work. (Brian Burns) New tests Jul 13. Update Jul 17. Discussion Jul 18. @@ -817,7 +835,7 @@ very high. (Yegappan Lakshmanan, 2010 Jul 22, Michael Peeters, 2010 Jul 22) Directory wrong in session file, caused by ":lcd" in BufEnter autocommand. (Felix Kater, 2009 Mar 3) -Session file generates error upon loading, cause bu --remote-silent-tab. +Session file generates error upon loading, cause by --remote-silent-tab. (7tommm (ytommm) 2010 Nov 24) Using ~ works OK on 'a' with composing char, but not on 0x0418 with composing @@ -938,8 +956,6 @@ error message? Or is this easy to implement? (Nathan Stratton Treadway, 2008 Aug 20) This is in ucs2bytes(), search for 0xBF. Using the ++bad argument is at the other match for 0xBF. -Fix for matchparen HL doesn't work. beep. - When adding "-complete=file" to a user command this also changes how the argument is processed for . (Ivan Tishchenko, 2008 Aug 19) @@ -1589,6 +1605,9 @@ Win32, NTFS: When editing a specific infostream directly and 'backupcopy' is name is something like "c:\path\foo.txt:bar", includes a colon. (Alex Jakushev, 2008 Feb 1) +printf() uses the field width in bytes. Can it be made character width, +perhaps with a modifier? What does Posix say? + Small problem displaying diff filler line when opening windows with a script. (David Luyer, 2007 Mar 1 ~/Mail/oldmail/mool/in.15872 ) diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt index a49c98c2b..ce7d49454 100644 --- a/runtime/doc/usr_21.txt +++ b/runtime/doc/usr_21.txt @@ -1,4 +1,4 @@ -*usr_21.txt* For Vim version 7.3. Last change: 2008 Nov 09 +*usr_21.txt* For Vim version 7.3. Last change: 2012 Nov 02 VIM USER MANUAL - by Bram Moolenaar @@ -282,7 +282,7 @@ example, use: > SESSION HERE, SESSION THERE The obvious way to use sessions is when working on different projects. -Suppose you store you session files in the directory "~/.vim". You are +Suppose you store your session files in the directory "~/.vim". You are currently working on the "secret" project and have to switch to the "boring" project: > @@ -295,7 +295,7 @@ is saved, using ":mksession!". This overwrites the previous session. The next time you load the secret session you can continue where you were at this point. And finally you load the new "boring" session. -If you open help windows, split and close various window, and generally mess +If you open help windows, split and close various windows, and generally mess up the window layout, you can go back to the last saved session: > :source ~/.vim/boring.vim @@ -423,10 +423,10 @@ and nine numbered 1 to 9. A VIEW WITH A NAME The second basic way to use views is by storing the view in a file with a name -you chose. This view can be loaded while editing another file. Vim will then -switch to editing the file specified in the view. Thus you can use this to -quickly switch to editing another file, with all its options set as you saved -them. +you choose. This view can be loaded while editing another file. Vim will +then switch to editing the file specified in the view. Thus you can use this +to quickly switch to editing another file, with all its options set as you +saved them. For example, to save the view of the current file: > :mkview ~/.vim/main.vim diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt index 8ca034e89..3c527a686 100644 --- a/runtime/doc/usr_22.txt +++ b/runtime/doc/usr_22.txt @@ -1,4 +1,4 @@ -*usr_22.txt* For Vim version 7.3. Last change: 2010 Feb 21 +*usr_22.txt* For Vim version 7.3. Last change: 2012 Nov 15 VIM USER MANUAL - by Bram Moolenaar @@ -326,9 +326,9 @@ shorter to type: > The output could look like this: - 1 #h "help.txt" line 62 ~ - 2 %a+ "usr_21.txt" line 1 ~ - 3 "usr_toc.txt" line 1 ~ + 1 #h "help.txt" line 62 ~ + 2 %a + "usr_21.txt" line 1 ~ + 3 "usr_toc.txt" line 1 ~ The first column contains the buffer number. You can use this to edit the buffer without having to type the name, see below. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index b9f771d75..b529ee59e 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.3. Last change: 2012 Apr 13 +*windows.txt* For Vim version 7.3. Last change: 2012 Nov 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -939,9 +939,9 @@ list of buffers. |unlisted-buffer| :buffers[!] *:buffers* *:ls* :ls[!] Show all buffers. Example: - 1 #h "/test/text" line 1 ~ - 2u "asdf" line 0 ~ - 3 %a+ "version.c" line 1 ~ + 1 #h "/test/text" line 1 ~ + 2u "asdf" line 0 ~ + 3 %a + "version.c" line 1 ~ When the [!] is included the list will show unlisted buffers (the term "unlisted" is a bit confusing then...). diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 8a66c840d..ac4dfc6ac 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v145" +let g:loaded_netrwPlugin = "v146" if v:version < 702 echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None finish diff --git a/runtime/syntax/abap.vim b/runtime/syntax/abap.vim index 8f7306d9d..fd4b48003 100644 --- a/runtime/syntax/abap.vim +++ b/runtime/syntax/abap.vim @@ -1,8 +1,8 @@ " Vim ABAP syntax file " Language: SAP - ABAP/R4 -" Revision: 2.0 +" Revision: 2.1 " Maintainer: Marius Piedallu van Wyk -" Last Change: 2012 Oct 12 +" Last Change: 2012 Oct 23 " Comment: Thanks to EPI-USE Labs for all your assistance. :) " For version < 6.0: Clear all syntax items @@ -16,7 +16,7 @@ endif " Always ignore case syn case ignore -" Symbol Operators +" Symbol Operators (space delimited) syn match abapSymbolOperator "\W+\W" syn match abapSymbolOperator "\W-\W" syn match abapSymbolOperator "\W/\W" @@ -49,99 +49,105 @@ else set iskeyword=48-57,_,A-Z,a-z,/ endif -syn match abapNamespace "/\w\+/" +syn match abapNamespace "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\<\(EXIT\W\+FROM\W\+STEP\W\+LOOP\|EXIT\)\>" +syn match abapComplexStatement "\<\(BEGIN\W\+OF\W\+\(BLOCK\|LINE\)\|BEGIN\W\+OF\)\>" +syn match abapComplexStatement "\<\(END\W\+OF\W\+\(BLOCK\|LINE\)\|END\W\+OF\)\>" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\<\(PUBLIC\|PRIVATE\|PROTECTED\)\(\W\+SECTION\)\?\>" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\<\(ALL\W\+OCCURRENCES\)\|\(\(FIRST\|LAST\)\W\+OCCURRENCE\)\>" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\<\(UP\W\+\)\?TO\>" " hyphenated-word statements -syn match abapComplexStatement "LINE-COUNT" -syn match abapComplexStatement "ADD-CORRESPONDING" -syn match abapComplexStatement "AUTHORITY-CHECK" -syn match abapComplexStatement "BREAK-POINT" -syn match abapComplexStatement "CLASS-DATA" -syn match abapComplexStatement "CLASS-METHODS" -syn match abapComplexStatement "CLASS-METHOD" -syn match abapComplexStatement "DIVIDE-CORRESPONDING" -syn match abapComplexStatement "EDITOR-CALL" -syn match abapComplexStatement "END-OF-DEFINITION" -syn match abapComplexStatement "END-OF-PAGE" -syn match abapComplexStatement "END-OF-SELECTION" -syn match abapComplexStatement "FIELD-GROUPS" -syn match abapComplexStatement "FIELD-SYMBOLS" -syn match abapComplexStatement "FUNCTION-POOL" -syn match abapComplexStatement "MOVE-CORRESPONDING" -syn match abapComplexStatement "MULTIPLY-CORRESPONDING" -syn match abapComplexStatement "NEW-LINE" -syn match abapComplexStatement "NEW-PAGE" -syn match abapComplexStatement "NEW-SECTION" -syn match abapComplexStatement "PRINT-CONTROL" -syn match abapComplexStatement "RP-PROVIDE-FROM-LAST" -syn match abapComplexStatement "SELECT-OPTIONS" -syn match abapComplexStatement "SELECTION-SCREEN" -syn match abapComplexStatement "START-OF-SELECTION" -syn match abapComplexStatement "SUBTRACT-CORRESPONDING" -syn match abapComplexStatement "SYNTAX-CHECK" -syn match abapComplexStatement "SYNTAX-TRACE" -syn match abapComplexStatement "TOP-OF-PAGE" -syn match abapComplexStatement "TYPE-POOL" -syn match abapComplexStatement "TYPE-POOLS" -syn match abapComplexStatement "LINE-SIZE" -syn match abapComplexStatement "LINE-COUNT" -syn match abapComplexStatement "MESSAGE-ID" -syn match abapComplexStatement "DISPLAY-MODE" -syn match abapComplexStatement "READ\(-ONLY\)\?" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" +syn match abapComplexStatement "\" " ABAP statements syn keyword abapStatement ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT -syn keyword abapStatement BACK BOUND +syn keyword abapStatement BACK syn keyword abapStatement CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY syn keyword abapStatement DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO syn keyword abapStatement ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT syn keyword abapStatement FETCH FIELDS FORM FORMAT FREE FROM FUNCTION syn keyword abapStatement GENERATE GET syn keyword abapStatement HIDE -syn keyword abapStatement IF IMPORT IMPORTING INDEX INFOTYPES INITIAL INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION IS +syn keyword abapStatement IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION syn keyword abapStatement LEAVE LIKE LINE LOAD LOCAL LOOP syn keyword abapStatement MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY syn keyword abapStatement ON OVERLAY OPTIONAL OTHERS syn keyword abapStatement PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT -syn keyword abapStatement RAISE RANGES RECEIVE REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK +syn keyword abapStatement RAISE RANGES RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK syn keyword abapStatement SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS syn keyword abapStatement TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES syn keyword abapStatement UNASSIGN ULINE UNPACK UPDATE syn keyword abapStatement WHEN WHILE WINDOW WRITE " More statemets +syn keyword abapStatement LINES +syn keyword abapStatement INTO GROUP BY HAVING ORDER BY SINGLE +syn keyword abapStatement APPENDING CORRESPONDING FIELDS OF TABLE +syn keyword abapStatement LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER ROWS CONNECTING syn keyword abapStatement OCCURS STRUCTURE OBJECT PROPERTY syn keyword abapStatement CASTING APPEND RAISING VALUE COLOR syn keyword abapStatement CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT syn keyword abapStatement ID NUMBER FOR TITLE OUTPUT " Special ABAP specific tables: -syn match abapSpecial "\(\W\|^\)\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)\(\W\|$\)"ms=s+1,me=e-1 -syn match abapSpecialTables "\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)-"me=e-1 contained -syn match abapSpecial "\(\W\|^\)\w\+-\(\w\+-\w\+\|\w\+\)"ms=s+1 contains=abapSpecialTables,abapStatement,abapComplexStatement +syn match abapSpecialTables "\<\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)-"me=e-1 contained +syn match abapStructure "\<\w\+-[^\>]"me=e-2 contains=abapSpecialTables,abapStatement,abapComplexStatement +syn match abapField "-\w\+"ms=s+1 " Pointer syn match abapSpecial "<\w\+>" -" Abap constants: +" Abap common constants: syn keyword abapSpecial TRUE FALSE NULL SPACE " Includes @@ -155,15 +161,8 @@ syn keyword abapOperator abs sign ceil floor trunc frac acos asin atan cos sin t syn keyword abapOperator cosh sinh tanh exp log log10 sqrt " String operators -syn keyword abapOperator strlen xstrlen charlen numofchar dbmaxlen +syn keyword abapStatement strlen xstrlen charlen numofchar dbmaxlen -" Table operators -syn keyword abapOperator lines - -" Table operators (SELECT operators) -syn keyword abapOperator INTO WHERE GROUP BY HAVING ORDER BY SINGLE -syn keyword abapOperator APPENDING CORRESPONDING FIELDS OF TABLE -syn keyword abapOperator LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING syn keyword abapOperator EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN " An error? Not strictly... but cannot think of reason this is intended. @@ -193,7 +192,7 @@ if version >= 508 || !exists("did_abap_syntax_inits") HiLink abapComplexStatement Statement HiLink abapSpecial Special HiLink abapNamespace Special - HiLink abapSpecialTables PreProc + HiLink abapSpecialTables Special HiLink abapSymbolOperator abapOperator HiLink abapOperator Operator HiLink abapCharString String @@ -201,6 +200,8 @@ if version >= 508 || !exists("did_abap_syntax_inits") HiLink abapFloat Float HiLink abapTypes Type HiLink abapSymbol Structure + HiLink abapStructure Structure + HiLink abapField Variable HiLink abapNumber Number HiLink abapHex Number diff --git a/runtime/syntax/lex.vim b/runtime/syntax/lex.vim index e500f5c07..b7aff34d6 100644 --- a/runtime/syntax/lex.vim +++ b/runtime/syntax/lex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Lex -" Maintainer: Charles E. Campbell, Jr. -" Last Change: Nov 01, 2010 -" Version: 12 +" Maintainer: Charles E. Campbell +" Last Change: Nov 14, 2012 +" Version: 14 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Option: @@ -17,20 +17,16 @@ elseif exists("b:current_syntax") endif " Read the C/C++ syntax to start with -if version >= 600 - if exists("lex_uses_cpp") - runtime! syntax/cpp.vim - else - runtime! syntax/c.vim - endif - unlet b:current_syntax -else - if exists("lex_uses_cpp") - so :p:h/cpp.vim - else - so :p:h/c.vim +let s:Cpath= fnameescape(expand(":p:h").(exists("g:lex_uses_cpp")? "/cpp.vim" : "/c.vim")) +if !filereadable(s:Cpath) + for s:Cpath in split(globpath(&rtp,(exists("g:lex_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") + if filereadable(fnameescape(s:Cpath)) + let s:Cpath= fnameescape(s:Cpath) + break endif + endfor endif +exe "syn include @lexCcode ".s:Cpath " --- ========= --- " --- Lex stuff --- @@ -39,10 +35,6 @@ endif " Options Section syn match lexOptions '^%\s*option\>.*$' contains=lexPatString -"I'd prefer to use lex.* , but vim doesn't handle forward definitions yet -syn cluster lexListGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatString,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,lexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError -syn cluster lexListPatCodeGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatTag,lexPatTag,lexPatTagZoneStart,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError - " Abbreviations Section if has("folding") syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState @@ -53,52 +45,69 @@ syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRe syn match lexAbbrv "^%[sx]" contained syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude if has("folding") - syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup + syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell + syn region lexAbbrvComment fold start="\%^/\*" end="\*/" contains=@Spell syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained else - syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup + syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell + syn region lexAbbrvComment start="\%^/\*" end="\*/" contains=@Spell syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained endif "%% : Patterns {Actions} if has("folding") - syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude - syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace + syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%\ze%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude + syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained else - syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude - syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace + syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude + syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace syn region lexPatInclude matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained endif syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep -syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s*\ze{" contained nextgroup=lexPatTagZoneStart +syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s\+\ze{" contained nextgroup=lexPatTagZoneStart syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep + +" Lex Patterns +syn region lexPattern start='[^ \t{}]' end="$" contained contains=lexPatRange +syn region lexPatRange matchgroup=Delimiter start='\[' skip='\\\\\|\\.' end='\]' contains=lexEscape +syn match lexEscape '\%(\\\\\)*\\.' contained + if has("folding") - syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment + syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell else - syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment + syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell endif -syn match lexPatCodeLine ".*$" contained contains=ALLBUT,@lexListGroup +syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine syn match lexSlashQuote +\(\\\\\)*\\"+ contained if has("folding") - syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=ALLBUT,@lexListPatCodeGroup + syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=@lexCcode,lexCFunctions else - syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=ALLBUT,@lexListPatCodeGroup + syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions endif +" Lex "functions" which may appear in C/C++ code blocks syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap +" %% +" lexAbbrevBlock +" %% +" lexPatBlock +" %% +" lexFinalCodeBlock +syn region lexFinalCodeBlock matchgroup=Todo start="%$"me=e-1 end="\%$" contained contains=@lexCcode + " includes several ALLBUTs; these have to be treated so as to exclude lex* groups syn cluster cParenGroup add=lex.* syn cluster cDefineGroup add=lex.* @@ -107,27 +116,27 @@ syn cluster cMultiGroup add=lex.* " Synchronization syn sync clear -syn sync minlines=300 +syn sync minlines=500 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]" syn sync match lexSyncPat groupthere lexPatBlock "^<$" syn sync match lexSyncPat groupthere lexPatBlock "^%%$" " The default highlighting. hi def link lexAbbrvComment lexPatComment -hi def link lexBrace lexPat -hi def link lexPatTagZone lexPatTag -hi def link lexSlashQuote lexPat - hi def link lexAbbrvRegExp Macro hi def link lexAbbrv SpecialChar +hi def link lexBrace lexPat hi def link lexCFunctions Function +hi def link lexCstruct cStructure hi def link lexMorePat SpecialChar hi def link lexOptions PreProc hi def link lexPatComment Comment hi def link lexPat Function hi def link lexPatString Function hi def link lexPatTag Special +hi def link lexPatTagZone lexPatTag hi def link lexSep Delimiter +hi def link lexSlashQuote lexPat hi def link lexStartState Statement let b:current_syntax = "lex" diff --git a/runtime/syntax/progress.vim b/runtime/syntax/progress.vim index 190a0f381..85a54a650 100644 --- a/runtime/syntax/progress.vim +++ b/runtime/syntax/progress.vim @@ -3,13 +3,13 @@ " Filename extensions: *.p (collides with Pascal), " *.i (collides with assembler) " *.w (collides with cweb) -" Maintainer: Philip Uren Remove SPAX spam block -" Contributors: Chris Ruprecht -" Philip Uren -" Mikhail Kuperblum -" John Florian -" Version: 12 -" Last Change: Aug 16 2012 +" Maintainer: Philip Uren Remove SPAXY spam block +" Contributors: Matthew Stickney +" Chris Ruprecht +" Mikhail Kuperblum +" John Florian +" Version: 13 +" Last Change: Nov 11 2012 " For version 5.x: Clear all syntax item " For version 6.x: Quit when a syntax file was already loaded @@ -99,8 +99,8 @@ syn keyword ProgressReserved window-maxim[ized] window-minim[ized] window-normal " Strings. Handles embedded quotes. " Note that, for some reason, Progress doesn't use the backslash, "\" " as the escape character; it uses tilde, "~". -syn region ProgressString matchgroup=ProgressQuote start=+"+ end=+"+ skip=+\~'\|\~\~+ contains=@Spell -syn region ProgressString matchgroup=ProgressQuote start=+'+ end=+'+ skip=+\~'\|\~\~+ contains=@Spell +syn region ProgressString matchgroup=ProgressQuote start=+"+ end=+"+ skip=+\~'\|\~\~\|\~"+ contains=@Spell +syn region ProgressString matchgroup=ProgressQuote start=+'+ end=+'+ skip=+\~'\|\~\~\|\~"+ contains=@Spell syn match ProgressIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>()" diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index b3f37d405..b68089720 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: reStructuredText documentation format " Maintainer: Nikolai Weibull -" Latest Revision: 2012-08-05 +" Latest Revision: 2012-11-01 if exists("b:current_syntax") finish @@ -139,6 +139,27 @@ syn match rstStandaloneHyperlink contains=@NoSpell " though. syn sync minlines=50 linebreaks=1 +syn region rstCodeBlock contained matchgroup=rstDirective + \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s+ + \ skip=+^$+ + \ end=+^\s\@!+ + \ contains=@NoSpell +syn cluster rstDirectives add=rstCodeBlock + +if !exists('g:rst_syntax_code_list') + let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', 'python', 'perl'] +endif + +for code in g:rst_syntax_code_list + unlet! b:current_syntax + exe 'syn include @rst'.code.' syntax/'.code.'.vim' + exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold ' + \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\s*$# ' + \.'skip=#^$# ' + \.'end=#^\s\@!# contains=@NoSpell,@rst'.code + exe 'syn cluster rstDirectives add=rstDirective'.code +endfor + hi def link rstTodo Todo hi def link rstComment Comment hi def link rstSections Title @@ -168,6 +189,7 @@ hi def link rstFootnoteReference Identifier hi def link rstCitationReference Identifier hi def link rstHyperLinkReference Identifier hi def link rstStandaloneHyperlink Identifier +hi def link rstCodeBlock String let b:current_syntax = "rst" diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 355e8eb91..f3c760441 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -1,9 +1,9 @@ " Vim syntax file " Language: shell (sh) Korn shell (ksh) bash (sh) -" Maintainer: Dr. Charles E. Campbell, Jr. +" Maintainer: Charles E. Campbell " Previous Maintainer: Lennart Schultz -" Last Change: Mar 19, 2012 -" Version: 122 +" Last Change: Nov 14, 2012 +" Version: 128 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) @@ -17,15 +17,18 @@ elseif exists("b:current_syntax") endif " AFAICT "." should be considered part of the iskeyword. Using iskeywords in -" syntax is dicey, so the following code permits the user to prevent/override -" its setting. -if exists("g:sh_isk") " override support - exe "setlocal isk=".g:sh_isk -elseif !exists("g:sh_noisk") " prevent modification support - setlocal isk+=. +" syntax is dicey, so the following code permits the user to +" g:sh_isk set to a string : specify iskeyword. +" g:sh_noisk exists : don't change iskeyword +" g:sh_noisk does not exist : (default) append "." to iskeyword +if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword + exe "setl isk=".g:sh_isk +elseif !exists("g:sh_noisk") " optionally prevent appending '.' to iskeyword + setl isk+=. endif " trying to answer the question: which shell is /bin/sh, really? +" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") if executable("/bin/sh") if resolve("/bin/sh") =~ 'bash$' @@ -76,16 +79,19 @@ elseif g:sh_fold_enabled != 0 && !has("folding") echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" endif if !exists("s:sh_fold_functions") - let s:sh_fold_functions = 1 + let s:sh_fold_functions= and(g:sh_fold_enabled,1) endif if !exists("s:sh_fold_heredoc") - let s:sh_fold_heredoc = 2 + let s:sh_fold_heredoc = and(g:sh_fold_enabled,2) endif if !exists("s:sh_fold_ifdofor") - let s:sh_fold_ifdofor = 4 + let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4) endif if g:sh_fold_enabled && &fdm == "manual" - setlocal fdm=syntax + " Given that the user provided g:sh_fold_enabled + " AND g:sh_fold_enabled is manual (usual default) + " implies a desire for syntax-based folding + setl fdm=syntax endif " sh syntax is case sensitive {{{1 @@ -102,12 +108,12 @@ syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq "syn cluster shColonList contains=@shCaseList -syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial +syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial,shCmdParenRegion syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial -syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial +syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError -syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote +syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq @@ -160,7 +166,7 @@ endif " Options: {{{1 " ==================== -syn match shOption "\s\zs[-+][-_a-zA-Z0-9]\+\>" +syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+" syn match shOption "\s\zs--[^ \t$`'"|]\+" " File Redirection Highlighted As Operators: {{{1 @@ -204,14 +210,15 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum " Loops: do, if, while, until {{{1 " ====== -if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor +if s:sh_fold_ifdofor syn region shDo fold transparent matchgroup=shConditional start="\" matchgroup=shConditional end="\" contains=@shLoopList syn region shIf fold transparent matchgroup=shConditional start="\+ end="\<;\_s*then\>" end="\" contains=@shIfList - syn region shFor fold matchgroup=shLoop start="\+ end="\<;\_s*then\>" end="\" contains=@shIfList - syn region shFor matchgroup=shLoop start="\\ze\_s*((' endif if exists("b:is_kornshell") || exists("b:is_bash") syn cluster shCaseList add=shRepeat @@ -230,7 +237,7 @@ syn match shComma contained "," " ==== syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar -if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor +if s:sh_fold_ifdofor syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment syn region shCaseEsac fold matchgroup=shConditional start="\" end="\" contains=@shCaseEsacList else @@ -246,13 +253,17 @@ endif syn region shCaseSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseDoubleQuote matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained -syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+]+ contained - +if exists("b:is_bash") + syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained contains=shCharClass + syn match shCharClass '\[:\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|or\|xdigit\):\]' contained +else + syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained +endif " Misc: {{{1 "====== syn match shWrapLineOperator "\\$" -syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList -syn match shEscape contained '\\.' contains=@shCommandSubList +syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList +syn match shEscape contained '\%(\\\\\)*\\.' " $() and $(()): {{{1 " $(..) is not supported by sh (Bourne shell). However, apparently @@ -268,20 +279,23 @@ if exists("b:is_kornshell") || exists("b:is_bash") elseif !exists("g:sh_no_error") syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList endif +syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList if exists("b:is_bash") syn cluster shCommandSubList add=bashSpecialVariables,bashStatement syn cluster shCaseList add=bashAdminStatement,bashStatement syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID - syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep install less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch + syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop + syn keyword bashStatement command compgen endif if exists("b:is_kornshell") syn cluster shCommandSubList add=kshSpecialVariables,kshStatement syn cluster shCaseList add=kshStatement syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL - syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep install killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput + syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput + syn keyword kshStatement command setgroups setsenv endif syn match shSource "^\.\s" @@ -309,8 +323,8 @@ syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@" contained syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier -syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote +syn match shSetIdentifier "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote if exists("b:is_bash") syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList - syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList elseif exists("b:is_kornshell") syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList @@ -390,15 +405,15 @@ if !exists("g:is_posix") endif if exists("b:is_bash") - if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + if s:sh_fold_functions + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained endif else - if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions + if s:sh_fold_functions syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else @@ -409,7 +424,7 @@ endif " Parameter Dereferencing: {{{1 " ======================== -syn match shDerefSimple "\$\%(\h\w*\|\d\)" +syn match shDerefSimple "\$\%(\k\+\|\d\)" syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray if !exists("g:sh_no_error") syn match shDerefWordError "[^}$[]" contained @@ -425,12 +440,12 @@ endif " ==================================== if exists("b:is_bash") syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp - syn match shDerefVar contained "{\@<=!\w\+" nextgroup=@shDerefVarList + syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList endif syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp -syn match shDerefVar contained "{\@<=\w\+" nextgroup=@shDerefVarList +syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList " sh ksh bash : ${var[... ]...} array reference: {{{1 syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError @@ -477,12 +492,12 @@ if exists("b:is_bash") " bash : ${parameter//pattern/string} " bash : ${parameter//pattern} syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft - syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList - syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList + syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList + syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList endif " Arithmetic Parenthesized Expressions: {{{1 -syn region shParen matchgroup=shArithRegion start='(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList +syn region shParen matchgroup=shArithRegion start='[^$]\zs(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList " Useful sh Keywords: {{{1 " =================== @@ -557,6 +572,7 @@ hi def link shDoubleQuote shString hi def link shEcho shString hi def link shEchoDelim shOperator hi def link shEchoQuote shString +hi def link shForPP shLoop hi def link shEmbeddedEcho shString hi def link shEscape shCommandSub hi def link shExDoubleQuote shDoubleQuote @@ -592,6 +608,7 @@ if exists("b:is_bash") hi def link bashStatement shStatement hi def link shFunctionParen Delimiter hi def link shFunctionDelim Delimiter + hi def link shCharClass shSpecial endif if exists("b:is_kornshell") hi def link kshSpecialVariables shShellVariables diff --git a/runtime/syntax/sqlhana.vim b/runtime/syntax/sqlhana.vim new file mode 100644 index 000000000..1410e99eb --- /dev/null +++ b/runtime/syntax/sqlhana.vim @@ -0,0 +1,293 @@ +" Vim syntax file +" Language: SQL, SAP HANA In Memory Database +" Maintainer: David Fishburn +" Last Change: 2012 Oct 23 +" Version: SP4 b (Q2 2012) +" Homepage: http://www.vim.org/scripts/script.php?script_id=4275 + +" Description: Updated to SAP HANA SP4 +" +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case ignore + +" The SQL reserved words, defined as keywords. +" These were pulled from the following SQL reference: +" http://help.sap.com/hana/hana_sql_en.pdf +" An easy approach is to copy all text from the PDF +" into a Vim buffer. The keywords are in UPPER case, +" so you can run the following commands to be left with +" mainly the UPPER case words: +" 1. Delete all words that do not begin with a Capital +" %s/\(\<[^A-Z]\w*\>\)//g +" 2. Remove all words where the 2nd letter is not a Capital +" %s/\(\<[A-Z][^A-Z]\w*\>\)//g +" 3. Remove all non-word (or space) characters +" %s/[^0-9A-Za-z_ ]*//g +" 4. Remove some known words +" %s/\<\(SAP\|HANA\|OK\|AG\|IBM\|DB2\|AIX\|POWER\d\+\|UNIX\)\>//g +" 5. Remove blank lines and trailing spaces +" %s/\s\+$//g +" %s/^\s\+//g +" %s/^$\n//g +" 6. Convert spaces to newlines remove single character +" %s/[ ]\+/\r/g +" %g/^\w$/d +" 7. Sort and remove duplicates +" :sort +" :Uniq +" 8. Use the WhatsMissing plugin against the sqlhana.vim file. +" 9. Generated a file of all UPPER cased words which should not +" be in the syntax file. These items should be removed +" from the list in step 7. You can use WhatsNotMissing +" between step 7 and this new file to weed out the words +" we know are not syntax related. +" 10. Use the WhatsMissingRemoveMatches to remove the words +" from step 9. + +syn keyword sqlSpecial false null true + +" Supported Functions for Date/Time types +syn keyword sqlFunction ADD_DAYS ADD_MONTHS ADD_SECONDS ADD_YEARS COALESCE +syn keyword sqlFunction CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_UTCDATE +syn keyword sqlFunction CURRENT_UTCTIME CURRENT_UTCTIMESTAMP +syn keyword sqlFunction DAYNAME DAYOFMONTH DAYOFYEAR DAYS_BETWEEN EXTRACT +syn keyword sqlFunction GREATEST HOUR IFNULL ISOWEEK LAST_DAY LEAST LOCALTOUTC +syn keyword sqlFunction MINUTE MONTH MONTHNAME NEXT_DAY NOW QUARTER SECOND +syn keyword sqlFunction SECONDS_BETWEEN UTCTOLOCAL WEEK WEEKDAY YEAR + +syn keyword sqlFunction TO_CHAR TO_DATE TO_DATS TO_NCHAR TO_TIME TO_TIMESTAMP UTCTOLOCAL + +" Aggregate +syn keyword sqlFunction COUNT MIN MAX SUM AVG STDDEV VAR + +" Datatype conversion +syn keyword sqlFunction CAST TO_ALPHANUM TO_BIGINT TO_BINARY TO_BLOB TO_CHAR TO_CLOB +syn keyword sqlFunction TO_DATE TO_DATS TO_DECIMAL TO_DOUBLE TO_INT TO_INTEGER TO_NCHAR +syn keyword sqlFunction TO_NCLOB TO_NVARCHAR TO_REAL TO_SECONDDATE TO_SMALLDECIMAL +syn keyword sqlFunction TO_SMALLINT TO_TIME TO_TIMESTAMP TO_TINYINT TO_VARCHAR TO_VARBINARY + +" Number functions +syn keyword sqlFunction ABS ACOS ASIN ATAN ATAN2 BINTOHEX BITAND CEIL COS COSH COT +syn keyword sqlFunction EXP FLOOR GREATEST HEXTOBIN LEAST LN LOG MOD POWER ROUND +syn keyword sqlFunction SIGN SIN SINH SQRT TAN TANH UMINUS + +" String functions +syn keyword sqlFunction ASCII CHAR CONCAT LCASE LENGTH LOCATE LOWER LPAD LTRIM +syn keyword sqlFunction NCHAR REPLACE RPAD RTRIM SUBSTR_AFTER SUBSTR_BEFORE +syn keyword sqlFunction SUBSTRING TRIM UCASE UNICODE UPPER + +" Miscellaneous functions +syn keyword sqlFunction COALESCE CURRENT_CONNECTION CURRENT_SCHEMA CURRENT_USER +syn keyword sqlFunction GROUPING_ID IFNULL MAP NULLIF SESSION_CONTEXT SESSION_USER SYSUUIDSQL +syn keyword sqlFunction GET_NUM_SERVERS + + +" sp_ procedures +" syn keyword sqlFunction sp_addalias + + +" Reserved keywords +syn keyword sqlkeyword ALL AS AT BEFORE +syn keyword sqlkeyword BEGIN BOTH BY +syn keyword sqlkeyword CONDITION +syn keyword sqlkeyword CURRVAL CURSOR DECLARE +syn keyword sqlkeyword DISTINCT DO ELSE ELSEIF ELSIF +syn keyword sqlkeyword END EXCEPTION EXEC +syn keyword sqlkeyword FOR FROM GROUP +syn keyword sqlkeyword HAVING IN +syn keyword sqlkeyword INOUT INTO IS +syn keyword sqlkeyword LEADING +syn keyword sqlkeyword LOOP MINUS NATURAL NEXTVAL +syn keyword sqlkeyword OF ON ORDER OUT +syn keyword sqlkeyword PRIOR RETURN RETURNS REVERSE +syn keyword sqlkeyword ROWID SELECT +syn keyword sqlkeyword SQL START STOP SYSDATE +syn keyword sqlkeyword SYSTIME SYSTIMESTAMP SYSUUID +syn keyword sqlkeyword TRAILING USING UTCDATE +syn keyword sqlkeyword UTCTIME UTCTIMESTAMP VALUES +syn keyword sqlkeyword WHILE +syn keyword sqlkeyword ANY SOME EXISTS ESCAPE + +" IF keywords +syn keyword sqlkeyword IF + +" CASE keywords +syn keyword sqlKeyword WHEN THEN + +" Syntax rules common to TEXT and SHORTTEXT keywords +syn keyword sqlKeyword LANGUAGE DETECTION LINGUISTIC +syn keyword sqlkeyword MIME TYPE +syn keyword sqlkeyword EXACT WEIGHT FUZZY FUZZINESSTHRESHOLD SEARCH +syn keyword sqlkeyword PHRASE INDEX RATIO REBUILD +syn keyword sqlkeyword CONFIGURATION +syn keyword sqlkeyword SEARCH ONLY +syn keyword sqlkeyword FAST PREPROCESS +syn keyword sqlkeyword SYNC SYNCHRONOUS ASYNC ASYNCHRONOUS FLUSH QUEUE +syn keyword sqlkeyword EVERY AFTER MINUTES DOCUMENTS SUSPEND + +" Statement keywords (i.e. after ALTER or CREATE) +syn keyword sqlkeyword AUDIT POLICY +syn keyword sqlkeyword FULLTEXT +syn keyword sqlkeyword SEQUENCE RESTART +syn keyword sqlkeyword TABLE +syn keyword sqlkeyword PROCEDURE STATISTICS +syn keyword sqlkeyword SCHEMA +syn keyword sqlkeyword SYNONYM +syn keyword sqlkeyword VIEW +syn keyword sqlkeyword COLUMN +syn keyword sqlkeyword SYSTEM LICENSE +syn keyword sqlkeyword SESSION +syn keyword sqlkeyword CANCEL WORK +syn keyword sqlkeyword PLAN CACHE +syn keyword sqlkeyword LOGGING NOLOGGING RETENTION +syn keyword sqlkeyword RECONFIGURE SERVICE +syn keyword sqlkeyword RESET MONITORING +syn keyword sqlkeyword SAVE DURATION PERFTRACE FUNCTION_PROFILER +syn keyword sqlkeyword SAVEPOINT +syn keyword sqlkeyword USER +syn keyword sqlkeyword ROLE +syn keyword sqlkeyword ASC DESC +syn keyword sqlkeyword OWNED +syn keyword sqlkeyword DEPENDENCIES SCRAMBLE + +" Create sequence +syn keyword sqlkeyword INCREMENT MAXVALUE MINVALUE CYCLE + +" Create table +syn keyword sqlkeyword HISTORY GLOBAL LOCAL TEMPORARY + +" Create trigger +syn keyword sqlkeyword TRIGGER REFERENCING EACH DEFAULT +syn keyword sqlkeyword SIGNAL RESIGNAL MESSAGE_TEXT OLD NEW +syn keyword sqlkeyword EXIT HANDLER SQL_ERROR_CODE +syn keyword sqlkeyword TARGET CONDITION SIGNAL + +" Alter table +syn keyword sqlkeyword ADD DROP MODIFY GENERATED ALWAYS +syn keyword sqlkeyword UNIQUE BTREE CPBTREE PRIMARY KEY +syn keyword sqlkeyword CONSTRAINT PRELOAD NONE +syn keyword sqlkeyword ROW THREADS BATCH +syn keyword sqlkeyword MOVE PARTITION TO LOCATION PHYSICAL OTHERS +syn keyword sqlkeyword ROUNDROBIN PARTITIONS HASH RANGE VALUE +syn keyword sqlkeyword PERSISTENT DELTA AUTO AUTOMERGE + +" Create audit policy +syn keyword sqlkeyword AUDITING SUCCESSFUL UNSUCCESSFUL +syn keyword sqlkeyword PRIVILEGE STRUCTURED CHANGE LEVEL +syn keyword sqlkeyword EMERGENCY ALERT CRITICAL WARNING INFO + +" Privileges +syn keyword sqlkeyword DEBUG EXECUTE + +" Schema +syn keyword sqlkeyword CASCADE RESTRICT PARAMETERS SCAN + +" Traces +syn keyword sqlkeyword CLIENT CRASHDUMP EMERGENCYDUMP +syn keyword sqlkeyword INDEXSERVER NAMESERVER DAEMON +syn keyword sqlkeyword CLEAR REMOVE TRACES + +" Reclaim +syn keyword sqlkeyword RECLAIM DATA VOLUME VERSION SPACE DEFRAGMENT SPARSIFY + +" Join +syn keyword sqlkeyword INNER OUTER LEFT RIGHT FULL CROSS JOIN +syn keyword sqlkeyword GROUPING SETS ROLLUP CUBE +syn keyword sqlkeyword BEST LIMIT OFFSET +syn keyword sqlkeyword WITH SUBTOTAL BALANCE TOTAL +syn keyword sqlkeyword TEXT_FILTER FILL UP SORT MATCHES TOP +syn keyword sqlkeyword RESULT OVERVIEW PREFIX MULTIPLE RESULTSETS + +" Lock +syn keyword sqlkeyword EXCLUSIVE MODE NOWAIT + +" Transaction +syn keyword sqlkeyword TRANSACTION ISOLATION READ COMMITTED +syn keyword sqlkeyword REPEATABLE SERIALIZABLE WRITE + +" Saml +syn keyword sqlkeyword SAML ASSERTION PROVIDER SUBJECT ISSUER + +" User +syn keyword sqlkeyword PASSWORD IDENTIFIED EXTERNALLY ATTEMPTS ATTEMPTS +syn keyword sqlkeyword ENABLE DISABLE OFF LIFETIME FORCE DEACTIVATE +syn keyword sqlkeyword ACTIVATE IDENTITY KERBEROS + +" Grant +syn keyword sqlkeyword ADMIN BACKUP CATALOG SCENARIO INIFILE MONITOR +syn keyword sqlkeyword OPTIMIZER OPTION +syn keyword sqlkeyword RESOURCE STRUCTUREDPRIVILEGE TRACE + +" Import +syn keyword sqlkeyword CSV FILE CONTROL NO CHECK SKIP FIRST LIST +syn keyword sqlkeyword RECORD DELIMITED FIELD OPTIONALLY ENCLOSED FORMAT + +" Roles +syn keyword sqlkeyword PUBLIC CONTENT_ADMIN MODELING MONITORING + +" Miscellaneous +syn keyword sqlkeyword APPLICATION BINARY IMMEDIATE COREFILE SECURITY DEFINER +syn keyword sqlkeyword DUMMY INVOKER MATERIALIZED MESSEGE_TEXT PARAMETER PARAMETERS +syn keyword sqlkeyword PART +syn keyword sqlkeyword CONSTANT SQLEXCEPTION SQLWARNING + +syn keyword sqlOperator WHERE BETWEEN LIKE NULL CONTAINS +syn keyword sqlOperator AND OR NOT CASE +syn keyword sqlOperator UNION INTERSECT EXCEPT + +syn keyword sqlStatement ALTER CALL CALLS CREATE DROP RENAME TRUNCATE +syn keyword sqlStatement DELETE INSERT UPDATE EXPLAIN +syn keyword sqlStatement MERGE REPLACE UPSERT SELECT +syn keyword sqlStatement SET UNSET LOAD UNLOAD +syn keyword sqlStatement CONNECT DISCONNECT COMMIT LOCK ROLLBACK +syn keyword sqlStatement GRANT REVOKE +syn keyword sqlStatement EXPORT IMPORT + + +syn keyword sqlType DATE TIME SECONDDATE TIMESTAMP TINYINT SMALLINT +syn keyword sqlType INT INTEGER BIGINT SMALLDECIMAL DECIMAL +syn keyword sqlType REAL DOUBLE FLOAT +syn keyword sqlType VARCHAR NVARCHAR ALPHANUM SHORTTEXT VARBINARY +syn keyword sqlType BLOB CLOB NCLOB TEXT DAYDATE + +syn keyword sqlOption Webservice_namespace_host + +" Strings and characters: +syn region sqlString start=+"+ end=+"+ contains=@Spell +syn region sqlString start=+'+ end=+'+ contains=@Spell + +" Numbers: +syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" + +" Comments: +syn region sqlDashComment start=/--/ end=/$/ contains=@Spell +syn region sqlSlashComment start=/\/\// end=/$/ contains=@Spell +syn region sqlMultiComment start="/\*" end="\*/" contains=sqlMultiComment,@Spell +syn cluster sqlComment contains=sqlDashComment,sqlSlashComment,sqlMultiComment,@Spell +syn sync ccomment sqlComment +syn sync ccomment sqlDashComment +syn sync ccomment sqlSlashComment + +hi def link sqlDashComment Comment +hi def link sqlSlashComment Comment +hi def link sqlMultiComment Comment +hi def link sqlNumber Number +hi def link sqlOperator Operator +hi def link sqlSpecial Special +hi def link sqlKeyword Keyword +hi def link sqlStatement Statement +hi def link sqlString String +hi def link sqlType Type +hi def link sqlFunction Function +hi def link sqlOption PreProc + +let b:current_syntax = "sqlhana" + +" vim:sw=4: diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 0eeff6f59..d8a384a98 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX -" Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: Apr 24, 2012 -" Version: 73 +" Maintainer: Charles E. Campbell +" Last Change: Nov 14, 2012 +" Version: 75 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Notes: {{{1 @@ -155,7 +155,7 @@ endif " Try to flag {} and () mismatches: {{{1 if !exists("g:tex_no_error") syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError - syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError + syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell else syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup @@ -723,7 +723,7 @@ if has("conceal") && &enc == 'utf-8' \ ['leftarrowtail' , '↢'], \ ['leftharpoondown', '↽'], \ ['leftharpoonup' , '↼'], - \ ['leftrightarrow' , '⇔'], + \ ['leftrightarrow' , '↔'], \ ['Leftrightarrow' , '⇔'], \ ['leftrightsquigarrow', '↭'], \ ['leftthreetimes' , '⋋'], diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index f8e846554..391e65010 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Vim 7.3 script -" Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: Jan 11, 2012 -" Version: 7.3-13 +" Maintainer: Charles E. Campbell +" Last Change: Nov 14, 2012 +" Version: 7.3-20 " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -76,7 +76,7 @@ syn case match " Function Names {{{2 syn keyword vimFuncName contained abs append argv atan2 bufexists bufname byte2line ceil cindent complete confirm cosh cursor did_filetype empty eventhandler exp extend filewritable findfile fmod foldclosed foldtext function getbufline getcharmod getcmdtype getfperm getftype getmatches getqflist gettabvar getwinposy globpath haslocaldir histdel hlexists iconv input inputrestore insert items len line localtime map match matchdelete matchstr min mode nextnonblank pathshorten prevnonblank pumvisible readfile reltimestr remote_foreground remote_read remove repeat reverse search searchpair searchpos serverlist setcmdpos setloclist setpos setreg settabwinvar shellescape sin sort spellbadword split str2float strchars strftime string strpart strtrans submatch synconcealed synIDattr synstack tabpagebuflist tabpagewinnr taglist tanh tolower tr type undotree virtcol winbufnr winheight winnr winrestview winwidth syn keyword vimFuncName contained acos argc asin browse buflisted bufnr byteidx changenr clearmatches complete_add copy count deepcopy diff_filler escape executable expand feedkeys filter float2nr fnameescape foldclosedend foldtextresult garbagecollect getbufvar getcmdline getcwd getfsize getline getpid getreg gettabwinvar getwinvar has hasmapto histget hlID indent inputdialog inputsave isdirectory join libcall line2byte log maparg matchadd matchend max mkdir mzeval nr2char pow printf range reltime remote_expr remote_peek remote_send rename resolve round searchdecl searchpairpos server2client setbufvar setline setmatches setqflist settabvar setwinvar simplify sinh soundfold spellsuggest sqrt str2nr strdisplaywidth stridx strlen strridx strwidth substitute synID synIDtrans system tabpagenr tagfiles tan tempname toupper trunc undofile values visualmode wincol winline winrestcmd winsaveview writefile -syn keyword vimFuncName contained add argidx atan browsedir bufloaded bufwinnr call char2nr col complete_check cos cscope_connection delete diff_hlID eval exists expr8 filereadable finddir floor fnamemodify foldlevel foreground get getchar getcmdpos getfontname getftime getloclist getpos getregtype getwinposx glob has_key histadd histnr hostname index inputlist inputsecret islocked keys libcallnr lispindent log10 mapcheck matcharg matchlist pyeval py3eval luaeval +syn keyword vimFuncName contained add argidx atan browsedir bufloaded bufwinnr call char2nr col complete_check cos cscope_connection delete diff_hlID eval exists expr8 filereadable finddir floor fnamemodify foldlevel foreground get getchar getcmdpos getfontname getftime getloclist getpos getregtype getwinposx glob has_key histadd histnr hostname index inputlist inputsecret islocked keys libcallnr lispindent log10 mapcheck matcharg matchlist "--- syntax above generated by mkvimvim --- " Special Vim Highlighting (not automatic) {{{1 @@ -149,11 +149,12 @@ syn keyword vimAugroupKey contained aug[roup] " Operators: {{{2 " ========= +" COMBAK: vimOperParen used to have "oneline" syn cluster vimOperGroup contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile -syn region vimOperParen oneline matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup -syn region vimOperParen oneline matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar +syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup +syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") syn match vimOperError ")" endif @@ -203,7 +204,7 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror") endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] -syn keyword vimUserAttrbCmplt contained augroup buffer command dir environment event expression file function help highlight mapping menu option shellcmd something tag tag_listfiles var +syn keyword vimUserAttrbCmplt contained augroup buffer color command compiler cscope dir environment event expression file file_in_path filetype function help highlight locale mapping menu option shellcmd sign syntax tag tag_listfiles var syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%(#\u\w*\)\+\|\u\w*\)"hs=s+1 nextgroup=vimUserCmdError @@ -328,7 +329,7 @@ syn match vimMapLhs contained "\S\+" contains=vimNotation,vimCtrlChar skipwhit syn match vimMapBang contained "!" skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapMod contained "\c<\(buffer\|expr\|\(local\)\=leader\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend -syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue +syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimNotation,vimCtrlChar,vimContinue skipnl nextgroup=vimMapRhsExtend syn case ignore syn keyword vimMapModKey contained buffer expr leader localleader plug script sid silent unique syn case match @@ -360,8 +361,8 @@ syn case match " User Function Highlighting {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute -syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute +syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation syn match vimNotFunc "\\|\\|\\|\" " Errors And Warnings: {{{2 @@ -429,7 +430,7 @@ syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\k\+" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" if has("conceal") - syn match vimSynMtchOpt contained "\:p:h")."/lua.vim") if !filereadable(s:luapath) - let s:luapath= fnameescape(globpath(&rtp,"syntax/lua.vim")) + for s:luapath in split(globpath(&rtp,"syntax/lua.vim"),"\n") + if filereadable(fnameescape(s:luapath)) + let s:luapath= fnameescape(s:luapath) + break + endif + endfor endif if (g:vimsyn_embed =~ 'l' && has("lua")) && filereadable(s:luapath) unlet! b:current_syntax @@ -584,7 +591,12 @@ unlet s:luapath " [-- perl --] {{{3 let s:perlpath= fnameescape(expand(":p:h")."/perl.vim") if !filereadable(s:perlpath) - let s:perlpath= fnameescape(globpath(&rtp,"syntax/perl.vim")) + for s:perlpath in split(globpath(&rtp,"syntax/perl.vim"),"\n") + if filereadable(fnameescape(s:perlpath)) + let s:perlpath= fnameescape(s:perlpath) + break + endif + endfor endif if (g:vimsyn_embed =~ 'p' && has("perl")) && filereadable(s:perlpath) unlet! b:current_syntax @@ -606,7 +618,12 @@ unlet s:perlpath " [-- ruby --] {{{3 let s:rubypath= fnameescape(expand(":p:h")."/ruby.vim") if !filereadable(s:rubypath) - let s:rubypath= fnameescape(globpath(&rtp,"syntax/ruby.vim")) + for s:rubypath in split(globpath(&rtp,"syntax/ruby.vim"),"\n") + if filereadable(fnameescape(s:rubypath)) + let s:rubypath= fnameescape(s:rubypath) + break + endif + endfor endif if (g:vimsyn_embed =~ 'r' && has("ruby")) && filereadable(s:rubypath) unlet! b:current_syntax @@ -627,9 +644,14 @@ unlet s:rubypath " [-- python --] {{{3 let s:pythonpath= fnameescape(expand(":p:h")."/python.vim") if !filereadable(s:pythonpath) - let s:pythonpath= fnameescape(globpath(&rtp,"syntax/python.vim")) + for s:pythonpath in split(globpath(&rtp,"syntax/python.vim"),"\n") + if filereadable(fnameescape(s:pythonpath)) + let s:pythonpath= fnameescape(s:pythonpath) + break + endif + endfor endif -if (g:vimsyn_embed =~ 'P' && has("python")) && filereadable(s:pythonpath) +if g:vimsyn_embed =~ 'P' && (has("python") || has("python3")) && filereadable(s:pythonpath) unlet! b:current_syntax exe "syn include @vimPythonScript ".s:pythonpath if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'P' @@ -656,7 +678,12 @@ endif if s:trytcl let s:tclpath= fnameescape(expand(":p:h")."/tcl.vim") if !filereadable(s:tclpath) - let s:tclpath= fnameescape(globpath(&rtp,"syntax/tcl.vim")) + for s:tclpath in split(globpath(&rtp,"syntax/tcl.vim"),"\n") + if filereadable(fnameescape(s:tclpath)) + let s:tclpath= fnameescape(s:tclpath) + break + endif + endfor endif if (g:vimsyn_embed =~ 't' && has("tcl")) && filereadable(s:tclpath) unlet! b:current_syntax @@ -683,7 +710,12 @@ unlet s:trytcl " [-- mzscheme --] {{{3 let s:mzschemepath= fnameescape(expand(":p:h")."/scheme.vim") if !filereadable(s:mzschemepath) - let s:mzschemepath= fnameescape(globpath(&rtp,"syntax/scheme.vim")) + for s:mzschemepath in split(globpath(&rtp,"syntax/mzscheme.vim"),"\n") + if filereadable(fnameescape(s:mzschemepath)) + let s:mzschemepath= fnameescape(s:mzschemepath) + break + endif + endfor endif if (g:vimsyn_embed =~ 'm' && has("mzscheme")) && filereadable(s:mzschemepath) unlet! b:current_syntax @@ -879,6 +911,7 @@ hi def link vimUserCmdError Error hi def link vimUserFunc Normal hi def link vimVar Identifier hi def link vimWarn WarningMsg +hi def link vimHiNmbr Number " Current Syntax Variable: {{{2 let b:current_syntax = "vim" diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim index 4ddf07843..3da7ffc9f 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Yacc -" Maintainer: Charles E. Campbell, Jr. -" Last Change: Aug 12, 2010 -" Version: 9 +" Maintainer: Charles E. Campbell +" Last Change: Nov 14, 2012 +" Version: 10 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Options: {{{1 @@ -20,18 +20,24 @@ endif " --------------------------------------------------------------------- " Folding Support {{{1 if has("folding") - com! -nargs=+ HiFold fold + com! -nargs=+ SynFold fold else - com! -nargs=+ HiFold + com! -nargs=+ SynFold endif " --------------------------------------------------------------------- " Read the C syntax to start with {{{1 -if exists("g:yacc_uses_cpp") - syn include @yaccCode :p:h/cpp.vim -else - syn include @yaccCode :p:h/c.vim +" Read the C/C++ syntax to start with +let s:Cpath= fnameescape(expand(":p:h").(exists("g:yacc_uses_cpp")? "/cpp.vim" : "/c.vim")) +if !filereadable(s:Cpath) + for s:Cpath in split(globpath(&rtp,(exists("g:yacc_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") + if filereadable(fnameescape(s:Cpath)) + let s:Cpath= fnameescape(s:Cpath) + break + endif + endfor endif +exe "syn include @yaccCode ".s:Cpath " --------------------------------------------------------------------- " Yacc Clusters: {{{1 @@ -40,12 +46,12 @@ syn cluster yaccRulesCluster contains=yaccNonterminal,yaccString " --------------------------------------------------------------------- " Yacc Sections: {{{1 -HiFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained -HiFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty -HiFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained -HiFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty -HiFold syn region yaccRules matchgroup=yaccSectionSep start='^%%$' end='^%%$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained -HiFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%$' end='\%$' contains=@yaccCode contained +SynFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained +SynFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty +SynFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained +SynFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty +SynFold syn region yaccRules matchgroup=yaccSectionSep start='^%%$' end='^%%$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained +SynFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%$' end='\%$' contains=@yaccCode contained " --------------------------------------------------------------------- " Yacc Commands: {{{1 @@ -63,11 +69,11 @@ syn match yaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+" contained syn keyword yaccKeyActn yyerrok yyclearin contained syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion contained -HiFold syn region yaccUnion matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccCode contained +SynFold syn region yaccUnion matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccCode contained syn match yaccBrkt "[<>]" contained syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt contained -HiFold syn region yaccNonterminal start="^\s*\a\w*\ze\_s*\(/\*\_.\{-}\*/\)\=\_s*:" matchgroup=yaccDelim end=";" matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=yaccAction,yaccDelim,yaccString,yaccComment contained +SynFold syn region yaccNonterminal start="^\s*\a\w*\ze\_s*\(/\*\_.\{-}\*/\)\=\_s*:" matchgroup=yaccDelim end=";" matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=yaccAction,yaccDelim,yaccString,yaccComment contained syn region yaccComment start="/\*" end="\*/" syn match yaccString "'[^']*'" contained @@ -75,7 +81,8 @@ syn match yaccString "'[^']*'" contained " --------------------------------------------------------------------- " I'd really like to highlight just the outer {}. Any suggestions??? {{{1 syn match yaccCurlyError "[{}]" -HiFold syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=@yaccCode contained +SynFold syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=@yaccCode,yaccVar contained +syn match yaccVar '\$\d\+\|\$\$\|\$<\I\i*>\$\|\$<\I\i*>\d\+' containedin=cParen,cPreProc,cMulti contained " --------------------------------------------------------------------- " Yacc synchronization: {{{1 @@ -84,39 +91,30 @@ syn sync fromstart " --------------------------------------------------------------------- " Define the default highlighting. {{{1 if !exists("did_yacc_syn_inits") - command -nargs=+ HiLink hi def link - - " Internal yacc highlighting links {{{2 - HiLink yaccBrkt yaccStmt - HiLink yaccKey yaccStmt - HiLink yaccOper yaccStmt - HiLink yaccUnionStart yaccKey - - " External yacc highlighting links {{{2 - HiLink yaccComment Comment - HiLink yaccCurly Delimiter - HiLink yaccCurlyError Error - HiLink yaccDefines cDefine - HiLink yaccParseParam yaccParseOption - HiLink yaccParseOption cDefine - HiLink yaccNonterminal Function - HiLink yaccDelim Delimiter - HiLink yaccKeyActn Special - HiLink yaccSectionSep Todo - HiLink yaccSep Delimiter - HiLink yaccString String - HiLink yaccStmt Statement - HiLink yaccType Type - - " since Bram doesn't like my Delimiter :| {{{2 - HiLink Delimiter Type - - delcommand HiLink + hi def link yaccBrkt yaccStmt + hi def link yaccComment Comment + hi def link yaccCurly Delimiter + hi def link yaccCurlyError Error + hi def link yaccDefines cDefine + hi def link yaccDelim Delimiter + hi def link yaccKeyActn Special + hi def link yaccKey yaccStmt + hi def link yaccNonterminal Function + hi def link yaccOper yaccStmt + hi def link yaccParseOption cDefine + hi def link yaccParseParam yaccParseOption + hi def link yaccSectionSep Todo + hi def link yaccSep Delimiter + hi def link yaccStmt Statement + hi def link yaccString String + hi def link yaccType Type + hi def link yaccUnionStart yaccKey + hi def link yaccVar Special endif " --------------------------------------------------------------------- " Cleanup: {{{1 -delcommand HiFold +delcommand SynFold let b:current_syntax = "yacc" " --------------------------------------------------------------------- -- cgit v1.2.1